chrisfisher / react-native-directed-scrollview

UNMAINTAINED- see below. A natively implemented scrollview component which lets you specify different scroll directions for child content.
MIT License
149 stars 67 forks source link

fixed a problem where pinch-to-zoom should scale around the pinch point #7

Closed oscarkuo closed 7 years ago

oscarkuo commented 7 years ago

Currently when you pinch-to-zoom the Android implementation, it always scale around the top left corner instead of the pinch point.

This PR sets the pivot point for scaling to where the pinch started.

chrisfisher commented 7 years ago

@oscarkuo Thanks for the PR - it's a great start. I noticed though that if the scroll offset is (0,0) then after you zoom the viewport isn't correctly aligned with the content (so you either get extra white space, or content is cut off and can't be scrolled to). One solution might be to do an animated realignment when ACTION_UP fires. Want to have a go at this? Or I may be able to take a look when I get some more time 😄

oscarkuo commented 7 years ago

@chrisfisher thanks for the feedback, by "scroll offset", do you mean if you use the scrollTo method then there will be extra whitespace?

I'll give it a go since getting this PR merged is part of the task I'm working on at work.

chrisfisher commented 7 years ago

@oscarkuo The scroll offset is (0,0) when you're in the top left corner (i.e. the starting point). If you pinch to zoom here in the example then you either get extra white space (zooming in) or content is cut off (zooming out).