From 40db3228a23e64804cd1e901beee2f0917dbcae8 Mon Sep 17 00:00:00 2001 From: elioat Date: Sun, 22 Dec 2024 11:17:00 -0500 Subject: * --- js/pixel-art/pixel/app.js | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/js/pixel-art/pixel/app.js b/js/pixel-art/pixel/app.js index 5da21b0..9dc9cd8 100644 --- a/js/pixel-art/pixel/app.js +++ b/js/pixel-art/pixel/app.js @@ -100,17 +100,21 @@ function handleColorChange() { } function handleReset() { - gridWidth = defaultGridWidth; - gridHeight = defaultGridHeight; - initializeGrid(); - centerGrid(); - drawGrid(); - localStorage.removeItem('pixelArtConfig'); - colorHistory = []; - renderColorHistory(); - document.getElementById('gridWidth').value = gridWidth; - document.getElementById('gridHeight').value = gridHeight; - alert("Grid reset, color history cleared, and local storage cleared."); + const confirmReset = confirm("Are you sure you want to reset? This will clear your drawing and settings."); + + if (confirmReset) { + gridWidth = defaultGridWidth; + gridHeight = defaultGridHeight; + initializeGrid(); + centerGrid(); + drawGrid(); + localStorage.removeItem('pixelArtConfig'); + colorHistory = []; + renderColorHistory(); + document.getElementById('gridWidth').value = gridWidth; + document.getElementById('gridHeight').value = gridHeight; + alert("Grid reset, color history cleared, and local storage cleared."); + } } function handlePan(e) { -- cgit 1.4.1-2-gfad0