<!DOCTYPE html>
|
<html>
|
<head>
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
<title>The source code</title>
|
<link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
|
<script type="text/javascript" src="../resources/prettify/prettify.js"></script>
|
<style type="text/css">
|
.highlight { display: block; background-color: #ddd; }
|
</style>
|
<script type="text/javascript">
|
function highlight() {
|
document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
|
}
|
</script>
|
</head>
|
<body onload="prettyPrint(); highlight();">
|
<pre class="prettyprint lang-js"><span id='Ext-panel-DD'>/**
|
</span> * DD implementation for Panels.
|
* @private
|
*/
|
Ext.define('Ext.panel.DD', {
|
extend: 'Ext.dd.DragSource',
|
requires: ['Ext.panel.Proxy'],
|
|
<span id='Ext-panel-DD-method-constructor'> constructor : function(panel, cfg){
|
</span> var me = this;
|
|
me.panel = panel;
|
me.dragData = {panel: panel};
|
me.panelProxy = new Ext.panel.Proxy(panel, cfg);
|
me.proxy = me.panelProxy.proxy;
|
|
me.callParent([panel.el, cfg]);
|
me.setupEl(panel);
|
},
|
|
<span id='Ext-panel-DD-method-setupEl'> setupEl: function(panel){
|
</span> var me = this,
|
header = panel.header,
|
el = panel.body;
|
|
if (header) {
|
me.setHandleElId(header.id);
|
el = header.el;
|
}
|
if (el) {
|
el.setStyle('cursor', 'move');
|
me.scroll = false;
|
} else {
|
// boxready fires after first layout, so we'll definitely be rendered
|
panel.on('boxready', me.setupEl, me, {single: true});
|
}
|
},
|
|
<span id='Ext-panel-DD-method-showFrame'> showFrame: Ext.emptyFn,
|
</span><span id='Ext-panel-DD-method-startDrag'> startDrag: Ext.emptyFn,
|
</span>
|
<span id='Ext-panel-DD-method-b4StartDrag'> b4StartDrag: function(x, y) {
|
</span> this.panelProxy.show();
|
},
|
|
<span id='Ext-panel-DD-method-b4MouseDown'> b4MouseDown: function(e) {
|
</span> var x = e.getPageX(),
|
y = e.getPageY();
|
|
this.autoOffset(x, y);
|
},
|
|
<span id='Ext-panel-DD-method-onInitDrag'> onInitDrag : function(x, y){
|
</span> this.onStartDrag(x, y);
|
return true;
|
},
|
|
<span id='Ext-panel-DD-method-createFrame'> createFrame : Ext.emptyFn,
|
</span>
|
<span id='Ext-panel-DD-method-getDragEl'> getDragEl : function(e){
|
</span> var ghost = this.panelProxy.ghost;
|
if (ghost) {
|
return ghost.el.dom;
|
}
|
},
|
|
<span id='Ext-panel-DD-method-endDrag'> endDrag : function(e){
|
</span> this.panelProxy.hide();
|
this.panel.saveState();
|
},
|
|
<span id='Ext-panel-DD-method-autoOffset'> autoOffset : function(x, y) {
|
</span> x -= this.startPageX;
|
y -= this.startPageY;
|
this.setDelta(x, y);
|
},
|
|
<span id='Ext-panel-DD-method-onInvalidDrop'> // Override this, we don't want to repair on an "invalid" drop, the panel
|
</span> // should main it's position
|
onInvalidDrop: function(target, e, id) {
|
var me = this;
|
|
if (me.beforeInvalidDrop(target, e, id) !== false) {
|
if (me.cachedTarget) {
|
if(me.cachedTarget.isNotifyTarget){
|
me.cachedTarget.notifyOut(me, e, me.dragData);
|
}
|
me.cacheTarget = null;
|
}
|
|
if (me.afterInvalidDrop) {
|
<span id='Ext-panel-DD-method-afterInvalidDrop'> /**
|
</span> * An empty function by default, but provided so that you can perform a custom action
|
* after an invalid drop has occurred by providing an implementation.
|
* @param {Event} e The event object
|
* @param {String} id The id of the dropped element
|
* @method afterInvalidDrop
|
*/
|
me.afterInvalidDrop(e, id);
|
}
|
}
|
}
|
});</pre>
|
</body>
|
</html>
|