Ignore:
Timestamp:
2009-07-12T20:31:35+02:00 (15 years ago)
Author:
dhansen
Message:

It was silly to return the number of tiles seen in terms of
square tiles. It's more natural to think in terms of number
of tiles in a single direction, so return the sqrt().

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/slippymap/src/org/openstreetmap/josm/plugins/slippymap/SlippyMapLayer.java

    r16461 r16462  
    519519                }
    520520
    521                 int tilesSpanned() {
     521                double tilesSpanned() {
    522522                        int x_span = z12x1 - z12x0;
    523523                        int y_span = z12y1 - z12y0;
    524                         return x_span * y_span;
     524                        return Math.sqrt(1.0 * x_span * y_span);
    525525                }
    526526
     
    585585                int zoom = currentZoomLevel;
    586586
    587                 if (zoomDecreaseAllowed() && (ts.tilesSpanned() > (18*18))) {
     587                if (zoomDecreaseAllowed() && (ts.tilesSpanned() > 18)) {
    588588                        this.debug("too many tiles, decreasing zoom from " + currentZoomLevel);
    589589            if (decreaseZoomLevel())
     
    591591                        return;
    592592                }
    593                 if (zoomIncreaseAllowed() && (ts.tilesSpanned() <= 0)) {
     593                if (zoomIncreaseAllowed() && (ts.tilesSpanned() < 1.0)) {
    594594                        this.debug("doesn't even cover one tile (" + ts.tilesSpanned()
    595595                                           + "), increasing zoom from " + currentZoomLevel);
Note: See TracChangeset for help on using the changeset viewer.