msand / zoomable-svg

Pinch to pan-n-zoom react-native-svg components using a render prop.
38 stars 14 forks source link

Reset transform? #8

Closed VanHoutte closed 5 years ago

VanHoutte commented 5 years ago

Hello again,

I have created a canvas where a certain object is displayed. Users can zoom in, scale, etc. I have a button that when pressed, it changes the canvas to its initial position.

Any idea how I could achieve this? I tried resetting the transform object but without luck.

Thanks in advance!

Kind regards

msand commented 5 years ago

Hello!

You can check here for example: https://github.com/msand/InfiniDraw/blob/32d31d8e944bbd4d5c79173257e1c674200eb949/lib/drawing.js#L371-L373

Essentially, make a reference, and call the reset method on the ref.

VanHoutte commented 5 years ago

It worked like a charm!

Hello!

You can check here for example: https://github.com/msand/InfiniDraw/blob/32d31d8e944bbd4d5c79173257e1c674200eb949/lib/drawing.js#L371-L373

Essentially, make a reference, and call the reset method on the ref.

It worked like a charm!