Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | 1x 1x 1x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 1x 1x 2x 2x | 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;
}
|