react-zoom-pan-pinch icon indicating copy to clipboard operation
react-zoom-pan-pinch copied to clipboard

limit the panning to the size of the image, not the screen.

Open doodguymandood opened this issue 1 year ago • 6 comments

Hi! does this library support this by chance? I really like this library and I've been trying to get this to work but no cigar

doodguymandood avatar May 17 '23 22:05 doodguymandood

What do you mean with limit the panning? Keeping the image inside the bounds?

If yes, you've got the prop limitToBounds

cojoclaudiu avatar May 17 '23 23:05 cojoclaudiu

think of it as a interactive map, im trying to keep people from dragging the map out bounds of the map image. but when I use limitToBounds it locks me in the left side of the image and wont let me out

doodguymandood avatar May 18 '23 01:05 doodguymandood

so I think the issue is that I want transformwrapper to wrap an imagine instead of the viewport

doodguymandood avatar May 18 '23 22:05 doodguymandood

so for some reason it believes that the top left of my image is the center of the image

doodguymandood avatar May 19 '23 04:05 doodguymandood

anwser? I need this please.

Jhonatha1 avatar May 16 '24 18:05 Jhonatha1

when I use limitToBounds it locks me in the left side of the image and wont let me out

I was able to make it work by adding a smaller height to the wrapper, similar to what's done in the mini-map code.

Seems that if the height of the wrapper is too big, it kind of understands that there's nothing to scroll, and the UX ends up feeling like it's stuck in the viewport.

At least, that worked for me! You can try changing the height size and see if that works! Good luck 🤞🏼

a-fortunato avatar Jun 13 '24 20:06 a-fortunato