From 1bb0be60c62e3a1ff909e082072a55015f39d766 Mon Sep 17 00:00:00 2001 From: discomrade <83621080+discomrade@users.noreply.github.com> Date: Fri, 31 May 2024 05:39:48 +0000 Subject: [PATCH] [handle_pixel] show zoom cursor on images --- ext/handle_pixel/script.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/ext/handle_pixel/script.js b/ext/handle_pixel/script.js index dd738cf5..980e0bd0 100644 --- a/ext/handle_pixel/script.js +++ b/ext/handle_pixel/script.js @@ -21,6 +21,17 @@ document.addEventListener('DOMContentLoaded', () => { img.css('max-height', (window.innerHeight * 0.95) + 'px'); } + const zoomed_height_diff = Math.round(window.innerHeight * 0.95 - img.height()); + const zoomed_width_diff = Math.round(img.parent().width() * 0.95 - img.width()); + + if (zoomed_height_diff > 0 && zoomed_width_diff > 0) { + img.css('cursor', ''); + } else if (zoom_type == "full") { + img.css('cursor', 'zoom-out'); + } else { + img.css('cursor', 'zoom-in'); + } + $(".shm-zoomer").val(zoom_type); if (save_cookie) {