From 7722addf758da09480808f1e03c5b9e3061f855b Mon Sep 17 00:00:00 2001 From: Daybrush Date: Sun, 3 Dec 2023 20:11:47 +0900 Subject: [PATCH] fix: fix names --- packages/react-moveable/src/ables/Snappable.tsx | 8 ++++++-- packages/react-moveable/src/ables/snappable/names.ts | 4 ++++ packages/react-moveable/src/ables/snappable/snap.ts | 5 +++-- 3 files changed, 13 insertions(+), 4 deletions(-) create mode 100644 packages/react-moveable/src/ables/snappable/names.ts diff --git a/packages/react-moveable/src/ables/Snappable.tsx b/packages/react-moveable/src/ables/Snappable.tsx index 2c64c96a8..9ebab92aa 100644 --- a/packages/react-moveable/src/ables/Snappable.tsx +++ b/packages/react-moveable/src/ables/Snappable.tsx @@ -72,6 +72,10 @@ import { getSnapBoundInfo, } from "./snappable/snapBounds"; import { getTotalGuidelines } from "./snappable/getTotalGuidelines"; +import { + NAME_snapRotationThreshold, NAME_snapRotationDegrees, + NAME_snapHorizontalThreshold, NAME_snapVerticalThreshold, +} from "./snappable/names"; export interface SnapPoses { @@ -610,8 +614,6 @@ function addBoundGuidelines( const directionCondition = getDirectionCondition("", ["resizable", "scalable"]); -const NAME_snapRotationThreshold = "snapRotationThreshold"; -const NAME_snapRotationDegrees = "snapRotationDegrees"; /** * @namespace Moveable.Snappable @@ -638,6 +640,8 @@ export default { "snapGridAll", NAME_snapRotationThreshold, NAME_snapRotationDegrees, + NAME_snapHorizontalThreshold, + NAME_snapVerticalThreshold, "horizontalGuidelines", "verticalGuidelines", "elementGuidelines", diff --git a/packages/react-moveable/src/ables/snappable/names.ts b/packages/react-moveable/src/ables/snappable/names.ts new file mode 100644 index 000000000..e0a5d5291 --- /dev/null +++ b/packages/react-moveable/src/ables/snappable/names.ts @@ -0,0 +1,4 @@ +export const NAME_snapRotationThreshold = "snapRotationThreshold"; +export const NAME_snapRotationDegrees = "snapRotationDegrees"; +export const NAME_snapHorizontalThreshold = "snapHorizontalThreshold"; +export const NAME_snapVerticalThreshold = "snapVerticalThreshold"; diff --git a/packages/react-moveable/src/ables/snappable/snap.ts b/packages/react-moveable/src/ables/snappable/snap.ts index 3a0f55b7d..ca9b728fa 100644 --- a/packages/react-moveable/src/ables/snappable/snap.ts +++ b/packages/react-moveable/src/ables/snappable/snap.ts @@ -10,6 +10,7 @@ import { getPosByDirection, getPosesByDirection } from "../../gesto/GestoUtils"; import { TINY_NUM } from "../../consts"; import { minus } from "@scena/matrix"; import { splitSnapDirectionPoses } from "./utils"; +import { NAME_snapHorizontalThreshold, NAME_snapVerticalThreshold } from "./names"; @@ -26,12 +27,12 @@ export function checkMoveableSnapPoses( const snapThresholdMultiples = moveable.state.snapThresholdInfo?.multiples || [1, 1]; const snapHorizontalThreshold = selectValue( customSnapHorizontalThreshold, - props.snapHorizontalThreshold, + props[NAME_snapHorizontalThreshold], 5, ); const snapVerticalThreshold = selectValue( customSnapVerticalThreshold, - props.snapVerticalThreshold, + props[NAME_snapVerticalThreshold], 5, );