From 3091ba6856db3b82dc6edf3c2e0ce1896a9bf32d Mon Sep 17 00:00:00 2001 From: kts of kettek Date: Sat, 17 Feb 2024 00:21:03 -0800 Subject: [PATCH] Fix the zooming --- frontend/src/sections/Editor2D.svelte | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/frontend/src/sections/Editor2D.svelte b/frontend/src/sections/Editor2D.svelte index d345419..8e43e44 100644 --- a/frontend/src/sections/Editor2D.svelte +++ b/frontend/src/sections/Editor2D.svelte @@ -47,7 +47,11 @@ } function zoomIn() { - zoom *= 2 + if (zoom < 1) { + zoom *=2 + } else { + zoom++ + } if (zoom > 1) { zoom = Math.round(zoom) } @@ -57,7 +61,11 @@ overlayDirty = true } function zoomOut() { - zoom /= 2 + if (zoom-1 <= 0) { + zoom /= 2 + } else { + zoom-- + } if (zoom > 1) { zoom = Math.round(zoom) }