Skip to content

Commit

Permalink
fix missing definition
Browse files Browse the repository at this point in the history
  • Loading branch information
rortan134 authored Dec 6, 2023
1 parent 7a6431d commit 7250895
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/useSelectify.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -810,9 +810,7 @@ function useSelectify<T extends HTMLElement>(

const handleDrawRectStart = React.useCallback(
async (event: PointerEvent) => {
if (disabled || !IS_BROWSER) {
return;
}
if (disabled || !IS_BROWSER) return;

const parentNode = ref.current;
const shouldActivate = event.button === 0 || event.button === 1 || event.isPrimary;
Expand All @@ -833,6 +831,7 @@ function useSelectify<T extends HTMLElement>(
if (await isInExclusionZone(eventStartingPoint)) {
return;
}
hasDraggedOnceRef.current = true;

// Prevent implicit pointer capture
// https://www.w3.org/TR/pointerevents3/#implicit-pointer-capture
Expand All @@ -849,7 +848,7 @@ function useSelectify<T extends HTMLElement>(
consumerCallback?.();

if (event.defaultPrevented) {
console.warn("use-selectify: Event prevented, stopping execution.");
console.log("use-selectify: Event prevented, stopping execution.");
return;
}

Expand All @@ -862,7 +861,7 @@ function useSelectify<T extends HTMLElement>(
capture: true,
once: true,
});
window.addEventListener("scroll", handleScroll);
globalThis?.window.addEventListener("scroll", handleScroll);

// Add event to cache
eventsCacheRef.current.push(event);
Expand Down

0 comments on commit 7250895

Please sign in to comment.