@effindomv2/fui-as 0.1.47 → 0.1.48

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.48",
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",
@@ -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
  }