liveview2D: only if isMatrix

This commit is contained in:
ewowi 2022-07-28 16:35:57 +02:00
parent affcca8034
commit ce99dbe40c
3 changed files with 1825 additions and 1839 deletions

View File

@ -64,7 +64,7 @@
<button id="buttonPower" onclick="togglePower()" class="tgl"><i class="icons">&#xe08f;</i><p class="tab-label">Power</p></button> <button id="buttonPower" onclick="togglePower()" class="tgl"><i class="icons">&#xe08f;</i><p class="tab-label">Power</p></button>
<button id="buttonNl" onclick="toggleNl()"><i class="icons">&#xe2a2;</i><p class="tab-label">Timer</p></button> <button id="buttonNl" onclick="toggleNl()"><i class="icons">&#xe2a2;</i><p class="tab-label">Timer</p></button>
<button id="buttonSync" onclick="toggleSync()"><i class="icons">&#xe116;</i><p class="tab-label">Sync</p></button> <button id="buttonSync" onclick="toggleSync()"><i class="icons">&#xe116;</i><p class="tab-label">Sync</p></button>
<button id="buttonSr" onclick="toggleLiveview2D()" ondblclick="toggleLiveview()"><i class="icons">&#xe410;</i><p class="tab-label">Peek</p></button> <button id="buttonSr" onclick="toggleLiveview()"><i class="icons">&#xe410;</i><p class="tab-label">Peek</p></button>
<button id="buttonI" onclick="toggleInfo()"><i class="icons">&#xe066;</i><p class="tab-label">Info</p></button> <button id="buttonI" onclick="toggleInfo()"><i class="icons">&#xe066;</i><p class="tab-label">Info</p></button>
<button id="buttonNodes" onclick="toggleNodes()"><i class="icons">&#xe22d;</i><p class="tab-label">Nodes</p></button> <button id="buttonNodes" onclick="toggleNodes()"><i class="icons">&#xe22d;</i><p class="tab-label">Nodes</p></button>
<button onclick="window.location.href='/settings';"><i class="icons">&#xe0a2;</i><p class="tab-label">Config</p></button> <button onclick="window.location.href='/settings';"><i class="icons">&#xe0a2;</i><p class="tab-label">Config</p></button>

View File

@ -1,7 +1,7 @@
//page js //page js
var loc = false, locip; var loc = false, locip;
var noNewSegs = false; var noNewSegs = false;
var isOn = false, nlA = false, isLv = false, isLv2D = false, isInfo = false, isNodes = false, syncSend = false, syncTglRecv = true; var isOn = false, nlA = false, isLv = false, isInfo = false, isNodes = false, syncSend = false, syncTglRecv = true;
var hasWhite = false, hasRGB = false, hasCCT = false; var hasWhite = false, hasRGB = false, hasCCT = false;
var nlDur = 60, nlTar = 0; var nlDur = 60, nlTar = 0;
var nlMode = false; var nlMode = false;
@ -1526,44 +1526,34 @@ function toggleSync()
function toggleLiveview() function toggleLiveview()
{ {
if (isLv2D) {toggleLiveview2D(); return;} //WLEDSR adding liveview2D support
if (isInfo && isM) toggleInfo();
if (isNodes && isM) toggleNodes();
isLv = !isLv;
isLv = !isLv; var lvID = "liveview";
gId('liveview').style.display = (isLv) ? "block":"none"; if (isM) {
var url = (loc?`http://${locip}`:'') + "/liveview"; lvID = "liveview2D"
gId('liveview').src = (isLv) ? url:"about:blank"; if (isLv) {
gId('buttonSr').className = (isLv) ? "active":""; var cn = '<iframe id="liveview2D" src="about:blank"></iframe>';
if (!isLv && ws && ws.readyState === WebSocket.OPEN) ws.send('{"lv":false}'); d.getElementById('kliveview2D').innerHTML = cn;
size();
}
function toggleLiveview2D()
{
if (isInfo) toggleInfo();
if (isNodes) toggleNodes();
if (isLv) toggleLiveview();
isLv2D = !isLv2D;
if (isLv2D) {
var cn = '<iframe id="liveview2D" src="about:blank"></iframe>';
d.getElementById('kliveview2D').innerHTML = cn;
} }
gId('mliveview2D').style.transform = (isLv2D) ? "translateY(0px)":"translateY(100%)"; gId('mliveview2D').style.transform = (isLv) ? "translateY(0px)":"translateY(100%)";
}
gId("liveview2D").style.display = (isLv2D) ? "block":"none"; gId(lvID).style.display = (isLv) ? "block":"none";
var url = (loc?`http://${locip}`:'') + "/liveview2D"; var url = (loc?`http://${locip}`:'') + "/" + lvID;
gId("liveview2D").src = (isLv2D) ? url:"about:blank"; gId(lvID).src = (isLv) ? url:"about:blank";
gId('buttonSr').className = (isLv2D) ? "active":""; gId('buttonSr').className = (isLv) ? "active":"";
if (!isLv2D && ws && ws.readyState === WebSocket.OPEN) ws.send('{"lv":false}'); if (!isLv && ws && ws.readyState === WebSocket.OPEN) ws.send('{"lv":false}');
size(); size();
} }
function toggleInfo() function toggleInfo()
{ {
if (isNodes) toggleNodes(); if (isNodes) toggleNodes();
if (isLv2D) toggleLiveview2D(); if (isLv && isM) toggleLiveview();
isInfo = !isInfo; isInfo = !isInfo;
if (isInfo) requestJson(); if (isInfo) requestJson();
gId('info').style.transform = (isInfo) ? "translateY(0px)":"translateY(100%)"; gId('info').style.transform = (isInfo) ? "translateY(0px)":"translateY(100%)";
@ -1573,7 +1563,7 @@ function toggleInfo()
function toggleNodes() function toggleNodes()
{ {
if (isInfo) toggleInfo(); if (isInfo) toggleInfo();
if (isLv2D) toggleLiveview2D(); if (isLv && isM) toggleLiveview();
isNodes = !isNodes; isNodes = !isNodes;
if (isNodes) loadNodes(); if (isNodes) loadNodes();
gId('nodes').style.transform = (isNodes) ? "translateY(0px)":"translateY(100%)"; gId('nodes').style.transform = (isNodes) ? "translateY(0px)":"translateY(100%)";

File diff suppressed because it is too large Load Diff