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({ ...@@ -59,28 +59,30 @@ 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 {
let zoom;
if (this.place.initialZoom) {
zoom = this.place.initialZoom;
} else { } else {
switch (this.place.place_type) { switch (this.place.place_type) {
case Geocode.PlaceType.STREET: case Geocode.PlaceType.STREET:
zoom = 16; zoom = 16;
break; break;
case Geocode.PlaceType.TOWN: case Geocode.PlaceType.TOWN:
zoom = 11; zoom = 11;
break; break;
case Geocode.PlaceType.COUNTRY: case Geocode.PlaceType.COUNTRY:
zoom = 6; zoom = 6;
break; break;
default: default:
zoom = this._view.max_zoom_level; zoom = this._view.max_zoom_level;
break; 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,
this.place.location.longitude); 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