[gnome-maps] mapView: Fix bug when loading previous zoom level
- From: Marcus Lundblad <mlundblad src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-maps] mapView: Fix bug when loading previous zoom level
- Date: Thu, 1 Aug 2019 19:02:52 +0000 (UTC)
commit dc4e5cd4ef2b3fbcadf5f012505e280075131c2d
Author: James Westman <flyingpimonster flyingpimonster net>
Date: Thu Aug 1 13:05:37 2019 -0500
mapView: Fix bug when loading previous zoom level
If the application was closed at a zoom level of 19, it would not be
loaded again properly due to a default max zoom of 18. Fixed by
restoring the zoom level after setting the map style.
src/mapView.js | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
---
diff --git a/src/mapView.js b/src/mapView.js
index 90aaf16..fc9388f 100644
--- a/src/mapView.js
+++ b/src/mapView.js
@@ -152,6 +152,9 @@ var MapView = GObject.registerClass({
this.setMapType(mapType);
+ if (Application.normalStartup)
+ this._goToStoredLocation();
+
this.shapeLayerStore = new Gio.ListStore(GObject.TYPE_OBJECT);
Application.geoclue.connect('location-changed',
@@ -186,8 +189,6 @@ var MapView = GObject.registerClass({
view.kinetic_mode = true;
view.horizontal_wrap = true;
- if (Application.normalStartup)
- this._goToStoredLocation(view);
view.connect('notify::latitude', this._onViewMoved.bind(this));
// switching map type will set view min-zoom-level from map source
view.connect('notify::min-zoom-level', () => {
@@ -460,20 +461,20 @@ var MapView = GObject.registerClass({
Application.settings.set('last-viewed-location', location);
}
- _goToStoredLocation(view) {
+ _goToStoredLocation() {
let location = Application.settings.get('last-viewed-location');
if (location.length === 2) {
- view.zoom_level = Application.settings.get('zoom-level');
- view.center_on(location[0], location[1]);
+ this.view.zoom_level = Application.settings.get('zoom-level');
+ this.view.center_on(location[0], location[1]);
} else {
/* bounding box. for backwards compatibility, not used anymore */
let bbox = new Champlain.BoundingBox({ top: location[0],
bottom: location[1],
left: location[2],
right: location[3] });
- view.connect("notify::realized", () => {
- if (view.realized)
+ this.view.connect("notify::realized", () => {
+ if (this.view.realized)
this.gotoBBox(bbox, true);
});
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]