anvaka / panzoom

Universal pan and zoom library (DOM, SVG, Custom)
https://anvaka.github.io/panzoom/demo/attach-via-script.html
MIT License
1.78k stars 286 forks source link

Bounding issue when using CSS transform: scale on container #203

Open Thul999 opened 4 years ago

Thul999 commented 4 years ago

When not using the CSS transform: scale on container, everything works perfectly, but when using scale with a value different than 1, boundsPadding behaves differently and erratically.

For example, if I put boundsPadding = 1, the normal behavior is that you don't see any blank spaces when panning/zooming the image. But with scale(0.85), you will see white space on the right and bottom when moving the image.

groenroos commented 4 years ago

I have this issue as well. The top and left edges don't show space, but when the image is panned as far up and left as possible, I think the amount of blank space on the bottom and right is directly inversely related to the percentage of scale.

i.e. at scale(0.5), there's 50% of the container worth of space on the bottom and right. At scale(0.25) there's 75% of space.