simplify Divide component to only set total on mousedown on divider
This commit is contained in:
parent
8679ecb1f8
commit
3ca66d6958
|
@ -30,21 +30,14 @@ $: style = s({
|
|||
'--divide-min-height': minSize > 0 && mode === 'v' ? `${minSize}px` : '0',
|
||||
});
|
||||
|
||||
onMount(() => {
|
||||
total = getTotal();
|
||||
});
|
||||
|
||||
function getTotal() {
|
||||
return mode === 'h' ? divide.clientWidth : divide.clientHeight;
|
||||
}
|
||||
|
||||
function handleResize() {
|
||||
total = getTotal();
|
||||
}
|
||||
|
||||
function handleMousedown(event) {
|
||||
if (event.button === 0) {
|
||||
dragging = true;
|
||||
total = getTotal();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -121,8 +114,6 @@ function handleMouseenter(event) {
|
|||
}
|
||||
</style>
|
||||
|
||||
<svelte:window on:resize="{handleResize}" />
|
||||
|
||||
<div
|
||||
class="{classes}"
|
||||
{style}
|
||||
|
|
Loading…
Reference in New Issue