From e6c933fd03fc7e722c52a2df640df19526b3e028 Mon Sep 17 00:00:00 2001 From: jebbs Date: Fri, 29 Mar 2024 14:18:01 +0800 Subject: [PATCH] preview: use cursors grab and grabbing --- templates/js/cursor.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/templates/js/cursor.js b/templates/js/cursor.js index ec2c8b8..503b9e0 100644 --- a/templates/js/cursor.js +++ b/templates/js/cursor.js @@ -6,7 +6,7 @@ function addCursorManager(settings) { // console.log("leftButton", leftButton, "rightButton", rightButton); if (!leftButton && !rightButton) { if (settings.swapMouseButtons) { - imgContainer.style.cursor = "move"; + imgContainer.style.cursor = "grab"; } else if (e.altKey) { imgContainer.style.cursor = "zoom-out"; } else { @@ -27,7 +27,14 @@ function addCursorManager(settings) { return; } // move - imgContainer.style.cursor = "move"; + if ( + (leftButton && settings.swapMouseButtons) || + (rightButton && !settings.swapMouseButtons) + ) { + imgContainer.style.cursor = "grabbing"; + } else { + imgContainer.style.cursor = "grab"; + } } imgContainer.addEventListener("mousedown", e => { // console.log("mousedown", e.button, e.buttons);