[gnome-maps] mapWalker: Improve travel animations



commit 2712c8e4e23bf3fd214c43f1e016b7f3f91f9411
Author: Hashem Nasarat <hashem riseup net>
Date:   Thu Jan 7 03:59:31 2016 -0500

    mapWalker: Improve travel animations
    
    Reorder the animation callbacks. There's some sort of race
    condition where the callbacks trigger sometimes for different
    animations than the one you expect. This leads to things like the map
    zooming-in instead of out to pan, and the map zooming-in on an area
    different than the ending position. Reordering the expressions seems
    to make us win these races.
    
    The ChamplainView API doesn't allow us to do much better unfortunately
    so this is a quick bandaid until there's time for bigger changes to be
    made.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=760256

 src/mapWalker.js |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)
---
diff --git a/src/mapWalker.js b/src/mapWalker.js
index f09e519..410baa7 100644
--- a/src/mapWalker.js
+++ b/src/mapWalker.js
@@ -88,7 +88,9 @@ const MapWalker = new Lang.Class({
     },
 
     goTo: function(animate, linear) {
-        Utils.debug('Going to ' + this.place.name);
+        Utils.debug('Going to ' + [this.place.name,
+                    this.place.location.latitude,
+                    this.place.location.longitude].join(' '));
         this._mapView.emit('going-to');
 
         if (!animate) {
@@ -117,20 +119,21 @@ const MapWalker = new Lang.Class({
              * location.
              */
             this._view.goto_animation_mode = Clutter.AnimationMode.EASE_IN_CUBIC;
+            this._ensureVisible(fromLocation);
 
             Utils.once(this._view, 'animation-completed', (function() {
+                this._view.goto_animation_mode = Clutter.AnimationMode.EASE_OUT_CUBIC;
+                this._view.go_to(this.place.location.latitude,
+                                 this.place.location.longitude);
+
                 Utils.once(this._view, 'animation-completed::go-to', (function() {
                     this.zoomToFit();
                     this._view.goto_animation_mode = Clutter.AnimationMode.EASE_IN_OUT_CUBIC;
                     this.emit('gone-to');
                 }).bind(this));
 
-                this._view.goto_animation_mode = Clutter.AnimationMode.EASE_OUT_CUBIC;
-                this._view.go_to(this.place.location.latitude,
-                                 this.place.location.longitude);
             }).bind(this));
 
-            this._ensureVisible(fromLocation);
         }
     },
 


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