From bc1ed72088bf3a0f905db83036c72d797f69a2bc Mon Sep 17 00:00:00 2001 From: An Orbit <68935009+orbit-loona@users.noreply.github.com> Date: Wed, 5 Feb 2025 19:57:31 -0500 Subject: [PATCH] weirdness II --- mods/a_mod_by_alice.js | 185 +++++++++++++++++++++-------------------- 1 file changed, 94 insertions(+), 91 deletions(-) diff --git a/mods/a_mod_by_alice.js b/mods/a_mod_by_alice.js index c583daed..64742aa0 100644 --- a/mods/a_mod_by_alice.js +++ b/mods/a_mod_by_alice.js @@ -2251,93 +2251,6 @@ td.inputCell { style.appendChild(document.createTextNode(css)); } - function showPropertySetter() { - var ps = document.getElementById("propertySetter"); - if(ps) { - ps.style.display = "block" - } - }; - - function hidePropertySetter() { - var ps = document.getElementById("propertySetter"); - if(ps) { - ps.style.display = "none" - } - }; - - function hideSetterColumn(type,index) { - //currently the only type is "numeric" - var heading = document.getElementById(`property${type}${index.toString()}headingcell`); - var input = document.getElementById(`property${type}${index.toString()}inputcell`); - heading.style.display = "none"; - input.style.display = "none"; - }; - - function showSetterColumn(type,index) { - var heading = document.getElementById(`property${type}${index.toString()}headingcell`); - var input = document.getElementById(`property${type}${index.toString()}inputcell`); - heading.style.display = "table-cell"; - input.style.display = "table-cell"; - }; - - function hideAllSetterColumnsOfType(type) { - var setter = document.getElementById("setterTable"); - var headingsAndInputs = setter.querySelectorAll(`[id^="property${type}][id$="cell"]`); - headingsAndInputs.forEach(n => n.style.display = "none"); - }; - - function hideAllSetterColumns() { - var setter = document.getElementById("setterTable"); - var headingsAndInputs = setter.querySelectorAll(`[id^="property"][id$="cell"]`); - headingsAndInputs.forEach(n => n.style.display = "none"); - }; - - howManySetters = 5; - var propertySetter = document.createElement("div"); - propertySetter.setAttribute("id","propertySetter"); - propertySetter.style.display = "none"; - var newTable = document.createElement("table"); - newTable.setAttribute("id","setterTable"); - propertySetter.appendChild(newTable); - var labelRow = document.createElement("tr"); - var inputRow = document.createElement("tr"); - newTable.appendChild(labelRow); - newTable.appendChild(inputRow); - //NUMERIC SETTERS - for(var i = 0; i < howManySetters; i++) { - var newHeading = document.createElement("th"); - newHeading.setAttribute("id",`propertynumeric${i.toString()}headingcell`); - var newHeadingText = document.createElement("span"); - newHeadingText.classList.add("ps-heading"); - newHeadingText.setAttribute("id",`propertynumeric${i.toString()}heading`); - newHeadingText.innerText = "None"; - newHeading.appendChild(newHeadingText) - labelRow.appendChild(newHeading); - var newInputCell = document.createElement("td"); - newInputCell.setAttribute("id",`propertynumeric${i.toString()}inputcell`); - newInputCell.classList.add("inputCell"); - var newNumberField = document.createElement("input"); - newNumberField.setAttribute("type","number"); - newNumberField.value = "1"; - newNumberField.setAttribute("set","none"); - newNumberField.addEventListener("change", function() { - var property = this.getAttribute("set"); - var parsedValue = parseFloat(this.value); - if(isNaN(parsedValue)) { - var newValue = (Math.max(parseFloat(this.getAttribute("min")),0)); - this.value = newValue; - parsedValue = newValue - }; - var value = parsedValue; - ambaPlaceProperties[property] = value - }); - newNumberField.setAttribute("id",`propertynumeric${i.toString()}input`); - newNumberField.classList.add("ps-number"); - newInputCell.appendChild(newNumberField) - inputRow.appendChild(newInputCell); - }; - //document.getElementById("colorSelector").after(propertySetter); - ambaPlaceProperties = { blackHoleRange: 15, whiteHoleRange: 15, @@ -2359,9 +2272,6 @@ td.inputCell { noteBlockDelay: 0 }; - hidePropertySetter(); - hideAllSetterColumns(); - //COLOR MANIPULATION TOOLS ## var colorToolCounter = 0; saturationAmount = 1; @@ -4149,6 +4059,96 @@ color1 and color2 spread through striped paint like dye does with itself. col quickSlDetectorLastKeys = []; }; }) + + howManySetters = 5; + var propertySetter = document.createElement("div"); + propertySetter.setAttribute("id","propertySetter"); + propertySetter.style.display = "none"; + var newTable = document.createElement("table"); + newTable.setAttribute("id","setterTable"); + propertySetter.appendChild(newTable); + var labelRow = document.createElement("tr"); + var inputRow = document.createElement("tr"); + newTable.appendChild(labelRow); + newTable.appendChild(inputRow); + //NUMERIC SETTERS + for(var i = 0; i < howManySetters; i++) { + var newHeading = document.createElement("th"); + newHeading.setAttribute("id",`propertynumeric${i.toString()}headingcell`); + var newHeadingText = document.createElement("span"); + newHeadingText.classList.add("ps-heading"); + newHeadingText.setAttribute("id",`propertynumeric${i.toString()}heading`); + newHeadingText.innerText = "None"; + newHeading.appendChild(newHeadingText) + labelRow.appendChild(newHeading); + var newInputCell = document.createElement("td"); + newInputCell.setAttribute("id",`propertynumeric${i.toString()}inputcell`); + newInputCell.classList.add("inputCell"); + var newNumberField = document.createElement("input"); + newNumberField.setAttribute("type","number"); + newNumberField.value = "1"; + newNumberField.setAttribute("set","none"); + newNumberField.addEventListener("change", function() { + var property = this.getAttribute("set"); + var parsedValue = parseFloat(this.value); + if(isNaN(parsedValue)) { + var newValue = (Math.max(parseFloat(this.getAttribute("min")),0)); + this.value = newValue; + parsedValue = newValue + }; + var value = parsedValue; + ambaPlaceProperties[property] = value + }); + newNumberField.setAttribute("id",`propertynumeric${i.toString()}input`); + newNumberField.classList.add("ps-number"); + newInputCell.appendChild(newNumberField) + inputRow.appendChild(newInputCell); + }; + //document.getElementById("colorSelector").after(propertySetter); + + function showPropertySetter() { + var ps = document.getElementById("propertySetter"); + if(ps) { + ps.style.display = "block" + } + }; + + function hidePropertySetter() { + var ps = document.getElementById("propertySetter"); + if(ps) { + ps.style.display = "none" + } + }; + + function hideSetterColumn(type,index) { + //currently the only type is "numeric" + var heading = document.getElementById(`property${type}${index.toString()}headingcell`); + var input = document.getElementById(`property${type}${index.toString()}inputcell`); + heading.style.display = "none"; + input.style.display = "none"; + }; + + function showSetterColumn(type,index) { + var heading = document.getElementById(`property${type}${index.toString()}headingcell`); + var input = document.getElementById(`property${type}${index.toString()}inputcell`); + heading.style.display = "table-cell"; + input.style.display = "table-cell"; + }; + + function hideAllSetterColumnsOfType(type) { + var setter = document.getElementById("setterTable"); + var headingsAndInputs = setter.querySelectorAll(`[id^="property${type}][id$="cell"]`); + headingsAndInputs.forEach(n => n.style.display = "none"); + }; + + function hideAllSetterColumns() { + var setter = document.getElementById("setterTable"); + var headingsAndInputs = setter.querySelectorAll(`[id^="property"][id$="cell"]`); + headingsAndInputs.forEach(n => n.style.display = "none"); + }; + + hidePropertySetter(); + hideAllSetterColumns(); }; //MORE CONFIGURABLE EXPLOSIONS (explodeAtPlus) ## @@ -9371,7 +9371,10 @@ color1 and color2 spread through striped paint like dye does with itself. col p0h.innerText = "Radius"; }; }, - onUnselect: hidePropertySetter, + onUnselect: function() { + hideAllSetterColumns(); + hidePropertySetter + }, hoverStat: (pixel => `r = ${(pixel.range?.toString() ?? "??")}`), tick: function(pixel) { pixel.color = _cc.w.r;