Skip to content

Fixes #3320 (UPDATED) — when a draggable element is inside a rotated parent, its drag direction is incorrect #3331

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

TheSilentIce
Copy link

Closes #3320
Updated PR so now it fixes both direction and momentum of child draggable in rotated parent container.

File Key Changes
packages/framer-motion/src/gestures/drag/VisualElementDragControls.ts - Changed updateAxis to check if a draggable has a rotated parent.
- Added checkForRotatedParent helper function to detect rotation in the parent.
- Added calculatedInverseMatrix helper function to create the inverse rotation matrix of the parent container's rotation.
- Added calculateInvertedPoint helper function to multiply the inverse matrix with the offset.
- Applies inverse matrix to velocity if in a rotated parent
packages/framer-motion/src/gestures/drag/__tests__/index.test.tsx - Added tests for proper x and y positions of a draggable child in a rotated parent.

@TheSilentIce
Copy link
Author

@rromecaster-figma
Please check if this satisfies your bug issue and let me know if there's anything wrong!

@TheSilentIce TheSilentIce changed the title Fixes #3320 — when a draggable element is inside a rotated parent, its drag direction is incorrect Fixes #3320 (UPDATED) — when a draggable element is inside a rotated parent, its drag direction is incorrect Jul 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Draggable direction is incorrect when parent container is rotated
1 participant