diff --git a/library/src/main/java/it/sephiroth/android/library/imagezoom/ImageViewTouchBase.java b/library/src/main/java/it/sephiroth/android/library/imagezoom/ImageViewTouchBase.java index 1df9d3a..339c492 100644 --- a/library/src/main/java/it/sephiroth/android/library/imagezoom/ImageViewTouchBase.java +++ b/library/src/main/java/it/sephiroth/android/library/imagezoom/ImageViewTouchBase.java @@ -76,6 +76,7 @@ public enum DisplayType { protected static final boolean LOG_ENABLED = false; public static final float ZOOM_INVALID = - 1f; + private static final int ZOOM_MAX_SCALE = 8; protected Easing mEasing = new Cubic(); protected Matrix mBaseMatrix = new Matrix(); @@ -87,6 +88,7 @@ public enum DisplayType { private float mMaxZoom = ZOOM_INVALID; private float mMinZoom = ZOOM_INVALID; + private int mMaxZoomScale = ZOOM_MAX_SCALE; // true when min and max zoom are explicitly defined private boolean mMaxZoomDefined; @@ -566,7 +568,7 @@ protected float computeMaxZoom() { float fw = (float) drawable.getIntrinsicWidth() / (float) mThisWidth; float fh = (float) drawable.getIntrinsicHeight() / (float) mThisHeight; - float scale = Math.max(fw, fh) * 8; + float scale = Math.max(fw, fh) * mMaxZoomScale; if (LOG_ENABLED) { Log.i(LOG_TAG, "computeMaxZoom: " + scale); @@ -1019,4 +1021,8 @@ public void run() { public void dispose() { clear(); } + + public void setMaxZoomScale(int maxScale){ + this.mMaxZoomScale = maxScale; + } }