Open oparoz opened 8 years ago
I played with the library a bit.
By replacing
imgWidth = (imageWidth > imageHeight && contHeight >= contWidth) || ratio * contHeight > contWidth ? contWidth : ratio * contHeight;
with
// Don't stretch images to fill the container
imgWidth = imageWidth;
I get the wanted effect, which is the image showing up at it's native size or zoomed in if a parameter was passed.
Next is the snap view:
That part of code is required to contain image inside container, changing that may affect on other modes.
I am out town for few days . Will be fixing once i am back.
Yeah, I've noticed that the fullscreen mode has the same problem where images will be stretched to fit. Just ping me when you're back and have time to work on this :).
Any news? :)
So In ImageViewer now it behaves as backgound-size contain for a given container. And whatever size is coming at that point I am considering it as 100% zoom, which literally is not correct. There are multiple problems which needs to be figured if image actual dimension to be considered as 100% zoom with current code.
This is a sample setup
and the code used
The slideshow CSS
The large image has the following style applied to it:
width: 918px; height: 918px
, but the original image is 50x50.I've tracked it down to this line, which stretches the image to fill the container: https://github.com/s-yadav/ImageViewer/blob/master/imageviewer.js#L608
I think there should be a limit applied, using the initial zoomValue.