react-zoom-pan-pinch
react-zoom-pan-pinch copied to clipboard
Propose: option to lock the panning bounds to the parent element bounding box
to illustrate what I mean:
in src/store/pan/index.ts
39,40c39,40
< const newPositionX = lockAxisX ? positionX : Math.max(Math.min(mouseX,10),this.bounds.minPositionX-10);
< const newPositionY = lockAxisY ? positionY : Math.max(Math.min(mouseY,10),this.bounds.minPositionY-10);
---
> const newPositionX = lockAxisX ? positionX : mouseX;
> const newPositionY = lockAxisY ? positionY : mouseY;
56,57d55
I hardcoded there, but need to add some setting...
@zpetukhov I'm using your solution temporarily, but agreed it should be part of the library if possible!
Voicing support for this, I'll be grabbing your solution until then. Thanks!
isn't it just a limitToBounds prop?
We can also disable animation which goes beyond wrapper - it's disablePadding prop.