general fixes for min/maxzoom, documentation cleared up
hopeful fix for #1086
This commit is contained in:
@@ -566,13 +566,22 @@ values. The valid configuration keys are listed below.
|
|||||||
**Default:** ``#1a1a1a``
|
**Default:** ``#1a1a1a``
|
||||||
|
|
||||||
``defaultzoom``
|
``defaultzoom``
|
||||||
This value specifies the default zoom level that the map will be opened
|
This value specifies the default zoom level that the map will be
|
||||||
with. It has to be greater than 0.
|
opened with. It has to be greater than 0, which corresponds to the
|
||||||
|
most zoomed-out level. If you use ``minzoom`` or ``maxzoom``, it
|
||||||
|
should be between those two.
|
||||||
|
|
||||||
**Default:** ``1``
|
**Default:** ``1``
|
||||||
|
|
||||||
``maxzoom``
|
``maxzoom``
|
||||||
This specifies the maximum zoom allowed by the zoom control on the web page.
|
This specifies the maximum, closest in zoom allowed by the zoom
|
||||||
|
control on the web page. This is relative to 0, the farthest-out
|
||||||
|
image, so setting this to 8 will allow you to zoom in at most 8
|
||||||
|
times. This is *not* relative to ``minzoom``, so setting
|
||||||
|
``minzoom`` will shave off even more levels. If you wish to
|
||||||
|
specify how many zoom levels to leave off, instead of how many
|
||||||
|
total to use, use a negative number here. For example, setting
|
||||||
|
this to -2 will disable the two most zoomed-in levels.
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
@@ -583,8 +592,9 @@ values. The valid configuration keys are listed below.
|
|||||||
**Default:** Automatically set to most detailed zoom level
|
**Default:** Automatically set to most detailed zoom level
|
||||||
|
|
||||||
``minzoom``
|
``minzoom``
|
||||||
This specifies the minimum zoom allowed by the zoom control on the web page. For
|
This specifies the minimum, farthest away zoom allowed by the zoom
|
||||||
example, setting this to 2 will disable the two most-zoomed out levels.
|
control on the web page. For example, setting this to 2 will
|
||||||
|
disable the two most zoomed-out levels.
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
|
|||||||
@@ -119,7 +119,7 @@ overviewer.util = {
|
|||||||
zoom = overviewer.mapView.options.currentTileSet.get('minZoom');
|
zoom = overviewer.mapView.options.currentTileSet.get('minZoom');
|
||||||
} else {
|
} else {
|
||||||
zoom = parseInt(zoom);
|
zoom = parseInt(zoom);
|
||||||
if (zoom < 0 && zoom + overviewer.mapView.options.currentTileSet.get('maxZoom') >= 0) {
|
if (zoom < 0) {
|
||||||
// if zoom is negative, treat it as a "zoom out from max"
|
// if zoom is negative, treat it as a "zoom out from max"
|
||||||
zoom += overviewer.mapView.options.currentTileSet.get('maxZoom');
|
zoom += overviewer.mapView.options.currentTileSet.get('maxZoom');
|
||||||
} else {
|
} else {
|
||||||
@@ -127,6 +127,13 @@ overviewer.util = {
|
|||||||
zoom = overviewer.mapView.options.currentTileSet.get('defaultZoom');
|
zoom = overviewer.mapView.options.currentTileSet.get('defaultZoom');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// clip zoom
|
||||||
|
if (zoom > overviewer.mapView.options.currentTileSet.get('maxZoom'))
|
||||||
|
zoom = overviewer.mapView.options.currentTileSet.get('maxZoom');
|
||||||
|
if (zoom < overviewer.mapView.options.currentTileSet.get('minZoom'))
|
||||||
|
zoom = overviewer.mapView.options.currentTileSet.get('minZoom');
|
||||||
|
|
||||||
overviewer.map.setZoom(zoom);
|
overviewer.map.setZoom(zoom);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -512,9 +519,9 @@ overviewer.util = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (zoom == currTileset.get('maxZoom')) {
|
if (zoom >= currTileset.get('maxZoom')) {
|
||||||
zoom = 'max';
|
zoom = 'max';
|
||||||
} else if (zoom == currTileset.get('minZoom')) {
|
} else if (zoom <= currTileset.get('minZoom')) {
|
||||||
zoom = 'min';
|
zoom = 'min';
|
||||||
} else {
|
} else {
|
||||||
// default to (map-update friendly) negative zooms
|
// default to (map-update friendly) negative zooms
|
||||||
@@ -556,7 +563,7 @@ overviewer.util = {
|
|||||||
zoom = tsetModel.get('minZoom');
|
zoom = tsetModel.get('minZoom');
|
||||||
} else {
|
} else {
|
||||||
zoom = parseInt(zoom);
|
zoom = parseInt(zoom);
|
||||||
if (zoom < 0 && zoom + tsetModel.get('maxZoom') >= 0) {
|
if (zoom < 0) {
|
||||||
// if zoom is negative, treat it as a "zoom out from max"
|
// if zoom is negative, treat it as a "zoom out from max"
|
||||||
zoom += tsetModel.get('maxZoom');
|
zoom += tsetModel.get('maxZoom');
|
||||||
} else {
|
} else {
|
||||||
@@ -565,6 +572,12 @@ overviewer.util = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// clip zoom
|
||||||
|
if (zoom > tsetModel.get('maxZoom'))
|
||||||
|
zoom = tsetModel.get('maxZoom');
|
||||||
|
if (zoom < tsetModel.get('minZoom'))
|
||||||
|
zoom = tsetModel.get('minZoom');
|
||||||
|
|
||||||
overviewer.map.setCenter(latlngcoords);
|
overviewer.map.setCenter(latlngcoords);
|
||||||
overviewer.map.setZoom(zoom);
|
overviewer.map.setZoom(zoom);
|
||||||
var locationmarker = new overviewer.views.LocationIconView();
|
var locationmarker = new overviewer.views.LocationIconView();
|
||||||
|
|||||||
@@ -552,7 +552,9 @@ class TileSet(object):
|
|||||||
poititle = self.options.get("poititle"),
|
poititle = self.options.get("poititle"),
|
||||||
showlocationmarker = self.options.get("showlocationmarker")
|
showlocationmarker = self.options.get("showlocationmarker")
|
||||||
)
|
)
|
||||||
|
d['maxZoom'] = min(self.treedepth, d['maxZoom'])
|
||||||
d['minZoom'] = min(max(0, self.options.get("minzoom", 0)), d['maxZoom'])
|
d['minZoom'] = min(max(0, self.options.get("minzoom", 0)), d['maxZoom'])
|
||||||
|
d['defaultZoom'] = max(d['minZoom'], min(d['defaultZoom'], d['maxZoom']))
|
||||||
|
|
||||||
if isOverlay:
|
if isOverlay:
|
||||||
d.update({"tilesets": self.options.get("overlay")})
|
d.update({"tilesets": self.options.get("overlay")})
|
||||||
|
|||||||
Reference in New Issue
Block a user