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,28 +59,30 @@ var MapWalker = GObject.registerClass({
// Zoom to the maximal zoom-level that fits the place type
zoomToFit() {
let zoom;
if (this._boundingBox !== null && this._boundingBox.is_valid()) {
this._view.zoom_level = this._view.max_zoom_level;
this._view.ensure_visible(this._boundingBox, false);
} else {
let zoom;
if (this.place.initialZoom) {
zoom = this.place.initialZoom;
} else {
switch (this.place.place_type) {
case Geocode.PlaceType.STREET:
zoom = 16;
break;
case Geocode.PlaceType.TOWN:
zoom = 11;
break;
case Geocode.PlaceType.COUNTRY:
zoom = 6;
break;
default:
zoom = this._view.max_zoom_level;
break;
}
}
this._view.zoom_level = zoom;
this._view.center_on(this.place.location.latitude,
this.place.location.longitude);
......
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