rebuild currentPixels function

This commit is contained in:
Laetitia (O-01-67) 2023-02-28 14:48:40 -05:00 committed by GitHub
parent 4a67bec9f4
commit a8cb38442f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 30 additions and 0 deletions

View File

@ -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];
};