mirror of
https://github.com/s00500/ESPUI.git
synced 2024-11-21 17:40:54 +00:00
Fixes #127
This commit is contained in:
parent
aa03c1683d
commit
777ceb2bed
39
data/js/controls.js
vendored
39
data/js/controls.js
vendored
@ -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");
|
||||
}
|
||||
});
|
||||
};
|
||||
|
5
data/js/controls.min.js
vendored
5
data/js/controls.min.js
vendored
@ -251,7 +251,7 @@ data.id+
|
||||
"</div>");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<UI_INITIAL_GUI){var element=$("#id"+data.id);if(data.type==UPDATE_SLIDER){element.removeClass("slider-turquoise slider-emerald slider-peterriver slider-wetasphalt slider-sunflower slider-carrot slider-alizarin");element.addClass("slider-"+colorClass(data.color));}else{element.removeClass("turquoise emerald peterriver wetasphalt sunflower carrot alizarin");element.addClass(colorClass(data.color));}}};websock.onmessage=handleEvent;}
|
||||
function sliderchange(number){var val=$("#sl"+number).val();websock.send("slvalue:"+val+":"+number);}
|
||||
function sliderchange(number){var val=$("#sl"+number).val();console.log("sliderchange "+number+": "+val);websock.send("slvalue:"+val+":"+number);}
|
||||
function numberchange(number){var val=$("#num"+number).val();websock.send("nvalue:"+val+":"+number);}
|
||||
function textchange(number){var val=$("#text"+number).val();websock.send("tvalue:"+val+":"+number);}
|
||||
function tabclick(number){var val=$("#tab"+number).val();websock.send("tabvalue:"+val+":"+number);}
|
||||
@ -259,4 +259,5 @@ function selectchange(number){var val=$("#select"+number).val();websock.send("sv
|
||||
function buttonclick(number,isdown){if(isdown)websock.send("bdown:"+number);else websock.send("bup:"+number);}
|
||||
function padclick(type,number,isdown){switch(type){case CENTER:if(isdown)websock.send("pcdown:"+number);else websock.send("pcup:"+number);break;case UP:if(isdown)websock.send("pfdown:"+number);else websock.send("pfup:"+number);break;case DOWN:if(isdown)websock.send("pbdown:"+number);else websock.send("pbup:"+number);break;case LEFT:if(isdown)websock.send("pldown:"+number);else websock.send("plup:"+number);break;case RIGHT:if(isdown)websock.send("prdown:"+number);else websock.send("prup:"+number);break;}}
|
||||
function switcher(number,state){if(state==null){if($("#s"+number).is(":checked")){websock.send("sactive:"+number);$("#sl"+number).addClass("checked");}else{websock.send("sinactive:"+number);$("#sl"+number).removeClass("checked");}}else if(state==1){$("#sl"+number).addClass("checked");$("#sl"+number).prop("checked",true);}else if(state==0){$("#sl"+number).removeClass("checked");$("#sl"+number).prop("checked",false);}}
|
||||
var rangeSlider=function(isDiscrete){var slider=$(".range-slider"),range=$(".range-slider__range"),value=$(".range-slider__value");slider.each(function(){value.each(function(){var value=$(this).prev().attr("value");$(this).html(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,""));},});}});};
|
||||
var rangeSlider=function(isDiscrete){var range=$(".range-slider__range");var value=$(".range-slider__value");value.each(function(){$(this).html($(this).prev().attr("value"))});range.on({input:function(){$(this).next().html(this.value)}});range.each(function(){if($(this).attr("callbackSet")!="true"){if(!isDiscrete){$(this).on({input:function(){sliderchange($(this).attr("id").replace(/^\D+/g,""));}});}else{$(this).on({change:function(){sliderchange($(this).attr("id").replace(/^\D+/g,""))}});}
|
||||
$(this).attr("callbackSet","true");}});};
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user