[the-board] [ui] Thing doesn't need Page for dragging operation anymore



commit d599809b322d0934791380fcc3108f2d0064afe4
Author: Lucas Rocha <lucasr gnome org>
Date:   Thu Jan 13 21:50:34 2011 +0000

    [ui] Thing doesn't need Page for dragging operation anymore

 src/js/ui/page.js  |    3 +--
 src/js/ui/thing.js |   26 +++-----------------------
 2 files changed, 4 insertions(+), 25 deletions(-)
---
diff --git a/src/js/ui/page.js b/src/js/ui/page.js
index 78deadd..870298e 100644
--- a/src/js/ui/page.js
+++ b/src/js/ui/page.js
@@ -588,8 +588,7 @@ Page.prototype = {
 
         let thingId = state.id;
 
-        let args = { parentActor: this._mainBox,
-                     context: this._context };
+        let args = { context: this._context };
 
         let thing = Thing.createThingFromId(thingId, args);
         thing.onLoadState(state);
diff --git a/src/js/ui/thing.js b/src/js/ui/thing.js
index ac81684..c783a50 100644
--- a/src/js/ui/thing.js
+++ b/src/js/ui/thing.js
@@ -36,12 +36,6 @@ Thing.prototype = {
     _init : function(args) {
         args = args || {};
 
-        if ('parentActor' in args) {
-            this._parentActor = args.parentActor;
-        } else {
-            throw new Error("Thing parentActor is required");
-        }
-
         if ('context' in args) {
             this._context = args.context;
         } else {
@@ -201,19 +195,7 @@ Thing.prototype = {
                                             Tb.BoxAlignment.END);
     },
 
-    _updatePosition : function(newX, newY, fromState) {
-        if (!fromState) {
-            newX = MathUtil.clamp(newX,
-                                  0,
-                                  this._parentActor.width -
-                                  this._mainBox.width);
-
-            newY = MathUtil.clamp(newY,
-                                  0,
-                                  this._parentActor.height -
-                                  this._mainBox.height);
-        }
-
+    _updatePosition : function(newX, newY) {
         this._mainBox.x = newX;
         this._mainBox.y = newY;
     },
@@ -416,8 +398,7 @@ Thing.prototype = {
         }
 
         if ('x' in state && 'y' in state) {
-            this._updatePosition(state.x, state.y,
-                                 true /* from state */);
+            this._updatePosition(state.x, state.y);
         }
 
         this._link = state.link || null;
@@ -456,8 +437,7 @@ Thing.prototype = {
     },
 
     setPosition : function(x, y) {
-        this._updatePosition(x, y,
-                             false /* not from state */);
+        this._updatePosition(x, y);
     },
 
     setSize : function(width, height) {



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