[gnome-maps/wip/contacts: 12/17] mapView: Add gotoBBox helper



commit a3e98f76cbf4d77b854a3c5b5fa36e1be1ad0667
Author: Jonas Danielsson <jonas threetimestwo org>
Date:   Tue Dec 16 04:34:15 2014 -0500

    mapView: Add gotoBBox helper

 src/mapView.js |   26 +++++++++++++++-----------
 1 files changed, 15 insertions(+), 11 deletions(-)
---
diff --git a/src/mapView.js b/src/mapView.js
index 63ec357..edba97a 100644
--- a/src/mapView.js
+++ b/src/mapView.js
@@ -179,6 +179,20 @@ const MapView = new Lang.Class({
         this.emit('user-location-changed');
     },
 
+    _gotoBBox: function(bbox) {
+        let [lat, lon] = bbox.get_center();
+        let place = new Geocode.Place({
+            location     : new Geocode.Location({ latitude  : lat,
+                                                  longitude : lon }),
+            bounding_box : new Geocode.BoundingBox({ top    : bbox.top,
+                                                     bottom : bbox.bottom,
+                                                     left   : bbox.left,
+                                                     right  : bbox.right })
+        });
+
+        new MapWalker.MapWalker(place, this).goTo(true);
+    },
+
     showTurnPoint: function(turnPoint) {
         if (this._turnPointMarker)
             this._turnPointMarker.destroy();
@@ -209,18 +223,8 @@ const MapView = new Lang.Class({
 
         route.path.forEach(this._routeLayer.add_node.bind(this._routeLayer));
 
-        let [lat, lon] = route.bbox.get_center();
-        let place = new Geocode.Place({
-            location     : new Geocode.Location({ latitude  : lat,
-                                                  longitude : lon }),
-            bounding_box : new Geocode.BoundingBox({ top    : route.bbox.top,
-                                                     bottom : route.bbox.bottom,
-                                                     left   : route.bbox.left,
-                                                     right  : route.bbox.right })
-        });
-
         this._showDestinationTurnpoints();
-        new MapWalker.MapWalker(place, this).goTo(true);
+        this._gotoBBox(route.bbox);
     },
 
     _showDestinationTurnpoints: function() {


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