Files
klz-cables.com/.pnpm-store/v10/files/d9/c2b5457117830bcb9f26d03372124174169f00acd6e4707f82f016e40b3c05c803f04cc5c8076f46112043b0995597f09652bbb3da470c015f82c1b3cac71c
Marc Mintel 5397309103
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
fix(products): fix breadcrumbs and product filtering (backport from main)
2026-02-24 16:04:21 +01:00

38 lines
1.3 KiB
Plaintext

/**
* Collision detection that considers the X
* axis only with respect to the position of the pointer (or collisionRect for keyboard)
*/export const closestInXAxis = args => {
const collisions = [];
// Use pointer coordinates if available (mouse/touch), otherwise use collisionRect center (keyboard)
let x;
let y;
if (args.pointerCoordinates) {
x = args.pointerCoordinates.x;
y = args.pointerCoordinates.y;
} else if (args.collisionRect) {
// For keyboard navigation, use the center of the collisionRect
x = args.collisionRect.left + args.collisionRect.width / 2;
y = args.collisionRect.top + args.collisionRect.height / 2;
} else {
return [];
}
for (const container of args.droppableContainers) {
const rect = args.droppableRects.get(container.id);
if (!rect) {
continue;
}
// Only consider widgets in the same row (same Y axis)
if (y >= rect.top && y <= rect.bottom) {
const centerX = rect.left + rect.width / 2;
const distance = Math.abs(x - centerX);
collisions.push({
id: String(container.id),
data: {
value: distance
}
});
}
}
return collisions.sort((a, b) => a.data.value - b.data.value);
};
//# sourceMappingURL=collisionDetection.js.map