@babylonjs/gui 5.20.0 → 5.22.1

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 (178) hide show
  1. package/2D/adtInstrumentation.js +70 -90
  2. package/2D/adtInstrumentation.js.map +1 -1
  3. package/2D/advancedDynamicTexture.d.ts +14 -0
  4. package/2D/advancedDynamicTexture.js +574 -620
  5. package/2D/advancedDynamicTexture.js.map +1 -1
  6. package/2D/controls/button.js +76 -90
  7. package/2D/controls/button.js.map +1 -1
  8. package/2D/controls/checkbox.js +86 -106
  9. package/2D/controls/checkbox.js.map +1 -1
  10. package/2D/controls/colorpicker.js +395 -415
  11. package/2D/controls/colorpicker.js.map +1 -1
  12. package/2D/controls/container.js +187 -230
  13. package/2D/controls/container.js.map +1 -1
  14. package/2D/controls/control.js +1073 -1353
  15. package/2D/controls/control.js.map +1 -1
  16. package/2D/controls/displayGrid.js +152 -196
  17. package/2D/controls/displayGrid.js.map +1 -1
  18. package/2D/controls/ellipse.js +32 -40
  19. package/2D/controls/ellipse.js.map +1 -1
  20. package/2D/controls/focusableButton.js +30 -35
  21. package/2D/controls/focusableButton.js.map +1 -1
  22. package/2D/controls/grid.js +172 -212
  23. package/2D/controls/grid.js.map +1 -1
  24. package/2D/controls/image.js +489 -592
  25. package/2D/controls/image.js.map +1 -1
  26. package/2D/controls/inputPassword.js +9 -16
  27. package/2D/controls/inputPassword.js.map +1 -1
  28. package/2D/controls/inputText.js +380 -467
  29. package/2D/controls/inputText.js.map +1 -1
  30. package/2D/controls/inputTextArea.js +234 -273
  31. package/2D/controls/inputTextArea.js.map +1 -1
  32. package/2D/controls/line.js +147 -198
  33. package/2D/controls/line.js.map +1 -1
  34. package/2D/controls/multiLine.js +87 -113
  35. package/2D/controls/multiLine.js.map +1 -1
  36. package/2D/controls/radioButton.js +106 -127
  37. package/2D/controls/radioButton.js.map +1 -1
  38. package/2D/controls/rectangle.js +60 -72
  39. package/2D/controls/rectangle.js.map +1 -1
  40. package/2D/controls/scrollViewers/scrollViewer.js +439 -543
  41. package/2D/controls/scrollViewers/scrollViewer.js.map +1 -1
  42. package/2D/controls/scrollViewers/scrollViewerWindow.js +99 -118
  43. package/2D/controls/scrollViewers/scrollViewerWindow.js.map +1 -1
  44. package/2D/controls/selector.js +241 -329
  45. package/2D/controls/selector.js.map +1 -1
  46. package/2D/controls/sliders/baseSlider.js +182 -230
  47. package/2D/controls/sliders/baseSlider.js.map +1 -1
  48. package/2D/controls/sliders/imageBasedSlider.js +86 -109
  49. package/2D/controls/sliders/imageBasedSlider.js.map +1 -1
  50. package/2D/controls/sliders/imageScrollBar.js +148 -178
  51. package/2D/controls/sliders/imageScrollBar.js.map +1 -1
  52. package/2D/controls/sliders/scrollBar.js +64 -80
  53. package/2D/controls/sliders/scrollBar.js.map +1 -1
  54. package/2D/controls/sliders/slider.js +91 -115
  55. package/2D/controls/sliders/slider.js.map +1 -1
  56. package/2D/controls/stackPanel.js +114 -135
  57. package/2D/controls/stackPanel.js.map +1 -1
  58. package/2D/controls/statics.js +5 -5
  59. package/2D/controls/statics.js.map +1 -1
  60. package/2D/controls/textBlock.js +322 -384
  61. package/2D/controls/textBlock.js.map +1 -1
  62. package/2D/controls/textWrapper.js +27 -41
  63. package/2D/controls/textWrapper.js.map +1 -1
  64. package/2D/controls/toggleButton.js +105 -121
  65. package/2D/controls/toggleButton.js.map +1 -1
  66. package/2D/controls/virtualKeyboard.js +101 -123
  67. package/2D/controls/virtualKeyboard.js.map +1 -1
  68. package/2D/math2D.js +62 -70
  69. package/2D/math2D.js.map +1 -1
  70. package/2D/measure.js +30 -32
  71. package/2D/measure.js.map +1 -1
  72. package/2D/multiLinePoint.js +71 -89
  73. package/2D/multiLinePoint.js.map +1 -1
  74. package/2D/style.js +55 -73
  75. package/2D/style.js.map +1 -1
  76. package/2D/valueAndUnit.js +71 -104
  77. package/2D/valueAndUnit.js.map +1 -1
  78. package/2D/xmlLoader.js +70 -84
  79. package/2D/xmlLoader.js.map +1 -1
  80. package/3D/behaviors/defaultBehavior.js +40 -59
  81. package/3D/behaviors/defaultBehavior.js.map +1 -1
  82. package/3D/controls/abstractButton3D.js +8 -12
  83. package/3D/controls/abstractButton3D.js.map +1 -1
  84. package/3D/controls/button3D.js +30 -35
  85. package/3D/controls/button3D.js.map +1 -1
  86. package/3D/controls/container3D.js +57 -71
  87. package/3D/controls/container3D.js.map +1 -1
  88. package/3D/controls/contentDisplay3D.js +47 -60
  89. package/3D/controls/contentDisplay3D.js.map +1 -1
  90. package/3D/controls/control3D.js +123 -158
  91. package/3D/controls/control3D.js.map +1 -1
  92. package/3D/controls/cylinderPanel.js +28 -38
  93. package/3D/controls/cylinderPanel.js.map +1 -1
  94. package/3D/controls/handMenu.js +20 -29
  95. package/3D/controls/handMenu.js.map +1 -1
  96. package/3D/controls/holographicBackplate.js +52 -72
  97. package/3D/controls/holographicBackplate.js.map +1 -1
  98. package/3D/controls/holographicButton.js +160 -200
  99. package/3D/controls/holographicButton.js.map +1 -1
  100. package/3D/controls/holographicSlate.js +176 -206
  101. package/3D/controls/holographicSlate.js.map +1 -1
  102. package/3D/controls/meshButton3D.js +24 -30
  103. package/3D/controls/meshButton3D.js.map +1 -1
  104. package/3D/controls/nearMenu.js +57 -71
  105. package/3D/controls/nearMenu.js.map +1 -1
  106. package/3D/controls/planePanel.js +6 -13
  107. package/3D/controls/planePanel.js.map +1 -1
  108. package/3D/controls/scatterPanel.js +43 -54
  109. package/3D/controls/scatterPanel.js.map +1 -1
  110. package/3D/controls/slider3D.js +168 -222
  111. package/3D/controls/slider3D.js.map +1 -1
  112. package/3D/controls/spherePanel.js +29 -39
  113. package/3D/controls/spherePanel.js.map +1 -1
  114. package/3D/controls/stackPanel3D.js +36 -49
  115. package/3D/controls/stackPanel3D.js.map +1 -1
  116. package/3D/controls/touchButton3D.js +126 -154
  117. package/3D/controls/touchButton3D.js.map +1 -1
  118. package/3D/controls/touchHolographicButton.js +223 -272
  119. package/3D/controls/touchHolographicButton.js.map +1 -1
  120. package/3D/controls/touchHolographicMenu.js +55 -66
  121. package/3D/controls/touchHolographicMenu.js.map +1 -1
  122. package/3D/controls/touchMeshButton3D.js +24 -30
  123. package/3D/controls/touchMeshButton3D.js.map +1 -1
  124. package/3D/controls/volumeBasedPanel.js +85 -107
  125. package/3D/controls/volumeBasedPanel.js.map +1 -1
  126. package/3D/gizmos/gizmoHandle.js +68 -103
  127. package/3D/gizmos/gizmoHandle.js.map +1 -1
  128. package/3D/gizmos/slateGizmo.js +165 -182
  129. package/3D/gizmos/slateGizmo.js.map +1 -1
  130. package/3D/gui3DManager.js +76 -101
  131. package/3D/gui3DManager.js.map +1 -1
  132. package/3D/materials/fluent/fluentMaterial.js +110 -119
  133. package/3D/materials/fluent/fluentMaterial.js.map +1 -1
  134. package/3D/materials/fluent/shaders/fluent.fragment.js +20 -3
  135. package/3D/materials/fluent/shaders/fluent.fragment.js.map +1 -1
  136. package/3D/materials/fluent/shaders/fluent.vertex.js +11 -3
  137. package/3D/materials/fluent/shaders/fluent.vertex.js.map +1 -1
  138. package/3D/materials/fluentBackplate/fluentBackplateMaterial.js +168 -177
  139. package/3D/materials/fluentBackplate/fluentBackplateMaterial.js.map +1 -1
  140. package/3D/materials/fluentBackplate/shaders/fluentBackplate.fragment.js +9 -3
  141. package/3D/materials/fluentBackplate/shaders/fluentBackplate.fragment.js.map +1 -1
  142. package/3D/materials/fluentBackplate/shaders/fluentBackplate.vertex.js +15 -3
  143. package/3D/materials/fluentBackplate/shaders/fluentBackplate.vertex.js.map +1 -1
  144. package/3D/materials/fluentButton/fluentButtonMaterial.js +205 -213
  145. package/3D/materials/fluentButton/fluentButtonMaterial.js.map +1 -1
  146. package/3D/materials/fluentButton/shaders/fluentButton.fragment.js +6 -3
  147. package/3D/materials/fluentButton/shaders/fluentButton.fragment.js.map +1 -1
  148. package/3D/materials/fluentButton/shaders/fluentButton.vertex.js +6 -3
  149. package/3D/materials/fluentButton/shaders/fluentButton.vertex.js.map +1 -1
  150. package/3D/materials/handle/handleMaterial.js +56 -69
  151. package/3D/materials/handle/handleMaterial.js.map +1 -1
  152. package/3D/materials/handle/shaders/handle.fragment.js +3 -3
  153. package/3D/materials/handle/shaders/handle.fragment.js.map +1 -1
  154. package/3D/materials/handle/shaders/handle.vertex.js +3 -3
  155. package/3D/materials/handle/shaders/handle.vertex.js.map +1 -1
  156. package/3D/materials/mrdl/mrdlBackplateMaterial.js +158 -166
  157. package/3D/materials/mrdl/mrdlBackplateMaterial.js.map +1 -1
  158. package/3D/materials/mrdl/mrdlSliderBarMaterial.js +322 -330
  159. package/3D/materials/mrdl/mrdlSliderBarMaterial.js.map +1 -1
  160. package/3D/materials/mrdl/mrdlSliderThumbMaterial.js +322 -330
  161. package/3D/materials/mrdl/mrdlSliderThumbMaterial.js.map +1 -1
  162. package/3D/materials/mrdl/shaders/mrdlBackplate.fragment.js +9 -3
  163. package/3D/materials/mrdl/shaders/mrdlBackplate.fragment.js.map +1 -1
  164. package/3D/materials/mrdl/shaders/mrdlBackplate.vertex.js +6 -3
  165. package/3D/materials/mrdl/shaders/mrdlBackplate.vertex.js.map +1 -1
  166. package/3D/materials/mrdl/shaders/mrdlSliderBar.fragment.js +24 -3
  167. package/3D/materials/mrdl/shaders/mrdlSliderBar.fragment.js.map +1 -1
  168. package/3D/materials/mrdl/shaders/mrdlSliderBar.vertex.js +12 -3
  169. package/3D/materials/mrdl/shaders/mrdlSliderBar.vertex.js.map +1 -1
  170. package/3D/materials/mrdl/shaders/mrdlSliderThumb.fragment.js +24 -3
  171. package/3D/materials/mrdl/shaders/mrdlSliderThumb.fragment.js.map +1 -1
  172. package/3D/materials/mrdl/shaders/mrdlSliderThumb.vertex.js +12 -3
  173. package/3D/materials/mrdl/shaders/mrdlSliderThumb.vertex.js.map +1 -1
  174. package/3D/vector3WithInfo.js +6 -12
  175. package/3D/vector3WithInfo.js.map +1 -1
  176. package/legacy/legacy.js +1 -1
  177. package/legacy/legacy.js.map +1 -1
  178. package/package.json +3 -6
