From 70d1fda23dad34634a6fbfa2edd4bd6b63854c71 Mon Sep 17 00:00:00 2001 From: Victor Seiji Hariki Date: Fri, 25 Nov 2022 00:34:34 -0300 Subject: [PATCH] a big commit with the selection and stamping tools Signed-off-by: Victor Seiji Hariki Former-commit-id: b3f849f3fdb334916f1a4ee6c81ac6bdf42a8f52 --- css/index.css | 28 ++- css/ui/tool/stamp.css | 77 ++++++++ css/ui/toolbar.css | 23 +++ index.html | 13 +- js/commands.js | 22 ++- js/input.js | 8 +- js/shortcuts.js | 6 + js/ui/tool/select.js | 399 +++++++++++++++++++++++++++++++++++++++--- js/ui/tool/stamp.js | 269 ++++++++++++++++++++++++++++ js/ui/toolbar.js | 16 +- res/icons/file-up.svg | 7 + res/icons/lock.svg | 5 + 12 files changed, 830 insertions(+), 43 deletions(-) create mode 100644 css/ui/tool/stamp.css create mode 100644 js/ui/tool/stamp.js create mode 100644 res/icons/file-up.svg create mode 100644 res/icons/lock.svg diff --git a/css/index.css b/css/index.css index d32ed36..9c6b916 100644 --- a/css/index.css +++ b/css/index.css @@ -30,20 +30,27 @@ body { grid-row-gap: 5px; } -.toolbar { +.button-array { display: flex; - justify-content: space-between; + justify-content: stretch; } -.toolbar > .tool { +.button-array > .button.tool { flex: 1; + border-radius: 0; } -.toolbar > .tool:not(:last-child) { - margin-right: 10px; +.button-array > .button.tool:first-child { + border-top-left-radius: 5px; + border-bottom-left-radius: 5px; } -button.tool { +.button-array > .button.tool:last-child { + border-top-right-radius: 5px; + border-bottom-right-radius: 5px; +} + +.button.tool { background-color: rgb(0, 0, 50); color: rgb(255, 255, 255); border-radius: 5px; @@ -57,8 +64,11 @@ button.tool { margin-bottom: 5px; } -button.tool:hover { - background-color: #667; +.button.tool:hover { + background-color: rgb(30, 30, 80); +} +.button.tool:active { + background-color: rgb(60, 60, 130); } .collapsible { @@ -100,7 +110,7 @@ button.tool:hover { font-size: medium; text-align: left; max-height: fit-content; - overflow: auto; + overflow: visible; cursor: auto; } diff --git a/css/ui/tool/stamp.css b/css/ui/tool/stamp.css new file mode 100644 index 0000000..2dc9a2d --- /dev/null +++ b/css/ui/tool/stamp.css @@ -0,0 +1,77 @@ +.resource-manager { + position: relative; + border-radius: 5px; +} + +.resource-manager { + user-select: none; +} +.resource-manager > .preview-pane { + display: none; + + position: absolute; + + height: 200px; + width: 200px; + + right: -200px; + top: 0px; + + background-color: white; + background-size: contain; + background-repeat: no-repeat; + background-position: center; + + border-radius: 2px; +} + +.resource-manager > .resource-list { + height: 200px; + + background-color: #ffffff66; + + border-top-left-radius: 5px; + border-top-right-radius: 5px; + + overflow-y: scroll; + overflow-x: hidden; +} + +.resource-manager > .resource-list > * { + cursor: pointer; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + +.resource-manager > .resource-list > *:hover { + background-color: #ffff; +} +.resource-manager > .resource-list > .selected { + background-color: #fff6; +} + +.resource-manager > .resource-list.dragging { + background-color: #ffffff88; + transition-duration: 0.3s; +} + +.resource-manager > .upload-button { + display: block; + width: 100%; + + padding-left: 0; + padding-right: 0; + + margin-top: 0; + + text-align: center; + + border-top-left-radius: 0px; + border-top-right-radius: 0px; + + border-bottom-left-radius: 5px; + border-bottom-right-radius: 5px; + + border: 0px; +} diff --git a/css/ui/toolbar.css b/css/ui/toolbar.css index 631a3ed..bb69d01 100644 --- a/css/ui/toolbar.css +++ b/css/ui/toolbar.css @@ -32,6 +32,29 @@ filter: invert(90%); } +/* Toolbar lock indicator */ +#ui-toolbar .lock-indicator { + position: absolute; + display: none; + + padding: 0; + + background-color: var(--c-text); + + right: 2px; + top: 10px; + + width: 15px; + height: 15px; + + background-color: red; + + -webkit-mask-image: url("/res/icons/lock.svg"); + -webkit-mask-size: contain; + mask-image: url("/res/icons/lock.svg"); + mask-size: contain; +} + /* The separator */ #ui-toolbar .separator { width: 80%; diff --git a/index.html b/index.html index 28e2ff7..1c7eba5 100644 --- a/index.html +++ b/index.html @@ -12,6 +12,9 @@ + + + @@ -165,11 +168,11 @@ people, person, humans, human, divers, diver, glitch, error, text, watermark, ba
History