Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions Pod/Classes/MWZoomingScrollView.m
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,12 @@ - (CGFloat)initialZoomScaleWithMinScale {
CGFloat yScale = boundsSize.height / imageSize.height; // the scale needed to perfectly fit the image height-wise
// Zooms standard portrait images on a 3.5in screen but not on a 4in screen.
if (ABS(boundsAR - imageAR) < 0.17) {
zoomScale = MAX(xScale, yScale);
// for images which are vertically long
if (imageAR < 1) {
zoomScale = MIN(xScale, yScale);
} else {
zoomScale = MAX(xScale, yScale);
}
// Ensure we don't zoom in or out too far, just in case
zoomScale = MIN(MAX(self.minimumZoomScale, zoomScale), self.maximumZoomScale);
}
Expand Down Expand Up @@ -286,8 +291,7 @@ - (void)setMaxMinZoomScalesForCurrentBounds {
if (self.zoomScale != minScale) {

// Centralise
self.contentOffset = CGPointMake((imageSize.width * self.zoomScale - boundsSize.width) / 2.0,
(imageSize.height * self.zoomScale - boundsSize.height) / 2.0);
self.contentOffset = CGPointMake((imageSize.width * self.zoomScale - boundsSize.width) / 2.0, 0);

}

Expand Down