general fixes for min/maxzoom, documentation cleared up
hopeful fix for #1086
This commit is contained in:
@@ -119,7 +119,7 @@ overviewer.util = {
|
||||
zoom = overviewer.mapView.options.currentTileSet.get('minZoom');
|
||||
} else {
|
||||
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"
|
||||
zoom += overviewer.mapView.options.currentTileSet.get('maxZoom');
|
||||
} else {
|
||||
@@ -127,6 +127,13 @@ overviewer.util = {
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -512,9 +519,9 @@ overviewer.util = {
|
||||
}
|
||||
|
||||
|
||||
if (zoom == currTileset.get('maxZoom')) {
|
||||
if (zoom >= currTileset.get('maxZoom')) {
|
||||
zoom = 'max';
|
||||
} else if (zoom == currTileset.get('minZoom')) {
|
||||
} else if (zoom <= currTileset.get('minZoom')) {
|
||||
zoom = 'min';
|
||||
} else {
|
||||
// default to (map-update friendly) negative zooms
|
||||
@@ -556,7 +563,7 @@ overviewer.util = {
|
||||
zoom = tsetModel.get('minZoom');
|
||||
} else {
|
||||
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"
|
||||
zoom += tsetModel.get('maxZoom');
|
||||
} 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.setZoom(zoom);
|
||||
var locationmarker = new overviewer.views.LocationIconView();
|
||||
|
||||
@@ -552,7 +552,9 @@ class TileSet(object):
|
||||
poititle = self.options.get("poititle"),
|
||||
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['defaultZoom'] = max(d['minZoom'], min(d['defaultZoom'], d['maxZoom']))
|
||||
|
||||
if isOverlay:
|
||||
d.update({"tilesets": self.options.get("overlay")})
|
||||
|
||||
Reference in New Issue
Block a user