deletePixel change

This commit is contained in:
An Orbit 2023-04-21 23:38:18 -04:00 committed by GitHub
parent 19c02ea910
commit 15ad2fbcbd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 27 additions and 0 deletions

View File

@ -1721,3 +1721,30 @@
};
return elements[name];
};
//Fixes
//fix -1-caused ghost pixels
function deletePixel(x,y) {
// remove pixelMap[x][y] from currentPixels
var pixelIndex = currentPixels.indexOf(pixelMap[x][y]);
if(pixelIndex !== -1) {
currentPixels.splice(pixelIndex,1)
};
if (pixelMap[x][y]) {pixelMap[x][y].del = true}
delete pixelMap[x][y];
/*for (var i = 0; i < currentPixels.length; i++) {
if (currentPixels[i].x == x && currentPixels[i].y == y) {
currentPixels.splice(i, 1);
break;
}
}*/
/*if (id != null) {
for (var i = 0; i < currentPixels.length; i++) {
if (currentPixels[i].id == id) {
currentPixels.splice(i, 1);
return;
}
}
}*/
}