From de1fe6787d8aaa1484468c9a00a071b505bac3a0 Mon Sep 17 00:00:00 2001 From: Mereck600 <160926474+Mereck600@users.noreply.github.com> Date: Wed, 19 Mar 2025 13:31:16 -0400 Subject: [PATCH] Added a new clear grid functionality to enhance user experience when drawing new bitmaps, found an issue where the bitmap was not displayed on the screen. This is likely due to something in the initialization, however, adding a console log which was originally just used for debugging solved this issue. That is not the optimal solution however, it works for now. --- web/public/bitmap_editor.html | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/web/public/bitmap_editor.html b/web/public/bitmap_editor.html index 18636bce..ced2fe8f 100644 --- a/web/public/bitmap_editor.html +++ b/web/public/bitmap_editor.html @@ -75,6 +75,9 @@ function Init() { grid = InitGrid(); + //Added this console log as a simple fix to ensure the grid had time to populate, on screen the grid would occasionally not populate properly unless I cleared local storage + // this is not the optimal solution and this simply buys time but it works for now + console.log(grid); DisplayGrid(); // enable/disable the rotate button depending on if the canvas is square @@ -106,6 +109,16 @@ } return createGrid(); } + /*Function to reset the grid using logic from createGrid */ + function ResetGrid(){ + for (let i = 0; i < HEIGHT; i++) { + for (let j = 0; j < WIDTH; j++) { + grid[i][j] = false; + } + } + saveGrid(); + DisplayGrid(); + } /* // Working on it function loadImage(file, type) { @@ -982,6 +995,9 @@