@mitcsutt/kiln-dnd
Version:
Kiln drag and drop: sortable lists, boards, drop zones and grid layouts with one keyboard model and one announcer, rendered through kiln-ui
17 lines (16 loc) • 462 B
JavaScript
//#region src/grid/engine/collision.ts
function e(e, t) {
return !(e.i === t.i || e.x + e.w <= t.x || e.x >= t.x + t.w || e.y + e.h <= t.y || e.y >= t.y + t.h);
}
function t(t, n) {
for (let r = 0; r < t.length; r++) {
let i = t[r];
if (i !== void 0 && e(i, n)) return i;
}
}
function n(t, n) {
return t.filter((t) => e(t, n));
}
//#endregion
export { e as collides, n as getAllCollisions, t as getFirstCollision };
//# sourceMappingURL=collision.js.map