magnet harder

This commit is contained in:
hamid zarghami
2026-04-26 11:09:26 +03:30
parent 333955fdf3
commit 3cac084aa5
@@ -4,7 +4,7 @@ export type Guide = {
position: number; position: number;
}; };
const SNAP_THRESHOLD = 5; const SNAP_THRESHOLD = 10;
export type SnappedPositionResult = { export type SnappedPositionResult = {
position: { x: number; y: number }; position: { x: number; y: number };
@@ -22,7 +22,7 @@ export const getSnappedPosition = (
guides.forEach((guide) => { guides.forEach((guide) => {
if ( if (
guide.orientation === "vertical" && guide.orientation === "vertical" &&
Math.abs(pos.x - guide.position) < SNAP_THRESHOLD Math.abs(pos.x - guide.position) <= SNAP_THRESHOLD
) { ) {
x = guide.position; x = guide.position;
activeGuideIds.push(guide.id); activeGuideIds.push(guide.id);
@@ -30,7 +30,7 @@ export const getSnappedPosition = (
if ( if (
guide.orientation === "horizontal" && guide.orientation === "horizontal" &&
Math.abs(pos.y - guide.position) < SNAP_THRESHOLD Math.abs(pos.y - guide.position) <= SNAP_THRESHOLD
) { ) {
y = guide.position; y = guide.position;
activeGuideIds.push(guide.id); activeGuideIds.push(guide.id);