UI/GFX improvements

This commit is contained in:
Ewoud
2023-03-27 20:41:53 +02:00
parent 9b25b6d8c6
commit 5991aa8624
5 changed files with 2244 additions and 2258 deletions

View File

@@ -1306,26 +1306,26 @@ function drawSegmentView() {
} // for each segment
if (gId("segcont").children.length > 0) { //Only show this if more then one segment
if (gId("segcont").children.length > 1) { //Only show this if more then one segment
gId("MD").innerHTML = "total W*H=LC: " + maxWidth + " x " + maxHeight + " = " + maxWidth * maxHeight;
}
gId("MD").style.display = gId("segcont").children.length > 0?"inline":"none"
gId("MD").style.display = gId("segcont").children.length > 1?"inline":"none"
function post() {
for (let p=0; p<gId("segcont").children.length; p++) {
if (!initSegmentVars(p)) break;
if (gId("segcont").children.length>1) { //only show number if more than one segment
if (gId("segcont").children.length>1) { //only show number and name if more than one segment
ctx.font = '40px Arial';
ctx.fillStyle = "orange";
ctx.fillText(p, topLeftX + pw/2*ppL - 10, topLeftY + ph/2*ppL + 10);
//show name of fx
ctx.font = '20px Arial';
ctx.fillStyle = "white";
var name = eJson.find((o)=>{return o.id==fx}).name;
ctx.fillText(name, topLeftX+10, topLeftY + ph*ppL - 10);
}
//show name of fx
ctx.font = '20px Arial';
ctx.fillStyle = "white";
var name = eJson.find((o)=>{return o.id==fx}).name;
ctx.fillText(name, topLeftX+10, topLeftY + ph*ppL - 10);
}
}

View File

@@ -24,9 +24,9 @@ function peek(c, setOff=false) {
if (leds[0] != 76 || leds[1] != 2 || !ctx) return; //'L', set in ws.cpp
let mW = leds[2]; // matrix width
let mH = leds[3]; // matrix height
let pPL = Math.min(c.width / mW, (c.height-10) / mH); // pixels per LED (width of circle) WLEDMM -10 for prompts
let pPL = Math.min(c.width / mW, c.height / mH); // pixels per LED (width of circle)
let lOf = Math.floor((c.width - pPL*mW)/2); //left offeset (to center matrix)
var i = 6;
var i = 4; //same offset as in ws.cpp
ctx.clearRect(0, 0, c.width, c.height); //WLEDMM
function colorAmp(color) {
if (color == 0) return 0;
@@ -39,10 +39,6 @@ function peek(c, setOff=false) {
ctx.fill();
i+=3;
}
//WLEDMM show preset and playlist id
ctx.fillStyle = `rgb(255,255,255)`;
if (leds[4] != 0) ctx.fillText("preset " + leds[4].toString(), lOf, mH*pPL+10);
if (leds[5] != 255) ctx.fillText("playlist " + leds[5].toString(), lOf + 70, mH*pPL+10);
}
} catch (err) {
console.error("Peek WS error:",err);