@babylonjs/gui 9.24.0 → 9.26.0
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/2D/controls/colorpicker.pure.js +2 -2
- package/2D/controls/colorpicker.pure.js.map +1 -1
- package/2D/controls/container.pure.d.ts +9 -0
- package/2D/controls/container.pure.js +14 -2
- package/2D/controls/container.pure.js.map +1 -1
- package/2D/controls/control.pure.d.ts +26 -1
- package/2D/controls/control.pure.js +104 -71
- package/2D/controls/control.pure.js.map +1 -1
- package/2D/controls/flexPanel.d.ts +1 -0
- package/2D/controls/flexPanel.js +4 -0
- package/2D/controls/flexPanel.js.map +1 -0
- package/2D/controls/flexPanel.pure.d.ts +91 -0
- package/2D/controls/flexPanel.pure.js +318 -0
- package/2D/controls/flexPanel.pure.js.map +1 -0
- package/2D/controls/index.d.ts +1 -0
- package/2D/controls/index.js +1 -0
- package/2D/controls/index.js.map +1 -1
- package/2D/controls/inputText.pure.js +7 -6
- package/2D/controls/inputText.pure.js.map +1 -1
- package/2D/controls/inputTextArea.pure.js +14 -13
- package/2D/controls/inputTextArea.pure.js.map +1 -1
- package/2D/controls/line.pure.js +9 -9
- package/2D/controls/line.pure.js.map +1 -1
- package/2D/controls/pure.d.ts +1 -0
- package/2D/controls/pure.js +1 -0
- package/2D/controls/pure.js.map +1 -1
- package/2D/controls/sliders/baseSlider.js +11 -11
- package/2D/controls/sliders/baseSlider.js.map +1 -1
- package/2D/controls/sliders/imageScrollBar.js +3 -3
- package/2D/controls/sliders/imageScrollBar.js.map +1 -1
- package/2D/controls/sliders/scrollBar.pure.js +3 -3
- package/2D/controls/sliders/scrollBar.pure.js.map +1 -1
- package/2D/controls/stackPanel.pure.js +1 -1
- package/2D/controls/stackPanel.pure.js.map +1 -1
- package/2D/controls/textBlock.pure.js +10 -10
- package/2D/controls/textBlock.pure.js.map +1 -1
- package/2D/multiLinePoint.js +2 -2
- package/2D/multiLinePoint.js.map +1 -1
- package/2D/valueAndUnit.d.ts +15 -3
- package/2D/valueAndUnit.js +36 -11
- package/2D/valueAndUnit.js.map +1 -1
- package/package.json +3 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./flexPanel.pure.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flexPanel.js","sourceRoot":"","sources":["../../../../../dev/gui/src/2D/controls/flexPanel.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AAEjC,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,iBAAiB,EAAE,CAAC","sourcesContent":["export * from \"./flexPanel.pure\";\n\nimport { RegisterFlexPanel } from \"./flexPanel.pure\";\nRegisterFlexPanel();\n"]}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { Container } from "./container.pure.js";
|
|
2
|
+
import { type Control } from "./control.pure.js";
|
|
3
|
+
import { Measure } from "../measure.js";
|
|
4
|
+
/**
|
|
5
|
+
* Main-axis direction and ordering of a FlexPanel.
|
|
6
|
+
*/
|
|
7
|
+
export type FlexDirection = "row" | "row-reverse" | "column" | "column-reverse";
|
|
8
|
+
/**
|
|
9
|
+
* Whether overflowing items form additional lines, and their cross-axis order.
|
|
10
|
+
*/
|
|
11
|
+
export type FlexWrap = "nowrap" | "wrap" | "wrap-reverse";
|
|
12
|
+
/**
|
|
13
|
+
* Distribution of spare space along the main axis.
|
|
14
|
+
*/
|
|
15
|
+
export type FlexJustification = "flex-start" | "flex-end" | "center" | "space-between" | "space-around" | "space-evenly";
|
|
16
|
+
/**
|
|
17
|
+
* Alignment of items within each line. Stretch fills the line's cross-axis size.
|
|
18
|
+
*/
|
|
19
|
+
export type FlexAlignment = "flex-start" | "flex-end" | "center" | "stretch";
|
|
20
|
+
/**
|
|
21
|
+
* Distribution of lines along the cross axis.
|
|
22
|
+
*/
|
|
23
|
+
export type FlexContentAlignment = FlexJustification | "stretch";
|
|
24
|
+
/**
|
|
25
|
+
* Arranges controls in flexible rows or columns using their declared width/height as the basis.
|
|
26
|
+
* Supports wrapping, gaps, alignment and Control.flexGrow/flexShrink without rewriting child properties.
|
|
27
|
+
* The panel uses its declared size; intrinsic CSS sizing and baseline alignment are not supported.
|
|
28
|
+
*/
|
|
29
|
+
export declare class FlexPanel extends Container {
|
|
30
|
+
private _items;
|
|
31
|
+
private _lines;
|
|
32
|
+
private _boxes;
|
|
33
|
+
private _gap;
|
|
34
|
+
private _flexDirection;
|
|
35
|
+
/**
|
|
36
|
+
* Gets or sets the main axis and item direction. Defaults to row.
|
|
37
|
+
*/
|
|
38
|
+
get flexDirection(): FlexDirection;
|
|
39
|
+
set flexDirection(value: FlexDirection);
|
|
40
|
+
private _flexWrap;
|
|
41
|
+
/**
|
|
42
|
+
* Gets or sets line wrapping. Defaults to nowrap.
|
|
43
|
+
*/
|
|
44
|
+
get flexWrap(): FlexWrap;
|
|
45
|
+
set flexWrap(value: FlexWrap);
|
|
46
|
+
private _justifyContent;
|
|
47
|
+
/**
|
|
48
|
+
* Gets or sets the distribution of remaining main-axis space after flexing.
|
|
49
|
+
*/
|
|
50
|
+
get justifyContent(): FlexJustification;
|
|
51
|
+
set justifyContent(value: FlexJustification);
|
|
52
|
+
private _alignItems;
|
|
53
|
+
/**
|
|
54
|
+
* Gets or sets cross-axis alignment within each line. Stretch fills the line.
|
|
55
|
+
*/
|
|
56
|
+
get alignItems(): FlexAlignment;
|
|
57
|
+
set alignItems(value: FlexAlignment);
|
|
58
|
+
private _alignContent;
|
|
59
|
+
/**
|
|
60
|
+
* Gets or sets cross-axis line distribution when wrapping is enabled.
|
|
61
|
+
*/
|
|
62
|
+
get alignContent(): FlexContentAlignment;
|
|
63
|
+
set alignContent(value: FlexContentAlignment);
|
|
64
|
+
/**
|
|
65
|
+
* Gets or sets the gap between items and lines in px, em, rem, or percent of the main-axis size.
|
|
66
|
+
*/
|
|
67
|
+
get gap(): string | number;
|
|
68
|
+
set gap(value: string | number);
|
|
69
|
+
/**
|
|
70
|
+
* Creates a flex layout container.
|
|
71
|
+
* @param name defines the control name
|
|
72
|
+
*/
|
|
73
|
+
constructor(name?: string);
|
|
74
|
+
protected _getTypeName(): string;
|
|
75
|
+
/**
|
|
76
|
+
* Removes a control and releases its cached layout data.
|
|
77
|
+
* @param control defines the control to remove
|
|
78
|
+
* @returns the current panel
|
|
79
|
+
*/
|
|
80
|
+
removeControl(control: Control): FlexPanel;
|
|
81
|
+
/** @internal */
|
|
82
|
+
_getLayoutMeasureForChild(child: Control): Measure | null;
|
|
83
|
+
private _spacing;
|
|
84
|
+
private _offset;
|
|
85
|
+
private _resolveFlexibleLengths;
|
|
86
|
+
protected _beforeChildLayout(): void;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Registers FlexPanel for serialization. Safe to call repeatedly.
|
|
90
|
+
*/
|
|
91
|
+
export declare function RegisterFlexPanel(): void;
|
|
@@ -0,0 +1,318 @@
|
|
|
1
|
+
import { __esDecorate, __runInitializers } from "@babylonjs/core/tslib.es6.js";
|
|
2
|
+
import { Container } from "./container.pure.js";
|
|
3
|
+
import { Measure } from "../measure.js";
|
|
4
|
+
import { ValueAndUnit } from "../valueAndUnit.js";
|
|
5
|
+
import { RegisterClass } from "@babylonjs/core/Misc/typeStore.js";
|
|
6
|
+
import { serialize } from "@babylonjs/core/Misc/decorators.js";
|
|
7
|
+
/**
|
|
8
|
+
* Arranges controls in flexible rows or columns using their declared width/height as the basis.
|
|
9
|
+
* Supports wrapping, gaps, alignment and Control.flexGrow/flexShrink without rewriting child properties.
|
|
10
|
+
* The panel uses its declared size; intrinsic CSS sizing and baseline alignment are not supported.
|
|
11
|
+
*/
|
|
12
|
+
let FlexPanel = (() => {
|
|
13
|
+
var _a;
|
|
14
|
+
let _classSuper = Container;
|
|
15
|
+
let _instanceExtraInitializers = [];
|
|
16
|
+
let _get_flexDirection_decorators;
|
|
17
|
+
let _get_flexWrap_decorators;
|
|
18
|
+
let _get_justifyContent_decorators;
|
|
19
|
+
let _get_alignItems_decorators;
|
|
20
|
+
let _get_alignContent_decorators;
|
|
21
|
+
let _get_gap_decorators;
|
|
22
|
+
return _a = class FlexPanel extends _classSuper {
|
|
23
|
+
/**
|
|
24
|
+
* Gets or sets the main axis and item direction. Defaults to row.
|
|
25
|
+
*/
|
|
26
|
+
get flexDirection() {
|
|
27
|
+
return this._flexDirection;
|
|
28
|
+
}
|
|
29
|
+
set flexDirection(value) {
|
|
30
|
+
if (this._flexDirection !== value) {
|
|
31
|
+
this._flexDirection = value;
|
|
32
|
+
this._markAsDirty();
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Gets or sets line wrapping. Defaults to nowrap.
|
|
37
|
+
*/
|
|
38
|
+
get flexWrap() {
|
|
39
|
+
return this._flexWrap;
|
|
40
|
+
}
|
|
41
|
+
set flexWrap(value) {
|
|
42
|
+
if (this._flexWrap !== value) {
|
|
43
|
+
this._flexWrap = value;
|
|
44
|
+
this._markAsDirty();
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Gets or sets the distribution of remaining main-axis space after flexing.
|
|
49
|
+
*/
|
|
50
|
+
get justifyContent() {
|
|
51
|
+
return this._justifyContent;
|
|
52
|
+
}
|
|
53
|
+
set justifyContent(value) {
|
|
54
|
+
if (this._justifyContent !== value) {
|
|
55
|
+
this._justifyContent = value;
|
|
56
|
+
this._markAsDirty();
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Gets or sets cross-axis alignment within each line. Stretch fills the line.
|
|
61
|
+
*/
|
|
62
|
+
get alignItems() {
|
|
63
|
+
return this._alignItems;
|
|
64
|
+
}
|
|
65
|
+
set alignItems(value) {
|
|
66
|
+
if (this._alignItems !== value) {
|
|
67
|
+
this._alignItems = value;
|
|
68
|
+
this._markAsDirty();
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Gets or sets cross-axis line distribution when wrapping is enabled.
|
|
73
|
+
*/
|
|
74
|
+
get alignContent() {
|
|
75
|
+
return this._alignContent;
|
|
76
|
+
}
|
|
77
|
+
set alignContent(value) {
|
|
78
|
+
if (this._alignContent !== value) {
|
|
79
|
+
this._alignContent = value;
|
|
80
|
+
this._markAsDirty();
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Gets or sets the gap between items and lines in px, em, rem, or percent of the main-axis size.
|
|
85
|
+
*/
|
|
86
|
+
get gap() {
|
|
87
|
+
return this._gap.toString(this._host);
|
|
88
|
+
}
|
|
89
|
+
set gap(value) {
|
|
90
|
+
if (this._gap.fromString(value)) {
|
|
91
|
+
this._markAsDirty();
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Creates a flex layout container.
|
|
96
|
+
* @param name defines the control name
|
|
97
|
+
*/
|
|
98
|
+
constructor(name) {
|
|
99
|
+
super(name);
|
|
100
|
+
this._items = (__runInitializers(this, _instanceExtraInitializers), []);
|
|
101
|
+
this._lines = [];
|
|
102
|
+
this._boxes = new WeakMap();
|
|
103
|
+
this._gap = new ValueAndUnit(0, ValueAndUnit.UNITMODE_PIXEL, false);
|
|
104
|
+
this._flexDirection = "row";
|
|
105
|
+
this._flexWrap = "nowrap";
|
|
106
|
+
this._justifyContent = "flex-start";
|
|
107
|
+
this._alignItems = "flex-start";
|
|
108
|
+
this._alignContent = "stretch";
|
|
109
|
+
}
|
|
110
|
+
_getTypeName() {
|
|
111
|
+
return "FlexPanel";
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Removes a control and releases its cached layout data.
|
|
115
|
+
* @param control defines the control to remove
|
|
116
|
+
* @returns the current panel
|
|
117
|
+
*/
|
|
118
|
+
removeControl(control) {
|
|
119
|
+
this._boxes.delete(control);
|
|
120
|
+
this._items.length = 0;
|
|
121
|
+
this._lines.length = 0;
|
|
122
|
+
super.removeControl(control);
|
|
123
|
+
return this;
|
|
124
|
+
}
|
|
125
|
+
/** @internal */
|
|
126
|
+
_getLayoutMeasureForChild(child) {
|
|
127
|
+
return this._boxes.get(child) ?? null;
|
|
128
|
+
}
|
|
129
|
+
_spacing(alignment, free, count) {
|
|
130
|
+
if (free <= 0) {
|
|
131
|
+
return 0;
|
|
132
|
+
}
|
|
133
|
+
switch (alignment) {
|
|
134
|
+
case "space-between":
|
|
135
|
+
return count > 1 ? free / (count - 1) : 0;
|
|
136
|
+
case "space-around":
|
|
137
|
+
return count > 0 ? free / count : 0;
|
|
138
|
+
case "space-evenly":
|
|
139
|
+
return free / (count + 1);
|
|
140
|
+
default:
|
|
141
|
+
return 0;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
_offset(alignment, free, spacing) {
|
|
145
|
+
switch (alignment) {
|
|
146
|
+
case "flex-end":
|
|
147
|
+
return free;
|
|
148
|
+
case "center":
|
|
149
|
+
return free / 2;
|
|
150
|
+
case "space-around":
|
|
151
|
+
return spacing / 2;
|
|
152
|
+
case "space-evenly":
|
|
153
|
+
return spacing;
|
|
154
|
+
default:
|
|
155
|
+
return 0;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
_resolveFlexibleLengths(line, main) {
|
|
159
|
+
const free = main - line.basis;
|
|
160
|
+
let remaining = free;
|
|
161
|
+
let frozeItem;
|
|
162
|
+
do {
|
|
163
|
+
let weight = 0;
|
|
164
|
+
let factorSum = 0;
|
|
165
|
+
for (let i = line.start; i < line.end; i++) {
|
|
166
|
+
const entry = this._items[i];
|
|
167
|
+
if (entry.frozen) {
|
|
168
|
+
continue;
|
|
169
|
+
}
|
|
170
|
+
const factor = free >= 0 ? entry.control.flexGrow : entry.control.flexShrink;
|
|
171
|
+
weight += free >= 0 ? factor : factor * entry.basis;
|
|
172
|
+
factorSum += factor;
|
|
173
|
+
}
|
|
174
|
+
// Fractional factors limit distribution using the initial free space, even after freezing.
|
|
175
|
+
const distributable = free >= 0 ? Math.min(remaining, free * factorSum) : Math.max(remaining, free * factorSum);
|
|
176
|
+
frozeItem = false;
|
|
177
|
+
for (let i = line.start; i < line.end; i++) {
|
|
178
|
+
const entry = this._items[i];
|
|
179
|
+
if (entry.frozen) {
|
|
180
|
+
continue;
|
|
181
|
+
}
|
|
182
|
+
const share = free >= 0 ? entry.control.flexGrow : entry.control.flexShrink * entry.basis;
|
|
183
|
+
const size = entry.basis + (weight ? distributable * (share / weight) : 0);
|
|
184
|
+
entry.size = Math.max(0, size);
|
|
185
|
+
if (size < 0) {
|
|
186
|
+
entry.frozen = true;
|
|
187
|
+
remaining += entry.basis;
|
|
188
|
+
frozeItem = true;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
} while (frozeItem);
|
|
192
|
+
}
|
|
193
|
+
_beforeChildLayout() {
|
|
194
|
+
const row = this._flexDirection === "row" || this._flexDirection === "row-reverse";
|
|
195
|
+
const reverse = this._flexDirection === "row-reverse" || this._flexDirection === "column-reverse";
|
|
196
|
+
const reverseLines = this._flexWrap === "wrap-reverse";
|
|
197
|
+
const width = Math.max(0, this._measureForChildren.width - (this.descendantsOnlyPadding ? this.paddingLeftInPixels + this.paddingRightInPixels : 0));
|
|
198
|
+
const height = Math.max(0, this._measureForChildren.height - (this.descendantsOnlyPadding ? this.paddingTopInPixels + this.paddingBottomInPixels : 0));
|
|
199
|
+
const main = row ? width : height;
|
|
200
|
+
const cross = row ? height : width;
|
|
201
|
+
const gap = this._getValueInPixel(this._gap, main);
|
|
202
|
+
let count = 0;
|
|
203
|
+
let lineCount = 0;
|
|
204
|
+
let line;
|
|
205
|
+
for (const child of this._children) {
|
|
206
|
+
if (!child.isVisible || child.notRenderable) {
|
|
207
|
+
continue;
|
|
208
|
+
}
|
|
209
|
+
child._tempParentMeasure.copyFrom(this._measureForChildren);
|
|
210
|
+
const basis = Math.max(0, child._getValueInPixel(child.getDimension(row ? "width" : "height"), main));
|
|
211
|
+
const crossSize = Math.max(0, child._getValueInPixel(child.getDimension(row ? "height" : "width"), cross));
|
|
212
|
+
if (!line || (this._flexWrap !== "nowrap" && count > line.start && line.basis + gap + basis > main)) {
|
|
213
|
+
line = this._lines[lineCount] ?? (this._lines[lineCount] = { start: 0, end: 0, basis: 0, cross: 0 });
|
|
214
|
+
line.start = count;
|
|
215
|
+
line.end = count;
|
|
216
|
+
line.basis = 0;
|
|
217
|
+
line.cross = 0;
|
|
218
|
+
lineCount++;
|
|
219
|
+
}
|
|
220
|
+
line.basis += basis + (count > line.start ? gap : 0);
|
|
221
|
+
line.cross = Math.max(line.cross, crossSize);
|
|
222
|
+
line.end++;
|
|
223
|
+
const entry = this._items[count];
|
|
224
|
+
if (!entry) {
|
|
225
|
+
this._items[count] = { control: child, basis, cross: crossSize, size: basis, frozen: false };
|
|
226
|
+
}
|
|
227
|
+
else {
|
|
228
|
+
entry.control = child;
|
|
229
|
+
entry.basis = entry.size = basis;
|
|
230
|
+
entry.cross = crossSize;
|
|
231
|
+
entry.frozen = false;
|
|
232
|
+
}
|
|
233
|
+
count++;
|
|
234
|
+
}
|
|
235
|
+
this._items.length = count;
|
|
236
|
+
this._lines.length = lineCount;
|
|
237
|
+
let crossUsed = Math.max(0, lineCount - 1) * gap;
|
|
238
|
+
for (const current of this._lines) {
|
|
239
|
+
if (this._flexWrap === "nowrap") {
|
|
240
|
+
current.cross = cross;
|
|
241
|
+
}
|
|
242
|
+
crossUsed += current.cross;
|
|
243
|
+
}
|
|
244
|
+
const crossFree = cross - crossUsed;
|
|
245
|
+
const lineSpacing = this._spacing(this._alignContent, crossFree, lineCount);
|
|
246
|
+
const stretch = this._alignContent === "stretch" && crossFree > 0 && lineCount ? crossFree / lineCount : 0;
|
|
247
|
+
let crossPosition = this._flexWrap === "nowrap" ? 0 : this._offset(this._alignContent, crossFree, lineSpacing);
|
|
248
|
+
for (const current of this._lines) {
|
|
249
|
+
current.cross += stretch;
|
|
250
|
+
this._resolveFlexibleLengths(current, main);
|
|
251
|
+
let used = Math.max(0, current.end - current.start - 1) * gap;
|
|
252
|
+
for (let i = current.start; i < current.end; i++) {
|
|
253
|
+
used += this._items[i].size;
|
|
254
|
+
}
|
|
255
|
+
const remaining = main - used;
|
|
256
|
+
const spacing = this._spacing(this._justifyContent, remaining, current.end - current.start);
|
|
257
|
+
let position = this._offset(this._justifyContent, remaining, spacing);
|
|
258
|
+
for (let i = current.start; i < current.end; i++) {
|
|
259
|
+
const entry = this._items[i];
|
|
260
|
+
const child = entry.control;
|
|
261
|
+
const childCross = this._alignItems === "stretch" ? current.cross : entry.cross;
|
|
262
|
+
const extra = current.cross - childCross;
|
|
263
|
+
let childCrossPosition = crossPosition + (this._alignItems === "center" ? extra / 2 : this._alignItems === "flex-end" ? extra : 0);
|
|
264
|
+
if (reverseLines) {
|
|
265
|
+
childCrossPosition = cross - childCrossPosition - childCross;
|
|
266
|
+
}
|
|
267
|
+
const childMainPosition = reverse ? main - position - entry.size : position;
|
|
268
|
+
const left = row ? childMainPosition : childCrossPosition;
|
|
269
|
+
const top = row ? childCrossPosition : childMainPosition;
|
|
270
|
+
const childWidth = row ? entry.size : childCross;
|
|
271
|
+
const childHeight = row ? childCross : entry.size;
|
|
272
|
+
let box = this._boxes.get(child);
|
|
273
|
+
if (!box) {
|
|
274
|
+
box = new Measure(left, top, childWidth, childHeight);
|
|
275
|
+
this._boxes.set(child, box);
|
|
276
|
+
child._markAsDirty();
|
|
277
|
+
}
|
|
278
|
+
else if (box.left !== left || box.top !== top || box.width !== childWidth || box.height !== childHeight) {
|
|
279
|
+
box.copyFromFloats(left, top, childWidth, childHeight);
|
|
280
|
+
child._markAsDirty();
|
|
281
|
+
}
|
|
282
|
+
position += entry.size + gap + spacing;
|
|
283
|
+
}
|
|
284
|
+
crossPosition += current.cross + gap + lineSpacing;
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
},
|
|
288
|
+
(() => {
|
|
289
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
290
|
+
_get_flexDirection_decorators = [serialize()];
|
|
291
|
+
_get_flexWrap_decorators = [serialize()];
|
|
292
|
+
_get_justifyContent_decorators = [serialize()];
|
|
293
|
+
_get_alignItems_decorators = [serialize()];
|
|
294
|
+
_get_alignContent_decorators = [serialize()];
|
|
295
|
+
_get_gap_decorators = [serialize()];
|
|
296
|
+
__esDecorate(_a, null, _get_flexDirection_decorators, { kind: "getter", name: "flexDirection", static: false, private: false, access: { has: obj => "flexDirection" in obj, get: obj => obj.flexDirection }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
297
|
+
__esDecorate(_a, null, _get_flexWrap_decorators, { kind: "getter", name: "flexWrap", static: false, private: false, access: { has: obj => "flexWrap" in obj, get: obj => obj.flexWrap }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
298
|
+
__esDecorate(_a, null, _get_justifyContent_decorators, { kind: "getter", name: "justifyContent", static: false, private: false, access: { has: obj => "justifyContent" in obj, get: obj => obj.justifyContent }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
299
|
+
__esDecorate(_a, null, _get_alignItems_decorators, { kind: "getter", name: "alignItems", static: false, private: false, access: { has: obj => "alignItems" in obj, get: obj => obj.alignItems }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
300
|
+
__esDecorate(_a, null, _get_alignContent_decorators, { kind: "getter", name: "alignContent", static: false, private: false, access: { has: obj => "alignContent" in obj, get: obj => obj.alignContent }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
301
|
+
__esDecorate(_a, null, _get_gap_decorators, { kind: "getter", name: "gap", static: false, private: false, access: { has: obj => "gap" in obj, get: obj => obj.gap }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
302
|
+
if (_metadata) Object.defineProperty(_a, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
303
|
+
})(),
|
|
304
|
+
_a;
|
|
305
|
+
})();
|
|
306
|
+
export { FlexPanel };
|
|
307
|
+
let _Registered = false;
|
|
308
|
+
/**
|
|
309
|
+
* Registers FlexPanel for serialization. Safe to call repeatedly.
|
|
310
|
+
*/
|
|
311
|
+
export function RegisterFlexPanel() {
|
|
312
|
+
if (_Registered) {
|
|
313
|
+
return;
|
|
314
|
+
}
|
|
315
|
+
_Registered = true;
|
|
316
|
+
RegisterClass("BABYLON.GUI.FlexPanel", FlexPanel);
|
|
317
|
+
}
|
|
318
|
+
//# sourceMappingURL=flexPanel.pure.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flexPanel.pure.js","sourceRoot":"","sources":["../../../../../dev/gui/src/2D/controls/flexPanel.pure.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE7C,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AA0BjD;;;;GAIG;IACU,SAAS;;sBAAS,SAAS;;;;;;;;sBAA3B,SAAU,SAAQ,WAAS;YAOpC;;eAEG;YAEH,IAAW,aAAa;gBACpB,OAAO,IAAI,CAAC,cAAc,CAAC;YAC/B,CAAC;YACD,IAAW,aAAa,CAAC,KAAoB;gBACzC,IAAI,IAAI,CAAC,cAAc,KAAK,KAAK,EAAE,CAAC;oBAChC,IAAI,CAAC,cAAc,GAAG,KAAK,CAAC;oBAC5B,IAAI,CAAC,YAAY,EAAE,CAAC;gBACxB,CAAC;YACL,CAAC;YAGD;;eAEG;YAEH,IAAW,QAAQ;gBACf,OAAO,IAAI,CAAC,SAAS,CAAC;YAC1B,CAAC;YACD,IAAW,QAAQ,CAAC,KAAe;gBAC/B,IAAI,IAAI,CAAC,SAAS,KAAK,KAAK,EAAE,CAAC;oBAC3B,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;oBACvB,IAAI,CAAC,YAAY,EAAE,CAAC;gBACxB,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AC7B,IAAI,WAAW,EAAE,CAAC;QACd,OAAO;IACX,CAAC;IACD,WAAW,GAAG,IAAI,CAAC;IACnB,aAAa,CAAC,uBAAuB,EAAE,SAAS,CAAC,CAAC;AACtD,CAAC","sourcesContent":["import { Container } from \"./container.pure\";\nimport { type Control } from \"./control.pure\";\nimport { Measure } from \"../measure\";\nimport { ValueAndUnit } from \"../valueAndUnit\";\nimport { RegisterClass } from \"core/Misc/typeStore\";\nimport { serialize } from \"core/Misc/decorators\";\n\n/**\n * Main-axis direction and ordering of a FlexPanel.\n */\nexport type FlexDirection = \"row\" | \"row-reverse\" | \"column\" | \"column-reverse\";\n/**\n * Whether overflowing items form additional lines, and their cross-axis order.\n */\nexport type FlexWrap = \"nowrap\" | \"wrap\" | \"wrap-reverse\";\n/**\n * Distribution of spare space along the main axis.\n */\nexport type FlexJustification = \"flex-start\" | \"flex-end\" | \"center\" | \"space-between\" | \"space-around\" | \"space-evenly\";\n/**\n * Alignment of items within each line. Stretch fills the line's cross-axis size.\n */\nexport type FlexAlignment = \"flex-start\" | \"flex-end\" | \"center\" | \"stretch\";\n/**\n * Distribution of lines along the cross axis.\n */\nexport type FlexContentAlignment = FlexJustification | \"stretch\";\n\ntype FlexItem = { control: Control; basis: number; cross: number; size: number; frozen: boolean };\ntype FlexLine = { start: number; end: number; basis: number; cross: number };\n\n/**\n * Arranges controls in flexible rows or columns using their declared width/height as the basis.\n * Supports wrapping, gaps, alignment and Control.flexGrow/flexShrink without rewriting child properties.\n * The panel uses its declared size; intrinsic CSS sizing and baseline alignment are not supported.\n */\nexport class FlexPanel extends Container {\n private _items: FlexItem[] = [];\n private _lines: FlexLine[] = [];\n private _boxes = new WeakMap<Control, Measure>();\n private _gap = new ValueAndUnit(0, ValueAndUnit.UNITMODE_PIXEL, false);\n\n private _flexDirection: FlexDirection = \"row\";\n /**\n * Gets or sets the main axis and item direction. Defaults to row.\n */\n @serialize()\n public get flexDirection(): FlexDirection {\n return this._flexDirection;\n }\n public set flexDirection(value: FlexDirection) {\n if (this._flexDirection !== value) {\n this._flexDirection = value;\n this._markAsDirty();\n }\n }\n\n private _flexWrap: FlexWrap = \"nowrap\";\n /**\n * Gets or sets line wrapping. Defaults to nowrap.\n */\n @serialize()\n public get flexWrap(): FlexWrap {\n return this._flexWrap;\n }\n public set flexWrap(value: FlexWrap) {\n if (this._flexWrap !== value) {\n this._flexWrap = value;\n this._markAsDirty();\n }\n }\n\n private _justifyContent: FlexJustification = \"flex-start\";\n /**\n * Gets or sets the distribution of remaining main-axis space after flexing.\n */\n @serialize()\n public get justifyContent(): FlexJustification {\n return this._justifyContent;\n }\n public set justifyContent(value: FlexJustification) {\n if (this._justifyContent !== value) {\n this._justifyContent = value;\n this._markAsDirty();\n }\n }\n\n private _alignItems: FlexAlignment = \"flex-start\";\n /**\n * Gets or sets cross-axis alignment within each line. Stretch fills the line.\n */\n @serialize()\n public get alignItems(): FlexAlignment {\n return this._alignItems;\n }\n public set alignItems(value: FlexAlignment) {\n if (this._alignItems !== value) {\n this._alignItems = value;\n this._markAsDirty();\n }\n }\n\n private _alignContent: FlexContentAlignment = \"stretch\";\n /**\n * Gets or sets cross-axis line distribution when wrapping is enabled.\n */\n @serialize()\n public get alignContent(): FlexContentAlignment {\n return this._alignContent;\n }\n public set alignContent(value: FlexContentAlignment) {\n if (this._alignContent !== value) {\n this._alignContent = value;\n this._markAsDirty();\n }\n }\n\n /**\n * Gets or sets the gap between items and lines in px, em, rem, or percent of the main-axis size.\n */\n @serialize()\n public get gap(): string | number {\n return this._gap.toString(this._host);\n }\n public set gap(value: string | number) {\n if (this._gap.fromString(value)) {\n this._markAsDirty();\n }\n }\n\n /**\n * Creates a flex layout container.\n * @param name defines the control name\n */\n constructor(name?: string) {\n super(name);\n }\n\n protected override _getTypeName(): string {\n return \"FlexPanel\";\n }\n\n /**\n * Removes a control and releases its cached layout data.\n * @param control defines the control to remove\n * @returns the current panel\n */\n public override removeControl(control: Control): FlexPanel {\n this._boxes.delete(control);\n this._items.length = 0;\n this._lines.length = 0;\n super.removeControl(control);\n return this;\n }\n\n /** @internal */\n public override _getLayoutMeasureForChild(child: Control): Measure | null {\n return this._boxes.get(child) ?? null;\n }\n\n private _spacing(alignment: FlexContentAlignment, free: number, count: number): number {\n if (free <= 0) {\n return 0;\n }\n switch (alignment) {\n case \"space-between\":\n return count > 1 ? free / (count - 1) : 0;\n case \"space-around\":\n return count > 0 ? free / count : 0;\n case \"space-evenly\":\n return free / (count + 1);\n default:\n return 0;\n }\n }\n\n private _offset(alignment: FlexContentAlignment, free: number, spacing: number): number {\n switch (alignment) {\n case \"flex-end\":\n return free;\n case \"center\":\n return free / 2;\n case \"space-around\":\n return spacing / 2;\n case \"space-evenly\":\n return spacing;\n default:\n return 0;\n }\n }\n\n private _resolveFlexibleLengths(line: FlexLine, main: number): void {\n const free = main - line.basis;\n let remaining = free;\n let frozeItem: boolean;\n do {\n let weight = 0;\n let factorSum = 0;\n for (let i = line.start; i < line.end; i++) {\n const entry = this._items[i];\n if (entry.frozen) {\n continue;\n }\n const factor = free >= 0 ? entry.control.flexGrow : entry.control.flexShrink;\n weight += free >= 0 ? factor : factor * entry.basis;\n factorSum += factor;\n }\n // Fractional factors limit distribution using the initial free space, even after freezing.\n const distributable = free >= 0 ? Math.min(remaining, free * factorSum) : Math.max(remaining, free * factorSum);\n frozeItem = false;\n for (let i = line.start; i < line.end; i++) {\n const entry = this._items[i];\n if (entry.frozen) {\n continue;\n }\n const share = free >= 0 ? entry.control.flexGrow : entry.control.flexShrink * entry.basis;\n const size = entry.basis + (weight ? distributable * (share / weight) : 0);\n entry.size = Math.max(0, size);\n if (size < 0) {\n entry.frozen = true;\n remaining += entry.basis;\n frozeItem = true;\n }\n }\n } while (frozeItem);\n }\n\n protected override _beforeChildLayout(): void {\n const row = this._flexDirection === \"row\" || this._flexDirection === \"row-reverse\";\n const reverse = this._flexDirection === \"row-reverse\" || this._flexDirection === \"column-reverse\";\n const reverseLines = this._flexWrap === \"wrap-reverse\";\n const width = Math.max(0, this._measureForChildren.width - (this.descendantsOnlyPadding ? this.paddingLeftInPixels + this.paddingRightInPixels : 0));\n const height = Math.max(0, this._measureForChildren.height - (this.descendantsOnlyPadding ? this.paddingTopInPixels + this.paddingBottomInPixels : 0));\n const main = row ? width : height;\n const cross = row ? height : width;\n const gap = this._getValueInPixel(this._gap, main);\n let count = 0;\n let lineCount = 0;\n let line: FlexLine | undefined;\n for (const child of this._children) {\n if (!child.isVisible || child.notRenderable) {\n continue;\n }\n child._tempParentMeasure.copyFrom(this._measureForChildren);\n const basis = Math.max(0, child._getValueInPixel(child.getDimension(row ? \"width\" : \"height\"), main));\n const crossSize = Math.max(0, child._getValueInPixel(child.getDimension(row ? \"height\" : \"width\"), cross));\n if (!line || (this._flexWrap !== \"nowrap\" && count > line.start && line.basis + gap + basis > main)) {\n line = this._lines[lineCount] ?? (this._lines[lineCount] = { start: 0, end: 0, basis: 0, cross: 0 });\n line.start = count;\n line.end = count;\n line.basis = 0;\n line.cross = 0;\n lineCount++;\n }\n line.basis += basis + (count > line.start ? gap : 0);\n line.cross = Math.max(line.cross, crossSize);\n line.end++;\n const entry = this._items[count];\n if (!entry) {\n this._items[count] = { control: child, basis, cross: crossSize, size: basis, frozen: false };\n } else {\n entry.control = child;\n entry.basis = entry.size = basis;\n entry.cross = crossSize;\n entry.frozen = false;\n }\n count++;\n }\n this._items.length = count;\n this._lines.length = lineCount;\n let crossUsed = Math.max(0, lineCount - 1) * gap;\n for (const current of this._lines) {\n if (this._flexWrap === \"nowrap\") {\n current.cross = cross;\n }\n crossUsed += current.cross;\n }\n const crossFree = cross - crossUsed;\n const lineSpacing = this._spacing(this._alignContent, crossFree, lineCount);\n const stretch = this._alignContent === \"stretch\" && crossFree > 0 && lineCount ? crossFree / lineCount : 0;\n let crossPosition = this._flexWrap === \"nowrap\" ? 0 : this._offset(this._alignContent, crossFree, lineSpacing);\n for (const current of this._lines) {\n current.cross += stretch;\n this._resolveFlexibleLengths(current, main);\n let used = Math.max(0, current.end - current.start - 1) * gap;\n for (let i = current.start; i < current.end; i++) {\n used += this._items[i].size;\n }\n const remaining = main - used;\n const spacing = this._spacing(this._justifyContent, remaining, current.end - current.start);\n let position = this._offset(this._justifyContent, remaining, spacing);\n for (let i = current.start; i < current.end; i++) {\n const entry = this._items[i];\n const child = entry.control;\n const childCross = this._alignItems === \"stretch\" ? current.cross : entry.cross;\n const extra = current.cross - childCross;\n let childCrossPosition = crossPosition + (this._alignItems === \"center\" ? extra / 2 : this._alignItems === \"flex-end\" ? extra : 0);\n if (reverseLines) {\n childCrossPosition = cross - childCrossPosition - childCross;\n }\n const childMainPosition = reverse ? main - position - entry.size : position;\n const left = row ? childMainPosition : childCrossPosition;\n const top = row ? childCrossPosition : childMainPosition;\n const childWidth = row ? entry.size : childCross;\n const childHeight = row ? childCross : entry.size;\n let box = this._boxes.get(child);\n if (!box) {\n box = new Measure(left, top, childWidth, childHeight);\n this._boxes.set(child, box);\n child._markAsDirty();\n } else if (box.left !== left || box.top !== top || box.width !== childWidth || box.height !== childHeight) {\n box.copyFromFloats(left, top, childWidth, childHeight);\n child._markAsDirty();\n }\n position += entry.size + gap + spacing;\n }\n crossPosition += current.cross + gap + lineSpacing;\n }\n }\n}\n\nlet _Registered = false;\n/**\n * Registers FlexPanel for serialization. Safe to call repeatedly.\n */\nexport function RegisterFlexPanel(): void {\n if (_Registered) {\n return;\n }\n _Registered = true;\n RegisterClass(\"BABYLON.GUI.FlexPanel\", FlexPanel);\n}\n"]}
|
package/2D/controls/index.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export * from "./ellipse.js";
|
|
|
7
7
|
export * from "./focusableButton.js";
|
|
8
8
|
export * from "./focusableControl.js";
|
|
9
9
|
export * from "./grid.js";
|
|
10
|
+
export * from "./flexPanel.js";
|
|
10
11
|
export * from "./image.js";
|
|
11
12
|
export * from "./inputText.js";
|
|
12
13
|
export * from "./inputTextArea.js";
|
package/2D/controls/index.js
CHANGED
|
@@ -7,6 +7,7 @@ export * from "./ellipse.js";
|
|
|
7
7
|
export * from "./focusableButton.js";
|
|
8
8
|
export * from "./focusableControl.js";
|
|
9
9
|
export * from "./grid.js";
|
|
10
|
+
export * from "./flexPanel.js";
|
|
10
11
|
export * from "./image.js";
|
|
11
12
|
export * from "./inputText.js";
|
|
12
13
|
export * from "./inputTextArea.js";
|
package/2D/controls/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../dev/gui/src/2D/controls/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,8BAA8B,CAAC;AAC7C,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,WAAW,CAAC;AAC1B,cAAc,yBAAyB,CAAC;AACxC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC","sourcesContent":["export * from \"./button\";\r\nexport * from \"./checkbox\";\r\nexport * from \"./colorpicker\";\r\nexport * from \"./container\";\r\nexport * from \"./control\";\r\nexport * from \"./ellipse\";\r\nexport * from \"./focusableButton\";\r\nexport * from \"./focusableControl\";\r\nexport * from \"./grid\";\r\nexport * from \"./image\";\r\nexport * from \"./inputText\";\r\nexport * from \"./inputTextArea\";\r\nexport * from \"./inputPassword\";\r\nexport * from \"./line\";\r\nexport * from \"./multiLine\";\r\nexport * from \"./radioButton\";\r\nexport * from \"./stackPanel\";\r\nexport * from \"./selector\";\r\nexport * from \"./scrollViewers/scrollViewer\";\r\nexport * from \"./textBlock\";\r\nexport * from \"./textWrapper\";\r\nexport * from \"./toggleButton\";\r\nexport * from \"./virtualKeyboard\";\r\nexport * from \"./rectangle\";\r\nexport * from \"./displayGrid\";\r\nexport * from \"./sliders/baseSlider\";\r\nexport * from \"./sliders/slider\";\r\nexport * from \"./sliders/imageBasedSlider\";\r\nexport * from \"./sliders/scrollBar\";\r\nexport * from \"./sliders/imageScrollBar\";\r\nexport * from \"./statics\";\r\nexport * from \"./gradient/BaseGradient\";\r\nexport * from \"./gradient/LinearGradient\";\r\nexport * from \"./gradient/RadialGradient\";\r\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../dev/gui/src/2D/controls/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,8BAA8B,CAAC;AAC7C,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,WAAW,CAAC;AAC1B,cAAc,yBAAyB,CAAC;AACxC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC","sourcesContent":["export * from \"./button\";\r\nexport * from \"./checkbox\";\r\nexport * from \"./colorpicker\";\r\nexport * from \"./container\";\r\nexport * from \"./control\";\r\nexport * from \"./ellipse\";\r\nexport * from \"./focusableButton\";\r\nexport * from \"./focusableControl\";\r\nexport * from \"./grid\";\r\nexport * from \"./flexPanel\";\r\nexport * from \"./image\";\r\nexport * from \"./inputText\";\r\nexport * from \"./inputTextArea\";\r\nexport * from \"./inputPassword\";\r\nexport * from \"./line\";\r\nexport * from \"./multiLine\";\r\nexport * from \"./radioButton\";\r\nexport * from \"./stackPanel\";\r\nexport * from \"./selector\";\r\nexport * from \"./scrollViewers/scrollViewer\";\r\nexport * from \"./textBlock\";\r\nexport * from \"./textWrapper\";\r\nexport * from \"./toggleButton\";\r\nexport * from \"./virtualKeyboard\";\r\nexport * from \"./rectangle\";\r\nexport * from \"./displayGrid\";\r\nexport * from \"./sliders/baseSlider\";\r\nexport * from \"./sliders/slider\";\r\nexport * from \"./sliders/imageBasedSlider\";\r\nexport * from \"./sliders/scrollBar\";\r\nexport * from \"./sliders/imageScrollBar\";\r\nexport * from \"./statics\";\r\nexport * from \"./gradient/BaseGradient\";\r\nexport * from \"./gradient/LinearGradient\";\r\nexport * from \"./gradient/RadialGradient\";\r\n"]}
|
|
@@ -68,7 +68,7 @@ let InputText = (() => {
|
|
|
68
68
|
}
|
|
69
69
|
/** Gets the maximum width allowed by the control in pixels */
|
|
70
70
|
get maxWidthInPixels() {
|
|
71
|
-
return this.
|
|
71
|
+
return this._getValueInPixel(this._maxWidth, this._cachedParentMeasure.width);
|
|
72
72
|
}
|
|
73
73
|
set maxWidth(value) {
|
|
74
74
|
if (this._maxWidth.toString(this._host) === value) {
|
|
@@ -129,7 +129,7 @@ let InputText = (() => {
|
|
|
129
129
|
}
|
|
130
130
|
/** Gets control margin in pixels */
|
|
131
131
|
get marginInPixels() {
|
|
132
|
-
return this.
|
|
132
|
+
return this._getValueInPixel(this._margin, this._cachedParentMeasure.width);
|
|
133
133
|
}
|
|
134
134
|
set margin(value) {
|
|
135
135
|
if (this._margin.toString(this._host) === value) {
|
|
@@ -835,7 +835,7 @@ let InputText = (() => {
|
|
|
835
835
|
this._fontOffset = Control._GetFontOffset(context.font, this._host.getScene()?.getEngine());
|
|
836
836
|
}
|
|
837
837
|
// Text
|
|
838
|
-
const clipTextLeft = this._currentMeasure.left + this.
|
|
838
|
+
const clipTextLeft = this._currentMeasure.left + this._getValueInPixel(this._margin, this._tempParentMeasure.width);
|
|
839
839
|
if (this.color) {
|
|
840
840
|
context.fillStyle = this.color;
|
|
841
841
|
}
|
|
@@ -848,13 +848,14 @@ let InputText = (() => {
|
|
|
848
848
|
}
|
|
849
849
|
}
|
|
850
850
|
this._textWidth = context.measureText(text.text).width;
|
|
851
|
-
const marginWidth = this.
|
|
851
|
+
const marginWidth = this._getValueInPixel(this._margin, this._tempParentMeasure.width) * 2;
|
|
852
852
|
if (this._autoStretchWidth) {
|
|
853
|
-
this.width = Math.min(this.
|
|
853
|
+
this.width = Math.min(this._getValueInPixel(this._maxWidth, this._tempParentMeasure.width), this._textWidth + marginWidth) + "px";
|
|
854
854
|
this._autoStretchWidth = true; // setting the width will have reset _autoStretchWidth to false!
|
|
855
855
|
}
|
|
856
856
|
const rootY = this._fontOffset.ascent + (this._currentMeasure.height - this._fontOffset.height) / 2;
|
|
857
|
-
const
|
|
857
|
+
const allocatedWidth = this.parent?._getLayoutMeasureForChild(this)?.width;
|
|
858
|
+
const availableWidth = (allocatedWidth ?? this._getValueInPixel(this._width, this._tempParentMeasure.width)) - marginWidth;
|
|
858
859
|
context.save();
|
|
859
860
|
context.beginPath();
|
|
860
861
|
context.rect(clipTextLeft, this._currentMeasure.top + (this._currentMeasure.height - this._fontOffset.height) / 2, availableWidth + 2, this._currentMeasure.height);
|