chrvadala / react-svg-pan-zoom

:eyes: A React component that adds pan and zoom features to SVG
https://chrvadala.github.io/react-svg-pan-zoom/
MIT License
681 stars 127 forks source link

Execute pan event for a certain amount of pixels by clicking a UI button #215

Closed Vikms95 closed 1 year ago

Vikms95 commented 1 year ago

Hi! Amazing library! I'm trying to apply functionality to my app where the SVG would not only pan when I click and drag the SVG itself, but also when some directional buttons which belong to my UI get clicked. That way, if I click the up button on my UI, the SVG would receive a pan event where it would move upwards for a certain amount of fixed pixels per click.

Been trying to apply the pan method on my Viewer ref, like so:

const movePanDown = () => { Viewer.current.pan(0, -100) }

And then passing this method to a the directional button, but it does not move. Any help is appreciated.

Please consider also to support the creator of this project: https://www.paypal.me/chrvadala/25