@homebound/beam 3.5.0 → 3.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +3 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -20782,7 +20782,9 @@ function DnDGrid(props) {
|
|
|
20782
20782
|
const target = maybeTarget instanceof HTMLElement ? maybeTarget?.closest(`[${gridItemIdKey}]`) : void 0;
|
|
20783
20783
|
if (target instanceof HTMLElement && target !== cloneEl.current && target !== dragEl.current) {
|
|
20784
20784
|
const targetPos = target.getBoundingClientRect();
|
|
20785
|
-
const
|
|
20785
|
+
const clonePos = cloneEl.current.getBoundingClientRect();
|
|
20786
|
+
const useYAxis = Math.abs(targetPos.top - clonePos.top) >= Math.abs(targetPos.left - clonePos.left);
|
|
20787
|
+
const isHalfwayPassedTarget = useYAxis ? (clientY - targetPos.top) / (targetPos.bottom - targetPos.top) > 0.5 : (clientX - targetPos.left) / (targetPos.right - targetPos.left) > 0.5;
|
|
20786
20788
|
const shouldInsert = isHalfwayPassedTarget && target.nextSibling !== cloneEl.current || !isHalfwayPassedTarget && target.previousSibling !== cloneEl.current;
|
|
20787
20789
|
if (shouldInsert) {
|
|
20788
20790
|
gridEl.current.insertBefore(cloneEl.current, isHalfwayPassedTarget ? target.nextSibling : target);
|