diff --git a/src-tauri/src/pake.js b/src-tauri/src/pake.js index 89622b4..ca1b9d7 100644 --- a/src-tauri/src/pake.js +++ b/src-tauri/src/pake.js @@ -154,22 +154,22 @@ function setDefaultZoom() { } } -function zoomCommon(callback) { +function zoomCommon(zoomRule) { const htmlZoom = window.localStorage.getItem('htmlZoom') || '100%'; const html = document.getElementsByTagName('html')[0]; - const zoom = callback(htmlZoom); + const zoom = zoomRule(htmlZoom); html.style.zoom = zoom; window.localStorage.setItem('htmlZoom', zoom); } function zoomIn() { zoomCommon((htmlZoom) => - parseInt(htmlZoom) < 200 ? parseInt(htmlZoom) + 10 + '%' : '200%', + `${Math.min(parseInt(htmlZoom) + 10, 200)}%` ); } function zoomOut() { zoomCommon((htmlZoom) => - parseInt(htmlZoom) > 30 ? parseInt(htmlZoom) - 10 + '%' : '30%', + `${Math.max(parseInt(htmlZoom) - 10, 30)}%` ); }