Thank you for reporting this bug. We will make it our priority to review this report.
Constrained drag throwing an error on drag start
Constrained drag throwing an error on drag start
Hello Sencha Team,
Just wanted to draw your attention to the thing I discovered today.
It appears that whenever you make your component draggable and try to add a constraint to the drag at runtime, ExtJS will throw an error while invoking calculateConstrainRegion method on drag start:
Code:
calculateConstrainRegion: function() {
var me = this,
comp = me.comp,
constrainTo = me.initialConstrainTo, //here is why the error is thrown
constraintInsets = comp.constraintInsets,
constrainEl,
delegateRegion,
elRegion,
dragEl = me.proxy ? me.proxy.el : comp.el,
shadowSize = (!me.constrainDelegate && dragEl.shadow && comp.constrainShadow && !dragEl.shadowDisabled) ? dragEl.shadow.getShadowSize() : 0;
if (!(constrainTo instanceof Ext.util.Region)) {
constrainEl = Ext.fly(constrainTo);
constrainTo = constrainEl.getViewRegion(); //here is where the error is thrown
constrainTo.right = constrainTo.left + constrainEl.dom.clientWidth;
} else {
constrainTo = constrainTo.copy();
}
if (constraintInsets) {
constraintInsets = Ext.isObject(constraintInsets) ? constraintInsets : Ext.Element.parseBox(constraintInsets);
constrainTo.adjust(constraintInsets.top, constraintInsets.right, constraintInsets.bottom, constraintInsets.length);
}
if (shadowSize) {
constrainTo.adjust(shadowSize[0], -shadowSize[1], -shadowSize[2], shadowSize[3]);
}
if (!me.constrainDelegate) {
delegateRegion = Ext.fly(me.dragTarget).getRegion();
elRegion = dragEl.getRegion();
constrainTo.adjust(
delegateRegion.top - elRegion.top,
delegateRegion.right - elRegion.right,
delegateRegion.bottom - elRegion.bottom,
delegateRegion.left - elRegion.left
);
}
return constrainTo;
}
(not)Working example:
Constrained drag throwing an error on drag start
Aucun commentaire:
Enregistrer un commentaire