Author: jmorliaguet
Date: Mon Mar 13 22:39:26 2006
New Revision: 2636

Modified:
   cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js
   
cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_dragdrop_test.html
Log:

- UI improvements when dropping objects



Modified: cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js
==============================================================================
--- cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js (original)
+++ cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js Mon Mar 13 
22:39:26 2006
@@ -743,13 +743,18 @@
         var target = el;
       }
       el.parentNode.insertBefore(this.dragged, target);
+      this.target = this.target;
     }
 
     var container = this.def.dragging.container;
     if (container && el.hasClassName(container)) {
       el.appendChild(this.dragged);
+      this.target = this.dragged;
     }
 
+    if (this.def.dragging.feedback) {
+      this.moved.setStyle({'width': this.target.getStyle('width')});
+    }
     Event.stop(e);
   },
 
@@ -765,23 +770,21 @@
       if (Position.within(d, x, y)) { inTarget = true; }
     });
 
-    var revert = this.def.dragging.revert;
+    var zoomback = this.def.dragging.zoomback;
     if (inTarget) {
-      revert = false;
+      zoomback = false;
       /* TODO: handle action */
-      alert('NotImplemented');
+      alert('Not Implemented');
     }
 
     if (this.def.dragging.feedback) {
-      if (revert) {
+      if (zoomback) {
         this.moved.moveTo({
           'x': this.x0,
           'y': this.y0,
-          'duration': revert.duration || 400,
+          'duration': zoomback.duration || 400,
           'onComplete': function() { this.parentNode.removeChild(this); }
         });
-      } else {
-        this.moved.parentNode.removeChild(this.moved);
       }
     }
 
@@ -794,7 +797,22 @@
           );
         });
       }
+      var zoomto = this.def.dropping.zoomto;
+      if (zoomto) {
+        var pos = Position.cumulativeOffset(this.target);
+        this.moved.moveTo({
+          'x': pos[0],
+          'y': pos[1],
+          'duration': zoomto.duration || 400,
+          'onComplete': function() { this.parentNode.removeChild(this); }
+        });
+      }
     }
+
+    if (!zoomback && !zoomto) {
+      this.moved.parentNode.removeChild(this.moved);
+    }
+
     this.dragged.setOpacity(1);
     Event.stop(e);
   }

Modified: 
cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_dragdrop_test.html
==============================================================================
--- 
cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_dragdrop_test.html
        (original)
+++ 
cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_dragdrop_test.html
        Mon Mar 13 22:39:26 2006
@@ -79,7 +79,7 @@
        "opacity": 0.8,
        "clone": true
      },
-     "revert": {
+     "zoomback": {
        "duration": 500
      }
    },
@@ -104,7 +104,6 @@
        "border": "#000",
        "background": "#ff0"
      }
-   }
   }}
   </ins>
 
@@ -139,6 +138,9 @@
      }
    },
    "dropping": {
+     "zoomto": {
+       "duration": 200
+     }
    }
   }}
   </ins>
-- 
http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins

Reply via email to