Fixed #5178 - Slider's change event fires on slide

This commit is contained in:
Richard Worth 2010-02-15 14:34:42 +00:00
parent c9177acec1
commit d4154562ea

View File

@ -36,6 +36,7 @@ $.widget("ui.slider", $.ui.mouse, {
var self = this, o = this.options; var self = this, o = this.options;
this._keySliding = false; this._keySliding = false;
this._mouseSliding = false;
this._animateOff = true; this._animateOff = true;
this._handleIndex = null; this._handleIndex = null;
this._detectOrientation(); this._detectOrientation();
@ -262,6 +263,7 @@ $.widget("ui.slider", $.ui.mouse, {
} }
this._start(event, index); this._start(event, index);
this._mouseSliding = true;
self._handleIndex = index; self._handleIndex = index;
@ -305,6 +307,7 @@ $.widget("ui.slider", $.ui.mouse, {
_mouseStop: function(event) { _mouseStop: function(event) {
this.handles.removeClass("ui-state-active"); this.handles.removeClass("ui-state-active");
this._mouseSliding = false;
this._stop(event, this._handleIndex); this._stop(event, this._handleIndex);
this._change(event, this._handleIndex); this._change(event, this._handleIndex);
this._handleIndex = null; this._handleIndex = null;
@ -421,15 +424,17 @@ $.widget("ui.slider", $.ui.mouse, {
}, },
_change: function(event, index) { _change: function(event, index) {
var uiHash = { if (!this._keySliding && !this._mouseSliding) {
handle: this.handles[index], var uiHash = {
value: this.value() handle: this.handles[index],
}; value: this.value()
if (this.options.values && this.options.values.length) { };
uiHash.value = this.values(index); if (this.options.values && this.options.values.length) {
uiHash.values = this.values(); uiHash.value = this.values(index);
uiHash.values = this.values();
}
this._trigger("change", event, uiHash);
} }
this._trigger("change", event, uiHash);
}, },
value: function(newValue) { value: function(newValue) {