Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
1 line
2.3 KiB
Plaintext
1 line
2.3 KiB
Plaintext
{"version":3,"file":"collisionDetection.js","names":["rectIntersection","customCollisionDetection","collisionRect","droppableContainers","args","droppableContainer","find","id","rectIntersectionCollisions","length","previewAreaRect","rect","current","isContained","top","left","bottom","right"],"sources":["../../../src/providers/LivePreview/collisionDetection.ts"],"sourcesContent":["import type { CollisionDetection } from '@dnd-kit/core'\n\nimport { rectIntersection } from '@dnd-kit/core'\n\n// If the toolbar exits the preview area, we need to reset its position\n// This will prevent the toolbar from getting stuck outside the preview area\nexport const customCollisionDetection: CollisionDetection = ({\n collisionRect,\n droppableContainers,\n ...args\n}) => {\n const droppableContainer = droppableContainers.find(({ id }) => id === 'live-preview-area')\n\n const rectIntersectionCollisions = rectIntersection({\n ...args,\n collisionRect,\n droppableContainers: [droppableContainer],\n })\n\n // Collision detection algorithms return an array of collisions\n if (rectIntersectionCollisions.length === 0) {\n // The preview area is not intersecting, return early\n return rectIntersectionCollisions\n }\n\n // Compute whether the draggable element is completely contained within the preview area\n const previewAreaRect = droppableContainer?.rect?.current\n\n const isContained =\n collisionRect.top >= previewAreaRect.top &&\n collisionRect.left >= previewAreaRect.left &&\n collisionRect.bottom <= previewAreaRect.bottom &&\n collisionRect.right <= previewAreaRect.right\n\n if (isContained) {\n return rectIntersectionCollisions\n }\n}\n"],"mappings":"AAEA,SAASA,gBAAgB,QAAQ;AAEjC;AACA;AACA,OAAO,MAAMC,wBAAA,GAA+CA,CAAC;EAC3DC,aAAa;EACbC,mBAAmB;EACnB,GAAGC;AAAA,CACJ;EACC,MAAMC,kBAAA,GAAqBF,mBAAA,CAAoBG,IAAI,CAAC,CAAC;IAAEC;EAAE,CAAE,KAAKA,EAAA,KAAO;EAEvE,MAAMC,0BAAA,GAA6BR,gBAAA,CAAiB;IAClD,GAAGI,IAAI;IACPF,aAAA;IACAC,mBAAA,EAAqB,CAACE,kBAAA;EACxB;EAEA;EACA,IAAIG,0BAAA,CAA2BC,MAAM,KAAK,GAAG;IAC3C;IACA,OAAOD,0BAAA;EACT;EAEA;EACA,MAAME,eAAA,GAAkBL,kBAAA,EAAoBM,IAAA,EAAMC,OAAA;EAElD,MAAMC,WAAA,GACJX,aAAA,CAAcY,GAAG,IAAIJ,eAAA,CAAgBI,GAAG,IACxCZ,aAAA,CAAca,IAAI,IAAIL,eAAA,CAAgBK,IAAI,IAC1Cb,aAAA,CAAcc,MAAM,IAAIN,eAAA,CAAgBM,MAAM,IAC9Cd,aAAA,CAAce,KAAK,IAAIP,eAAA,CAAgBO,KAAK;EAE9C,IAAIJ,WAAA,EAAa;IACf,OAAOL,0BAAA;EACT;AACF","ignoreList":[]} |