浏览代码

fix: use `button` property for `data-tauri-drag-region` mouse button detection, closes #7694 (#7746)

Jason Tsai 1 年之前
父节点
当前提交
0797a002ca
共有 2 个文件被更改,包括 6 次插入1 次删除
  1. 5 0
      .changes/tauri-tap-drag-region-detection.md
  2. 1 1
      core/tauri/scripts/core.js

+ 5 - 0
.changes/tauri-tap-drag-region-detection.md

@@ -0,0 +1,5 @@
+---
+'tauri': 'patch:bug'
+---
+
+On macOS, fixed tapping on custom title bar doesn't maximize the window.

+ 1 - 1
core/tauri/scripts/core.js

@@ -134,7 +134,7 @@
 
   // drag region
   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