diff options
author | Hsieh Chin Fan <pham@topo.tw> | 2024-09-24 20:08:36 +0800 |
---|---|---|
committer | Hsieh Chin Fan <pham@topo.tw> | 2024-09-25 10:49:45 +0800 |
commit | c57800b4cf5fc2aa047c9f01bae5b5994f89fbe9 (patch) | |
tree | b36bd40d82544f79919584e56eed344c84f7c901 /src/Layout.mjs | |
parent | 54f0c9381fce41c4ca46baebfd6281a8f9f9ff93 (diff) |
chore: reformat code
Diffstat (limited to 'src/Layout.mjs')
-rw-r--r-- | src/Layout.mjs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/Layout.mjs b/src/Layout.mjs index 51caefb..1279111 100644 --- a/src/Layout.mjs +++ b/src/Layout.mjs | |||
@@ -123,7 +123,6 @@ export class Overlay extends Layout { | |||
123 | } | 123 | } |
124 | 124 | ||
125 | enterHandler = ({ htmlHolder, blocks }) => { | 125 | enterHandler = ({ htmlHolder, blocks }) => { |
126 | |||
127 | // FIXME It is weird rect from this method and this scope are different... | 126 | // FIXME It is weird rect from this method and this scope are different... |
128 | blocks.forEach(this.saveLeftTopAsData) | 127 | blocks.forEach(this.saveLeftTopAsData) |
129 | 128 | ||
@@ -144,10 +143,11 @@ export class Overlay extends Layout { | |||
144 | </div> | 143 | </div> |
145 | ` | 144 | ` |
146 | 145 | ||
146 | // Set DOMRect for wrapper | ||
147 | wrapper.appendChild(block) | 147 | wrapper.appendChild(block) |
148 | htmlHolder.appendChild(wrapper) | ||
149 | wrapper.style.left = left + "px" | 148 | wrapper.style.left = left + "px" |
150 | wrapper.style.top = top + "px" | 149 | wrapper.style.top = top + "px" |
150 | htmlHolder.appendChild(wrapper) | ||
151 | const { width } = wrapper.getBoundingClientRect() | 151 | const { width } = wrapper.getBoundingClientRect() |
152 | left += width + 30 | 152 | left += width + 30 |
153 | if (left > window.innerWidth) { | 153 | if (left > window.innerWidth) { |
@@ -155,10 +155,11 @@ export class Overlay extends Layout { | |||
155 | left = left % window.innerWidth | 155 | left = left % window.innerWidth |
156 | } | 156 | } |
157 | 157 | ||
158 | // Animation for DOMRect | ||
158 | animateRectTransition( | 159 | animateRectTransition( |
159 | wrapper, | 160 | wrapper, |
160 | { left: originLeft, top: originTop }, | 161 | { left: originLeft, top: originTop }, |
161 | { resume: true, duration: 500 } | 162 | { resume: true, duration: 300 } |
162 | ) | 163 | ) |
163 | .finished | 164 | .finished |
164 | .finally(() => this.addDraggable(wrapper)) | 165 | .finally(() => this.addDraggable(wrapper)) |