From f690d8e21fb9f0ab275ce81c3ff459787d80661a Mon Sep 17 00:00:00 2001 From: "Laetitia (O-01-67)" <68935009+O-01-67@users.noreply.github.com> Date: Tue, 13 Dec 2022 12:14:56 -0500 Subject: [PATCH] Prevent deletePixel splicing of index -1 as a cause of ghost pixels when this happens, pixels are "deleted" starting from the newest pixel created and become ghost pixels present in pixelMap but not currentPixels (in worldgen worlds, this manifests as the pixels disappearing from the upwards and leftwards from the bottom right) --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index 4cf76a2e..daad0a1d 100644 --- a/index.html +++ b/index.html @@ -7000,7 +7000,7 @@ } function deletePixel(x,y) { // remove pixelMap[x][y] from currentPixels - currentPixels.splice(currentPixels.indexOf(pixelMap[x][y]),1); + if(currentPixels.indexOf(pixelMap[x][y]) !== -1) { currentPixels.splice(currentPixels.indexOf(pixelMap[x][y]),1) }; if (pixelMap[x][y]) {pixelMap[x][y].del = true;} delete pixelMap[x][y]; /*for (var i = 0; i < currentPixels.length; i++) {