Fixed bug: jQuery slider default change event name is "slidechange", and it behaves a bit differently than "slide" event.

This commit is contained in:
Valera Rozuvan
2013-01-11 11:47:20 +02:00
committed by Alexander Kryklia
parent a75003ef2f
commit 271c182f4e
2 changed files with 7 additions and 6 deletions

View File

@@ -18,8 +18,9 @@ define('Sliders', ['logme'], function (logme) {
if (sliderDiv.length === 1) {
onEvent = 'slide';
if (sliderDiv.attr('data-on_event') === 'change') {
onEvent = 'change';
onEvent = 'slidechange';
}
createSlider(sliderDiv, paramName, onEvent);
} else if (sliderDiv.length > 1) {
logme('ERROR: Found more than one slider for the parameter "' + paramName + '".');
@@ -48,9 +49,7 @@ define('Sliders', ['logme'], function (logme) {
'min': paramObj.min,
'max': paramObj.max,
'value': paramObj.value,
'step': paramObj.step,
onEvent: sliderOnSlide
'step': paramObj.step
});
// Tell the parameter object stored in state that we have a slider
@@ -58,6 +57,9 @@ define('Sliders', ['logme'], function (logme) {
// will also update the value of this slider.
paramObj.sliderDiv = sliderDiv;
// Atach a callback to update the slider's parameter.
paramObj.sliderDiv.on(onEvent, sliderOnSlide);
return;
// Update the 'state' - i.e. set the value of the parameter this
@@ -66,7 +68,6 @@ define('Sliders', ['logme'], function (logme) {
// This will cause the plot to be redrawn each time after the user
// drags the slider handle and releases it.
function sliderOnSlide(event, ui) {
// Last parameter passed to setParameterValue() will be 'true'
// so that the function knows we are a slider, and it can
// change the our value back in the case when the new value is

View File

@@ -241,7 +241,7 @@ define('State', ['logme'], function (logme) {
}
// Update the single slider with the new parameter's value.
if (parameters[paramName].sliderDiv !== null) {
if ((slider === false) && (parameters[paramName].sliderDiv !== null)) {
parameters[paramName].sliderDiv.slider('value', paramValueNum);
}