[gnome-maps/wip/fix-geoloc: 6/8] AMEND: cleanups



commit 677074f7c5ed6806585355a9fc755dc701c508d1
Author: Mattias Bengtsson <mattias jc bengtsson gmail com>
Date:   Thu Jul 11 03:56:45 2013 +0200

    AMEND: cleanups

 src/mapLocation.js |   15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)
---
diff --git a/src/mapLocation.js b/src/mapLocation.js
index 989d537..f9eeb9d 100644
--- a/src/mapLocation.js
+++ b/src/mapLocation.js
@@ -83,11 +83,7 @@ const MapLocation = new Lang.Class({
             this._view.go_to(this.latitude, this.longitude);
         }).bind(this));
 
-        this._mapView.ensureVisible([
-            new Geocode.Location({ latitude: this._view.get_center_latitude(),
-                                   longitude: this._view.get_center_longitude() }),
-            this
-        ]);
+        this._mapView.ensureVisible([this._getCurrentLocation(), this]);
     },
 
     show: function(layer) {
@@ -108,7 +104,7 @@ const MapLocation = new Lang.Class({
     zoomToFit: function() {
         let zoom;
         if (this.accuracy == Geocode.LOCATION_ACCURACY_UNKNOWN)
-             zoom = 12; // Accuracy is usually city-level when unknown
+            zoom = 12; // Accuracy is usually city-level when unknown
         else if (this.accuracy <= Geocode.LOCATION_ACCURACY_STREET)
             zoom = 16;
         else if (this.accuracy <= Geocode.LOCATION_ACCURACY_CITY)
@@ -120,6 +116,13 @@ const MapLocation = new Lang.Class({
         else
             zoom = 3;
         this._view.set_zoom_level(zoom);
+    },
+
+    _getCurrentLocation: function() {
+        return new Geocode.Location({
+            latitude: this._view.get_center_latitude(),
+            longitude: this._view.get_center_longitude()
+        });
     }
 });
 Signals.addSignalMethods(MapLocation.prototype);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]