Skip to content

Commit

Permalink
fix: prevent default only when node held
Browse files Browse the repository at this point in the history
  • Loading branch information
KovaCro committed Nov 21, 2023
1 parent f56738d commit ce203c9
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions packages/lib/src/tree/node.wc.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,19 @@
</script>

<svelte:document
on:mousemove|preventDefault={(e) => {
on:mousemove={(e) => {
if (isGrabbed) {
e.preventDefault()
node.style.transform = 'translateY(' + (e.clientY - startingY) + 'px)';
node.style.transform += 'translateX(' + (e.clientX - startingX) + 'px)';
}
}}
on:mouseup|preventDefault={(e) => {
isGrabbed = false;
node.style = '';
on:mouseup={(e) => {
if(isGrabbed){
e.preventDefault()
isGrabbed = false;
node.style = '';
}
}}
/>

Expand Down

0 comments on commit ce203c9

Please sign in to comment.