[gnome-shell] overviewControls: Move translation-x to SlideLayout



commit 88393f0f651a20570b66f7ea2339b5f8f0a3f2bc
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Wed Sep 18 19:59:02 2013 -0400

    overviewControls: Move translation-x to SlideLayout
    
    Not because ClutterActor is bad or wrong, but because I always get
    confused on the difference, and having them both in SlideLayout
    makes the code a bit easier to read and understand.

 js/ui/overviewControls.js |   29 +++++++++++++++++++----------
 1 files changed, 19 insertions(+), 10 deletions(-)
---
diff --git a/js/ui/overviewControls.js b/js/ui/overviewControls.js
index a1d99e6..1a06457 100644
--- a/js/ui/overviewControls.js
+++ b/js/ui/overviewControls.js
@@ -36,6 +36,7 @@ const SlideLayout = new Lang.Class({
 
     _init: function(params) {
         this._slideX = 1;
+        this._translationX = 0;
         this._direction = SlideDirection.LEFT;
 
         this.parent(params);
@@ -66,7 +67,7 @@ const SlideLayout = new Lang.Class({
         let alignX = (realDirection == SlideDirection.LEFT) ? (availWidth - natWidth) : 0;
 
         let actorBox = new Clutter.ActorBox();
-        actorBox.x1 = box.x1 + alignX;
+        actorBox.x1 = box.x1 + alignX + this._translationX;
         actorBox.x2 = actorBox.x1 + availWidth;
         actorBox.y1 = box.y1;
         actorBox.y2 = actorBox.y1 + availHeight;
@@ -90,7 +91,16 @@ const SlideLayout = new Lang.Class({
 
     get slideDirection() {
         return this._direction;
-    }
+    },
+
+    set translationX(value) {
+        this._translationX = value;
+        this.layout_changed();
+    },
+
+    get translationX() {
+        return this._translationX;
+    },
 });
 
 const SlidingControl = new Lang.Class({
@@ -158,20 +168,19 @@ const SlidingControl = new Lang.Class({
             translationEnd = translation;
         }
 
-        if (this.actor.translation_x == translationEnd)
+        if (this.layout.translationX == translationEnd)
             return;
 
-        this.actor.translation_x = translationStart;
-        Tweener.addTween(this.actor, { translation_x: translationEnd,
-                                       time: SIDE_CONTROLS_ANIMATION_TIME,
-                                       transition: 'easeOutQuad'
-                                     });
+        this.layout.translationX = translationStart;
+        Tweener.addTween(this.layout, { translationX: translationEnd,
+                                        time: SIDE_CONTROLS_ANIMATION_TIME,
+                                        transition: 'easeOutQuad' });
     },
 
     _onOverviewShowing: function() {
         this._visible = true;
         this.layout.slideX = this._getSlide();
-        this.actor.translation_x = this._getTranslation();
+        this.layout.translationX = this._getTranslation();
         this.slideIn();
     },
 
@@ -189,7 +198,7 @@ const SlidingControl = new Lang.Class({
 
     _onDragBegin: function() {
         this._inDrag = true;
-        this.actor.translation_x = 0;
+        this.layout.translationX = 0;
         this._updateSlide();
     },
 


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