dd-proxy.js revision 489504a37b99aa0273fca2d41ae36da3356233cf
/**
* Plugin for dd-drag for creating a proxy drag node, instead of dragging the original node.
* @module dd
* @submodule dd-proxy
*/
/**
* Plugin for dd-drag for creating a proxy drag node, instead of dragging the original node.
* @class DDProxy
* @extends Base
* @constructor
* @namespace Plugin
*/
NODE = 'node',
DRAG_NODE = 'dragNode',
HOST = 'host',
P = function(config) {
};
P.NAME = 'DDProxy';
/**
* @property NS
* @default con
* @readonly
* @protected
* @static
* @description The Proxy instance will be placed on the Drag instance under the proxy namespace.
* @type {String}
*/
P.NS = 'proxy';
P.ATTRS = {
host: {
},
/**
* @attribute moveOnEnd
* @description Move the original node at the end of the drag. Default: true
* @type Boolean
*/
moveOnEnd: {
},
/**
* @attribute hideOnEnd
* @description Hide the drag node at the end of the drag. Default: true
* @type Boolean
*/
hideOnEnd: {
},
/**
* @attribute resizeFrame
* @description Make the Proxy node assume the size of the original node. Default: true
* @type Boolean
*/
resizeFrame: {
},
/**
* @attribute positionProxy
* @description Make the Proxy node appear in the same place as the original node. Default: true
* @type Boolean
*/
},
/**
* @attribute borderStyle
* @description The default border style for the border of the proxy. Default: 1px solid #808080
* @type Boolean
*/
borderStyle: {
value: '1px solid #808080'
},
/**
* @attribute cloneNode
* @description Should the node be cloned into the proxy for you. Default: false
* @type Boolean
*/
cloneNode: {
value: false
}
};
proto = {
/**
* @private
* @property _hands
* @description Holds the event handles for setting the proxy
*/
_hands: null,
/**
* @private
* @method _init
* @description Handler for the proxy config attribute
*/
_init: function() {
DDM._createFrame();
return;
}
if (!this._hands) {
this._hands = [];
}
}
}
v.detach();
});
}
}, this));
if (this.get('moveOnEnd')) {
}
if (this.get('hideOnEnd')) {
}
if (this.get('cloneNode')) {
}
}
}, this));
},
initializer: function() {
this._init();
},
destructor: function() {
v.detach();
});
},
clone: function() {
c = n.cloneNode(true);
delete c._yuid;
return c;
}
};
Y.namespace('Plugin');
//Add a couple of methods to the DDM
/**
* @private
* @for DDM
* @namespace DD
* @method _createFrame
* @description Create the proxy element if it doesn't already exist and set the DD.DDM._proxy value
*/
_createFrame: function() {
b = Y.one('body');
p.setStyles({
position: 'absolute',
display: 'none',
zIndex: '999',
top: '-999px',
left: '-999px'
});
b.prepend(p);
}
},
/**
* @private
* @for DDM
* @namespace DD
* @method _setFrame
* @description If resizeProxy is set to true (default) it will resize the proxy element to match the size of the Drag Element.
* If positionProxy is set to true (default) it will position the proxy element in the same location as the Drag Element.
*/
if (ah) {
}
if (cur == 'auto') {
}
d.setStyles({
visibility: 'hidden',
display: 'block',
});
}
d.setStyles({
});
}
}
}
});
//Create the frame when DOM is ready
//Y.on('domready', Y.bind(DDM._createFrame, DDM));