@effindomv2/fui-as 0.1.47 → 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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@effindomv2/fui-as",
3
- "version": "0.1.47",
3
+ "version": "0.1.49",
4
4
  "private": false,
5
5
  "license": "AGPL-3.0-only OR LicenseRef-EffinDom-Commercial",
6
6
  "description": "EffinDom v2 AssemblyScript frontend framework SDK and browser harness",
@@ -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 == 0 || event.pointerType == 2 || event.pointerType == 3;
32
+ return event.button == PointerButton.Primary || event.pointerType == PointerType.Touch || event.pointerType == PointerType.Pen;
33
33
  }
34
34
 
35
35
  enum MenuItemKind {
@@ -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 isPrimaryActivation = pending !== null
114
- ? this.isPrimaryActivationPointer(changetype<PointerEventArgs>(pending))
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 (!isPrimaryActivation) {
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 && isPrimaryActivation) {
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 isPrimaryActivationPointer(event: PointerEventArgs): bool {
201
- return event.button == 0 || event.pointerType == PointerType.Touch || event.pointerType == PointerType.Pen;
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 {
@@ -2,6 +2,7 @@ import { HandlerAction } from "../core/Action";
2
2
  import { Disposable, disposeAll } from "../core/Disposable";
3
3
  import { Theme, activeTheme } from "../core/Theme";
4
4
  import { warn } from "../core/Logger";
5
+ import { FlexDirection, JustifyContent, Orientation } from "../core/ffi";
5
6
  import { FlexBox } from "../nodes";
6
7
 
7
8
  function clamp(value: f32, min: f32, max: f32): f32 {
@@ -23,6 +24,7 @@ export class ProgressBar extends FlexBox {
23
24
  private currentValue: f32 = 0.0;
24
25
  private lengthValue: f32 = 220.0;
25
26
  private thicknessValue: f32 = 14.0;
27
+ private orientationValue: Orientation = Orientation.Horizontal;
26
28
  private trackColorValue: u32 = 0;
27
29
  private fillColorValue: u32 = 0;
28
30
  private trackColorOverridden: bool = false;
@@ -33,6 +35,7 @@ export class ProgressBar extends FlexBox {
33
35
  super();
34
36
  this.fillNode = new FlexBox();
35
37
  this.child(this.fillNode);
38
+ this.semanticOrientation(Orientation.Horizontal);
36
39
  this.track(activeTheme.addAction(new HandlerAction<ProgressBar, Theme>(this, (bar: ProgressBar, _theme: Theme): void => {
37
40
  bar.handleThemeChanged();
38
41
  })));
@@ -89,6 +92,15 @@ export class ProgressBar extends FlexBox {
89
92
  return this;
90
93
  }
91
94
 
95
+ orientation(value: Orientation): this {
96
+ this.orientationValue = value == Orientation.Vertical
97
+ ? Orientation.Vertical
98
+ : Orientation.Horizontal;
99
+ this.semanticOrientation(this.orientationValue);
100
+ this.syncGeometry();
101
+ return this;
102
+ }
103
+
92
104
  trackColor(color: u32): this {
93
105
  this.trackColorOverridden = true;
94
106
  this.trackColorValue = color;
@@ -128,10 +140,21 @@ export class ProgressBar extends FlexBox {
128
140
  const range = this.maxValue - this.minValue;
129
141
  const fraction = range > 0.0 ? clamp((this.currentValue - this.minValue) / range, 0.0, 1.0) : 0.0;
130
142
  const fillLength = this.lengthValue * fraction;
131
- this.width(this.lengthValue);
132
- this.height(this.thicknessValue);
133
- this.fillNode.width(fillLength);
134
- this.fillNode.height(this.thicknessValue);
143
+ if (this.orientationValue == Orientation.Vertical) {
144
+ this.flexDirection(FlexDirection.Column);
145
+ this.justifyContent(JustifyContent.End);
146
+ this.width(this.thicknessValue);
147
+ this.height(this.lengthValue);
148
+ this.fillNode.width(this.thicknessValue);
149
+ this.fillNode.height(fillLength);
150
+ } else {
151
+ this.flexDirection(FlexDirection.Row);
152
+ this.justifyContent(JustifyContent.Start);
153
+ this.width(this.lengthValue);
154
+ this.height(this.thicknessValue);
155
+ this.fillNode.width(fillLength);
156
+ this.fillNode.height(this.thicknessValue);
157
+ }
135
158
  this.semanticValueRange(this.currentValue, this.minValue, this.maxValue);
136
159
  this.syncSemanticLabel();
137
160
  }
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 == 0 || event.pointerType == PointerType.Touch || event.pointerType == PointerType.Pen;
80
+ return event.button == PointerButton.Primary || event.pointerType == PointerType.Touch || event.pointerType == PointerType.Pen;
81
81
  }
82
82
 
83
83
  export enum GestureIntent {