Use Element.Layout to calculate the ghost size.
authorJan Schneider <jan@horde.org>
Tue, 20 Apr 2010 16:47:45 +0000 (18:47 +0200)
committerJan Schneider <jan@horde.org>
Tue, 20 Apr 2010 16:47:45 +0000 (18:47 +0200)
horde/js/dragdrop2.js

index 7a83fa5..3738539 100644 (file)
@@ -324,7 +324,12 @@ Drag = Class.create({
             if (!this.ghost) {
                 // Create the "ghost", i.e. the moving element, a clone of the
                 // original element, if it doesn't exist yet.
-                this.ghost = $(this.element.cloneNode(true)).writeAttribute('id', null).addClassName(this.options.classname).clonePosition(this.element, { setHeight: false, setWidth: false }).setStyle({ height: this.element.clientHeight + 'px', position: 'absolute', width: this.element.clientWidth + 'px' });
+                var layout = this.element.getLayout();
+                this.ghost = $(this.element.cloneNode(true))
+                    .writeAttribute('id', null)
+                    .addClassName(this.options.classname)
+                    .clonePosition(this.element, { setHeight: false, setWidth: false })
+                    .setStyle({ position: 'absolute', height: layout.get('height') + 'px', width: layout.get('width') + 'px' });
 
                 // eo is the offset of the original element to the body.
                 eo = this.element.cumulativeOffset();