Open ppowalowski opened 9 years ago
I agree. Our image container is a fixed height and sometimes the content image is smaller than the container so it gets stretched, making the "zoom" actually zoom out.
modify this block of code and it will be fixed.
move: function(e) {
var left = (e.pageX - offset.left),
top = (e.pageY - offset.top);
if (xRatio < 0) {
xRatio = 0
img.style.width = sourceWidth + 'px';
}
if (yRatio < 0) {
yRatio = 0
img.style.height = sourceHeight + 'px';
}
top = Math.max(Math.min(top, sourceHeight), 0);
left = Math.max(Math.min(left, sourceWidth), 0);
img.style.left = (left * -xRatio) + 'px';
img.style.top = (top * -yRatio) + 'px';
}
There should be something like a minimal zoomratio so the user can decide when it's worthy for jquery-zoom to kick in magnification. Currently it also applies magnification if the target image is smaller - this should be at least locked to 1:1 ratio.