[gnome-shell] popupMenu: Force submenu arrow rotation angles to multiples of 90



commit dc5618558f9a7cad940db8705792b3f033998e8e
Author: Hashem Nasarat <hashem riseup net>
Date:   Fri Apr 25 01:09:39 2014 -0400

    popupMenu: Force submenu arrow rotation angles to multiples of 90
    
    When you open or close a PopupSubMenu the arrow icon rotates, but
    the code previously assumed that the starting angle was a multiple
    of 90.  If you click the submenu fast enough the rotation could overlap
    with the previous rotation and you'd get something that wasn't a multiple
    of 90.
    Now we ensure that the ending arrowRotation angle is always a multiple
    of 90 regardless of what the starting angle is.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=728927

 js/ui/popupMenu.js |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/js/ui/popupMenu.js b/js/ui/popupMenu.js
index 1694e0a..be8bbe9 100644
--- a/js/ui/popupMenu.js
+++ b/js/ui/popupMenu.js
@@ -922,8 +922,10 @@ const PopupSubMenu = new Lang.Class({
             let [minHeight, naturalHeight] = this.actor.get_preferred_height(-1);
             this.actor.height = 0;
             this.actor._arrowRotation = this._arrow.rotation_angle_z;
+            let angle = this.actor._arrowRotation;
+            // animate to the first multiple of 90 greater than current angle
             Tweener.addTween(this.actor,
-                             { _arrowRotation: this.actor._arrowRotation + 90,
+                             { _arrowRotation: angle - angle % 90 + 90,
                                height: naturalHeight,
                                time: 0.25,
                                onUpdateScope: this,
@@ -955,8 +957,10 @@ const PopupSubMenu = new Lang.Class({
 
         if (animate) {
             this.actor._arrowRotation = this._arrow.rotation_angle_z;
+            let angle = this.actor._arrowRotation;
+            // animate to the first multiple of 90 less than current angle
             Tweener.addTween(this.actor,
-                             { _arrowRotation: this.actor._arrowRotation - 90,
+                             { _arrowRotation: (angle - 1) - (angle - 1) % 90,
                                height: 0,
                                time: 0.25,
                                onUpdateScope: this,


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