[gnome-maps/wip/contacts: 70/81] mapView: Add gotoBBox helper



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

    mapView: Add gotoBBox helper
    
    https://bugzilla.gnome.org/show_bug.cgi?id=741591

 src/mapView.js |   25 ++++++++++++++-----------
 1 files changed, 14 insertions(+), 11 deletions(-)
---
diff --git a/src/mapView.js b/src/mapView.js
index 1b3f5a7..3b89631 100644
--- a/src/mapView.js
+++ b/src/mapView.js
@@ -190,6 +190,19 @@ const MapView = new Lang.Class({
         this.emit('user-location-changed');
     },
 
+    _gotoBBox: function(bbox) {
+        let [lat, lon] = bbox.get_center();
+        let place = new 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();
@@ -220,18 +233,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 Place.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]