This causes some interesting effects - e.g. menus don't disappear when they should.
Here's the setVisible method in Ext.dom.Layer:
Code:
Ext.define('Ext.dom.Layer', {
extend: 'Ext.Element',
...
// overridden Element method
setVisible: function(visible, animate, duration, callback, easing) {
var me = this,
cb;
// post operation processing
cb = function() {
if (visible) {
me.sync(true);
}
if (callback) {
callback();
}
};
// Hide shadow and shim if hiding
if (!visible) {
me.hideUnders(true);
}
me.callParent([visible, animate, duration, callback, easing]);
if (!animate) {
cb();
}
return me;
},
...
});
and here's the corresponding method in the (uncompressed) collated 'app.js' file after building:
Code:
(Ext.cmd.derive('Ext.dom.Layer', Ext.Element, {alternateClassName: 'Ext.Layer', statics: {shims: []}, isLayer: true, localXYNames: {get: 'getLocalXY', set: 'setLocalXY'}, constructor: function(config, existingEl) {
...
setVisible: function(visible, animate, duration, callback, easing) {
var me = this, cb;
cb = function() {
if (visible)
{
me.sync(true);
}
if (callback)
{
callback();
}
};
if (!visible)
{
me.hideUnders(true);
}
Ext.dom.AbstractElement.prototype.setVisible.apply(this, [visible, animate, duration, callback, easing]);
if (!animate)
{
cb();
}
return me;
}
...
}}, 1, 0, 0, 0, 0, 0, [Ext.dom, 'Layer', Ext, 'Layer'], 0));
;
As can be seen, the call to the parent's setVisible is replaced with a call to the setVisible of AbstractElement.
As for a possible cause of this behaviour:
* Ext.dom.Layer extends from Ext.dom.Element, which extends from Ext.dom.AbstractElement.
* Ext.dom.AbstractElement does have a 'setVisible' method.
* Ext.dom.Element does not have a 'setVisible' method (directly)
* Ext.dom.Element includes an override - Element_fx.js - which _does_ provide a 'setVisible' method.
When the packaging system replaces the 'this.callParent' method with a direct call, it doesn't appear to take into account the override.
This is with ExtJs 4.2.1 and Sencha Cmd 5.
A sample project is attached (with packaged javascript, but nothing else). When run in dev mode, you can open and close menus normally. When run out of the packaged application, menus do not hide themselves properly on close.
Aucun commentaire:
Enregistrer un commentaire