PDA

View Full Version : Hide and Show Animation is in documentation but missing from code!



mindstuff
31 Dec 2010, 12:14 AM
I've spend countless hours reading the docs to find out that the reason that some features of Sencha touch just don't work are mainly because the features are actually not implemented in the code. At version 1.0.x I'd expect all features to have been implemented at this point, especially if they're in the docs. I can deal with possibly letting us know that these features are on the way, or on the roadmap.

Case in point are the Element's hide and show functions which, according to the docs, take an optional boolean argument that performs a default animation. The joke is on us with the simple fact that internally these functions call setVisible and don't even pass the animation argument. What is even funnier (sadder depending on who you're asking) is that the setVisible function does absolutely nothing with the animation argument. So even if you tried to bypass the useless hide and show functions you'd figure out quite quickly that you're not going to get what you thought.

Where is the animation functionality in this code?



/**
* Hide this element - Uses display mode to determine whether to use "display" or "visibility". See {@link #setVisible}.
* @param {Boolean/Object} animate (optional) true for the default animation or a standard Element animation config object
* @return {Ext.Element} this
*/
hide : function() {
this.setVisible(false);
return this;
},

/**
* Show this element - Uses display mode to determine whether to use "display" or "visibility". See {@link #setVisible}.
* @param {Boolean/Object} animate (optional) true for the default animation or a standard Element animation config object
* @return {Ext.Element} this
*/
show : function() {
this.setVisible(true);
return this;
},

/**
* Sets the visibility of the element (see details). If the visibilityMode is set to Element.DISPLAY, it will use
* the display property to hide the element, otherwise it uses visibility. The default is to hide and show using the visibility property.
* @param {Boolean} visible Whether the element is visible
* @param {Boolean/Object} animate (optional) True for the default animation, or a standard Element animation config object
* @return {Ext.Element} this
*/
setVisible : function(visible, animate) {
var me = this,
dom = me.dom,
mode = this.getVisibilityMode();

switch (mode) {
case El.VISIBILITY:
this.removeCls(['x-hidden-display', 'x-hidden-offsets']);
this[visible ? 'removeCls' : 'addCls']('x-hidden-visibility');
break;

case El.DISPLAY:
this.removeCls(['x-hidden-visibility', 'x-hidden-offsets']);
this[visible ? 'removeCls' : 'addCls']('x-hidden-display');
break;

case El.OFFSETS:
this.removeCls(['x-hidden-visibility', 'x-hidden-display']);
this[visible ? 'removeCls' : 'addCls']('x-hidden-offsets');
break;
}

return me;
},