From 70e535abd5410873862fb035b6b66f0fea1edde2 Mon Sep 17 00:00:00 2001 From: Jason Tsai Date: Tue, 5 Sep 2023 01:09:23 +0800 Subject: [PATCH] fix(window): use `button` property for `data-tauri-drag-region` left mouse button detection (#590) --- .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 000000000..66fcbaf72 --- /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 3b227bc6e..2bcc3ee61 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