[gnome-maps/wip/osrm-routing: 5/21] Set champlain layers invisible before modifying them
- From: Mattias Bengtsson <mattiasb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-maps/wip/osrm-routing: 5/21] Set champlain layers invisible before modifying them
- Date: Tue, 23 Jul 2013 15:03:41 +0000 (UTC)
commit 5d132c2c0c5680bad67137f3b6a3f2655eca4ed9
Author: Jussi Kukkonen <jku goto fi>
Date: Mon Apr 22 16:29:42 2013 +0300
Set champlain layers invisible before modifying them
This improves performance as otherwise the canvas gets repainted on
every change.
src/mapView.js | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/src/mapView.js b/src/mapView.js
index 075d15c..102030d 100644
--- a/src/mapView.js
+++ b/src/mapView.js
@@ -94,6 +94,10 @@ const MapView = new Lang.Class({
let fromLocation = this._userLocation;
let router = new osrm.Router();
+ // modify layers while not visible to avoid repaints
+ this._routeLayer.visible = false;
+ this._instructionsLayer.visible = false;
+
this._routeLayer.remove_all();
this._instructionsLayer.remove_all();
@@ -109,6 +113,7 @@ const MapView = new Lang.Class({
log("Got a " +route.length+ "m route with " + route.points.length + " nodes and " +
route.instructions.length + " turn instructions.");
+
for (let i = 0; i < route.points.length; i++) {
let coord = new Champlain.Coordinate();
coord.set_location(route.points[i]._lat,
@@ -123,8 +128,9 @@ const MapView = new Lang.Class({
route.instructions[i]._lon);
this._instructionsLayer.add_marker(coord);
}
- this._routeLayer.set_visible(true);
+ this._routeLayer.visible = true;
+ this._instructionsLayer.visible = true;
this.ensureVisible([fromLocation, toLocation]);
}));
},
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]