From 657fe8994ca0eb97c3912abcf02258999ae4997c Mon Sep 17 00:00:00 2001 From: Jason Tsai Date: Mon, 4 Sep 2023 22:44:34 +0800 Subject: [PATCH] fix(window): use `button` property for `data-tauri-drag-region` mouse button detection --- .changes/window-tap-drag-region-detection.md | 5 +++++ plugins/window/src/scripts/drag.js | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changes/window-tap-drag-region-detection.md diff --git a/.changes/window-tap-drag-region-detection.md b/.changes/window-tap-drag-region-detection.md new file mode 100644 index 00000000..66fcbaf7 --- /dev/null +++ b/.changes/window-tap-drag-region-detection.md @@ -0,0 +1,5 @@ +--- +"window": "patch" +--- + +On macOS, fixed tapping on custom title bar doesn't maximize the window. diff --git a/plugins/window/src/scripts/drag.js b/plugins/window/src/scripts/drag.js index 3b227bc6..2bcc3ee6 100644 --- a/plugins/window/src/scripts/drag.js +++ b/plugins/window/src/scripts/drag.js @@ -3,7 +3,7 @@ // SPDX-License-Identifier: MIT document.addEventListener("mousedown", (e) => { - if (e.target.hasAttribute("data-tauri-drag-region") && e.buttons === 1) { + if (e.target.hasAttribute("data-tauri-drag-region") && e.button === 0) { // prevents text cursor e.preventDefault(); // fix #2549: double click on drag region edge causes content to maximize without window sizing change