openspacelabs / react-native-zoomable-view

A view component for react-native with pinch to zoom, tap to move and double tap to zoom capability.
MIT License
205 stars 57 forks source link

Disable Panning when Zoom 1 #38

Closed sebasptsch closed 1 year ago

sebasptsch commented 2 years ago

It should be possible to disable panning when the image has not yet been zoomed into. This is useful when using with libraries like 'react-native-pager-view'

mmdevcodes commented 2 years ago

Yes this feature would be great, plus a follow up question: Is there some way to disable panning at all?

RayHughes commented 2 years ago

Request feature as well. This library solves html rendering zoom for images. The ability to disable pan at initial zoom is needed.

danielreuterwall commented 2 years ago

I've made a fork to implement this. It seems to work ok, cdf1b1c47017e37951b63f29674df8b5b1c89fc1? Can make a pull request, what do you think?

janpe commented 2 years ago

Hoping to see this feature as well. @danielreuterwall maybe you should go ahead and open the pull request to get this moving?

janpe commented 2 years ago

@danielreuterwall or maybe it could be just a panEnabled (default true) prop where you can determine yourself when it should be enabled or disabled. Similar to zoomEnabled on react-native-pager-view which was mentioned in the initial message of this issue.

danielreuterwall commented 1 year ago

I agree, having a panEnabled is a more flexible solution. Although this feels like a very common requirement that is could justify a dedicated prop. I'll try to fix a PR this week.

sebasptsch commented 1 year ago

I agree, having a panEnabled is a more flexible solution. Although this feels like a very common requirement that is could justify a dedicated prop. I'll try to fix a PR this week.

Thanks for taking a look!

janpe commented 1 year ago

Hi again @danielreuterwall! Do you have an idea when you might have time to continue this one?

danielreuterwall commented 1 year ago

Just added a PR for the fix I made. Haven't continued with the panEnabled prop but that would be a natural continuation.

tauntmachine commented 1 year ago

would someone be kind enough to approve this??

manarfalah commented 1 year ago

is there any way to disable panning beyond edges also when zooming ? I am using disablePanOnInitialZoom but I want this behavior also when I zoom and get to edge of image.