get group resize, enter and exit working

This commit is contained in:
matei jordache
2026-03-27 14:13:09 -07:00
parent 98d36eb327
commit 1eda4030d1
11 changed files with 362 additions and 24 deletions

18
frontend/src/groupDrag.js Normal file
View File

@@ -0,0 +1,18 @@
export const GROUP_DRAG_RELEASE_DISTANCE = 18;
export function getPointDistanceOutsideRect(rect, point) {
if (!rect || !point) return Infinity;
const dx = point.x < rect.left
? rect.left - point.x
: (point.x > rect.right ? point.x - rect.right : 0);
const dy = point.y < rect.top
? rect.top - point.y
: (point.y > rect.bottom ? point.y - rect.bottom : 0);
return Math.hypot(dx, dy);
}
export function shouldReleaseFromGroup(rect, point, threshold = GROUP_DRAG_RELEASE_DISTANCE) {
return getPointDistanceOutsideRect(rect, point) >= threshold;
}