diff options
Diffstat (limited to 'js')
-rw-r--r-- | js/pixel-art/pixel/app.js | 26 |
1 files 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) { |