[gnome-maps/wip/osrm-routing: 21/24] Show sidebar when a route is drawn



commit 10918f3c9210ca87d1c2de7678337f41c2dafc4f
Author: Mattias Bengtsson <mattias jc bengtsson gmail com>
Date:   Thu Jun 13 04:29:39 2013 +0200

    Show sidebar when a route is drawn
    
    Automatically show and reveal the sidebar when a route is calculated
    and drawn on the map. The sidebar will be filled with the route
    instructions later.

 src/mapView.js |   13 +++++++++++--
 src/sidebar.js |    3 ++-
 2 files changed, 13 insertions(+), 3 deletions(-)
---
diff --git a/src/mapView.js b/src/mapView.js
index 9a180e3..f6357e2 100644
--- a/src/mapView.js
+++ b/src/mapView.js
@@ -66,8 +66,7 @@ const MapView = new Lang.Class({
         this.view.connect('notify::longitude', Lang.bind(this, this._onViewMoved));
 
         this._sidebar = new Sidebar.Sidebar();
-        // Don't show sidebar until it has something in it
-        //this.view.add_child(this._sidebar.actor);
+        this.view.add_child(this._sidebar.actor);
 
         this._markerLayer = new Champlain.MarkerLayer();
         this._markerLayer.set_selection_mode(Champlain.SelectionMode.SINGLE);
@@ -90,6 +89,15 @@ const MapView = new Lang.Class({
         this._showUserLocation();
     },
 
+    showSidebar: function() {
+        this._sidebar.reveal();
+        this._sidebar.actor.show();
+    },
+    hideSidebar: function() {
+        this._sidebar.actor.hide();
+        this._sidebar.conceal();
+    },
+    
     _route_request: function(toLocation) {
         let fromLocation = this._userLocation;
         let router = new osrm.Router();
@@ -137,6 +145,7 @@ const MapView = new Lang.Class({
             this._routeLayer.visible = true;
             this._instructionsLayer.visible = true;
             this.ensureVisible([fromLocation, toLocation]);
+            this.showSidebar();
         }));
     },
 
diff --git a/src/sidebar.js b/src/sidebar.js
index 8912a3d..cb9eb05 100644
--- a/src/sidebar.js
+++ b/src/sidebar.js
@@ -42,7 +42,8 @@ const Sidebar = new Lang.Class({
         this.actor = new Clutter.Actor({ layout_manager: new Clutter.BoxLayout({ spacing: 12 }),
                                          y_expand: true,
                                          x_align: Clutter.ActorAlign.END });
-
+        this.actor.hide();
+        
         // create the button
         this._revealButton = new Gd.HeaderSimpleButton({ valign: Gtk.Align.CENTER });
         this._revealButton.get_style_context().add_class('osd');


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