Author: reebalazs
Date: Mon May 14 18:50:09 2007
New Revision: 43377

Modified:
   
kukit/azax/branch/1.1-ree-plugin-dad/plugins/draganddrop/browser/kss_dragdrop.js
Log:
Attempt to fix the relative position of the droppable element during the drop

Modified: 
kukit/azax/branch/1.1-ree-plugin-dad/plugins/draganddrop/browser/kss_dragdrop.js
==============================================================================
--- 
kukit/azax/branch/1.1-ree-plugin-dad/plugins/draganddrop/browser/kss_dragdrop.js
    (original)
+++ 
kukit/azax/branch/1.1-ree-plugin-dad/plugins/draganddrop/browser/kss_dragdrop.js
    Mon May 14 18:50:09 2007
@@ -55,7 +55,7 @@
             }
             if (new_active) {
                 this.activate(new_active);
-                if(new_active.onHover) {
+            if(new_active.onHover) {
                     Position.within(new_active.element, point[0], point[1]);
                     new_active.onHover(element, new_active.element, 
Position.overlap(new_active.overlap, new_active.element));
                 }
@@ -66,6 +66,8 @@
     kukit.draganddrop.initDroppables = function() {};
 };
 
+/* the event binder */
+
 kukit.draganddrop.DragAndDropEvent = function() {
     kukit.draganddrop.initDroppables();
     this.dragparms = {};
@@ -147,11 +149,24 @@
         if (oper.hasExecuteActions()) {
             var f = oper.makeExecuteActionsHook();
             var self = this;
-            options.onDrop = function(element, last_active, evt) {
-                Position.absolutize(element);
-                f({browserevent: evt, defaultparms: self.dragparms});
-                Position.relativize(element);
-            };
+            if (oper.parms.resumeposition) {
+                options.onDrop = function(element, last_active, evt) {
+                    // This solution is not the best, there is a short blink
+                    // of the element, I believe
+                    var drag = self.dragparms.drag;
+                    var pos1 = Position.cumulativeOffset(drag);
+                    f({browserevent: evt, defaultparms: self.dragparms});
+                    var pos2 = Position.cumulativeOffset(drag);
+                    var delta = [parseInt(Element.getStyle(drag,'left') || 
'0'),
+                                 parseInt(Element.getStyle(drag,'top') || 
'0')];
+                    drag.style.left = (delta[0] + pos1[0] - pos2[0]) + 'px';
+                    drag.style.top = (delta[1] + pos1[1] - pos2[1]) + 'px';
+                };
+            } else {
+                options.onDrop = function(element, last_active, evt) {
+                    f({browserevent: evt, defaultparms: self.dragparms});
+                };
+            }
         }
     }
     // make node a landing zone
_______________________________________________
Kukit-checkins mailing list
[email protected]
http://codespeak.net/mailman/listinfo/kukit-checkins

Reply via email to