⚡️⚡️⚡️ Self-hosted collaborative bookmark manager to collect, read, annotate, and fully preserve what matters, all in one place.
TypeScript bookmarkbookmark-managercollaborationnextjsreact-nativeread-it-laterself-hostedtypescript
update collision algorithm
Kha Nguyen6e60031e4009
diff --git a/apps/web/pages/dashboard.tsx b/apps/web/pages/dashboard.tsxindex 217f225c..ddbc8ca2 100644--- a/apps/web/pages/dashboard.tsx+++ b/apps/web/pages/dashboard.tsx@@ -38,6 +38,9 @@ import {MouseSensor,TouchSensor,useSensors,+ closestCenter,+ pointerWithin,+ rectIntersection,} from "@dnd-kit/core";import { restrictToWindowEdges } from "@dnd-kit/modifiers";import Droppable from "@/components/Droppable";@@ -327,6 +330,7 @@ export default function Dashboard() {onDragCancel={handleDragOverCancel}modifiers={[restrictToWindowEdges]}sensors={sensors}+ collisionDetection={customCollisionDetectionAlgorithm}><MainLayout>{!!activeLink && (@@ -644,3 +648,18 @@ const Section = ({return null;}};++// Custom collision detection algorithm that first checks for pointer collisions+// and then falls back to rectangle intersections+function customCollisionDetectionAlgorithm(args: any) {+ // First, let's see if there are any collisions with the pointer+ const pointerCollisions = pointerWithin(args);++ // Collision detection algorithms return an array of collisions+ if (pointerCollisions.length > 0) {+ return pointerCollisions;+ }++ // If there are no collisions with the pointer, return rectangle intersections+ return rectIntersection(args);+}