ドラッグの初期化方法を変更する独自のウィンドウ クラスを作成することもできます。ここでは、必要なことを正確に実行するウィンドウ クラスを定義しました。
Ext.define("MyCustomWindowClass", {
extend: "Ext.window.Window",
initDraggable: function() {
var me = this,
ddConfig;
if (!me.header) {
me.updateHeader(true);
}
/*
* Check the header here again. If for whatever reason it wasn't created in
* updateHeader (we were configured with header: false) then we'll just ignore the rest since the
* header acts as the drag handle.
*/
//if (me.header) {
ddConfig = Ext.applyIf({
el: me.el//,-Reimius, I commented out the next line that delegates the dragger to the header of the window
//delegate: '#' + Ext.escapeId(me.header.id)
}, me.draggable);
// Add extra configs if Window is specified to be constrained
/*if (me.constrain || me.constrainHeader) {
ddConfig.constrain = me.constrain;
ddConfig.constrainDelegate = me.constrainHeader;
ddConfig.constrainTo = me.constrainTo || me.container;
}*/
/**
* @property {Ext.util.ComponentDragger} dd
* If this Window is configured {@link #cfg-draggable}, this property will contain an instance of
* {@link Ext.util.ComponentDragger} (A subclass of {@link Ext.dd.DragTracker DragTracker}) which handles dragging
* the Window's DOM Element, and constraining according to the {@link #constrain} and {@link #constrainHeader} .
*
* This has implementations of `onBeforeStart`, `onDrag` and `onEnd` which perform the dragging action. If
* extra logic is needed at these points, use {@link Ext.Function#createInterceptor createInterceptor} or
* {@link Ext.Function#createSequence createSequence} to augment the existing implementations.
*/
me.dd = new Ext.util.ComponentDragger(this, ddConfig);
me.relayEvents(me.dd, ['dragstart', 'drag', 'dragend']);
//}
}
});