(function() {
var util = YAHOO.util,lang = YAHOO.lang, Dom = util.Dom;
/**
* Module Proxy handle the drag/dropping from the module list to the layer (in the WiringEditor)
* @class ModuleProxy
* @constructor
* @param {HTMLElement} el
* @param {WireIt.WiringEditor} WiringEditor
*/
WireIt.ModuleProxy = function(el, WiringEditor) {
this._WiringEditor = WiringEditor;
// Init the DDProxy
WireIt.ModuleProxy.superclass.constructor.call(this,el, "module", {
dragElId: "moduleProxy"
});
this.isTarget = false;
};
lang.extend(WireIt.ModuleProxy,YAHOO.util.DDProxy, {
/**
* copy the html and apply selected classes
* @method startDrag
*/
startDrag: function(e) {
WireIt.ModuleProxy.superclass.startDrag.call(this,e);
var del = this.getDragEl(),
lel = this.getEl();
del.innerHTML = lel.innerHTML;
del.className = lel.className;
},
/**
* Override default behavior of DDProxy
* @method endDrag
*/
endDrag: function(e) {},
/**
* Add the module to the WiringEditor on drop on layer
* @method onDragDrop
*/
onDragDrop: function(e, ddTargets) {
// The layer is the only target :
var layerTarget = ddTargets[0],
layer = ddTargets[0]._layer,
del = this.getDragEl(),
pos = Dom.getXY(del),
layerPos = Dom.getXY(layer.el);
this._WiringEditor.addModule( this._module ,[pos[0]-layerPos[0]+layer.el.scrollLeft, pos[1]-layerPos[1]+layer.el.scrollTop]);
}
});
})();
# |
Change |
User |
Description |
Committed |
|
#1
|
16445 |
christiane_renck |
Rename/move file(s) |
|
|
//guest/christiane_renck/MergeQuestJS/main/demos/WireIt/plugins/editor/js/ModuleProxy.js |
#1
|
16444 |
christiane_renck |
Adding MergeQuestJS to the Workshop. |
|
|