</span> * @class Ext.slider.Multi
* @extends Ext.form.field.Base
* <p>Slider which supports vertical or horizontal orientation, keyboard adjustments, configurable snapping, axis
- * clicking and animation. Can be added as an item to any container. In addition,
+ * clicking and animation. Can be added as an item to any container. In addition,
* {@img Ext.slider.Multi/Ext.slider.Multi.png Ext.slider.Multi component}
* <p>Example usage:</p>
* Sliders can be created with more than one thumb handle by passing an array of values instead of a single one:
//this defaults to true, setting to false allows the thumbs to pass each other
{@link #constrainThumbs}: false,
renderTo: Ext.getBody()
- });
+ });
</pre>
- * @xtype multislider
*/
Ext.define('Ext.slider.Multi', {
extend: 'Ext.form.field.Base',
var me = this,
tipPlug,
hasTip;
-
+
<span id='Ext-slider-Multi-property-thumbs'> /**
</span> * @property thumbs
* @type Array
var thumbs = this.thumbs,
ln = thumbs.length,
zIndex, thumb, i;
-
+
for (i = 0; i < ln; i++) {
thumb = thumbs[i];
*/
initEvents : function() {
var me = this;
-
+
me.mon(me.el, {
scope : me,
mousedown: me.onMouseDown,
thumbs = me.thumbs,
len = thumbs.length,
local;
-
+
if (me.disabled) {
return;
}
onClickChange : function(local) {
var me = this,
thumb, index;
-
+
if (local.top > me.clickRange[0] && local.top < me.clickRange[1]) {
//find the nearest thumb to the click event
thumb = me.getNearest(local, 'left');
var me = this,
k,
val;
-
+
if(me.disabled || me.thumbs.length !== 1) {
e.preventDefault();
return;
}
k = e.getKey();
-
+
switch(k) {
case e.UP:
case e.RIGHT:
}
},
-<span id='Ext-slider-Multi-method-doSnap'> /**
-</span> * @private
- * If using snapping, this takes a desired new value and returns the closest snapped
- * value to it
- * @param {Number} value The unsnapped value
- * @return {Number} The value of the nearest snap target
- */
- doSnap : function(value) {
- var newValue = value,
- inc = this.increment,
- m;
-
- if (!(inc && value)) {
- return value;
- }
- m = value % inc;
- if (m !== 0) {
- newValue -= m;
- if (m * 2 >= inc) {
- newValue += inc;
- } else if (m * 2 < -inc) {
- newValue -= inc;
- }
- }
- return Ext.Number.constrain(newValue, this.minValue, this.maxValue);
- },
-
// private
afterRender : function() {
var me = this,
len = thumbs.length,
thumb,
v;
-
+
me.callParent(arguments);
for (; i < len; i++) {
*/
normalizeValue : function(v) {
var me = this;
-
- v = me.doSnap(v);
+
+ v = Ext.Number.snap(v, this.increment, this.minValue, this.maxValue);
v = Ext.util.Format.round(v, me.decimalPrecision);
v = Ext.Number.constrain(v, me.minValue, me.maxValue);
return v;
thumbs = me.thumbs,
len = thumbs.length,
t;
-
+
me.minValue = val;
me.inputEl.dom.setAttribute('aria-valuemin', val);
thumbs = me.thumbs,
len = thumbs.length,
t;
-
+
me.maxValue = val;
me.inputEl.dom.setAttribute('aria-valuemax', val);
thumb,
el,
xy;
-
+
me.callParent();
for (; i < len; i++) {
len = thumbs.length,
thumb,
el;
-
+
this.callParent();
for (; i < len; i++) {
// private
beforeDestroy : function() {
var me = this;
-
+
Ext.destroyMembers(me.innerEl, me.endEl, me.focusEl);
Ext.each(me.thumbs, function(thumb) {
Ext.destroy(thumb);