[gnome-shell/wip/re-search-v2: 23/33] dash: Add show/hide methods



commit a0c29e85b60fb1d96e835e461111b05eedd8b533
Author: Tanner Doshier <doshitan gmail com>
Date:   Thu Aug 16 19:59:07 2012 -0500

    dash: Add show/hide methods
    
    https://bugzilla.gnome.org/show_bug.cgi?id=682050

 js/ui/dash.js |   36 ++++++++++++++++++++++++++++++++++++
 1 files changed, 36 insertions(+), 0 deletions(-)
---
diff --git a/js/ui/dash.js b/js/ui/dash.js
index 3bd3766..3595a60 100644
--- a/js/ui/dash.js
+++ b/js/ui/dash.js
@@ -421,6 +421,8 @@ const Dash = new Lang.Class({
                               Lang.bind(this, this._onDragCancelled));
         Main.overview.connect('window-drag-end',
                               Lang.bind(this, this._onDragEnd));
+        Main.overview.connect('showing',
+                              Lang.bind(this, this._onOverviewShowing));
     },
 
     _onDragBegin: function() {
@@ -923,6 +925,40 @@ const Dash = new Lang.Class({
             }));
 
         return true;
+    },
+
+    _computeTranslation: function() {
+        let rtl = (this.actor.get_text_direction() == Clutter.TextDirection.RTL);
+
+        if (rtl)
+            return this.actor.width;
+        else
+            return - this.actor.width;
+    },
+
+    _onOverviewShowing: function() {
+        // reset any translation and make sure the actor is visible when
+        // entering the overview
+        this.actor.translation_x = 0;
+        this.actor.show();
+    },
+
+    show: function() {
+        Tweener.addTween(this.actor, { translation_x: 0,
+                                       transition: 'easeOutQuad',
+                                       time: DASH_ANIMATION_TIME
+                                     });
+    },
+
+    hide: function() {
+        let hiddenX = this._computeTranslation();
+        Tweener.addTween(this.actor, { translation_x: hiddenX,
+                                       transition: 'easeOutQuad',
+                                       time: DASH_ANIMATION_TIME,
+                                       onComplete: function() {
+                                       },
+                                       onCompleteScope: this
+                                     });
     }
 });
 



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