simplify Divide component to only set total on mousedown on divider

This commit is contained in:
Xymorot 2019-06-22 21:58:48 +02:00
parent 8679ecb1f8
commit 3ca66d6958
1 changed files with 1 additions and 10 deletions

View File

@ -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}