@wailsio/runtime 3.0.0-alpha2.117 → 3.0.0-alpha2.119

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/drag.js +21 -6
  2. package/package.json +1 -1
package/dist/drag.js CHANGED
@@ -7,7 +7,7 @@
7
7
  The electron alternative for Go
8
8
  (c) Lea Anthony 2019-present
9
9
  */
10
- import { invoke, IsWindows, IsLinux } from "./system.js";
10
+ import { invoke, IsWindows, IsLinux, IsMac } from "./system.js";
11
11
  import { GetFlag } from "./flags.js";
12
12
  import { canTrackButtons, eventTarget } from "./utils.js";
13
13
  // Setup
@@ -76,6 +76,16 @@ if (hasDOM) {
76
76
  }, 50);
77
77
  }
78
78
  function suppressEvent(event) {
79
+ if (event.type === "dblclick"
80
+ && IsMac()
81
+ && window === window.top
82
+ && isDraggableEvent(event)) {
83
+ event.stopImmediatePropagation();
84
+ event.stopPropagation();
85
+ event.preventDefault();
86
+ invoke("wails:drag:doubleclick");
87
+ return;
88
+ }
79
89
  // Suppress click events while resizing or dragging.
80
90
  if (dragging || resizing) {
81
91
  event.stopImmediatePropagation();
@@ -83,6 +93,15 @@ function suppressEvent(event) {
83
93
  event.preventDefault();
84
94
  }
85
95
  }
96
+ function isDraggableEvent(event) {
97
+ const target = eventTarget(event);
98
+ const style = window.getComputedStyle(target);
99
+ return (style.getPropertyValue("--wails-draggable").trim() === "drag"
100
+ && event.offsetX >= 0
101
+ && event.offsetX < target.clientWidth
102
+ && event.offsetY >= 0
103
+ && event.offsetY < target.clientHeight);
104
+ }
86
105
  // Use constants to avoid comparing strings multiple times.
87
106
  const MouseDown = 0;
88
107
  const MouseUp = 1;
@@ -167,13 +186,9 @@ function primaryDown(event) {
167
186
  return;
168
187
  }
169
188
  // Retrieve target element
170
- const target = eventTarget(event);
171
189
  // Ready to drag if the primary button was pressed for the first time on a draggable element.
172
190
  // Ignore clicks on the scrollbar.
173
- const style = window.getComputedStyle(target);
174
- canDrag = (style.getPropertyValue("--wails-draggable").trim() === "drag"
175
- && (event.offsetX - parseFloat(style.paddingLeft) < target.clientWidth
176
- && event.offsetY - parseFloat(style.paddingTop) < target.clientHeight));
191
+ canDrag = isDraggableEvent(event);
177
192
  }
178
193
  function primaryUp(event) {
179
194
  // Stop dragging and resizing.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@wailsio/runtime",
3
3
  "type": "module",
4
- "version": "3.0.0-alpha2.117",
4
+ "version": "3.0.0-alpha2.119",
5
5
  "description": "Wails Runtime",
6
6
  "types": "types/index.d.ts",
7
7
  "exports": {