[gnome-maps] mapMarker: Move map bubble when map view moves



commit 17c0d790fbd8976e6237cef3185ab46a37a38319
Author: Marcus Lundblad <ml update uu se>
Date:   Thu Dec 14 22:55:55 2017 +0100

    mapMarker: Move map bubble when map view moves
    
    When a map marker is visible and the view moves
    (i.e. when using arrow keys) move the bubble as
    well. Hide it when when marker goes out of view.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=791579

 src/mapMarker.js |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/src/mapMarker.js b/src/mapMarker.js
index 1d237fb..328281e 100644
--- a/src/mapMarker.js
+++ b/src/mapMarker.js
@@ -72,6 +72,9 @@ var MapMarker = new Lang.Class({
             this.bind_property('longitude',
                                this.place.location, 'longitude',
                                GObject.BindingFlags.DEFAULT);
+            this._view.connect('notify::latitude', this._onViewUpdated.bind(this));
+            this._view.connect('notify::longitude', this._onViewUpdated.bind(this));
+            this._view.connect('notify::zoom-level', this._onViewUpdated.bind(this));
         }
     },
 
@@ -287,6 +290,15 @@ var MapMarker = new Lang.Class({
                y + ty + this.height > 0 && y + ty < mapSize.height;
     },
 
+    _onViewUpdated: function() {
+        if (this.bubble) {
+            if (this._isInsideView())
+                this._positionBubble(this.bubble);
+            else
+                this.bubble.hide();
+        }
+    },
+
     showBubble: function() {
         if (this.bubble && !this.bubble.visible && this._isInsideView()) {
             this._initBubbleSignals();


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