Skip to content

Commit e461024

Browse files
fix: Fix issue on reenabling resizer after trying to drag it while disabled (#64)
1 parent b9f1355 commit e461024

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

.changeset/tall-guests-study.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"paneforge": patch
3+
---
4+
5+
fix: issue on reenabling resizer after trying to drag it while disabled

packages/paneforge/src/lib/paneforge.svelte.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -625,6 +625,14 @@ class PaneResizerState {
625625
});
626626
}
627627

628+
#startDragging = (e: MouseEvent | TouchEvent) => {
629+
e.preventDefault();
630+
631+
if (this.#disabled.current) return;
632+
this.#group.startDragging(this.#id.current, e);
633+
this.#onDraggingChange.current(true);
634+
};
635+
628636
#stopDraggingAndBlur = () => {
629637
const node = this.#ref.current;
630638
if (!node) return;
@@ -682,9 +690,7 @@ class PaneResizerState {
682690
};
683691

684692
#onmousedown = (e: MouseEvent) => {
685-
e.preventDefault();
686-
this.#group.startDragging(this.#id.current, e);
687-
this.#onDraggingChange.current(true);
693+
this.#startDragging(e);
688694
};
689695

690696
#onmouseup = () => {
@@ -700,9 +706,7 @@ class PaneResizerState {
700706
};
701707

702708
#ontouchstart = (e: TouchEvent) => {
703-
e.preventDefault();
704-
this.#group.startDragging(this.#id.current, e);
705-
this.#onDraggingChange.current(true);
709+
this.#startDragging(e);
706710
};
707711

708712
props = $derived.by(

0 commit comments

Comments
 (0)