diff options
| author | Hsieh Chin Fan <pham@topo.tw> | 2024-09-22 15:03:56 +0800 |
|---|---|---|
| committer | Hsieh Chin Fan <pham@topo.tw> | 2024-09-22 15:03:56 +0800 |
| commit | 66b9043665f85a3180d91a63d7cbacd82493c16b (patch) | |
| tree | 3a1c9225f2623ce10f684a0f4b0d974a8b0dd4c5 /src | |
| parent | 59663cdb0bea2c79aceabd5c222ff32d99fe8afc (diff) | |
feat(CSS): use class name to hide draggable block
Diffstat (limited to 'src')
| -rw-r--r-- | src/Layout.mjs | 6 | ||||
| -rw-r--r-- | src/css/dumbymap.css | 4 |
2 files changed, 5 insertions, 5 deletions
diff --git a/src/Layout.mjs b/src/Layout.mjs index 0c992d7..2deef01 100644 --- a/src/Layout.mjs +++ b/src/Layout.mjs | |||
| @@ -91,7 +91,7 @@ export class Overlay extends Layout { | |||
| 91 | 91 | ||
| 92 | // Close button | 92 | // Close button |
| 93 | draggableBlock.querySelector('#close').onclick = () => { | 93 | draggableBlock.querySelector('#close').onclick = () => { |
| 94 | draggableBlock.setAttribute("data-state", "hide") | 94 | draggableBlock.classList.add('hide') |
| 95 | } | 95 | } |
| 96 | // Plus/Minus font-size of content | 96 | // Plus/Minus font-size of content |
| 97 | draggableBlock.querySelector('#plus-font-size').onclick = () => { | 97 | draggableBlock.querySelector('#plus-font-size').onclick = () => { |
| @@ -107,11 +107,11 @@ export class Overlay extends Layout { | |||
| 107 | const utils = draggableBlock.querySelector('.utils') | 107 | const utils = draggableBlock.querySelector('.utils') |
| 108 | draggableInstance.onDragStart = () => { | 108 | draggableInstance.onDragStart = () => { |
| 109 | utils.style.opacity = 0 | 109 | utils.style.opacity = 0 |
| 110 | draggableBlock.setAttribute('data-state', 'on-drag') | 110 | draggableBlock.classList.add('drag') |
| 111 | } | 111 | } |
| 112 | draggableInstance.onDragEnd = () => { | 112 | draggableInstance.onDragEnd = () => { |
| 113 | utils.style = '' | 113 | utils.style = '' |
| 114 | draggableBlock.removeAttribute('data-state') | 114 | draggableBlock.classList.remove('drag') |
| 115 | } | 115 | } |
| 116 | 116 | ||
| 117 | // Reposition draggable instance when resized | 117 | // Reposition draggable instance when resized |
diff --git a/src/css/dumbymap.css b/src/css/dumbymap.css index fb3b76e..e04b6bc 100644 --- a/src/css/dumbymap.css +++ b/src/css/dumbymap.css | |||
| @@ -330,7 +330,7 @@ | |||
| 330 | display: none; | 330 | display: none; |
| 331 | } | 331 | } |
| 332 | 332 | ||
| 333 | &[data-state="hide"] { | 333 | &.hide { |
| 334 | animation: fade-out 0.3s; | 334 | animation: fade-out 0.3s; |
| 335 | 335 | ||
| 336 | opacity: 0; | 336 | opacity: 0; |
| @@ -338,7 +338,7 @@ | |||
| 338 | } | 338 | } |
| 339 | 339 | ||
| 340 | &:has(.draggable:hover, .utils:hover), | 340 | &:has(.draggable:hover, .utils:hover), |
| 341 | &[data-state="on-drag"] { | 341 | &.drag { |
| 342 | .dumby-block { | 342 | .dumby-block { |
| 343 | color: gray; | 343 | color: gray; |
| 344 | 344 | ||