react-diagrams icon indicating copy to clipboard operation
react-diagrams copied to clipboard

Zoom centering at mouse position with mouse wheel

Open sompylasar opened this issue 9 years ago • 4 comments

Right now the diagram ignores where you point the mouse pointer when spinning the wheel / swiping the touchpad, so the diagram is always scaling to the left top corner, which is counter-intuitive UX compared to, for example, Google Maps.

sompylasar avatar Aug 15 '17 09:08 sompylasar

Hello! I managed to implement this Example: Demo

Diff: https://github.com/projectstorm/react-diagrams/compare/master...JokerNN:master

onWheel handler became huge so maybe it's better to have it as class method Also important to mention that swapping scale and transition made things mach more easier. It uses clientWidth, which forces reflow, but I have no idea how to avoid it :(

Hope this help @dylanvorster

JokerNN avatar Sep 15 '17 11:09 JokerNN

This is super legit, could you open up a PR!

dylanvorster avatar Sep 15 '17 11:09 dylanvorster

Sure: https://github.com/projectstorm/react-diagrams/pull/87

JokerNN avatar Sep 15 '17 11:09 JokerNN

Let it be known that @JokerNN is awesome, this is now available in 3.1.0

dylanvorster avatar Sep 15 '17 13:09 dylanvorster