Created
August 27, 2021 12:14
-
-
Save colinfwren/b6db03c1db29555669e6cc054953b47d to your computer and use it in GitHub Desktop.
Drag Bounds Function for Control Point
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function dragBoundFunc(pos, axis, anchorRef) { | |
const staticPos = anchorRef.current.getAbsolutePosition(); | |
const otherAxis = axis === 'y' ? 'x' : 'y'; | |
return { | |
[axis]: pos[axis], | |
[otherAxis]: staticPos[otherAxis] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment