From 5f170cb9bc24c3c2456538d433ffe59e90124f48 Mon Sep 17 00:00:00 2001 From: elioat Date: Sun, 22 Dec 2024 11:20:44 -0500 Subject: * --- js/pixel-art/pixel/app.js | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'js/pixel-art/pixel/app.js') diff --git a/js/pixel-art/pixel/app.js b/js/pixel-art/pixel/app.js index 1fab676..e99b542 100644 --- a/js/pixel-art/pixel/app.js +++ b/js/pixel-art/pixel/app.js @@ -40,6 +40,7 @@ document.getElementById('panUpBtn').addEventListener('click', () => handlePanBut document.getElementById('panDownBtn').addEventListener('click', () => handlePanButton('down')); document.getElementById('panLeftBtn').addEventListener('click', () => handlePanButton('left')); document.getElementById('panRightBtn').addEventListener('click', () => handlePanButton('right')); +document.getElementById('centerViewBtn').addEventListener('click', resetView); // Initialization resizeCanvas(); @@ -316,4 +317,11 @@ function handlePanButton(direction) { break; } drawGrid(); +} + +function resetView() { + cellSize = 16; // Reset to default zoom + centerGrid(); + drawGrid(); + saveToLocalStorage(); } \ No newline at end of file -- cgit 1.4.1-2-gfad0