]> gitweb.fperrin.net Git - GpsPrune.git/blobdiff - src/tim/prune/gui/map/MapPosition.java
Never overzoom when initially opening a track
[GpsPrune.git] / src / tim / prune / gui / map / MapPosition.java
index 25f05fc1a2a238370d8888ea4b807b7d3f5f8adb..71ab6cd4d88ed9eb9823db56ab19dc72d574db53 100644 (file)
@@ -30,14 +30,14 @@ public class MapPosition
         * @param inWidth width of display
         * @param inHeight height of display
         */
-       public void zoomToXY(double inMinX, double inMaxX, double inMinY, double inMaxY, int inWidth, int inHeight)
+       public void zoomToXY(double inMinX, double inMaxX, double inMinY, double inMaxY, int inWidth, int inHeight, int maxZoom)
        {
                // System.out.println("Zooming to " + inMinX + ", " + inMaxX + ", " + inMinY + ", " + inMaxY + "; width=" + inWidth + ", height=" + inHeight);
                double diffX = Math.abs(inMaxX - inMinX);
                double diffY = Math.abs(inMaxY - inMinY);
                // Find out what zoom level to go to
                int requiredZoom = -1;
-               for (int currZoom = MAX_ZOOM; currZoom >= 2; currZoom--)
+               for (int currZoom = maxZoom; currZoom >= 2; currZoom--)
                {
                        if (transformToPixels(diffX, currZoom) < inWidth
                                && transformToPixels(diffY, currZoom) < inHeight)