From b7eef29e701f8550d866f41f88f99f87f7eac4a1 Mon Sep 17 00:00:00 2001 From: Ewoud Date: Mon, 22 Jan 2024 14:59:15 +0100 Subject: [PATCH] effect startPos / endPos as coord3D and use to make subsets of physleds MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit general - use UINT8_MAX and UINT16_MAX instead of own defines index.css - canvas has black border - table has box-shadow (as border-radius alone does not work) index.js - coord3D: add change event to x,y,z input nodes - sendvalue: add "value" property, add support for coord3D AppLedsV: fixtureProjectAndMap: - default y and z to 0 (not 1) - only process if physical led within startPos and endPos boundaries - 2D-2D: use start and endpos to calc virtual coordinate and bucket - other dimensions: to do! (WIP) AppModLeds: - fxStart and End chFun: assign ledsV.start/endPos - move dimensions and nrOfLeds to table SysModUI: processJson: - add vector to freeze for loop - value handling: refactor and allow for coord3D, add setValue for coord3D SysModWeb - wsEvent: add 💀 for multipart messages (WIP) --- data/index.css | 5 +- data/index.js | 71 +- src/App/AppEffects.h | 6 +- src/App/AppLedsV.cpp | 266 ++-- src/App/AppLedsV.h | 2 +- src/App/AppModFixtureGen.h | 7 +- src/App/AppModLeds.h | 10 +- src/App/AppModPreview.h | 2 +- src/Sys/SysModFiles.cpp | 4 +- src/Sys/SysModModel.cpp | 4 +- src/Sys/SysModModel.h | 6 +- src/Sys/SysModPins.cpp | 4 +- src/Sys/SysModUI.cpp | 118 +- src/Sys/SysModUI.h | 24 +- src/Sys/SysModWeb.cpp | 19 +- src/SysModule.h | 3 - src/SysModules.cpp | 6 +- src/User/UserModArtNet.h | 2 +- src/User/UserModDDP.h | 2 +- src/User/UserModE131.h | 6 +- src/User/UserModInstances.h | 11 +- src/html_ui.h | 2574 ++++++++++++++++++----------------- src/main.cpp | 2 +- 23 files changed, 1601 insertions(+), 1553 deletions(-) diff --git a/data/index.css b/data/index.css index bfb81f43..0cac2612 100644 --- a/data/index.css +++ b/data/index.css @@ -123,6 +123,7 @@ canvas { width: 100%; height: 100%; border-radius: 12px; + border: 1px solid black; background: transparent; cursor: default; } @@ -180,7 +181,9 @@ div { font-family: Arial, Helvetica, sans-serif; border-collapse: collapse; width: 100%; - border-radius: .5em; /*does not seem to work */ + border-radius: 10px; /*does not seem to work */ + border-style: hidden; /* hide standard table (collapsed) border */ + box-shadow: 0 0 0 1px #666; /* this draws the table border */ } .table td, .table th { diff --git a/data/index.js b/data/index.js index b14332b8..dd7033b5 100644 --- a/data/index.js +++ b/data/index.js @@ -320,12 +320,17 @@ function generateHTML(json, parentNode = null, rowNr = -1) { xNode.min = variable.min?variable.min:0; //if not specified then unsigned value (min=0) if (variable.max) xNode.max = variable.max; xNode.placeholder = "x"; + xNode.addEventListener('change', (event) => {console.log(variable.type + " change", event.target.parentNode);sendValue(event.target.parentNode);}); + varNode.appendChild(xNode); + let yNode = xNode.cloneNode(); yNode.placeholder = "y"; + yNode.addEventListener('change', (event) => {console.log(variable.type + " change", event.target.parentNode);sendValue(event.target.parentNode);}); + varNode.appendChild(yNode); + let zNode = xNode.cloneNode(); zNode.placeholder = "z"; - varNode.appendChild(xNode); - varNode.appendChild(yNode); + zNode.addEventListener('change', (event) => {console.log(variable.type + " change", event.target.parentNode);sendValue(event.target.parentNode);}); varNode.appendChild(zNode); } else { //input types: text, search, tel, url, email, and password. @@ -777,7 +782,7 @@ function changeHTML(variable, node, commandJson, rowNr = -1) { if (commandJson.value) node.value = commandJson.value; //else the id / label is used as button label } else if (node.className == "coord3D") { - console.log("chHTML value coord3D", node, commandJson.value, rowNr); + // console.log("chHTML value coord3D", node, commandJson.value, rowNr); if (commandJson.value && Object.keys(commandJson.value)) { //tbd: support arrays (now only objects) let index = 0; @@ -925,29 +930,37 @@ function requestJson(command) { }); } -function sendValue(element) { +function sendValue(varNode) { let varId; - if (element.id == "saveModel" || element.id == "bSave") { + if (varNode.id == "saveModel" || varNode.id == "bSave") { varId = "saveModel"; gId("bSave").value = "Save"; gId("bSave").disabled = true; } else { - varId = element.id; + varId = varNode.id; gId("bSave").value = "Save*"; gId("bSave").disabled = false; } var command = {}; - if (element.type == "checkbox") - command[varId] = element.checked; - else if (element.nodeName.toLocaleLowerCase() == "span") - command[varId] = element.innerText; - else - command[varId] = Number(element.value)?Number(element.value):element.value; //type number is default but html converts numbers in