[gnome-maps/wip/osrm-routing] Show sidebar when a route is drawn
- From: Mattias Bengtsson <mattiasb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-maps/wip/osrm-routing] Show sidebar when a route is drawn
- Date: Thu, 13 Jun 2013 02:33:15 +0000 (UTC)
commit 8ec0cfbfdaa99270b02e18200998fcec85c2a71d
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 25e9240..f78545e 100644
--- a/src/mapView.js
+++ b/src/mapView.js
@@ -65,8 +65,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);
@@ -89,6 +88,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();
@@ -136,6 +144,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 aea242b..9caa61f 100644
--- a/src/sidebar.js
+++ b/src/sidebar.js
@@ -43,7 +43,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]