-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
When the width and height dimensions of an svg are different from the viewBox dimensions, dragging items doesn’t work correctly: The mouse pointer location does not correspond to the dragged item’s location.
<svg viewBox="0 0 100 100" width="500" height="500">
<motion.rect width="10" height="10" drag />
</svg>Expected behaviour
When the viewBox corresponds to the width and height, there is no such issue.
<svg viewBox="0 0 500 500" width="500" height="500">
<motion.rect width="50" height="50" drag />
</svg>Is there any way of getting a correct drag behaviour in an svg with a fixed viewBox? It would be very inconvenient to change the viewBox (and recalculating the entire content) every time the SVG’s dimensions change (e.g. after resizing the window).
Sandbox
https://codesandbox.io/s/musing-bush-dc4vh?file=/src/App.js:475-596
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working

