LED Layouts, Delete Effect, Colorpicker for EC (#290)

* upd

* ipadte schemas

* update html

* update

* fix matrix index increment

[skip ci]

* matrix 1 led as minimum

[skip ci]

* disable zoom

[skpi ci]
This commit is contained in:
brindosch
2016-11-18 18:39:27 +01:00
committed by GitHub
parent c2faf07574
commit c05181666c
25 changed files with 632 additions and 102 deletions

View File

@@ -1,3 +1,52 @@
JSONEditor.defaults.editors.colorPicker = JSONEditor.defaults.editors.string.extend({
getValue: function() {
color = $(this.input).data('colorpicker').color.toRGB();
return [color.r, color.g, color.b];
},
setValue: function(val) {
function rgb2hex(rgb){
return "#" +
("0" + parseInt(rgb[0],10).toString(16)).slice(-2) +
("0" + parseInt(rgb[1],10).toString(16)).slice(-2) +
("0" + parseInt(rgb[2],10).toString(16)).slice(-2);
}
$(this.input).colorpicker('setValue', rgb2hex(val));
},
build: function() {
this._super();
var myinput = this
$(this.input).colorpicker({
format: 'rgb',
customClass: 'colorpicker-2x',
sliders: {
saturation: {
maxLeft: 200,
maxTop: 200
},
hue: {
maxTop: 200
},
},
})
//$(this.input).colorpicker().on('changeColor', function(e) {
//$(this.input).trigger("change");
//});
}
});
JSONEditor.defaults.resolvers.unshift(function(schema) {
if(schema.type === "array" && schema.format === "colorpicker") {
return "colorPicker";
}
});
$(hyperion).one("cmd-config-getschema", function(event) {
effects = parsedConfSchemaJSON.properties.effectSchemas.internal
EffectsHtml = "";
@@ -83,7 +132,25 @@ $(hyperion).one("cmd-config-getschema", function(event) {
$('#btn_cont_test').off().on('click',function() {
toggleClass('#btn_cont_test', "btn-success", "btn-danger");
});
// Delete effect
delList=parsedServerInfoJSON.info.effects
var EffectHtml
for(var idx=0; idx<delList.length; idx++)
{
if(!/:/.test(delList[idx].file))
{
EffectHtml += '<option value="'+delList[idx].name+'">'+delList[idx].name+'</option>';
}
}
$("#effectsdellist").html(EffectHtml);
$('#btn_delete').off().on('click',function() {
var name = $("#effectsdellist").val();
requestDeleteEffect(name);
});
$(document).ready( function() {
requestServerConfigSchema();
});