diff --git a/packages/core/components/DraggableComponent/collision/dynamic/index.ts b/packages/core/components/DraggableComponent/collision/dynamic/index.ts index a06ad4eb3..796e0aed8 100644 --- a/packages/core/components/DraggableComponent/collision/dynamic/index.ts +++ b/packages/core/components/DraggableComponent/collision/dynamic/index.ts @@ -39,8 +39,16 @@ export const createDynamicCollisionDetector = ( const { dragOperation, droppable } = input; const { position } = dragOperation; - const dragShape = dragOperation.shape?.current; - const { shape: dropShape } = droppable; + const { current: dragShape, last: lastDragShape } = + dragOperation.shape || {}; + + const dropShape = droppable.shape; + + // TODO last shape fix is custom dndkit patch + // const dropShape = + // dragOperation.source?.id === droppable.id + // ? lastDragShape + // : droppable.shape; if (!dragShape || !dropShape) { return null; @@ -68,23 +76,29 @@ export const createDynamicCollisionDetector = ( const collision = directionalCollision(input, interval.previous); - if (collision) { - return { - ...collision, - priority: CollisionPriority.Highest, - data: { - direction: interval.direction, - }, - }; - } - - // return null; + // console.log("dropShape", droppable.id, dropShape); + + collisionDebug(dragCenter, dropCenter, droppable.id.toString(), "yellow"); + + // if (collision) { + // return { + // ...collision, + // priority: CollisionPriority.Highest, + // data: { + // direction: interval.direction, + // }, + // }; + // } + + return null; } const intersectionArea = dragShape.intersectionArea(dropShape); const intersectionRatio = intersectionArea / dropShape.area; if (intersectionArea && overMidpoint) { + // console.log("dropShape", droppable.id, dropShape); + collisionDebug(dragCenter, dropCenter, droppable.id.toString(), "green"); const collision: Collision = { @@ -97,6 +111,8 @@ export const createDynamicCollisionDetector = ( type: "" as any, }; + console.log("collide", droppable.id); + return collision; }