@@ -1,4 +1,4 @@
1
- import { __decorate, __extends } from "tslib";
1
+ import { __decorate } from "@babylonjs/core/tslib.es6.js";
2
2
  import { Observable } from "@babylonjs/core/Misc/observable.js";
3
3
  import { ValueAndUnit } from "../valueAndUnit.js";
4
4
  import { Control } from "./control.js";
@@ -30,305 +30,254 @@ export var TextWrapping;
30
30
  /**
31
31
  * Class used to create text block control
32
32
  */
33
- var TextBlock = /** @class */ (function (_super) {
34
- __extends(TextBlock, _super);
33
+ export class TextBlock extends Control {
35
34
  /**
36
35
  * Creates a new TextBlock object
37
36
  * @param name defines the name of the control
38
37
  * @param text defines the text to display (empty string by default)
39
38
  */
40
- function TextBlock(
39
+ constructor(
41
40
  /**
42
41
  * Defines the name of the control
43
42
  */
44
- name, text) {
45
- if (text === void 0) { text = ""; }
46
- var _this = _super.call(this, name) || this;
47
- _this.name = name;
48
- _this._text = "";
49
- _this._textWrapping = TextWrapping.Clip;
50
- _this._textHorizontalAlignment = Control.HORIZONTAL_ALIGNMENT_CENTER;
51
- _this._textVerticalAlignment = Control.VERTICAL_ALIGNMENT_CENTER;
52
- _this._resizeToFit = false;
53
- _this._lineSpacing = new ValueAndUnit(0);
54
- _this._outlineWidth = 0;
55
- _this._outlineColor = "white";
56
- _this._underline = false;
57
- _this._lineThrough = false;
58
- _this._wordDivider = " ";
43
+ name, text = "") {
44
+ super(name);
45
+ this.name = name;
46
+ this._text = "";
47
+ this._textWrapping = TextWrapping.Clip;
48
+ this._textHorizontalAlignment = Control.HORIZONTAL_ALIGNMENT_CENTER;
49
+ this._textVerticalAlignment = Control.VERTICAL_ALIGNMENT_CENTER;
50
+ this._resizeToFit = false;
51
+ this._lineSpacing = new ValueAndUnit(0);
52
+ this._outlineWidth = 0;
53
+ this._outlineColor = "white";
54
+ this._underline = false;
55
+ this._lineThrough = false;
56
+ this._wordDivider = " ";
59
57
  /**
60
58
  * An event triggered after the text is changed
61
59
  */
62
- _this.onTextChangedObservable = new Observable();
60
+ this.onTextChangedObservable = new Observable();
63
61
  /**
64
62
  * An event triggered after the text was broken up into lines
65
63
  */
66
- _this.onLinesReadyObservable = new Observable();
67
- _this.text = text;
68
- return _this;
64
+ this.onLinesReadyObservable = new Observable();
65
+ this.text = text;
69
66
  }
70
- Object.defineProperty(TextBlock.prototype, "lines", {
71
- /**
72
- * Return the line list (you may need to use the onLinesReadyObservable to make sure the list is ready)
73
- */
74
- get: function () {
75
- return this._lines;
76
- },
77
- enumerable: false,
78
- configurable: true
79
- });
80
- Object.defineProperty(TextBlock.prototype, "resizeToFit", {
81
- /**
82
- * Gets or sets an boolean indicating that the TextBlock will be resized to fit container
83
- */
84
- get: function () {
85
- return this._resizeToFit;
86
- },
87
- /**
88
- * Gets or sets an boolean indicating that the TextBlock will be resized to fit container
89
- */
90
- set: function (value) {
91
- if (this._resizeToFit === value) {
92
- return;
93
- }
94
- this._resizeToFit = value;
95
- if (this._resizeToFit) {
96
- this._width.ignoreAdaptiveScaling = true;
97
- this._height.ignoreAdaptiveScaling = true;
98
- }
99
- this._markAsDirty();
100
- },
101
- enumerable: false,
102
- configurable: true
103
- });
104
- Object.defineProperty(TextBlock.prototype, "textWrapping", {
105
- /**
106
- * Gets or sets a boolean indicating if text must be wrapped
107
- */
108
- get: function () {
109
- return this._textWrapping;
110
- },
111
- /**
112
- * Gets or sets a boolean indicating if text must be wrapped
113
- */
114
- set: function (value) {
115
- if (this._textWrapping === value) {
116
- return;
117
- }
118
- this._textWrapping = +value;
119
- this._markAsDirty();
120
- },
121
- enumerable: false,
122
- configurable: true
123
- });
124
- Object.defineProperty(TextBlock.prototype, "text", {
125
- /**
126
- * Gets or sets text to display
127
- */
128
- get: function () {
129
- return this._text;
130
- },
131
- /**
132
- * Gets or sets text to display
133
- */
134
- set: function (value) {
135
- if (this._text === value) {
136
- return;
137
- }
138
- this._text = value + ""; // Making sure it is a text
139
- this._markAsDirty();
140
- this.onTextChangedObservable.notifyObservers(this);
141
- },
142
- enumerable: false,
143
- configurable: true
144
- });
145
- Object.defineProperty(TextBlock.prototype, "textHorizontalAlignment", {
146
- /**
147
- * Gets or sets text horizontal alignment (BABYLON.GUI.Control.HORIZONTAL_ALIGNMENT_CENTER by default)
148
- */
149
- get: function () {
150
- return this._textHorizontalAlignment;
151
- },
152
- /**
153
- * Gets or sets text horizontal alignment (BABYLON.GUI.Control.HORIZONTAL_ALIGNMENT_CENTER by default)
154
- */
155
- set: function (value) {
156
- if (this._textHorizontalAlignment === value) {
157
- return;
158
- }
159
- this._textHorizontalAlignment = value;
160
- this._markAsDirty();
161
- },
162
- enumerable: false,
163
- configurable: true
164
- });
165
- Object.defineProperty(TextBlock.prototype, "textVerticalAlignment", {
166
- /**
167
- * Gets or sets text vertical alignment (BABYLON.GUI.Control.VERTICAL_ALIGNMENT_CENTER by default)
168
- */
169
- get: function () {
170
- return this._textVerticalAlignment;
171
- },
172
- /**
173
- * Gets or sets text vertical alignment (BABYLON.GUI.Control.VERTICAL_ALIGNMENT_CENTER by default)
174
- */
175
- set: function (value) {
176
- if (this._textVerticalAlignment === value) {
177
- return;
178
- }
179
- this._textVerticalAlignment = value;
180
- this._markAsDirty();
181
- },
182
- enumerable: false,
183
- configurable: true
184
- });
185
- Object.defineProperty(TextBlock.prototype, "lineSpacing", {
186
- /**
187
- * Gets or sets line spacing value
188
- */
189
- get: function () {
190
- return this._lineSpacing.toString(this._host);
191
- },
192
- /**
193
- * Gets or sets line spacing value
194
- */
195
- set: function (value) {
196
- if (this._lineSpacing.fromString(value)) {
197
- this._markAsDirty();
198
- }
199
- },
200
- enumerable: false,
201
- configurable: true
202
- });
203
- Object.defineProperty(TextBlock.prototype, "outlineWidth", {
204
- /**
205
- * Gets or sets outlineWidth of the text to display
206
- */
207
- get: function () {
208
- return this._outlineWidth;
209
- },
210
- /**
211
- * Gets or sets outlineWidth of the text to display
212
- */
213
- set: function (value) {
214
- if (this._outlineWidth === value) {
215
- return;
216
- }
217
- this._outlineWidth = value;
218
- this._markAsDirty();
219
- },
220
- enumerable: false,
221
- configurable: true
222
- });
223
- Object.defineProperty(TextBlock.prototype, "underline", {
224
- /**
225
- * Gets or sets a boolean indicating that text must have underline
226
- */
227
- get: function () {
228
- return this._underline;
229
- },
230
- /**
231
- * Gets or sets a boolean indicating that text must have underline
232
- */
233
- set: function (value) {
234
- if (this._underline === value) {
235
- return;
236
- }
237
- this._underline = value;
238
- this._markAsDirty();
239
- },
240
- enumerable: false,
241
- configurable: true
242
- });
243
- Object.defineProperty(TextBlock.prototype, "lineThrough", {
244
- /**
245
- * Gets or sets an boolean indicating that text must be crossed out
246
- */
247
- get: function () {
248
- return this._lineThrough;
249
- },
250
- /**
251
- * Gets or sets an boolean indicating that text must be crossed out
252
- */
253
- set: function (value) {
254
- if (this._lineThrough === value) {
255
- return;
256
- }
257
- this._lineThrough = value;
258
- this._markAsDirty();
259
- },
260
- enumerable: false,
261
- configurable: true
262
- });
263
- Object.defineProperty(TextBlock.prototype, "outlineColor", {
264
- /**
265
- * Gets or sets outlineColor of the text to display
266
- */
267
- get: function () {
268
- return this._outlineColor;
269
- },
270
- /**
271
- * Gets or sets outlineColor of the text to display
272
- */
273
- set: function (value) {
274
- if (this._outlineColor === value) {
275
- return;
276
- }
277
- this._outlineColor = value;
278
- this._markAsDirty();
279
- },
280
- enumerable: false,
281
- configurable: true
282
- });
283
- Object.defineProperty(TextBlock.prototype, "wordDivider", {
284
- /**
285
- * Gets or sets word divider
286
- */
287
- get: function () {
288
- return this._wordDivider;
289
- },
290
- /**
291
- * Gets or sets word divider
292
- */
293
- set: function (value) {
294
- if (this._wordDivider === value) {
295
- return;
296
- }
297
- this._wordDivider = value;
67
+ /**
68
+ * Return the line list (you may need to use the onLinesReadyObservable to make sure the list is ready)
69
+ */
70
+ get lines() {
71
+ return this._lines;
72
+ }
73
+ /**
74
+ * Gets or sets an boolean indicating that the TextBlock will be resized to fit container
75
+ */
76
+ get resizeToFit() {
77
+ return this._resizeToFit;
78
+ }
79
+ /**
80
+ * Gets or sets an boolean indicating that the TextBlock will be resized to fit container
81
+ */
82
+ set resizeToFit(value) {
83
+ if (this._resizeToFit === value) {
84
+ return;
85
+ }
86
+ this._resizeToFit = value;
87
+ if (this._resizeToFit) {
88
+ this._width.ignoreAdaptiveScaling = true;
89
+ this._height.ignoreAdaptiveScaling = true;
90
+ }
91
+ this._markAsDirty();
92
+ }
93
+ /**
94
+ * Gets or sets a boolean indicating if text must be wrapped
95
+ */
96
+ get textWrapping() {
97
+ return this._textWrapping;
98
+ }
99
+ /**
100
+ * Gets or sets a boolean indicating if text must be wrapped
101
+ */
102
+ set textWrapping(value) {
103
+ if (this._textWrapping === value) {
104
+ return;
105
+ }
106
+ this._textWrapping = +value;
107
+ this._markAsDirty();
108
+ }
109
+ /**
110
+ * Gets or sets text to display
111
+ */
112
+ get text() {
113
+ return this._text;
114
+ }
115
+ /**
116
+ * Gets or sets text to display
117
+ */
118
+ set text(value) {
119
+ if (this._text === value) {
120
+ return;
121
+ }
122
+ this._text = value + ""; // Making sure it is a text
123
+ this._markAsDirty();
124
+ this.onTextChangedObservable.notifyObservers(this);
125
+ }
126
+ /**
127
+ * Gets or sets text horizontal alignment (BABYLON.GUI.Control.HORIZONTAL_ALIGNMENT_CENTER by default)
128
+ */
129
+ get textHorizontalAlignment() {
130
+ return this._textHorizontalAlignment;
131
+ }
132
+ /**
133
+ * Gets or sets text horizontal alignment (BABYLON.GUI.Control.HORIZONTAL_ALIGNMENT_CENTER by default)
134
+ */
135
+ set textHorizontalAlignment(value) {
136
+ if (this._textHorizontalAlignment === value) {
137
+ return;
138
+ }
139
+ this._textHorizontalAlignment = value;
140
+ this._markAsDirty();
141
+ }
142
+ /**
143
+ * Gets or sets text vertical alignment (BABYLON.GUI.Control.VERTICAL_ALIGNMENT_CENTER by default)
144
+ */
145
+ get textVerticalAlignment() {
146
+ return this._textVerticalAlignment;
147
+ }
148
+ /**
149
+ * Gets or sets text vertical alignment (BABYLON.GUI.Control.VERTICAL_ALIGNMENT_CENTER by default)
150
+ */
151
+ set textVerticalAlignment(value) {
152
+ if (this._textVerticalAlignment === value) {
153
+ return;
154
+ }
155
+ this._textVerticalAlignment = value;
156
+ this._markAsDirty();
157
+ }
158
+ /**
159
+ * Gets or sets line spacing value
160
+ */
161
+ set lineSpacing(value) {
162
+ if (this._lineSpacing.fromString(value)) {
298
163
  this._markAsDirty();
299
- },
300
- enumerable: false,
301
- configurable: true
302
- });
303
- TextBlock.prototype._getTypeName = function () {
164
+ }
165
+ }
166
+ /**
167
+ * Gets or sets line spacing value
168
+ */
169
+ get lineSpacing() {
170
+ return this._lineSpacing.toString(this._host);
171
+ }
172
+ /**
173
+ * Gets or sets outlineWidth of the text to display
174
+ */
175
+ get outlineWidth() {
176
+ return this._outlineWidth;
177
+ }
178
+ /**
179
+ * Gets or sets outlineWidth of the text to display
180
+ */
181
+ set outlineWidth(value) {
182
+ if (this._outlineWidth === value) {
183
+ return;
184
+ }
185
+ this._outlineWidth = value;
186
+ this._markAsDirty();
187
+ }
188
+ /**
189
+ * Gets or sets a boolean indicating that text must have underline
190
+ */
191
+ get underline() {
192
+ return this._underline;
193
+ }
194
+ /**
195
+ * Gets or sets a boolean indicating that text must have underline
196
+ */
197
+ set underline(value) {
198
+ if (this._underline === value) {
199
+ return;
200
+ }
201
+ this._underline = value;
202
+ this._markAsDirty();
203
+ }
204
+ /**
205
+ * Gets or sets an boolean indicating that text must be crossed out
206
+ */
207
+ get lineThrough() {
208
+ return this._lineThrough;
209
+ }
210
+ /**
211
+ * Gets or sets an boolean indicating that text must be crossed out
212
+ */
213
+ set lineThrough(value) {
214
+ if (this._lineThrough === value) {
215
+ return;
216
+ }
217
+ this._lineThrough = value;
218
+ this._markAsDirty();
219
+ }
220
+ /**
221
+ * Gets or sets outlineColor of the text to display
222
+ */
223
+ get outlineColor() {
224
+ return this._outlineColor;
225
+ }
226
+ /**
227
+ * Gets or sets outlineColor of the text to display
228
+ */
229
+ set outlineColor(value) {
230
+ if (this._outlineColor === value) {
231
+ return;
232
+ }
233
+ this._outlineColor = value;
234
+ this._markAsDirty();
235
+ }
236
+ /**
237
+ * Gets or sets word divider
238
+ */
239
+ get wordDivider() {
240
+ return this._wordDivider;
241
+ }
242
+ /**
243
+ * Gets or sets word divider
244
+ */
245
+ set wordDivider(value) {
246
+ if (this._wordDivider === value) {
247
+ return;
248
+ }
249
+ this._wordDivider = value;
250
+ this._markAsDirty();
251
+ }
252
+ _getTypeName() {
304
253
  return "TextBlock";
305
- };
306
- TextBlock.prototype._processMeasures = function (parentMeasure, context) {
254
+ }
255
+ _processMeasures(parentMeasure, context) {
307
256
  if (!this._fontOffset || this.isDirty) {
308
257
  this._fontOffset = Control._GetFontOffset(context.font);
309
258
  }
310
- _super.prototype._processMeasures.call(this, parentMeasure, context);
259
+ super._processMeasures(parentMeasure, context);
311
260
  // Prepare lines
312
261
  this._lines = this._breakLines(this._currentMeasure.width, this._currentMeasure.height, context);
313
262
  this.onLinesReadyObservable.notifyObservers(this);
314
- var maxLineWidth = 0;
315
- for (var i = 0; i < this._lines.length; i++) {
316
- var line = this._lines[i];
263
+ let maxLineWidth = 0;
264
+ for (let i = 0; i < this._lines.length; i++) {
265
+ const line = this._lines[i];
317
266
  if (line.width > maxLineWidth) {
318
267
  maxLineWidth = line.width;
319
268
  }
320
269
  }
321
270
  if (this._resizeToFit) {
322
271
  if (this._textWrapping === TextWrapping.Clip) {
323
- var newWidth = (this._paddingLeftInPixels + this._paddingRightInPixels + maxLineWidth) | 0;
272
+ const newWidth = (this._paddingLeftInPixels + this._paddingRightInPixels + maxLineWidth) | 0;
324
273
  if (newWidth !== this._width.internalValue) {
325
274
  this._width.updateInPlace(newWidth, ValueAndUnit.UNITMODE_PIXEL);
326
275
  this._rebuildLayout = true;
327
276
  }
328
277
  }
329
- var newHeight = (this._paddingTopInPixels + this._paddingBottomInPixels + this._fontOffset.height * this._lines.length) | 0;
278
+ let newHeight = (this._paddingTopInPixels + this._paddingBottomInPixels + this._fontOffset.height * this._lines.length) | 0;
330
279
  if (this._lines.length > 0 && this._lineSpacing.internalValue !== 0) {
331
- var lineSpacing = 0;
280
+ let lineSpacing = 0;
332
281
  if (this._lineSpacing.isPixel) {
333
282
  lineSpacing = this._lineSpacing.getValue(this._host);
334
283
  }
@@ -342,10 +291,10 @@ var TextBlock = /** @class */ (function (_super) {
342
291
  this._rebuildLayout = true;
343
292
  }
344
293
  }
345
- };
346
- TextBlock.prototype._drawText = function (text, textWidth, y, context) {
347
- var width = this._currentMeasure.width;
348
- var x = 0;
294
+ }
295
+ _drawText(text, textWidth, y, context) {
296
+ const width = this._currentMeasure.width;
297
+ let x = 0;
349
298
  switch (this._textHorizontalAlignment) {
350
299
  case Control.HORIZONTAL_ALIGNMENT_LEFT:
351
300
  x = 0;
@@ -383,75 +332,69 @@ var TextBlock = /** @class */ (function (_super) {
383
332
  context.stroke();
384
333
  context.closePath();
385
334
  }
386
- };
335
+ }
387
336
  /**
388
337
  * @param context
389
338
  * @hidden
390
339
  */
391
- TextBlock.prototype._draw = function (context) {
340
+ _draw(context) {
392
341
  context.save();
393
342
  this._applyStates(context);
394
343
  // Render lines
395
344
  this._renderLines(context);
396
345
  context.restore();
397
- };
398
- TextBlock.prototype._applyStates = function (context) {
399
- _super.prototype._applyStates.call(this, context);
346
+ }
347
+ _applyStates(context) {
348
+ super._applyStates(context);
400
349
  if (this.outlineWidth) {
401
350
  context.lineWidth = this.outlineWidth;
402
351
  context.strokeStyle = this.outlineColor;
403
352
  context.lineJoin = "miter";
404
353
  context.miterLimit = 2;
405
354
  }
406
- };
407
- TextBlock.prototype._breakLines = function (refWidth, refHeight, context) {
408
- var lines = [];
409
- var _lines = this.text.split("\n");
355
+ }
356
+ _breakLines(refWidth, refHeight, context) {
357
+ const lines = [];
358
+ const _lines = this.text.split("\n");
410
359
  if (this._textWrapping === TextWrapping.Ellipsis) {
411
- for (var _i = 0, _lines_1 = _lines; _i < _lines_1.length; _i++) {
412
- var _line = _lines_1[_i];
360
+ for (const _line of _lines) {
413
361
  lines.push(this._parseLineEllipsis(_line, refWidth, context));
414
362
  }
415
363
  }
416
364
  else if (this._textWrapping === TextWrapping.WordWrap) {
417
- for (var _a = 0, _lines_2 = _lines; _a < _lines_2.length; _a++) {
418
- var _line = _lines_2[_a];
419
- lines.push.apply(lines, this._parseLineWordWrap(_line, refWidth, context));
365
+ for (const _line of _lines) {
366
+ lines.push(...this._parseLineWordWrap(_line, refWidth, context));
420
367
  }
421
368
  }
422
369
  else if (this._textWrapping === TextWrapping.WordWrapEllipsis) {
423
- for (var _b = 0, _lines_3 = _lines; _b < _lines_3.length; _b++) {
424
- var _line = _lines_3[_b];
425
- lines.push.apply(lines, this._parseLineWordWrapEllipsis(_line, refWidth, refHeight, context));
370
+ for (const _line of _lines) {
371
+ lines.push(...this._parseLineWordWrapEllipsis(_line, refWidth, refHeight, context));
426
372
  }
427
373
  }
428
374
  else {
429
- for (var _c = 0, _lines_4 = _lines; _c < _lines_4.length; _c++) {
430
- var _line = _lines_4[_c];
375
+ for (const _line of _lines) {
431
376
  lines.push(this._parseLine(_line, context));
432
377
  }
433
378
  }
434
379
  return lines;
435
- };
436
- TextBlock.prototype._parseLine = function (line, context) {
437
- if (line === void 0) { line = ""; }
380
+ }
381
+ _parseLine(line = "", context) {
438
382
  return { text: line, width: this._getTextMetricsWidth(context.measureText(line)) };
439
- };
383
+ }
440
384
  //Calculate how many characters approximately we need to remove
441
- TextBlock.prototype._getCharsToRemove = function (lineWidth, width, lineLength) {
442
- var diff = lineWidth > width ? lineWidth - width : 0;
385
+ _getCharsToRemove(lineWidth, width, lineLength) {
386
+ const diff = lineWidth > width ? lineWidth - width : 0;
443
387
  // This isn't exact unless the font is monospaced
444
- var charWidth = lineWidth / lineLength;
445
- var removeChars = Math.max(Math.floor(diff / charWidth), 1);
388
+ const charWidth = lineWidth / lineLength;
389
+ const removeChars = Math.max(Math.floor(diff / charWidth), 1);
446
390
  return removeChars;
447
- };
448
- TextBlock.prototype._parseLineEllipsis = function (line, width, context) {
449
- if (line === void 0) { line = ""; }
450
- var lineWidth = this._getTextMetricsWidth(context.measureText(line));
451
- var removeChars = this._getCharsToRemove(lineWidth, width, line.length);
391
+ }
392
+ _parseLineEllipsis(line = "", width, context) {
393
+ let lineWidth = this._getTextMetricsWidth(context.measureText(line));
394
+ let removeChars = this._getCharsToRemove(lineWidth, width, line.length);
452
395
  // unicode support. split('') does not work with unicode!
453
396
  // make sure Array.from is available
454
- var characters = Array.from && Array.from(line);
397
+ const characters = Array.from && Array.from(line);
455
398
  if (!characters) {
456
399
  // no array.from, use the old method
457
400
  while (line.length > 2 && lineWidth > width) {
@@ -465,27 +408,26 @@ var TextBlock = /** @class */ (function (_super) {
465
408
  else {
466
409
  while (characters.length && lineWidth > width) {
467
410
  characters.splice(characters.length - removeChars, removeChars);
468
- line = "".concat(characters.join(""), "\u2026");
411
+ line = `${characters.join("")}…`;
469
412
  lineWidth = this._getTextMetricsWidth(context.measureText(line));
470
413
  removeChars = this._getCharsToRemove(lineWidth, width, line.length);
471
414
  }
472
415
  }
473
416
  return { text: line, width: lineWidth };
474
- };
475
- TextBlock.prototype._getTextMetricsWidth = function (textMetrics) {
417
+ }
418
+ _getTextMetricsWidth(textMetrics) {
476
419
  if (textMetrics.actualBoundingBoxLeft !== undefined) {
477
420
  return Math.abs(textMetrics.actualBoundingBoxLeft) + Math.abs(textMetrics.actualBoundingBoxRight);
478
421
  }
479
422
  return textMetrics.width;
480
- };
481
- TextBlock.prototype._parseLineWordWrap = function (line, width, context) {
482
- if (line === void 0) { line = ""; }
483
- var lines = [];
484
- var words = this.wordSplittingFunction ? this.wordSplittingFunction(line) : line.split(this._wordDivider);
485
- var lineWidth = this._getTextMetricsWidth(context.measureText(line));
486
- for (var n = 0; n < words.length; n++) {
487
- var testLine = n > 0 ? line + this._wordDivider + words[n] : words[0];
488
- var testWidth = this._getTextMetricsWidth(context.measureText(testLine));
423
+ }
424
+ _parseLineWordWrap(line = "", width, context) {
425
+ const lines = [];
426
+ const words = this.wordSplittingFunction ? this.wordSplittingFunction(line) : line.split(this._wordDivider);
427
+ let lineWidth = this._getTextMetricsWidth(context.measureText(line));
428
+ for (let n = 0; n < words.length; n++) {
429
+ const testLine = n > 0 ? line + this._wordDivider + words[n] : words[0];
430
+ const testWidth = this._getTextMetricsWidth(context.measureText(testLine));
489
431
  if (testWidth > width && n > 0) {
490
432
  lines.push({ text: line, width: lineWidth });
491
433
  line = words[n];
@@ -498,31 +440,30 @@ var TextBlock = /** @class */ (function (_super) {
498
440
  }
499
441
  lines.push({ text: line, width: lineWidth });
500
442
  return lines;
501
- };
502
- TextBlock.prototype._parseLineWordWrapEllipsis = function (line, width, height, context) {
503
- if (line === void 0) { line = ""; }
504
- var lines = this._parseLineWordWrap(line, width, context);
505
- for (var n = 1; n <= lines.length; n++) {
506
- var currentHeight = this._computeHeightForLinesOf(n);
443
+ }
444
+ _parseLineWordWrapEllipsis(line = "", width, height, context) {
445
+ const lines = this._parseLineWordWrap(line, width, context);
446
+ for (let n = 1; n <= lines.length; n++) {
447
+ const currentHeight = this._computeHeightForLinesOf(n);
507
448
  if (currentHeight > height && n > 1) {
508
- var lastLine = lines[n - 2];
509
- var currentLine = lines[n - 1];
510
- lines[n - 2] = this._parseLineEllipsis("".concat(lastLine.text + currentLine.text), width, context);
511
- var linesToRemove = lines.length - n + 1;
512
- for (var i = 0; i < linesToRemove; i++) {
449
+ const lastLine = lines[n - 2];
450
+ const currentLine = lines[n - 1];
451
+ lines[n - 2] = this._parseLineEllipsis(`${lastLine.text + currentLine.text}`, width, context);
452
+ const linesToRemove = lines.length - n + 1;
453
+ for (let i = 0; i < linesToRemove; i++) {
513
454
  lines.pop();
514
455
  }
515
456
  return lines;
516
457
  }
517
458
  }
518
459
  return lines;
519
- };
520
- TextBlock.prototype._renderLines = function (context) {
460
+ }
461
+ _renderLines(context) {
521
462
  if (!this._fontOffset || !this._lines) {
522
463
  return;
523
464
  }
524
- var height = this._currentMeasure.height;
525
- var rootY = 0;
465
+ const height = this._currentMeasure.height;
466
+ let rootY = 0;
526
467
  switch (this._textVerticalAlignment) {
527
468
  case Control.VERTICAL_ALIGNMENT_TOP:
528
469
  rootY = this._fontOffset.ascent;
@@ -535,8 +476,8 @@ var TextBlock = /** @class */ (function (_super) {
535
476
  break;
536
477
  }
537
478
  rootY += this._currentMeasure.top;
538
- for (var i = 0; i < this._lines.length; i++) {
539
- var line = this._lines[i];
479
+ for (let i = 0; i < this._lines.length; i++) {
480
+ const line = this._lines[i];
540
481
  if (i !== 0 && this._lineSpacing.internalValue !== 0) {
541
482
  if (this._lineSpacing.isPixel) {
542
483
  rootY += this._lineSpacing.getValue(this._host);
@@ -548,11 +489,11 @@ var TextBlock = /** @class */ (function (_super) {
548
489
  this._drawText(line.text, line.width, rootY, context);
549
490
  rootY += this._fontOffset.height;
550
491
  }
551
- };
552
- TextBlock.prototype._computeHeightForLinesOf = function (lineCount) {
553
- var newHeight = this._paddingTopInPixels + this._paddingBottomInPixels + this._fontOffset.height * lineCount;
492
+ }
493
+ _computeHeightForLinesOf(lineCount) {
494
+ let newHeight = this._paddingTopInPixels + this._paddingBottomInPixels + this._fontOffset.height * lineCount;
554
495
  if (lineCount > 0 && this._lineSpacing.internalValue !== 0) {
555
- var lineSpacing = 0;
496
+ let lineSpacing = 0;
556
497
  if (this._lineSpacing.isPixel) {
557
498
  lineSpacing = this._lineSpacing.getValue(this._host);
558
499
  }
@@ -562,68 +503,65 @@ var TextBlock = /** @class */ (function (_super) {
562
503
  newHeight += (lineCount - 1) * lineSpacing;
563
504
  }
564
505
  return newHeight;
565
- };
506
+ }
566
507
  /**
567
508
  * Given a width constraint applied on the text block, find the expected height
568
509
  * @returns expected height
569
510
  */
570
- TextBlock.prototype.computeExpectedHeight = function () {
571
- var _a;
511
+ computeExpectedHeight() {
572
512
  if (this.text && this.widthInPixels) {
573
513
  // Should abstract platform instead of using LastCreatedEngine
574
- var context_1 = (_a = EngineStore.LastCreatedEngine) === null || _a === void 0 ? void 0 : _a.createCanvas(0, 0).getContext("2d");
575
- if (context_1) {
576
- this._applyStates(context_1);
514
+ const context = EngineStore.LastCreatedEngine?.createCanvas(0, 0).getContext("2d");
515
+ if (context) {
516
+ this._applyStates(context);
577
517
  if (!this._fontOffset) {
578
- this._fontOffset = Control._GetFontOffset(context_1.font);
518
+ this._fontOffset = Control._GetFontOffset(context.font);
579
519
  }
580
- var lines = this._lines
520
+ const lines = this._lines
581
521
  ? this._lines
582
- : this._breakLines(this.widthInPixels - this._paddingLeftInPixels - this._paddingRightInPixels, this.heightInPixels - this._paddingTopInPixels - this._paddingBottomInPixels, context_1);
522
+ : this._breakLines(this.widthInPixels - this._paddingLeftInPixels - this._paddingRightInPixels, this.heightInPixels - this._paddingTopInPixels - this._paddingBottomInPixels, context);
583
523
  return this._computeHeightForLinesOf(lines.length);
584
524
  }
585
525
  }
586
526
  return 0;
587
- };
588
- TextBlock.prototype.dispose = function () {
589
- _super.prototype.dispose.call(this);
527
+ }
528
+ dispose() {
529
+ super.dispose();
590
530
  this.onTextChangedObservable.clear();
591
- };
592
- __decorate([
593
- serialize()
594
- ], TextBlock.prototype, "resizeToFit", null);
595
- __decorate([
596
- serialize()
597
- ], TextBlock.prototype, "textWrapping", null);
598
- __decorate([
599
- serialize()
600
- ], TextBlock.prototype, "text", null);
601
- __decorate([
602
- serialize()
603
- ], TextBlock.prototype, "textHorizontalAlignment", null);
604
- __decorate([
605
- serialize()
606
- ], TextBlock.prototype, "textVerticalAlignment", null);
607
- __decorate([
608
- serialize()
609
- ], TextBlock.prototype, "lineSpacing", null);
610
- __decorate([
611
- serialize()
612
- ], TextBlock.prototype, "outlineWidth", null);
613
- __decorate([
614
- serialize()
615
- ], TextBlock.prototype, "underline", null);
616
- __decorate([
617
- serialize()
618
- ], TextBlock.prototype, "lineThrough", null);
619
- __decorate([
620
- serialize()
621
- ], TextBlock.prototype, "outlineColor", null);
622
- __decorate([
623
- serialize()
624
- ], TextBlock.prototype, "wordDivider", null);
625
- return TextBlock;
626
- }(Control));
627
- export { TextBlock };
531
+ }
532
+ }
533
+ __decorate([
534
+ serialize()
535
+ ], TextBlock.prototype, "resizeToFit", null);
536
+ __decorate([
537
+ serialize()
538
+ ], TextBlock.prototype, "textWrapping", null);
539
+ __decorate([
540
+ serialize()
541
+ ], TextBlock.prototype, "text", null);
542
+ __decorate([
543
+ serialize()
544
+ ], TextBlock.prototype, "textHorizontalAlignment", null);
545
+ __decorate([
546
+ serialize()
547
+ ], TextBlock.prototype, "textVerticalAlignment", null);
548
+ __decorate([
549
+ serialize()
550
+ ], TextBlock.prototype, "lineSpacing", null);
551
+ __decorate([
552
+ serialize()
553
+ ], TextBlock.prototype, "outlineWidth", null);
554
+ __decorate([
555
+ serialize()
556
+ ], TextBlock.prototype, "underline", null);
557
+ __decorate([
558
+ serialize()
559
+ ], TextBlock.prototype, "lineThrough", null);
560
+ __decorate([
561
+ serialize()
562
+ ], TextBlock.prototype, "outlineColor", null);
563
+ __decorate([
564
+ serialize()
565
+ ], TextBlock.prototype, "wordDivider", null);
628
566
  RegisterClass("BABYLON.GUI.TextBlock", TextBlock);
629
567
  //# sourceMappingURL=textBlock.js.map