X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/0494b8d9b9bb03ab6c22b34dae81261e3cd7e3e6..7a654f8d43fdb43d78b63d90528bed6e86b608cc:/src/layout/component/field/Slider.js diff --git a/src/layout/component/field/Slider.js b/src/layout/component/field/Slider.js new file mode 100644 index 00000000..b3d26bd4 --- /dev/null +++ b/src/layout/component/field/Slider.js @@ -0,0 +1,46 @@ +/** + * @class Ext.layout.component.field.Slider + * @extends Ext.layout.component.field.Field + * @private + */ + +Ext.define('Ext.layout.component.field.Slider', { + + /* Begin Definitions */ + + alias: ['layout.sliderfield'], + + extend: 'Ext.layout.component.field.Field', + + /* End Definitions */ + + type: 'sliderfield', + + sizeBodyContents: function(width, height) { + var owner = this.owner, + thumbs = owner.thumbs, + length = thumbs.length, + inputEl = owner.inputEl, + innerEl = owner.innerEl, + endEl = owner.endEl, + i = 0; + + /* + * If we happen to be animating during a resize, the position of the thumb will likely be off + * when the animation stops. As such, just stop any animations before syncing the thumbs. + */ + for(; i < length; ++i) { + thumbs[i].el.stopAnimation(); + } + + if (owner.vertical) { + inputEl.setHeight(height); + innerEl.setHeight(Ext.isNumber(height) ? height - inputEl.getPadding('t') - endEl.getPadding('b') : height); + } + else { + inputEl.setWidth(width); + innerEl.setWidth(Ext.isNumber(width) ? width - inputEl.getPadding('l') - endEl.getPadding('r') : width); + } + owner.syncThumbs(); + } +});