[gnome-maps/wip/freebase-poi: 4/4] view: Control visibility of POI



commit 95d556bca9f0a86da1c9dede066190be828f370a
Author: Carlos Garnacho <carlosg gnome org>
Date:   Sun Sep 28 18:12:43 2014 +0200

    view: Control visibility of POI
    
    View changes now trigger queries for POI within the range after an
    inactivity timeout, and jumps to a location just erase and forget the
    currently fetched POI.

 src/mapView.js |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/src/mapView.js b/src/mapView.js
index 5e348dd..c00fc83 100644
--- a/src/mapView.js
+++ b/src/mapView.js
@@ -186,6 +186,7 @@ const MapView = new Lang.Class({
     },
 
     showNGotoLocation: function(place) {
+        this._unsetPoi();
         let mapLocation = this.showLocation(place);
         mapLocation.goTo(true);
     },
@@ -406,6 +407,14 @@ const MapView = new Lang.Class({
     },
 
     _onViewMoved: function() {
+        if (this._queryPoiTimeoutId)
+            Mainloop.source_remove(this._queryPoiTimeoutId);
+        this._queryPoiTimeoutId = Mainloop.timeout_add_seconds(1, Lang.bind(this, function() {
+            this._updatePoiLayer();
+            this._queryPoiTimeoutId = 0;
+            return false;
+        }));
+
         this.emit('view-moved');
     }
 });


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