mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
Correct PR1312 and LEDSim fixes (#1336)
* Revert Refactor/Optimization of PR1312 * LED Layout - Only update preview image when visible * Revert Debug updates * Correct Refactor/Optimization of PR1312 * LedSim: Do not stream LED data when not required, LedS-im/Layout: Sync on video streaming * Remove initial switch to instance 0 during API init
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
var ledsCustomCfgInitialized = false;
|
||||
var onLedLayoutTab = false;
|
||||
var nonBlacklistLedArray = [];
|
||||
var ledBlacklist = [];
|
||||
var finalLedArray = [];
|
||||
@@ -568,9 +569,12 @@ $(document).ready(function () {
|
||||
// toggle live video
|
||||
$('#leds_prev_toggle_live_video').off().on("click", function () {
|
||||
setClassByBool('#leds_prev_toggle_live_video', window.imageStreamActive, "btn-success", "btn-danger");
|
||||
if (window.imageStreamActive) {
|
||||
requestLedImageStop();
|
||||
|
||||
if (onLedLayoutTab && window.imageStreamActive) {
|
||||
imageCanvasNodeCtx.clear();
|
||||
if (!$('#leds_toggle_live_video').hasClass("btn-success")) {
|
||||
requestLedImageStop();
|
||||
}
|
||||
}
|
||||
else {
|
||||
requestLedImageStart();
|
||||
@@ -578,14 +582,17 @@ $(document).ready(function () {
|
||||
});
|
||||
|
||||
$(window.hyperion).on("cmd-ledcolors-imagestream-update", function (event) {
|
||||
setClassByBool('#leds_prev_toggle_live_video', window.imageStreamActive, "btn-danger", "btn-success");
|
||||
var imageData = (event.response.result.image);
|
||||
//Only update Image, if LED Layout Tab is visible
|
||||
if (onLedLayoutTab && window.imageStreamActive) {
|
||||
setClassByBool('#leds_prev_toggle_live_video', window.imageStreamActive, "btn-danger", "btn-success");
|
||||
var imageData = (event.response.result.image);
|
||||
|
||||
var image = new Image();
|
||||
image.onload = function () {
|
||||
imageCanvasNodeCtx.drawImage(image, 0, 0, imageCanvasNodeCtx.canvas.width, imageCanvasNodeCtx.canvas.height);
|
||||
};
|
||||
image.src = imageData;
|
||||
var image = new Image();
|
||||
image.onload = function () {
|
||||
imageCanvasNodeCtx.drawImage(image, 0, 0, imageCanvasNodeCtx.canvas.width, imageCanvasNodeCtx.canvas.height);
|
||||
};
|
||||
image.src = imageData;
|
||||
}
|
||||
});
|
||||
|
||||
// open checklist
|
||||
@@ -605,9 +612,14 @@ $(document).ready(function () {
|
||||
// nav
|
||||
$('#leds_cfg_nav a[data-toggle="tab"]').off().on('shown.bs.tab', function (e) {
|
||||
var target = $(e.target).attr("href") // activated tab
|
||||
if (target == "#menu_gencfg" && !ledsCustomCfgInitialized) {
|
||||
$('#leds_custom_updsim').trigger('click');
|
||||
ledsCustomCfgInitialized = true;
|
||||
if (target == "#menu_gencfg") {
|
||||
onLedLayoutTab = true;
|
||||
if (!ledsCustomCfgInitialized) {
|
||||
$('#leds_custom_updsim').trigger('click');
|
||||
ledsCustomCfgInitialized = true;
|
||||
}
|
||||
} else {
|
||||
onLedLayoutTab = false;
|
||||
}
|
||||
|
||||
blacklist_editor.on('change', function () {
|
||||
|
Reference in New Issue
Block a user