Commit 5b05ba4a authored by Marcus Lundblad's avatar Marcus Lundblad

mapWalker: Use initial zoom level when set

If the place set for the map walker has an
initial desired zoom level set, use that.
parent 07754fb9
...@@ -59,27 +59,29 @@ var MapWalker = GObject.registerClass({ ...@@ -59,27 +59,29 @@ var MapWalker = GObject.registerClass({
// Zoom to the maximal zoom-level that fits the place type // Zoom to the maximal zoom-level that fits the place type
zoomToFit() { zoomToFit() {
let zoom;
if (this._boundingBox !== null && this._boundingBox.is_valid()) { if (this._boundingBox !== null && this._boundingBox.is_valid()) {
this._view.zoom_level = this._view.max_zoom_level; this._view.zoom_level = this._view.max_zoom_level;
this._view.ensure_visible(this._boundingBox, false); this._view.ensure_visible(this._boundingBox, false);
} else { } else {
switch (this.place.place_type) { let zoom;
case Geocode.PlaceType.STREET:
zoom = 16; if (this.place.initialZoom) {
break; zoom = this.place.initialZoom;
} else {
case Geocode.PlaceType.TOWN: switch (this.place.place_type) {
zoom = 11; case Geocode.PlaceType.STREET:
break; zoom = 16;
break;
case Geocode.PlaceType.COUNTRY: case Geocode.PlaceType.TOWN:
zoom = 6; zoom = 11;
break; break;
case Geocode.PlaceType.COUNTRY:
default: zoom = 6;
zoom = this._view.max_zoom_level; break;
break; default:
zoom = this._view.max_zoom_level;
break;
}
} }
this._view.zoom_level = zoom; this._view.zoom_level = zoom;
this._view.center_on(this.place.location.latitude, this._view.center_on(this.place.location.latitude,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment