diff --git a/data/js/controls.js b/data/js/controls.js index 76d5f4e..e93f2f4 100644 --- a/data/js/controls.js +++ b/data/js/controls.js @@ -896,31 +896,24 @@ function switcher(number, state) { } var rangeSlider = function (isDiscrete) { - var slider = $(".range-slider"), - range = $(".range-slider__range"), - value = $(".range-slider__value"); + var range = $(".range-slider__range"); + var slidercb = function() { + sliderchange($(this).attr("id").replace(/^\D+/g, "")); + }; - slider.each(function () { - value.each(function () { - var value = $(this).prev().attr("value"); - $(this).html(value); - }); + range.on({input: function() { + $(this).next().html(this.value)} + }); - if (!isDiscrete) { - range.on({ - input: function () { - sliderchange($(this).attr("id").replace(/^\D+/g, "")); - }, - }); - } else { - range.on({ - input: function () { - $(this).next().html(this.value); - }, - change: function () { - sliderchange($(this).attr("id").replace(/^\D+/g, "")); - }, - }); + range.each(function() { + $(this).next().html(this.value); + if($(this).attr("callbackSet") != "true") { + if (!isDiscrete) { + $(this).on({input: slidercb}); //input fires when dragging + } else { + $(this).on({change: slidercb}); //change fires only once released + } + $(this).attr("callbackSet", "true"); } }); }; diff --git a/data/js/controls.min.js b/data/js/controls.min.js index a47337a..a08fcdc 100644 --- a/data/js/controls.min.js +++ b/data/js/controls.min.js @@ -251,7 +251,7 @@ data.id+ "");requestOrientationPermission();} break;case UPDATE_LABEL:$("#l"+data.id).html(data.value);break;case UPDATE_SWITCHER:switcher(data.id,data.value=="0"?0:1);break;case UPDATE_SLIDER:slider_move($("#id"+data.id),data.value,"100",false);break;case UPDATE_NUMBER:$("#num"+data.id).val(data.value);break;case UPDATE_TEXT_INPUT:$("#text"+data.id).val(data.value);break;case UPDATE_SELECT:$("#select"+data.id).val(data.value);break;case UPDATE_BUTTON:case UPDATE_PAD:case UPDATE_CPAD:break;case UPDATE_GAUGE:$("#gauge"+data.id).val(data.value);break;case UPDATE_ACCEL:break;default:console.error("Unknown type or event");break;} if(data.type>=UPDATE_OFFSET&&data.type");requestOrientationPermission();} break;case UPDATE_LABEL:$("#l"+data.id).html(data.value);break;case UPDATE_SWITCHER:switcher(data.id,data.value=="0"?0:1);break;case UPDATE_SLIDER:slider_move($("#id"+data.id),data.value,"100",false);break;case UPDATE_NUMBER:$("#num"+data.id).val(data.value);break;case UPDATE_TEXT_INPUT:$("#text"+data.id).val(data.value);break;case UPDATE_SELECT:$("#select"+data.id).val(data.value);break;case UPDATE_BUTTON:case UPDATE_PAD:case UPDATE_CPAD:break;case UPDATE_GAUGE:$("#gauge"+data.id).val(data.value);break;case UPDATE_ACCEL:break;default:console.error("Unknown type or event");break;} if(data.type>=UPDATE_OFFSET&&data.type