Skip to content

Commit

Permalink
Merge branch 'main' into use-bunchee
Browse files Browse the repository at this point in the history
  • Loading branch information
huozhi committed Feb 10, 2024
2 parents 996ca6e + 6e0127d commit b4f394f
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,8 @@ function Root({
function closeDrawer() {
if (!drawerRef.current) return;

cancelDrag();

onClose?.();
set(drawerRef.current, {
transform: isVertical(direction)
Expand Down Expand Up @@ -492,6 +494,15 @@ function Root({
}
}

function cancelDrag() {
if (!isDragging || !drawerRef.current) return;

drawerRef.current.classList.remove(DRAG_CLASS);
isAllowedToDrag.current = false;
setIsDragging(false);
dragEndTime.current = new Date();
}

function onRelease(event: React.PointerEvent<HTMLDivElement>) {
if (!isDragging || !drawerRef.current) return;

Expand Down

0 comments on commit b4f394f

Please sign in to comment.