jmariani
15 Apr 2010, 8:51 PM
More a work in progress and proof of concept than a final product.
It adds 'slideIn' and 'slideOut' effect to panels, like OSX does.
Consider it very primitive, but good starting point.
Congrats to Animal & Sean McDaniel for providing the initial code & ideas. And to Ext team for providing us Ext. And Saki for providing so great tutorials.
Try it and share your comments.
Here's the code:
// create namespace for plugins
Ext.namespace('Ext.ux.plugins');
/**
*
* @author Jorge Mariani
* @date April 15, 2010
*
* @class Ext.ux.plugins.blind
* @extends Ext.util.Observable
*
* Config options for panel:
*
* modal: if set to true, will mask the page (Same as a modal window)
* slideFrom: Element to align the panel to and start the animation. If not set, Ext.getBody() will be used.
*
* Function added:
*
* dismiss: Call this to slideOut the panel.
*/
Ext.ux.plugins.blind = function(config) {
Ext.apply(this, config);
};
// plugin code
Ext.extend(Ext.ux.plugins.blind, Ext.util.Observable, {
init:function(panel) {
Ext.apply(panel, {
show: panel.show.createSequence(function(){
if (!panel.rendered) {
this.render(Ext.getBody());
}
if (panel.modal) {
// var mask = Ext.getBody().mask();
var mask = Ext.get(document.body).mask();
panel.el.position('fixed', Number(mask.getStyle('z-index')) + 1);
}
if (panel.slideFrom) {
panel.el.alignTo(this.slideFrom, 't-t');
} else {
panel.el.alignTo(Ext.getBody(), 't-t');
}
panel.el.slideIn('t', {
callback: function() {
panel.el.visible = true; // Ext bug. Flag not set causes enableShadow to fail.
},
scope: this
});
})
, dismiss: function(){
panel.el.slideOut('t', {
callback: function() {
panel.destroy();
// Ext.getBody().unmask();
if (panel.modal) {
Ext.get(document.body).unmask();
}
},
scope: this
});
}
});
} // end of function init
}); // end of extend
Ext.preg('blind', Ext.ux.plugins.blind);
// end of file
It adds 'slideIn' and 'slideOut' effect to panels, like OSX does.
Consider it very primitive, but good starting point.
Congrats to Animal & Sean McDaniel for providing the initial code & ideas. And to Ext team for providing us Ext. And Saki for providing so great tutorials.
Try it and share your comments.
Here's the code:
// create namespace for plugins
Ext.namespace('Ext.ux.plugins');
/**
*
* @author Jorge Mariani
* @date April 15, 2010
*
* @class Ext.ux.plugins.blind
* @extends Ext.util.Observable
*
* Config options for panel:
*
* modal: if set to true, will mask the page (Same as a modal window)
* slideFrom: Element to align the panel to and start the animation. If not set, Ext.getBody() will be used.
*
* Function added:
*
* dismiss: Call this to slideOut the panel.
*/
Ext.ux.plugins.blind = function(config) {
Ext.apply(this, config);
};
// plugin code
Ext.extend(Ext.ux.plugins.blind, Ext.util.Observable, {
init:function(panel) {
Ext.apply(panel, {
show: panel.show.createSequence(function(){
if (!panel.rendered) {
this.render(Ext.getBody());
}
if (panel.modal) {
// var mask = Ext.getBody().mask();
var mask = Ext.get(document.body).mask();
panel.el.position('fixed', Number(mask.getStyle('z-index')) + 1);
}
if (panel.slideFrom) {
panel.el.alignTo(this.slideFrom, 't-t');
} else {
panel.el.alignTo(Ext.getBody(), 't-t');
}
panel.el.slideIn('t', {
callback: function() {
panel.el.visible = true; // Ext bug. Flag not set causes enableShadow to fail.
},
scope: this
});
})
, dismiss: function(){
panel.el.slideOut('t', {
callback: function() {
panel.destroy();
// Ext.getBody().unmask();
if (panel.modal) {
Ext.get(document.body).unmask();
}
},
scope: this
});
}
});
} // end of function init
}); // end of extend
Ext.preg('blind', Ext.ux.plugins.blind);
// end of file