@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 { ClipboardEventTypes } from "@babylonjs/core/Events/clipboardEvents.js";
4
4
  import { PointerEventTypes } from "@babylonjs/core/Events/pointerEvents.js";
@@ -10,355 +10,272 @@ import { serialize } from "@babylonjs/core/Misc/decorators.js";
10
10
  /**
11
11
  * Class used to create input text control
12
12
  */
13
- var InputText = /** @class */ (function (_super) {
14
- __extends(InputText, _super);
13
+ export class InputText extends Control {
15
14
  /**
16
15
  * Creates a new InputText
17
16
  * @param name defines the control name
18
17
  * @param text defines the text of the control
19
18
  */
20
- function InputText(name, text) {
21
- if (text === void 0) { text = ""; }
22
- var _this = _super.call(this, name) || this;
23
- _this.name = name;
24
- _this._placeholderText = "";
25
- _this._background = "#222222";
26
- _this._focusedBackground = "#000000";
27
- _this._focusedColor = "white";
28
- _this._placeholderColor = "gray";
29
- _this._thickness = 1;
30
- _this._margin = new ValueAndUnit(10, ValueAndUnit.UNITMODE_PIXEL);
31
- _this._autoStretchWidth = true;
32
- _this._maxWidth = new ValueAndUnit(1, ValueAndUnit.UNITMODE_PERCENTAGE, false);
33
- _this._isFocused = false;
34
- _this._blinkIsEven = false;
35
- _this._cursorOffset = 0;
36
- _this._deadKey = false;
37
- _this._addKey = true;
38
- _this._currentKey = "";
39
- _this._isTextHighlightOn = false;
40
- _this._textHighlightColor = "#d5e0ff";
41
- _this._highligherOpacity = 0.4;
42
- _this._highlightedText = "";
43
- _this._startHighlightIndex = 0;
44
- _this._endHighlightIndex = 0;
45
- _this._cursorIndex = -1;
46
- _this._onFocusSelectAll = false;
47
- _this._isPointerDown = false;
19
+ constructor(name, text = "") {
20
+ super(name);
21
+ this.name = name;
22
+ this._placeholderText = "";
23
+ this._background = "#222222";
24
+ this._focusedBackground = "#000000";
25
+ this._focusedColor = "white";
26
+ this._placeholderColor = "gray";
27
+ this._thickness = 1;
28
+ this._margin = new ValueAndUnit(10, ValueAndUnit.UNITMODE_PIXEL);
29
+ this._autoStretchWidth = true;
30
+ this._maxWidth = new ValueAndUnit(1, ValueAndUnit.UNITMODE_PERCENTAGE, false);
31
+ this._isFocused = false;
32
+ this._blinkIsEven = false;
33
+ this._cursorOffset = 0;
34
+ this._deadKey = false;
35
+ this._addKey = true;
36
+ this._currentKey = "";
37
+ this._isTextHighlightOn = false;
38
+ this._textHighlightColor = "#d5e0ff";
39
+ this._highligherOpacity = 0.4;
40
+ this._highlightedText = "";
41
+ this._startHighlightIndex = 0;
42
+ this._endHighlightIndex = 0;
43
+ this._cursorIndex = -1;
44
+ this._onFocusSelectAll = false;
45
+ this._isPointerDown = false;
48
46
  /** Gets or sets a string representing the message displayed on mobile when the control gets the focus */
49
- _this.promptMessage = "Please enter text:";
47
+ this.promptMessage = "Please enter text:";
50
48
  /** Force disable prompt on mobile device */
51
- _this.disableMobilePrompt = false;
49
+ this.disableMobilePrompt = false;
52
50
  /** Observable raised when the text changes */
53
- _this.onTextChangedObservable = new Observable();
51
+ this.onTextChangedObservable = new Observable();
54
52
  /** Observable raised just before an entered character is to be added */
55
- _this.onBeforeKeyAddObservable = new Observable();
53
+ this.onBeforeKeyAddObservable = new Observable();
56
54
  /** Observable raised when the control gets the focus */
57
- _this.onFocusObservable = new Observable();
55
+ this.onFocusObservable = new Observable();
58
56
  /** Observable raised when the control loses the focus */
59
- _this.onBlurObservable = new Observable();
57
+ this.onBlurObservable = new Observable();
60
58
  /**Observable raised when the text is highlighted */
61
- _this.onTextHighlightObservable = new Observable();
59
+ this.onTextHighlightObservable = new Observable();
62
60
  /**Observable raised when copy event is triggered */
63
- _this.onTextCopyObservable = new Observable();
61
+ this.onTextCopyObservable = new Observable();
64
62
  /** Observable raised when cut event is triggered */
65
- _this.onTextCutObservable = new Observable();
63
+ this.onTextCutObservable = new Observable();
66
64
  /** Observable raised when paste event is triggered */
67
- _this.onTextPasteObservable = new Observable();
65
+ this.onTextPasteObservable = new Observable();
68
66
  /** Observable raised when a key event was processed */
69
- _this.onKeyboardEventProcessedObservable = new Observable();
70
- _this.text = text;
71
- _this.isPointerBlocker = true;
72
- return _this;
67
+ this.onKeyboardEventProcessedObservable = new Observable();
68
+ this.text = text;
69
+ this.isPointerBlocker = true;
73
70
  }
74
- Object.defineProperty(InputText.prototype, "maxWidth", {
75
- /** Gets or sets the maximum width allowed by the control */
76
- get: function () {
77
- return this._maxWidth.toString(this._host);
78
- },
79
- set: function (value) {
80
- if (this._maxWidth.toString(this._host) === value) {
81
- return;
82
- }
83
- if (this._maxWidth.fromString(value)) {
84
- this._markAsDirty();
85
- }
86
- },
87
- enumerable: false,
88
- configurable: true
89
- });
90
- Object.defineProperty(InputText.prototype, "maxWidthInPixels", {
91
- /** Gets the maximum width allowed by the control in pixels */
92
- get: function () {
93
- return this._maxWidth.getValueInPixel(this._host, this._cachedParentMeasure.width);
94
- },
95
- enumerable: false,
96
- configurable: true
97
- });
98
- Object.defineProperty(InputText.prototype, "highligherOpacity", {
99
- /** Gets or sets the text highlighter transparency; default: 0.4 */
100
- get: function () {
101
- return this._highligherOpacity;
102
- },
103
- set: function (value) {
104
- if (this._highligherOpacity === value) {
105
- return;
106
- }
107
- this._highligherOpacity = value;
108
- this._markAsDirty();
109
- },
110
- enumerable: false,
111
- configurable: true
112
- });
113
- Object.defineProperty(InputText.prototype, "onFocusSelectAll", {
114
- /** Gets or sets a boolean indicating whether to select complete text by default on input focus */
115
- get: function () {
116
- return this._onFocusSelectAll;
117
- },
118
- set: function (value) {
119
- if (this._onFocusSelectAll === value) {
120
- return;
121
- }
122
- this._onFocusSelectAll = value;
123
- this._markAsDirty();
124
- },
125
- enumerable: false,
126
- configurable: true
127
- });
128
- Object.defineProperty(InputText.prototype, "textHighlightColor", {
129
- /** Gets or sets the text hightlight color */
130
- get: function () {
131
- return this._textHighlightColor;
132
- },
133
- set: function (value) {
134
- if (this._textHighlightColor === value) {
135
- return;
136
- }
137
- this._textHighlightColor = value;
138
- this._markAsDirty();
139
- },
140
- enumerable: false,
141
- configurable: true
142
- });
143
- Object.defineProperty(InputText.prototype, "margin", {
144
- /** Gets or sets control margin */
145
- get: function () {
146
- return this._margin.toString(this._host);
147
- },
148
- set: function (value) {
149
- if (this._margin.toString(this._host) === value) {
150
- return;
151
- }
152
- if (this._margin.fromString(value)) {
153
- this._markAsDirty();
154
- }
155
- },
156
- enumerable: false,
157
- configurable: true
158
- });
159
- Object.defineProperty(InputText.prototype, "marginInPixels", {
160
- /** Gets control margin in pixels */
161
- get: function () {
162
- return this._margin.getValueInPixel(this._host, this._cachedParentMeasure.width);
163
- },
164
- enumerable: false,
165
- configurable: true
166
- });
167
- Object.defineProperty(InputText.prototype, "autoStretchWidth", {
168
- /** Gets or sets a boolean indicating if the control can auto stretch its width to adapt to the text */
169
- get: function () {
170
- return this._autoStretchWidth;
171
- },
172
- set: function (value) {
173
- if (this._autoStretchWidth === value) {
174
- return;
175
- }
176
- this._autoStretchWidth = value;
177
- this._markAsDirty();
178
- },
179
- enumerable: false,
180
- configurable: true
181
- });
182
- Object.defineProperty(InputText.prototype, "thickness", {
183
- /** Gets or sets border thickness */
184
- get: function () {
185
- return this._thickness;
186
- },
187
- set: function (value) {
188
- if (this._thickness === value) {
189
- return;
190
- }
191
- this._thickness = value;
192
- this._markAsDirty();
193
- },
194
- enumerable: false,
195
- configurable: true
196
- });
197
- Object.defineProperty(InputText.prototype, "focusedBackground", {
198
- /** Gets or sets the background color when focused */
199
- get: function () {
200
- return this._focusedBackground;
201
- },
202
- set: function (value) {
203
- if (this._focusedBackground === value) {
204
- return;
205
- }
206
- this._focusedBackground = value;
207
- this._markAsDirty();
208
- },
209
- enumerable: false,
210
- configurable: true
211
- });
212
- Object.defineProperty(InputText.prototype, "focusedColor", {
213
- /** Gets or sets the background color when focused */
214
- get: function () {
215
- return this._focusedColor;
216
- },
217
- set: function (value) {
218
- if (this._focusedColor === value) {
219
- return;
220
- }
221
- this._focusedColor = value;
222
- this._markAsDirty();
223
- },
224
- enumerable: false,
225
- configurable: true
226
- });
227
- Object.defineProperty(InputText.prototype, "background", {
228
- /** Gets or sets the background color */
229
- get: function () {
230
- return this._background;
231
- },
232
- set: function (value) {
233
- if (this._background === value) {
234
- return;
235
- }
236
- this._background = value;
237
- this._markAsDirty();
238
- },
239
- enumerable: false,
240
- configurable: true
241
- });
242
- Object.defineProperty(InputText.prototype, "placeholderColor", {
243
- /** Gets or sets the placeholder color */
244
- get: function () {
245
- return this._placeholderColor;
246
- },
247
- set: function (value) {
248
- if (this._placeholderColor === value) {
249
- return;
250
- }
251
- this._placeholderColor = value;
252
- this._markAsDirty();
253
- },
254
- enumerable: false,
255
- configurable: true
256
- });
257
- Object.defineProperty(InputText.prototype, "placeholderText", {
258
- /** Gets or sets the text displayed when the control is empty */
259
- get: function () {
260
- return this._placeholderText;
261
- },
262
- set: function (value) {
263
- if (this._placeholderText === value) {
264
- return;
265
- }
266
- this._placeholderText = value;
71
+ /** Gets or sets the maximum width allowed by the control */
72
+ get maxWidth() {
73
+ return this._maxWidth.toString(this._host);
74
+ }
75
+ /** Gets the maximum width allowed by the control in pixels */
76
+ get maxWidthInPixels() {
77
+ return this._maxWidth.getValueInPixel(this._host, this._cachedParentMeasure.width);
78
+ }
79
+ set maxWidth(value) {
80
+ if (this._maxWidth.toString(this._host) === value) {
81
+ return;
82
+ }
83
+ if (this._maxWidth.fromString(value)) {
267
84
  this._markAsDirty();
268
- },
269
- enumerable: false,
270
- configurable: true
271
- });
272
- Object.defineProperty(InputText.prototype, "deadKey", {
273
- /** Gets or sets the dead key flag */
274
- get: function () {
275
- return this._deadKey;
276
- },
277
- set: function (flag) {
278
- this._deadKey = flag;
279
- },
280
- enumerable: false,
281
- configurable: true
282
- });
283
- Object.defineProperty(InputText.prototype, "highlightedText", {
284
- /** Gets or sets the highlight text */
285
- get: function () {
286
- return this._highlightedText;
287
- },
288
- set: function (text) {
289
- if (this._highlightedText === text) {
290
- return;
291
- }
292
- this._highlightedText = text;
85
+ }
86
+ }
87
+ /** Gets or sets the text highlighter transparency; default: 0.4 */
88
+ get highligherOpacity() {
89
+ return this._highligherOpacity;
90
+ }
91
+ set highligherOpacity(value) {
92
+ if (this._highligherOpacity === value) {
93
+ return;
94
+ }
95
+ this._highligherOpacity = value;
96
+ this._markAsDirty();
97
+ }
98
+ /** Gets or sets a boolean indicating whether to select complete text by default on input focus */
99
+ get onFocusSelectAll() {
100
+ return this._onFocusSelectAll;
101
+ }
102
+ set onFocusSelectAll(value) {
103
+ if (this._onFocusSelectAll === value) {
104
+ return;
105
+ }
106
+ this._onFocusSelectAll = value;
107
+ this._markAsDirty();
108
+ }
109
+ /** Gets or sets the text hightlight color */
110
+ get textHighlightColor() {
111
+ return this._textHighlightColor;
112
+ }
113
+ set textHighlightColor(value) {
114
+ if (this._textHighlightColor === value) {
115
+ return;
116
+ }
117
+ this._textHighlightColor = value;
118
+ this._markAsDirty();
119
+ }
120
+ /** Gets or sets control margin */
121
+ get margin() {
122
+ return this._margin.toString(this._host);
123
+ }
124
+ /** Gets control margin in pixels */
125
+ get marginInPixels() {
126
+ return this._margin.getValueInPixel(this._host, this._cachedParentMeasure.width);
127
+ }
128
+ set margin(value) {
129
+ if (this._margin.toString(this._host) === value) {
130
+ return;
131
+ }
132
+ if (this._margin.fromString(value)) {
293
133
  this._markAsDirty();
294
- },
295
- enumerable: false,
296
- configurable: true
297
- });
298
- Object.defineProperty(InputText.prototype, "addKey", {
299
- /** Gets or sets if the current key should be added */
300
- get: function () {
301
- return this._addKey;
302
- },
303
- set: function (flag) {
304
- this._addKey = flag;
305
- },
306
- enumerable: false,
307
- configurable: true
308
- });
309
- Object.defineProperty(InputText.prototype, "currentKey", {
310
- /** Gets or sets the value of the current key being entered */
311
- get: function () {
312
- return this._currentKey;
313
- },
314
- set: function (key) {
315
- this._currentKey = key;
316
- },
317
- enumerable: false,
318
- configurable: true
319
- });
320
- Object.defineProperty(InputText.prototype, "text", {
321
- /** Gets or sets the text displayed in the control */
322
- get: function () {
323
- return this._textWrapper.text;
324
- },
325
- set: function (value) {
326
- var valueAsString = value.toString(); // Forcing convertion
327
- if (!this._textWrapper) {
328
- this._textWrapper = new TextWrapper();
329
- }
330
- if (this._textWrapper.text === valueAsString) {
331
- return;
332
- }
333
- this._textWrapper.text = valueAsString;
334
- this._textHasChanged();
335
- },
336
- enumerable: false,
337
- configurable: true
338
- });
339
- InputText.prototype._textHasChanged = function () {
134
+ }
135
+ }
136
+ /** Gets or sets a boolean indicating if the control can auto stretch its width to adapt to the text */
137
+ get autoStretchWidth() {
138
+ return this._autoStretchWidth;
139
+ }
140
+ set autoStretchWidth(value) {
141
+ if (this._autoStretchWidth === value) {
142
+ return;
143
+ }
144
+ this._autoStretchWidth = value;
145
+ this._markAsDirty();
146
+ }
147
+ /** Gets or sets border thickness */
148
+ get thickness() {
149
+ return this._thickness;
150
+ }
151
+ set thickness(value) {
152
+ if (this._thickness === value) {
153
+ return;
154
+ }
155
+ this._thickness = value;
156
+ this._markAsDirty();
157
+ }
158
+ /** Gets or sets the background color when focused */
159
+ get focusedBackground() {
160
+ return this._focusedBackground;
161
+ }
162
+ set focusedBackground(value) {
163
+ if (this._focusedBackground === value) {
164
+ return;
165
+ }
166
+ this._focusedBackground = value;
167
+ this._markAsDirty();
168
+ }
169
+ /** Gets or sets the background color when focused */
170
+ get focusedColor() {
171
+ return this._focusedColor;
172
+ }
173
+ set focusedColor(value) {
174
+ if (this._focusedColor === value) {
175
+ return;
176
+ }
177
+ this._focusedColor = value;
178
+ this._markAsDirty();
179
+ }
180
+ /** Gets or sets the background color */
181
+ get background() {
182
+ return this._background;
183
+ }
184
+ set background(value) {
185
+ if (this._background === value) {
186
+ return;
187
+ }
188
+ this._background = value;
189
+ this._markAsDirty();
190
+ }
191
+ /** Gets or sets the placeholder color */
192
+ get placeholderColor() {
193
+ return this._placeholderColor;
194
+ }
195
+ set placeholderColor(value) {
196
+ if (this._placeholderColor === value) {
197
+ return;
198
+ }
199
+ this._placeholderColor = value;
200
+ this._markAsDirty();
201
+ }
202
+ /** Gets or sets the text displayed when the control is empty */
203
+ get placeholderText() {
204
+ return this._placeholderText;
205
+ }
206
+ set placeholderText(value) {
207
+ if (this._placeholderText === value) {
208
+ return;
209
+ }
210
+ this._placeholderText = value;
211
+ this._markAsDirty();
212
+ }
213
+ /** Gets or sets the dead key flag */
214
+ get deadKey() {
215
+ return this._deadKey;
216
+ }
217
+ set deadKey(flag) {
218
+ this._deadKey = flag;
219
+ }
220
+ /** Gets or sets the highlight text */
221
+ get highlightedText() {
222
+ return this._highlightedText;
223
+ }
224
+ set highlightedText(text) {
225
+ if (this._highlightedText === text) {
226
+ return;
227
+ }
228
+ this._highlightedText = text;
229
+ this._markAsDirty();
230
+ }
231
+ /** Gets or sets if the current key should be added */
232
+ get addKey() {
233
+ return this._addKey;
234
+ }
235
+ set addKey(flag) {
236
+ this._addKey = flag;
237
+ }
238
+ /** Gets or sets the value of the current key being entered */
239
+ get currentKey() {
240
+ return this._currentKey;
241
+ }
242
+ set currentKey(key) {
243
+ this._currentKey = key;
244
+ }
245
+ /** Gets or sets the text displayed in the control */
246
+ get text() {
247
+ return this._textWrapper.text;
248
+ }
249
+ set text(value) {
250
+ const valueAsString = value.toString(); // Forcing convertion
251
+ if (!this._textWrapper) {
252
+ this._textWrapper = new TextWrapper();
253
+ }
254
+ if (this._textWrapper.text === valueAsString) {
255
+ return;
256
+ }
257
+ this._textWrapper.text = valueAsString;
258
+ this._textHasChanged();
259
+ }
260
+ _textHasChanged() {
340
261
  this._markAsDirty();
341
262
  this.onTextChangedObservable.notifyObservers(this);
342
- };
343
- Object.defineProperty(InputText.prototype, "width", {
344
- /** Gets or sets control width */
345
- get: function () {
346
- return this._width.toString(this._host);
347
- },
348
- set: function (value) {
349
- if (this._width.toString(this._host) === value) {
350
- return;
351
- }
352
- if (this._width.fromString(value)) {
353
- this._markAsDirty();
354
- }
355
- this.autoStretchWidth = false;
356
- },
357
- enumerable: false,
358
- configurable: true
359
- });
263
+ }
264
+ /** Gets or sets control width */
265
+ get width() {
266
+ return this._width.toString(this._host);
267
+ }
268
+ set width(value) {
269
+ if (this._width.toString(this._host) === value) {
270
+ return;
271
+ }
272
+ if (this._width.fromString(value)) {
273
+ this._markAsDirty();
274
+ }
275
+ this.autoStretchWidth = false;
276
+ }
360
277
  /** @hidden */
361
- InputText.prototype.onBlur = function () {
278
+ onBlur() {
362
279
  this._isFocused = false;
363
280
  this._scrollLeft = null;
364
281
  this._cursorOffset = 0;
@@ -369,14 +286,13 @@ var InputText = /** @class */ (function (_super) {
369
286
  if (this._onClipboardObserver) {
370
287
  this._host.onClipboardObservable.remove(this._onClipboardObserver);
371
288
  }
372
- var scene = this._host.getScene();
289
+ const scene = this._host.getScene();
373
290
  if (this._onPointerDblTapObserver && scene) {
374
291
  scene.onPointerObservable.remove(this._onPointerDblTapObserver);
375
292
  }
376
- };
293
+ }
377
294
  /** @hidden */
378
- InputText.prototype.onFocus = function () {
379
- var _this = this;
295
+ onFocus() {
380
296
  if (!this._isEnabled) {
381
297
  return;
382
298
  }
@@ -387,7 +303,7 @@ var InputText = /** @class */ (function (_super) {
387
303
  this._markAsDirty();
388
304
  this.onFocusObservable.notifyObservers(this);
389
305
  if (this._focusedBy === "touch" && !this.disableMobilePrompt) {
390
- var value = prompt(this.promptMessage);
306
+ const value = prompt(this.promptMessage);
391
307
  if (value !== null) {
392
308
  this.text = value;
393
309
  }
@@ -395,73 +311,73 @@ var InputText = /** @class */ (function (_super) {
395
311
  return;
396
312
  }
397
313
  this._host.registerClipboardEvents();
398
- this._onClipboardObserver = this._host.onClipboardObservable.add(function (clipboardInfo) {
314
+ this._onClipboardObserver = this._host.onClipboardObservable.add((clipboardInfo) => {
399
315
  // process clipboard event, can be configured.
400
316
  switch (clipboardInfo.type) {
401
317
  case ClipboardEventTypes.COPY:
402
- _this._onCopyText(clipboardInfo.event);
403
- _this.onTextCopyObservable.notifyObservers(_this);
318
+ this._onCopyText(clipboardInfo.event);
319
+ this.onTextCopyObservable.notifyObservers(this);
404
320
  break;
405
321
  case ClipboardEventTypes.CUT:
406
- _this._onCutText(clipboardInfo.event);
407
- _this.onTextCutObservable.notifyObservers(_this);
322
+ this._onCutText(clipboardInfo.event);
323
+ this.onTextCutObservable.notifyObservers(this);
408
324
  break;
409
325
  case ClipboardEventTypes.PASTE:
410
- _this._onPasteText(clipboardInfo.event);
411
- _this.onTextPasteObservable.notifyObservers(_this);
326
+ this._onPasteText(clipboardInfo.event);
327
+ this.onTextPasteObservable.notifyObservers(this);
412
328
  break;
413
329
  default:
414
330
  return;
415
331
  }
416
332
  });
417
- var scene = this._host.getScene();
333
+ const scene = this._host.getScene();
418
334
  if (scene) {
419
335
  //register the pointer double tap event
420
- this._onPointerDblTapObserver = scene.onPointerObservable.add(function (pointerInfo) {
421
- if (!_this._isFocused) {
336
+ this._onPointerDblTapObserver = scene.onPointerObservable.add((pointerInfo) => {
337
+ if (!this._isFocused) {
422
338
  return;
423
339
  }
424
340
  if (pointerInfo.type === PointerEventTypes.POINTERDOUBLETAP) {
425
- _this._processDblClick(pointerInfo);
341
+ this._processDblClick(pointerInfo);
426
342
  }
427
343
  });
428
344
  }
429
345
  if (this._onFocusSelectAll) {
430
346
  this._selectAllText();
431
347
  }
432
- };
348
+ }
433
349
  /**
434
350
  * Function to focus an inputText programmatically
435
351
  */
436
- InputText.prototype.focus = function () {
352
+ focus() {
437
353
  this._host.moveFocusToControl(this);
438
- };
354
+ }
439
355
  /**
440
356
  * Function to unfocus an inputText programmatically
441
357
  */
442
- InputText.prototype.blur = function () {
358
+ blur() {
443
359
  this._host.focusedControl = null;
444
- };
445
- InputText.prototype._getTypeName = function () {
360
+ }
361
+ _getTypeName() {
446
362
  return "InputText";
447
- };
363
+ }
448
364
  /**
449
365
  * Function called to get the list of controls that should not steal the focus from this control
450
366
  * @returns an array of controls
451
367
  */
452
- InputText.prototype.keepsFocusWith = function () {
368
+ keepsFocusWith() {
453
369
  if (!this._connectedVirtualKeyboard) {
454
370
  return null;
455
371
  }
456
372
  return [this._connectedVirtualKeyboard];
457
- };
373
+ }
458
374
  /**
459
375
  * @param keyCode
460
376
  * @param key
461
377
  * @param evt
462
378
  * @hidden
463
379
  */
464
- InputText.prototype.processKey = function (keyCode, key, evt) {
380
+ processKey(keyCode, key, evt) {
465
381
  if (this.isReadOnly) {
466
382
  return;
467
383
  }
@@ -504,7 +420,7 @@ var InputText = /** @class */ (function (_super) {
504
420
  this.text = this._textWrapper.substr(0, this._textWrapper.length - 1);
505
421
  }
506
422
  else {
507
- var deletePosition = this._textWrapper.length - this._cursorOffset;
423
+ const deletePosition = this._textWrapper.length - this._cursorOffset;
508
424
  if (deletePosition > 0) {
509
425
  this._textWrapper.removePart(deletePosition - 1, deletePosition);
510
426
  this._textHasChanged();
@@ -527,7 +443,7 @@ var InputText = /** @class */ (function (_super) {
527
443
  return;
528
444
  }
529
445
  if (this._textWrapper.text && this._textWrapper.length > 0 && this._cursorOffset > 0) {
530
- var deletePosition = this._textWrapper.length - this._cursorOffset;
446
+ const deletePosition = this._textWrapper.length - this._cursorOffset;
531
447
  this._textWrapper.removePart(deletePosition, deletePosition + 1);
532
448
  this._textHasChanged();
533
449
  this._cursorOffset--;
@@ -731,18 +647,18 @@ var InputText = /** @class */ (function (_super) {
731
647
  this.text += key;
732
648
  }
733
649
  else {
734
- var insertPosition = this._textWrapper.length - this._cursorOffset;
650
+ const insertPosition = this._textWrapper.length - this._cursorOffset;
735
651
  this._textWrapper.removePart(insertPosition, insertPosition, key);
736
652
  this._textHasChanged();
737
653
  }
738
654
  }
739
655
  }
740
- };
656
+ }
741
657
  /**
742
658
  * @param offset
743
659
  * @hidden
744
660
  */
745
- InputText.prototype._updateValueFromCursorIndex = function (offset) {
661
+ _updateValueFromCursorIndex(offset) {
746
662
  //update the cursor
747
663
  this._blinkIsEven = false;
748
664
  if (this._cursorIndex === -1) {
@@ -765,17 +681,17 @@ var InputText = /** @class */ (function (_super) {
765
681
  }
766
682
  this._isTextHighlightOn = true;
767
683
  this._markAsDirty();
768
- };
684
+ }
769
685
  /**
770
686
  * @param evt
771
687
  * @hidden
772
688
  */
773
689
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
774
- InputText.prototype._processDblClick = function (evt) {
690
+ _processDblClick(evt) {
775
691
  //pre-find the start and end index of the word under cursor, speeds up the rendering
776
692
  this._startHighlightIndex = this._textWrapper.length - this._cursorOffset;
777
693
  this._endHighlightIndex = this._startHighlightIndex;
778
- var moveLeft, moveRight;
694
+ let moveLeft, moveRight;
779
695
  do {
780
696
  moveRight = this._endHighlightIndex < this._textWrapper.length && this._textWrapper.isWord(this._endHighlightIndex) ? ++this._endHighlightIndex : 0;
781
697
  moveLeft = this._startHighlightIndex > 0 && this._textWrapper.isWord(this._startHighlightIndex - 1) ? --this._startHighlightIndex : 0;
@@ -787,9 +703,9 @@ var InputText = /** @class */ (function (_super) {
787
703
  this._blinkIsEven = true;
788
704
  this._cursorIndex = -1;
789
705
  this._markAsDirty();
790
- };
706
+ }
791
707
  /** @hidden */
792
- InputText.prototype._selectAllText = function () {
708
+ _selectAllText() {
793
709
  this._blinkIsEven = true;
794
710
  this._isTextHighlightOn = true;
795
711
  this._startHighlightIndex = 0;
@@ -797,34 +713,34 @@ var InputText = /** @class */ (function (_super) {
797
713
  this._cursorOffset = this._textWrapper.length;
798
714
  this._cursorIndex = -1;
799
715
  this._markAsDirty();
800
- };
716
+ }
801
717
  /**
802
718
  * Handles the keyboard event
803
719
  * @param evt Defines the KeyboardEvent
804
720
  */
805
- InputText.prototype.processKeyboard = function (evt) {
721
+ processKeyboard(evt) {
806
722
  // process pressed key
807
723
  this.processKey(evt.keyCode, evt.key, evt);
808
724
  this.onKeyboardEventProcessedObservable.notifyObservers(evt);
809
- };
725
+ }
810
726
  /**
811
727
  * @param ev
812
728
  * @hidden
813
729
  */
814
- InputText.prototype._onCopyText = function (ev) {
730
+ _onCopyText(ev) {
815
731
  this._isTextHighlightOn = false;
816
732
  //when write permission to clipbaord data is denied
817
733
  try {
818
734
  ev.clipboardData && ev.clipboardData.setData("text/plain", this._highlightedText);
819
735
  }
820
- catch (_a) { } //pass
736
+ catch { } //pass
821
737
  this._host.clipboardData = this._highlightedText;
822
- };
738
+ }
823
739
  /**
824
740
  * @param ev
825
741
  * @hidden
826
742
  */
827
- InputText.prototype._onCutText = function (ev) {
743
+ _onCutText(ev) {
828
744
  if (!this._highlightedText) {
829
745
  return;
830
746
  }
@@ -836,16 +752,16 @@ var InputText = /** @class */ (function (_super) {
836
752
  try {
837
753
  ev.clipboardData && ev.clipboardData.setData("text/plain", this._highlightedText);
838
754
  }
839
- catch (_a) { } //pass
755
+ catch { } //pass
840
756
  this._host.clipboardData = this._highlightedText;
841
757
  this._highlightedText = "";
842
- };
758
+ }
843
759
  /**
844
760
  * @param ev
845
761
  * @hidden
846
762
  */
847
- InputText.prototype._onPasteText = function (ev) {
848
- var data = "";
763
+ _onPasteText(ev) {
764
+ let data = "";
849
765
  if (ev.clipboardData && ev.clipboardData.types.indexOf("text/plain") !== -1) {
850
766
  data = ev.clipboardData.getData("text/plain");
851
767
  }
@@ -853,12 +769,11 @@ var InputText = /** @class */ (function (_super) {
853
769
  //get the cached data; returns blank string by default
854
770
  data = this._host.clipboardData;
855
771
  }
856
- var insertPosition = this._textWrapper.length - this._cursorOffset;
772
+ const insertPosition = this._textWrapper.length - this._cursorOffset;
857
773
  this._textWrapper.removePart(insertPosition, insertPosition, data);
858
774
  this._textHasChanged();
859
- };
860
- InputText.prototype._draw = function (context) {
861
- var _this = this;
775
+ }
776
+ _draw(context) {
862
777
  context.save();
863
778
  this._applyStates(context);
864
779
  if (this.shadowBlur || this.shadowOffsetX || this.shadowOffsetY) {
@@ -887,11 +802,11 @@ var InputText = /** @class */ (function (_super) {
887
802
  this._fontOffset = Control._GetFontOffset(context.font);
888
803
  }
889
804
  // Text
890
- var clipTextLeft = this._currentMeasure.left + this._margin.getValueInPixel(this._host, this._tempParentMeasure.width);
805
+ const clipTextLeft = this._currentMeasure.left + this._margin.getValueInPixel(this._host, this._tempParentMeasure.width);
891
806
  if (this.color) {
892
807
  context.fillStyle = this.color;
893
808
  }
894
- var text = this._beforeRenderText(this._textWrapper);
809
+ let text = this._beforeRenderText(this._textWrapper);
895
810
  if (!this._isFocused && !this._textWrapper.text && this._placeholderText) {
896
811
  text = new TextWrapper();
897
812
  text.text = this._placeholderText;
@@ -900,19 +815,19 @@ var InputText = /** @class */ (function (_super) {
900
815
  }
901
816
  }
902
817
  this._textWidth = context.measureText(text.text).width;
903
- var marginWidth = this._margin.getValueInPixel(this._host, this._tempParentMeasure.width) * 2;
818
+ const marginWidth = this._margin.getValueInPixel(this._host, this._tempParentMeasure.width) * 2;
904
819
  if (this._autoStretchWidth) {
905
820
  this.width = Math.min(this._maxWidth.getValueInPixel(this._host, this._tempParentMeasure.width), this._textWidth + marginWidth) + "px";
906
821
  this._autoStretchWidth = true; // setting the width will have reset _autoStretchWidth to false!
907
822
  }
908
- var rootY = this._fontOffset.ascent + (this._currentMeasure.height - this._fontOffset.height) / 2;
909
- var availableWidth = this._width.getValueInPixel(this._host, this._tempParentMeasure.width) - marginWidth;
823
+ const rootY = this._fontOffset.ascent + (this._currentMeasure.height - this._fontOffset.height) / 2;
824
+ const availableWidth = this._width.getValueInPixel(this._host, this._tempParentMeasure.width) - marginWidth;
910
825
  context.save();
911
826
  context.beginPath();
912
827
  context.rect(clipTextLeft, this._currentMeasure.top + (this._currentMeasure.height - this._fontOffset.height) / 2, availableWidth + 2, this._currentMeasure.height);
913
828
  context.clip();
914
829
  if (this._isFocused && this._textWidth > availableWidth) {
915
- var textLeft = clipTextLeft - this._textWidth + availableWidth;
830
+ const textLeft = clipTextLeft - this._textWidth + availableWidth;
916
831
  if (!this._scrollLeft) {
917
832
  this._scrollLeft = textLeft;
918
833
  }
@@ -925,11 +840,11 @@ var InputText = /** @class */ (function (_super) {
925
840
  if (this._isFocused) {
926
841
  // Need to move cursor
927
842
  if (this._clickedCoordinate) {
928
- var rightPosition = this._scrollLeft + this._textWidth;
929
- var absoluteCursorPosition = rightPosition - this._clickedCoordinate;
930
- var currentSize = 0;
843
+ const rightPosition = this._scrollLeft + this._textWidth;
844
+ const absoluteCursorPosition = rightPosition - this._clickedCoordinate;
845
+ let currentSize = 0;
931
846
  this._cursorOffset = 0;
932
- var previousDist = 0;
847
+ let previousDist = 0;
933
848
  do {
934
849
  if (this._cursorOffset) {
935
850
  previousDist = Math.abs(absoluteCursorPosition - currentSize);
@@ -946,9 +861,9 @@ var InputText = /** @class */ (function (_super) {
946
861
  }
947
862
  // Render cursor
948
863
  if (!this._blinkIsEven) {
949
- var cursorOffsetText = text.substr(text.length - this._cursorOffset);
950
- var cursorOffsetWidth = context.measureText(cursorOffsetText).width;
951
- var cursorLeft = this._scrollLeft + this._textWidth - cursorOffsetWidth;
864
+ const cursorOffsetText = text.substr(text.length - this._cursorOffset);
865
+ const cursorOffsetWidth = context.measureText(cursorOffsetText).width;
866
+ let cursorLeft = this._scrollLeft + this._textWidth - cursorOffsetWidth;
952
867
  if (cursorLeft < clipTextLeft) {
953
868
  this._scrollLeft += clipTextLeft - cursorLeft;
954
869
  cursorLeft = clipTextLeft;
@@ -964,17 +879,17 @@ var InputText = /** @class */ (function (_super) {
964
879
  }
965
880
  }
966
881
  clearTimeout(this._blinkTimeout);
967
- this._blinkTimeout = setTimeout(function () {
968
- _this._blinkIsEven = !_this._blinkIsEven;
969
- _this._markAsDirty();
882
+ this._blinkTimeout = setTimeout(() => {
883
+ this._blinkIsEven = !this._blinkIsEven;
884
+ this._markAsDirty();
970
885
  }, 500);
971
886
  //show the highlighted text
972
887
  if (this._isTextHighlightOn) {
973
888
  clearTimeout(this._blinkTimeout);
974
- var highlightCursorOffsetWidth = context.measureText(text.substring(this._startHighlightIndex)).width;
975
- var highlightCursorLeft = this._scrollLeft + this._textWidth - highlightCursorOffsetWidth;
889
+ const highlightCursorOffsetWidth = context.measureText(text.substring(this._startHighlightIndex)).width;
890
+ let highlightCursorLeft = this._scrollLeft + this._textWidth - highlightCursorOffsetWidth;
976
891
  this._highlightedText = text.substring(this._startHighlightIndex, this._endHighlightIndex);
977
- var width = context.measureText(text.substring(this._startHighlightIndex, this._endHighlightIndex)).width;
892
+ let width = context.measureText(text.substring(this._startHighlightIndex, this._endHighlightIndex)).width;
978
893
  if (highlightCursorLeft < clipTextLeft) {
979
894
  width = width - (clipTextLeft - highlightCursorLeft);
980
895
  if (!width) {
@@ -1008,9 +923,9 @@ var InputText = /** @class */ (function (_super) {
1008
923
  context.strokeRect(this._currentMeasure.left + this._thickness / 2, this._currentMeasure.top + this._thickness / 2, this._currentMeasure.width - this._thickness, this._currentMeasure.height - this._thickness);
1009
924
  }
1010
925
  context.restore();
1011
- };
1012
- InputText.prototype._onPointerDown = function (target, coordinates, pointerId, buttonIndex, pi) {
1013
- if (!_super.prototype._onPointerDown.call(this, target, coordinates, pointerId, buttonIndex, pi)) {
926
+ }
927
+ _onPointerDown(target, coordinates, pointerId, buttonIndex, pi) {
928
+ if (!super._onPointerDown(target, coordinates, pointerId, buttonIndex, pi)) {
1014
929
  return false;
1015
930
  }
1016
931
  if (this.isReadOnly) {
@@ -1034,25 +949,25 @@ var InputText = /** @class */ (function (_super) {
1034
949
  }
1035
950
  this._host.focusedControl = this;
1036
951
  return true;
1037
- };
1038
- InputText.prototype._onPointerMove = function (target, coordinates, pointerId, pi) {
952
+ }
953
+ _onPointerMove(target, coordinates, pointerId, pi) {
1039
954
  if (this._host.focusedControl === this && this._isPointerDown && !this.isReadOnly) {
1040
955
  this._clickedCoordinate = coordinates.x;
1041
956
  this._markAsDirty();
1042
957
  this._updateValueFromCursorIndex(this._cursorOffset);
1043
958
  }
1044
- _super.prototype._onPointerMove.call(this, target, coordinates, pointerId, pi);
1045
- };
1046
- InputText.prototype._onPointerUp = function (target, coordinates, pointerId, buttonIndex, notifyClick) {
959
+ super._onPointerMove(target, coordinates, pointerId, pi);
960
+ }
961
+ _onPointerUp(target, coordinates, pointerId, buttonIndex, notifyClick) {
1047
962
  this._isPointerDown = false;
1048
963
  delete this._host._capturingControl[pointerId];
1049
- _super.prototype._onPointerUp.call(this, target, coordinates, pointerId, buttonIndex, notifyClick);
1050
- };
1051
- InputText.prototype._beforeRenderText = function (textWrapper) {
964
+ super._onPointerUp(target, coordinates, pointerId, buttonIndex, notifyClick);
965
+ }
966
+ _beforeRenderText(textWrapper) {
1052
967
  return textWrapper;
1053
- };
1054
- InputText.prototype.dispose = function () {
1055
- _super.prototype.dispose.call(this);
968
+ }
969
+ dispose() {
970
+ super.dispose();
1056
971
  this.onBlurObservable.clear();
1057
972
  this.onFocusObservable.clear();
1058
973
  this.onTextChangedObservable.clear();
@@ -1061,60 +976,58 @@ var InputText = /** @class */ (function (_super) {
1061
976
  this.onTextPasteObservable.clear();
1062
977
  this.onTextHighlightObservable.clear();
1063
978
  this.onKeyboardEventProcessedObservable.clear();
1064
- };
1065
- __decorate([
1066
- serialize()
1067
- ], InputText.prototype, "promptMessage", void 0);
1068
- __decorate([
1069
- serialize()
1070
- ], InputText.prototype, "disableMobilePrompt", void 0);
1071
- __decorate([
1072
- serialize()
1073
- ], InputText.prototype, "maxWidth", null);
1074
- __decorate([
1075
- serialize()
1076
- ], InputText.prototype, "highligherOpacity", null);
1077
- __decorate([
1078
- serialize()
1079
- ], InputText.prototype, "onFocusSelectAll", null);
1080
- __decorate([
1081
- serialize()
1082
- ], InputText.prototype, "textHighlightColor", null);
1083
- __decorate([
1084
- serialize()
1085
- ], InputText.prototype, "margin", null);
1086
- __decorate([
1087
- serialize()
1088
- ], InputText.prototype, "autoStretchWidth", null);
1089
- __decorate([
1090
- serialize()
1091
- ], InputText.prototype, "thickness", null);
1092
- __decorate([
1093
- serialize()
1094
- ], InputText.prototype, "focusedBackground", null);
1095
- __decorate([
1096
- serialize()
1097
- ], InputText.prototype, "focusedColor", null);
1098
- __decorate([
1099
- serialize()
1100
- ], InputText.prototype, "background", null);
1101
- __decorate([
1102
- serialize()
1103
- ], InputText.prototype, "placeholderColor", null);
1104
- __decorate([
1105
- serialize()
1106
- ], InputText.prototype, "placeholderText", null);
1107
- __decorate([
1108
- serialize()
1109
- ], InputText.prototype, "deadKey", null);
1110
- __decorate([
1111
- serialize()
1112
- ], InputText.prototype, "text", null);
1113
- __decorate([
1114
- serialize()
1115
- ], InputText.prototype, "width", null);
1116
- return InputText;
1117
- }(Control));
1118
- export { InputText };
979
+ }
980
+ }
981
+ __decorate([
982
+ serialize()
983
+ ], InputText.prototype, "promptMessage", void 0);
984
+ __decorate([
985
+ serialize()
986
+ ], InputText.prototype, "disableMobilePrompt", void 0);
987
+ __decorate([
988
+ serialize()
989
+ ], InputText.prototype, "maxWidth", null);
990
+ __decorate([
991
+ serialize()
992
+ ], InputText.prototype, "highligherOpacity", null);
993
+ __decorate([
994
+ serialize()
995
+ ], InputText.prototype, "onFocusSelectAll", null);
996
+ __decorate([
997
+ serialize()
998
+ ], InputText.prototype, "textHighlightColor", null);
999
+ __decorate([
1000
+ serialize()
1001
+ ], InputText.prototype, "margin", null);
1002
+ __decorate([
1003
+ serialize()
1004
+ ], InputText.prototype, "autoStretchWidth", null);
1005
+ __decorate([
1006
+ serialize()
1007
+ ], InputText.prototype, "thickness", null);
1008
+ __decorate([
1009
+ serialize()
1010
+ ], InputText.prototype, "focusedBackground", null);
1011
+ __decorate([
1012
+ serialize()
1013
+ ], InputText.prototype, "focusedColor", null);
1014
+ __decorate([
1015
+ serialize()
1016
+ ], InputText.prototype, "background", null);
1017
+ __decorate([
1018
+ serialize()
1019
+ ], InputText.prototype, "placeholderColor", null);
1020
+ __decorate([
1021
+ serialize()
1022
+ ], InputText.prototype, "placeholderText", null);
1023
+ __decorate([
1024
+ serialize()
1025
+ ], InputText.prototype, "deadKey", null);
1026
+ __decorate([
1027
+ serialize()
1028
+ ], InputText.prototype, "text", null);
1029
+ __decorate([
1030
+ serialize()
1031
+ ], InputText.prototype, "width", null);
1119
1032
  RegisterClass("BABYLON.GUI.InputText", InputText);
1120
1033
  //# sourceMappingURL=inputText.js.map