Skip to content

Added a new clear grid button functionality to enhance user experience when … #569

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions web/public/bitmap_editor.html
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -982,6 +995,9 @@ <h1>Jack Bitmap Editor v2.5</h1>
<td align="center">
<input type="button" value="Invert" onclick="InvertBitmap()" />
</td>
<td align="center">
<input type="button" value="Clear Grid" onclick="ResetGrid()" />
</td>
<td align="center">
<input
id="invertMode"
Expand Down