@effindomv2/fui-as 0.1.48 → 0.1.49
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.
- package/package.json +1 -1
- package/src/controls/ContextMenu.ts +2 -2
- package/src/controls/NavLink.ts +16 -9
- package/src/core/Node.ts +1 -1
package/package.json
CHANGED
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
import { HandlerAction } from "../core/Action";
|
|
17
17
|
import { Disposable, disposeAll } from "../core/Disposable";
|
|
18
18
|
import { navigateTo } from "../core/Navigation";
|
|
19
|
-
import { Node, PointerEventArgs, VisibilityChangedEventArgs } from "../core/Node";
|
|
19
|
+
import { Node, PointerButton, PointerEventArgs, PointerType, VisibilityChangedEventArgs } from "../core/Node";
|
|
20
20
|
import { Theme, activeTheme } from "../core/Theme";
|
|
21
21
|
import { warn } from "../core/Logger";
|
|
22
22
|
import { FontFamily, FontStyle, FontWeight } from "../core/Typography";
|
|
@@ -29,7 +29,7 @@ const MENU_EDGE_PADDING: f32 = 8.0;
|
|
|
29
29
|
const DEFAULT_PANEL_BACKGROUND_BLUR_SIGMA: f32 = 10.0;
|
|
30
30
|
|
|
31
31
|
function isPrimaryActivationPointer(event: PointerEventArgs): bool {
|
|
32
|
-
return event.button ==
|
|
32
|
+
return event.button == PointerButton.Primary || event.pointerType == PointerType.Touch || event.pointerType == PointerType.Pen;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
enum MenuItemKind {
|
package/src/controls/NavLink.ts
CHANGED
|
@@ -12,7 +12,7 @@ import { Disposable, disposeAll } from "../core/Disposable";
|
|
|
12
12
|
import { FocusAdornerManager } from "../core/FocusAdornerManager";
|
|
13
13
|
import { keyboardFocusVisible } from "../core/FocusVisibility";
|
|
14
14
|
import { navigateTo } from "../core/Navigation";
|
|
15
|
-
import { PointerEventArgs, PointerType } from "../core/Node";
|
|
15
|
+
import { PointerButton, PointerEventArgs, PointerType } from "../core/Node";
|
|
16
16
|
import { hasPrimaryShortcutModifier } from "../core/Platform";
|
|
17
17
|
import { Theme, activeTheme } from "../core/Theme";
|
|
18
18
|
import { FlexBox, Text } from "../nodes";
|
|
@@ -110,9 +110,12 @@ export class NavLink extends FlexBox {
|
|
|
110
110
|
|
|
111
111
|
_handlePointerEvent(eventType: PointerEventType, x: f32, y: f32, modifiers: u32 = 0): void {
|
|
112
112
|
const pending = NavLink.pendingPointerEventArgs;
|
|
113
|
-
const
|
|
114
|
-
? this.
|
|
113
|
+
const isActivation = pending !== null
|
|
114
|
+
? this.isActivationPointer(changetype<PointerEventArgs>(pending))
|
|
115
115
|
: true;
|
|
116
|
+
const isMiddleClick = pending !== null
|
|
117
|
+
? this.isMiddleMouseButton(changetype<PointerEventArgs>(pending))
|
|
118
|
+
: false;
|
|
116
119
|
super._handlePointerEvent(eventType, x, y, modifiers);
|
|
117
120
|
if (eventType == PointerEventType.Enter) {
|
|
118
121
|
this.hovered = true;
|
|
@@ -131,18 +134,18 @@ export class NavLink extends FlexBox {
|
|
|
131
134
|
return;
|
|
132
135
|
}
|
|
133
136
|
if (eventType == PointerEventType.Down) {
|
|
134
|
-
if (!
|
|
137
|
+
if (!isActivation) {
|
|
135
138
|
this.pointerPressed = false;
|
|
136
139
|
this.pointerPressedOpenInNewTab = false;
|
|
137
140
|
return;
|
|
138
141
|
}
|
|
139
142
|
this.pointerPressed = true;
|
|
140
|
-
this.pointerPressedOpenInNewTab = this.shouldOpenInNewTab(modifiers);
|
|
143
|
+
this.pointerPressedOpenInNewTab = isMiddleClick || this.shouldOpenInNewTab(modifiers);
|
|
141
144
|
return;
|
|
142
145
|
}
|
|
143
|
-
if (eventType == PointerEventType.Up && this.pointerPressed &&
|
|
146
|
+
if (eventType == PointerEventType.Up && this.pointerPressed && isActivation) {
|
|
144
147
|
this.pointerPressed = false;
|
|
145
|
-
this.activate(this.pointerPressedOpenInNewTab || this.shouldOpenInNewTab(modifiers));
|
|
148
|
+
this.activate(isMiddleClick || this.pointerPressedOpenInNewTab || this.shouldOpenInNewTab(modifiers));
|
|
146
149
|
this.pointerPressedOpenInNewTab = false;
|
|
147
150
|
}
|
|
148
151
|
}
|
|
@@ -197,8 +200,12 @@ export class NavLink extends FlexBox {
|
|
|
197
200
|
return this.openInNewTabValue || hasPrimaryShortcutModifier(<KeyModifier>modifiers);
|
|
198
201
|
}
|
|
199
202
|
|
|
200
|
-
private
|
|
201
|
-
return event.
|
|
203
|
+
private isMiddleMouseButton(event: PointerEventArgs): bool {
|
|
204
|
+
return event.pointerType == PointerType.Mouse && event.button == PointerButton.Auxiliary;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
private isActivationPointer(event: PointerEventArgs): bool {
|
|
208
|
+
return event.button == PointerButton.Primary || this.isMiddleMouseButton(event) || event.pointerType == PointerType.Touch || event.pointerType == PointerType.Pen;
|
|
202
209
|
}
|
|
203
210
|
|
|
204
211
|
pinPreviewForContextMenu(): void {
|
package/src/core/Node.ts
CHANGED
|
@@ -77,7 +77,7 @@ export enum PointerButtons {
|
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
function isPrimaryActivationPointer(event: PointerEventArgs): bool {
|
|
80
|
-
return event.button ==
|
|
80
|
+
return event.button == PointerButton.Primary || event.pointerType == PointerType.Touch || event.pointerType == PointerType.Pen;
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
export enum GestureIntent {
|