Author: jmorliaguet Date: Thu Mar 9 21:21:43 2006 New Revision: 2563 Modified: cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js Log:
- drag-and-drop: added ghosting effect as in scriptaculous 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 Thu Mar 9 21:21:43 2006 @@ -635,12 +635,25 @@ dragEvent: function(e) { var draggable = this._findDraggable(e); - var pos = Position.page(draggable); + if (!draggable) { + return + } + if (this.def.ghosting) { + var clone = $(draggable.cloneNode(true)); + clone.setStyle( + {'z-index': parseInt(draggable.getStyle('z-index') || 0) +1} + ); + CPSSkins.Canvas.setOpacity(clone, 0.5); + draggable.parentNode.insertBefore(clone, draggable); + this.moved = clone; + } else { + this.moved = draggable; + } + var pos = Position.page(this.moved); this.x0 = Event.pointerX(e) - pos[0]; this.y0 = Event.pointerY(e) - pos[1]; Event.observe(document, "mousemove", this.moveEvent); Event.observe(document, "mouseup", this.dropEvent); - this.moved = draggable; }, moveEvent: function(e) { @@ -661,6 +674,9 @@ if (Position.within(d, x, y)) { inTarget = true; } }); + if (this.def.ghosting) { + this.moved.parentNode.removeChild(this.moved); + } if (inTarget) { /* TODO: handle action */ } -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins