From a8cb38442fb7635a9aebed6a14cf24b450e34328 Mon Sep 17 00:00:00 2001 From: "Laetitia (O-01-67)" <68935009+O-01-67@users.noreply.github.com> Date: Tue, 28 Feb 2023 14:48:40 -0500 Subject: [PATCH] rebuild currentPixels function --- mods/code_library.js | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/mods/code_library.js b/mods/code_library.js index a01db5d1..7d9e337a 100644 --- a/mods/code_library.js +++ b/mods/code_library.js @@ -1554,3 +1554,33 @@ var isBright = (color.l > 20); return isRed && isVivid && isBright; }; + + //Ghost pixel repair function + function rebuildCurrentPixels() { + var currPix = []; //rebuild currentPixels from pixelMap to try to fix bug + for(pmi = 0; pmi < pixelMap.length; pmi++) { + var pixelMapPart = pixelMap[pmi]; + for(pmj = 0; pmj < pixelMapPart.length; pmj++) { + var pixelMapUnit = pixelMapPart[pmj]; + if(typeof(pixelMapUnit) === "object") { + if(pixelMapUnit !== null) { + currPix.push(pixelMapUnit); + }; + }; + }; + }; + currentPixels = currPix; + }; + + +//Sugar functions + + function newElement(name="element_name",color="#FF00FF",otherProps={}) { + elements[name] = { + color: color, + }; + for(property in otherProps) { + elements[name][property] = otherProps[property]; + }; + return elements[name]; + };