aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorHsieh Chin Fan <pham@topo.tw>2024-09-22 14:11:56 +0800
committerHsieh Chin Fan <pham@topo.tw>2024-09-22 14:12:55 +0800
commit2abb5459a7403dcb7342a8dffe2445d76c36f4cf (patch)
treebed796d424dc018e5f632865f65d7c1401ee7404
parent438ade206064346ccad8d519a088b9d904ee2a38 (diff)
feat(layout): remove unnecessary observer
-rw-r--r--src/Layout.mjs5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/Layout.mjs b/src/Layout.mjs
index 2f90278..0c992d7 100644
--- a/src/Layout.mjs
+++ b/src/Layout.mjs
@@ -21,6 +21,7 @@ export class SideBySide extends Layout {
21 const handle = bar.querySelector('.bar-handle') 21 const handle = bar.querySelector('.bar-handle')
22 container.appendChild(bar) 22 container.appendChild(bar)
23 23
24 // Resize views by value
24 const resizeByLeft = (left) => { 25 const resizeByLeft = (left) => {
25 htmlHolder.style.width = (left) + "px" 26 htmlHolder.style.width = (left) + "px"
26 showcase.style.width = (parseFloat(getComputedStyle(container).width) - left) + "px" 27 showcase.style.width = (parseFloat(getComputedStyle(container).width) - left) + "px"
@@ -39,9 +40,7 @@ export class SideBySide extends Layout {
39 handle.removeAttribute('style') 40 handle.removeAttribute('style')
40 } 41 }
41 42
42 new ResizeObserver(() => { 43 onRemove(bar, () => draggable.remove())
43 if (draggable) resizeByLeft(draggable.left)
44 }).observe(container);
45 } 44 }
46 45
47 leaveHandler = ({ container }) => { 46 leaveHandler = ({ container }) => {