Skip to content

Commit

Permalink
fix(movable): should skip ingore step if not specified
Browse files Browse the repository at this point in the history
  • Loading branch information
Quang Phan committed Oct 3, 2022
1 parent aedc4d9 commit 53b9606
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/dirty-candles-shake.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@svelte-put/movable": patch
---

fix: skip ignore step if not provided
9 changes: 6 additions & 3 deletions packages/actions/movable/src/movable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,9 +217,12 @@ export function movable(node: HTMLElement, parameters: MovableParameters = { ena
};

const onMouseDown = (event: MouseEvent) => {
const excludedNodes = Array.from(trigger.querySelectorAll(ignore.join(', ')));
if (excludedNodes.some((node) => node.isSameNode(event.target as HTMLElement))) {
return;
const ignoreSelector = ignore.join(',');
if (ignoreSelector) {
const excludedNodes = Array.from(trigger.querySelectorAll(ignore.join(', ')));
if (excludedNodes.some((node) => node.isSameNode(event.target as HTMLElement))) {
return;
}
}

const computedStyles = getComputedStyle(node);
Expand Down

0 comments on commit 53b9606

Please sign in to comment.