@babylonjs/gui 5.0.0-beta.9 → 5.0.0-rc.10
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/adtInstrumentation.d.ts +52 -52
- package/2D/adtInstrumentation.js +126 -126
- package/2D/adtInstrumentation.js.map +1 -1
- package/2D/advancedDynamicTexture.d.ts +449 -412
- package/2D/advancedDynamicTexture.js +1318 -1239
- package/2D/advancedDynamicTexture.js.map +1 -1
- package/2D/controls/button.d.ts +135 -97
- package/2D/controls/button.js +276 -238
- package/2D/controls/button.js.map +1 -1
- package/2D/controls/checkbox.d.ts +59 -51
- package/2D/controls/checkbox.js +188 -178
- package/2D/controls/checkbox.js.map +1 -1
- package/2D/controls/colorpicker.d.ts +103 -90
- package/2D/controls/colorpicker.js +1417 -1400
- package/2D/controls/colorpicker.js.map +1 -1
- package/2D/controls/container.d.ts +175 -130
- package/2D/controls/container.js +570 -525
- package/2D/controls/container.js.map +1 -1
- package/2D/controls/control.d.ts +866 -743
- package/2D/controls/control.js +2433 -2308
- package/2D/controls/control.js.map +1 -1
- package/2D/controls/displayGrid.d.ts +53 -55
- package/2D/controls/displayGrid.js +245 -245
- package/2D/controls/displayGrid.js.map +1 -1
- package/2D/controls/ellipse.d.ts +21 -21
- package/2D/controls/ellipse.js +85 -85
- package/2D/controls/ellipse.js.map +1 -1
- package/2D/controls/focusableButton.d.ts +59 -52
- package/2D/controls/focusableButton.js +99 -92
- package/2D/controls/focusableButton.js.map +1 -1
- package/2D/controls/focusableControl.d.ts +34 -34
- package/2D/controls/focusableControl.js +1 -1
- package/2D/controls/focusableControl.js.map +1 -1
- package/2D/controls/grid.d.ts +139 -135
- package/2D/controls/grid.js +529 -525
- package/2D/controls/grid.js.map +1 -1
- package/2D/controls/image.d.ts +204 -197
- package/2D/controls/image.js +887 -879
- package/2D/controls/image.js.map +1 -1
- package/2D/controls/index.d.ts +29 -29
- package/2D/controls/index.js +29 -29
- package/2D/controls/index.js.map +1 -1
- package/2D/controls/inputPassword.d.ts +9 -8
- package/2D/controls/inputPassword.js +28 -25
- package/2D/controls/inputPassword.js.map +1 -1
- package/2D/controls/inputText.d.ts +201 -180
- package/2D/controls/inputText.js +1119 -1095
- package/2D/controls/inputText.js.map +1 -1
- package/2D/controls/line.d.ts +66 -66
- package/2D/controls/line.js +271 -271
- package/2D/controls/line.js.map +1 -1
- package/2D/controls/multiLine.d.ts +75 -77
- package/2D/controls/multiLine.js +262 -262
- package/2D/controls/multiLine.js.map +1 -1
- package/2D/controls/radioButton.d.ts +49 -49
- package/2D/controls/radioButton.js +205 -205
- package/2D/controls/radioButton.js.map +1 -1
- package/2D/controls/rectangle.d.ts +29 -29
- package/2D/controls/rectangle.js +150 -150
- package/2D/controls/rectangle.js.map +1 -1
- package/2D/controls/scrollViewers/scrollViewer.d.ts +182 -175
- package/2D/controls/scrollViewers/scrollViewer.js +677 -676
- package/2D/controls/scrollViewers/scrollViewer.js.map +1 -1
- package/2D/controls/scrollViewers/scrollViewerWindow.d.ts +57 -45
- package/2D/controls/scrollViewers/scrollViewerWindow.js +278 -263
- package/2D/controls/scrollViewers/scrollViewerWindow.js.map +1 -1
- package/2D/controls/selector.d.ts +263 -209
- package/2D/controls/selector.js +692 -629
- package/2D/controls/selector.js.map +1 -1
- package/2D/controls/sliders/baseSlider.d.ts +82 -78
- package/2D/controls/sliders/baseSlider.js +347 -343
- package/2D/controls/sliders/baseSlider.js.map +1 -1
- package/2D/controls/sliders/imageBasedSlider.d.ts +49 -47
- package/2D/controls/sliders/imageBasedSlider.js +192 -188
- package/2D/controls/sliders/imageBasedSlider.js.map +1 -1
- package/2D/controls/sliders/imageScrollBar.d.ts +65 -61
- package/2D/controls/sliders/imageScrollBar.js +263 -256
- package/2D/controls/sliders/imageScrollBar.js.map +1 -1
- package/2D/controls/sliders/scrollBar.d.ts +38 -34
- package/2D/controls/sliders/scrollBar.js +143 -136
- package/2D/controls/sliders/scrollBar.js.map +1 -1
- package/2D/controls/sliders/slider.d.ts +35 -37
- package/2D/controls/sliders/slider.js +271 -271
- package/2D/controls/sliders/slider.js.map +1 -1
- package/2D/controls/stackPanel.d.ts +64 -56
- package/2D/controls/stackPanel.js +246 -236
- package/2D/controls/stackPanel.js.map +1 -1
- package/2D/controls/statics.d.ts +6 -6
- package/2D/controls/statics.js +49 -47
- package/2D/controls/statics.js.map +1 -1
- package/2D/controls/textBlock.d.ts +175 -171
- package/2D/controls/textBlock.js +603 -588
- package/2D/controls/textBlock.js.map +1 -1
- package/2D/controls/textWrapper.d.ts +13 -13
- package/2D/controls/textWrapper.js +101 -101
- package/2D/controls/textWrapper.js.map +1 -1
- package/2D/controls/toggleButton.d.ts +117 -83
- package/2D/controls/toggleButton.js +268 -234
- package/2D/controls/toggleButton.js.map +1 -1
- package/2D/controls/virtualKeyboard.d.ts +96 -96
- package/2D/controls/virtualKeyboard.js +256 -256
- package/2D/controls/virtualKeyboard.js.map +1 -1
- package/2D/index.d.ts +9 -9
- package/2D/index.js +10 -9
- package/2D/index.js.map +1 -1
- package/2D/math2D.d.ts +117 -117
- package/2D/math2D.js +221 -221
- package/2D/math2D.js.map +1 -1
- package/2D/measure.d.ts +77 -77
- package/2D/measure.js +139 -149
- package/2D/measure.js.map +1 -1
- package/2D/multiLinePoint.d.ts +47 -47
- package/2D/multiLinePoint.js +127 -127
- package/2D/multiLinePoint.js.map +1 -1
- package/2D/style.d.ts +46 -46
- package/2D/style.js +97 -97
- package/2D/style.js.map +1 -1
- package/2D/valueAndUnit.d.ts +89 -89
- package/2D/valueAndUnit.js +226 -222
- package/2D/valueAndUnit.js.map +1 -1
- package/2D/xmlLoader.d.ts +60 -60
- package/2D/xmlLoader.js +348 -341
- package/2D/xmlLoader.js.map +1 -1
- package/3D/behaviors/defaultBehavior.d.ts +73 -73
- package/3D/behaviors/defaultBehavior.js +121 -121
- package/3D/behaviors/defaultBehavior.js.map +1 -1
- package/3D/controls/abstractButton3D.d.ts +15 -15
- package/3D/controls/abstractButton3D.js +25 -25
- package/3D/controls/abstractButton3D.js.map +1 -1
- package/3D/controls/button3D.d.ts +30 -30
- package/3D/controls/button3D.js +93 -93
- package/3D/controls/button3D.js.map +1 -1
- package/3D/controls/container3D.d.ts +72 -72
- package/3D/controls/container3D.js +139 -140
- package/3D/controls/container3D.js.map +1 -1
- package/3D/controls/contentDisplay3D.d.ts +30 -30
- package/3D/controls/contentDisplay3D.js +79 -78
- package/3D/controls/contentDisplay3D.js.map +1 -1
- package/3D/controls/control3D.d.ts +201 -165
- package/3D/controls/control3D.js +445 -408
- package/3D/controls/control3D.js.map +1 -1
- package/3D/controls/cylinderPanel.d.ts +17 -17
- package/3D/controls/cylinderPanel.js +66 -66
- package/3D/controls/cylinderPanel.js.map +1 -1
- package/3D/controls/handMenu.d.ts +28 -28
- package/3D/controls/handMenu.js +47 -47
- package/3D/controls/handMenu.js.map +1 -1
- package/3D/controls/holographicBackplate.d.ts +49 -48
- package/3D/controls/holographicBackplate.js +120 -120
- package/3D/controls/holographicBackplate.js.map +1 -1
- package/3D/controls/holographicButton.d.ts +84 -83
- package/3D/controls/holographicButton.js +339 -338
- package/3D/controls/holographicButton.js.map +1 -1
- package/3D/controls/holographicSlate.d.ts +131 -118
- package/3D/controls/holographicSlate.js +431 -369
- package/3D/controls/holographicSlate.js.map +1 -1
- package/3D/controls/index.d.ts +21 -21
- package/3D/controls/index.js +21 -21
- package/3D/controls/index.js.map +1 -1
- package/3D/controls/meshButton3D.d.ts +21 -21
- package/3D/controls/meshButton3D.js +62 -61
- package/3D/controls/meshButton3D.js.map +1 -1
- package/3D/controls/nearMenu.d.ts +44 -44
- package/3D/controls/nearMenu.js +114 -112
- package/3D/controls/nearMenu.js.map +1 -1
- package/3D/controls/planePanel.d.ts +9 -9
- package/3D/controls/planePanel.js +36 -36
- package/3D/controls/planePanel.js.map +1 -1
- package/3D/controls/scatterPanel.d.ts +18 -18
- package/3D/controls/scatterPanel.js +108 -108
- package/3D/controls/scatterPanel.js.map +1 -1
- package/3D/controls/slider3D.d.ts +81 -80
- package/3D/controls/slider3D.js +268 -267
- package/3D/controls/slider3D.js.map +1 -1
- package/3D/controls/spherePanel.d.ts +17 -17
- package/3D/controls/spherePanel.js +67 -67
- package/3D/controls/spherePanel.js.map +1 -1
- package/3D/controls/stackPanel3D.d.ts +22 -22
- package/3D/controls/stackPanel3D.js +107 -107
- package/3D/controls/stackPanel3D.js.map +1 -1
- package/3D/controls/touchButton3D.d.ts +80 -64
- package/3D/controls/touchButton3D.js +233 -188
- package/3D/controls/touchButton3D.js.map +1 -1
- package/3D/controls/touchHolographicButton.d.ts +110 -104
- package/3D/controls/touchHolographicButton.js +445 -432
- package/3D/controls/touchHolographicButton.js.map +1 -1
- package/3D/controls/touchHolographicMenu.d.ts +61 -61
- package/3D/controls/touchHolographicMenu.js +149 -148
- package/3D/controls/touchHolographicMenu.js.map +1 -1
- package/3D/controls/touchMeshButton3D.d.ts +21 -22
- package/3D/controls/touchMeshButton3D.js +62 -62
- package/3D/controls/touchMeshButton3D.js.map +1 -1
- package/3D/controls/volumeBasedPanel.d.ts +53 -52
- package/3D/controls/volumeBasedPanel.js +174 -174
- package/3D/controls/volumeBasedPanel.js.map +1 -1
- package/3D/gizmos/gizmoHandle.d.ts +108 -108
- package/3D/gizmos/gizmoHandle.js +209 -209
- package/3D/gizmos/gizmoHandle.js.map +1 -1
- package/3D/gizmos/index.d.ts +2 -2
- package/3D/gizmos/index.js +2 -2
- package/3D/gizmos/index.js.map +1 -1
- package/3D/gizmos/slateGizmo.d.ts +57 -59
- package/3D/gizmos/slateGizmo.js +369 -363
- package/3D/gizmos/slateGizmo.js.map +1 -1
- package/3D/gui3DManager.d.ts +94 -94
- package/3D/gui3DManager.js +257 -257
- package/3D/gui3DManager.js.map +1 -1
- package/3D/index.d.ts +5 -5
- package/3D/index.js +6 -5
- package/3D/index.js.map +1 -1
- package/3D/materials/fluent/fluentMaterial.d.ts +91 -90
- package/3D/materials/fluent/fluentMaterial.js +292 -281
- package/3D/materials/fluent/fluentMaterial.js.map +1 -1
- package/3D/materials/fluent/index.d.ts +1 -1
- package/3D/materials/fluent/index.js +1 -1
- package/3D/materials/fluent/index.js.map +1 -1
- package/3D/materials/fluent/shaders/fluent.fragment.d.ts +5 -5
- package/3D/materials/fluent/shaders/fluent.fragment.js +8 -6
- package/3D/materials/fluent/shaders/fluent.fragment.js.map +1 -1
- package/3D/materials/fluent/shaders/fluent.vertex.d.ts +5 -5
- package/3D/materials/fluent/shaders/fluent.vertex.js +8 -6
- package/3D/materials/fluent/shaders/fluent.vertex.js.map +1 -1
- package/3D/materials/fluentBackplate/fluentBackplateMaterial.d.ts +155 -154
- package/3D/materials/fluentBackplate/fluentBackplateMaterial.js +469 -434
- package/3D/materials/fluentBackplate/fluentBackplateMaterial.js.map +1 -1
- package/3D/materials/fluentBackplate/index.d.ts +1 -1
- package/3D/materials/fluentBackplate/index.js +1 -1
- package/3D/materials/fluentBackplate/index.js.map +1 -1
- package/3D/materials/fluentBackplate/shaders/fluentBackplate.fragment.d.ts +5 -5
- package/3D/materials/fluentBackplate/shaders/fluentBackplate.fragment.js +8 -6
- package/3D/materials/fluentBackplate/shaders/fluentBackplate.fragment.js.map +1 -1
- package/3D/materials/fluentBackplate/shaders/fluentBackplate.vertex.d.ts +5 -5
- package/3D/materials/fluentBackplate/shaders/fluentBackplate.vertex.js +8 -6
- package/3D/materials/fluentBackplate/shaders/fluentBackplate.vertex.js.map +1 -1
- package/3D/materials/fluentButton/fluentButtonMaterial.d.ts +190 -189
- package/3D/materials/fluentButton/fluentButtonMaterial.js +539 -537
- package/3D/materials/fluentButton/fluentButtonMaterial.js.map +1 -1
- package/3D/materials/fluentButton/index.d.ts +1 -1
- package/3D/materials/fluentButton/index.js +1 -1
- package/3D/materials/fluentButton/index.js.map +1 -1
- package/3D/materials/fluentButton/shaders/fluentButton.fragment.d.ts +5 -5
- package/3D/materials/fluentButton/shaders/fluentButton.fragment.js +8 -6
- package/3D/materials/fluentButton/shaders/fluentButton.fragment.js.map +1 -1
- package/3D/materials/fluentButton/shaders/fluentButton.vertex.d.ts +5 -5
- package/3D/materials/fluentButton/shaders/fluentButton.vertex.js +8 -6
- package/3D/materials/fluentButton/shaders/fluentButton.vertex.js.map +1 -1
- package/3D/materials/fluentMaterial.d.ts +4 -4
- package/3D/materials/fluentMaterial.js +4 -4
- package/3D/materials/fluentMaterial.js.map +1 -1
- package/3D/materials/handle/handleMaterial.d.ts +68 -68
- package/3D/materials/handle/handleMaterial.js +126 -126
- package/3D/materials/handle/handleMaterial.js.map +1 -1
- package/3D/materials/handle/index.d.ts +1 -1
- package/3D/materials/handle/index.js +1 -1
- package/3D/materials/handle/index.js.map +1 -1
- package/3D/materials/handle/shaders/handle.fragment.d.ts +5 -5
- package/3D/materials/handle/shaders/handle.fragment.js +8 -6
- package/3D/materials/handle/shaders/handle.fragment.js.map +1 -1
- package/3D/materials/handle/shaders/handle.vertex.d.ts +5 -5
- package/3D/materials/handle/shaders/handle.vertex.js +8 -6
- package/3D/materials/handle/shaders/handle.vertex.js.map +1 -1
- package/3D/materials/index.d.ts +5 -5
- package/3D/materials/index.js +6 -5
- package/3D/materials/index.js.map +1 -1
- package/3D/materials/mrdl/index.d.ts +3 -3
- package/3D/materials/mrdl/index.js +3 -3
- package/3D/materials/mrdl/index.js.map +1 -1
- package/3D/materials/mrdl/mrdlBackplateMaterial.d.ts +148 -147
- package/3D/materials/mrdl/mrdlBackplateMaterial.js +436 -409
- package/3D/materials/mrdl/mrdlBackplateMaterial.js.map +1 -1
- package/3D/materials/mrdl/mrdlSliderBarMaterial.d.ts +334 -333
- package/3D/materials/mrdl/mrdlSliderBarMaterial.js +851 -786
- package/3D/materials/mrdl/mrdlSliderBarMaterial.js.map +1 -1
- package/3D/materials/mrdl/mrdlSliderThumbMaterial.d.ts +334 -333
- package/3D/materials/mrdl/mrdlSliderThumbMaterial.js +851 -786
- package/3D/materials/mrdl/mrdlSliderThumbMaterial.js.map +1 -1
- package/3D/materials/mrdl/shaders/mrdlBackplate.fragment.d.ts +5 -5
- package/3D/materials/mrdl/shaders/mrdlBackplate.fragment.js +8 -6
- package/3D/materials/mrdl/shaders/mrdlBackplate.fragment.js.map +1 -1
- package/3D/materials/mrdl/shaders/mrdlBackplate.vertex.d.ts +5 -5
- package/3D/materials/mrdl/shaders/mrdlBackplate.vertex.js +8 -6
- package/3D/materials/mrdl/shaders/mrdlBackplate.vertex.js.map +1 -1
- package/3D/materials/mrdl/shaders/mrdlSliderBar.fragment.d.ts +5 -5
- package/3D/materials/mrdl/shaders/mrdlSliderBar.fragment.js +8 -6
- package/3D/materials/mrdl/shaders/mrdlSliderBar.fragment.js.map +1 -1
- package/3D/materials/mrdl/shaders/mrdlSliderBar.vertex.d.ts +5 -5
- package/3D/materials/mrdl/shaders/mrdlSliderBar.vertex.js +8 -6
- package/3D/materials/mrdl/shaders/mrdlSliderBar.vertex.js.map +1 -1
- package/3D/materials/mrdl/shaders/mrdlSliderThumb.fragment.d.ts +5 -5
- package/3D/materials/mrdl/shaders/mrdlSliderThumb.fragment.js +8 -6
- package/3D/materials/mrdl/shaders/mrdlSliderThumb.fragment.js.map +1 -1
- package/3D/materials/mrdl/shaders/mrdlSliderThumb.vertex.d.ts +5 -5
- package/3D/materials/mrdl/shaders/mrdlSliderThumb.vertex.js +8 -6
- package/3D/materials/mrdl/shaders/mrdlSliderThumb.vertex.js.map +1 -1
- package/3D/vector3WithInfo.d.ts +16 -16
- package/3D/vector3WithInfo.js +23 -23
- package/3D/vector3WithInfo.js.map +1 -1
- package/index.d.ts +2 -2
- package/index.js +3 -2
- package/index.js.map +1 -1
- package/legacy/legacy.d.ts +1 -1
- package/legacy/legacy.js +14 -13
- package/legacy/legacy.js.map +1 -1
- package/package.json +21 -328
- package/readme.md +2 -2
package/2D/controls/control.js
CHANGED
|
@@ -1,2309 +1,2434 @@
|
|
|
1
|
-
import { __decorate } from "tslib";
|
|
2
|
-
import { Observable } from "@babylonjs/core/Misc/observable.js";
|
|
3
|
-
import { Vector2, Vector3, Matrix } from "@babylonjs/core/Maths/math.vector.js";
|
|
4
|
-
import { PointerEventTypes } from "@babylonjs/core/Events/pointerEvents.js";
|
|
5
|
-
import { Logger } from "@babylonjs/core/Misc/logger.js";
|
|
6
|
-
import { Tools } from "@babylonjs/core/Misc/tools.js";
|
|
7
|
-
import { ValueAndUnit } from "../valueAndUnit
|
|
8
|
-
import { Measure } from "../measure
|
|
9
|
-
import { Matrix2D, Vector2WithInfo } from "../math2D
|
|
10
|
-
import { RegisterClass } from "@babylonjs/core/Misc/typeStore.js";
|
|
11
|
-
import { SerializationHelper, serialize } from "@babylonjs/core/Misc/decorators.js";
|
|
12
|
-
import { EngineStore } from "@babylonjs/core/Engines/engineStore.js";
|
|
13
|
-
/**
|
|
14
|
-
* Root class used for all 2D controls
|
|
15
|
-
* @see https://doc.babylonjs.com/how_to/gui#controls
|
|
16
|
-
*/
|
|
17
|
-
var Control = /** @class */ (function () {
|
|
18
|
-
// Functions
|
|
19
|
-
/**
|
|
20
|
-
* Creates a new control
|
|
21
|
-
* @param name defines the name of the control
|
|
22
|
-
*/
|
|
23
|
-
function Control(
|
|
24
|
-
/** defines the name of the control */
|
|
25
|
-
name) {
|
|
26
|
-
this.name = name;
|
|
27
|
-
this._alpha = 1;
|
|
28
|
-
this._alphaSet = false;
|
|
29
|
-
this._zIndex = 0;
|
|
30
|
-
/** @hidden */
|
|
31
|
-
this._currentMeasure = Measure.Empty();
|
|
32
|
-
/** @hidden */
|
|
33
|
-
this._tempPaddingMeasure = Measure.Empty();
|
|
34
|
-
this._fontFamily = "Arial";
|
|
35
|
-
this._fontStyle = "";
|
|
36
|
-
this._fontWeight = "";
|
|
37
|
-
this._fontSize = new ValueAndUnit(18, ValueAndUnit.UNITMODE_PIXEL, false);
|
|
38
|
-
/** @hidden */
|
|
39
|
-
this._width = new ValueAndUnit(1, ValueAndUnit.UNITMODE_PERCENTAGE, false);
|
|
40
|
-
/** @hidden */
|
|
41
|
-
this._height = new ValueAndUnit(1, ValueAndUnit.UNITMODE_PERCENTAGE, false);
|
|
42
|
-
this._color = "";
|
|
43
|
-
this._style = null;
|
|
44
|
-
/** @hidden */
|
|
45
|
-
this._horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_CENTER;
|
|
46
|
-
/** @hidden */
|
|
47
|
-
this._verticalAlignment = Control.VERTICAL_ALIGNMENT_CENTER;
|
|
48
|
-
/** @hidden */
|
|
49
|
-
this._isDirty = true;
|
|
50
|
-
/** @hidden */
|
|
51
|
-
this._wasDirty = false;
|
|
52
|
-
/** @hidden */
|
|
53
|
-
this._tempParentMeasure = Measure.Empty();
|
|
54
|
-
/** @hidden */
|
|
55
|
-
this._prevCurrentMeasureTransformedIntoGlobalSpace = Measure.Empty();
|
|
56
|
-
/** @hidden */
|
|
57
|
-
this._cachedParentMeasure = Measure.Empty();
|
|
58
|
-
this._descendantsOnlyPadding = false;
|
|
59
|
-
this._paddingLeft = new ValueAndUnit(0);
|
|
60
|
-
this._paddingRight = new ValueAndUnit(0);
|
|
61
|
-
this._paddingTop = new ValueAndUnit(0);
|
|
62
|
-
this._paddingBottom = new ValueAndUnit(0);
|
|
63
|
-
/** @hidden */
|
|
64
|
-
this._left = new ValueAndUnit(0);
|
|
65
|
-
/** @hidden */
|
|
66
|
-
this._top = new ValueAndUnit(0);
|
|
67
|
-
this._scaleX = 1.0;
|
|
68
|
-
this._scaleY = 1.0;
|
|
69
|
-
this._rotation = 0;
|
|
70
|
-
this._transformCenterX = 0.5;
|
|
71
|
-
this._transformCenterY = 0.5;
|
|
72
|
-
/** @hidden */
|
|
73
|
-
this._transformMatrix = Matrix2D.Identity();
|
|
74
|
-
/** @hidden */
|
|
75
|
-
this._invertTransformMatrix = Matrix2D.Identity();
|
|
76
|
-
/** @hidden */
|
|
77
|
-
this._transformedPosition = Vector2.Zero();
|
|
78
|
-
this._isMatrixDirty = true;
|
|
79
|
-
this._isVisible = true;
|
|
80
|
-
this._isHighlighted = false;
|
|
81
|
-
this._highlightColor = "#4affff";
|
|
82
|
-
this._highlightLineWidth = 2;
|
|
83
|
-
this._fontSet = false;
|
|
84
|
-
this._dummyVector2 = Vector2.Zero();
|
|
85
|
-
this._downCount = 0;
|
|
86
|
-
this._enterCount = -1;
|
|
87
|
-
this._doNotRender = false;
|
|
88
|
-
this._downPointerIds = {};
|
|
89
|
-
this._evaluatedMeasure = new Measure(0, 0, 0, 0);
|
|
90
|
-
this._evaluatedParentMeasure = new Measure(0, 0, 0, 0);
|
|
91
|
-
this._isEnabled = true;
|
|
92
|
-
this._disabledColor = "#9a9a9a";
|
|
93
|
-
this._disabledColorItem = "#6a6a6a";
|
|
94
|
-
this._isReadOnly = false;
|
|
95
|
-
/** @hidden */
|
|
96
|
-
this._rebuildLayout = false;
|
|
97
|
-
/** @hidden */
|
|
98
|
-
this._customData = {};
|
|
99
|
-
/** @hidden */
|
|
100
|
-
this._isClipped = false;
|
|
101
|
-
/** @hidden */
|
|
102
|
-
this._automaticSize = false;
|
|
103
|
-
/**
|
|
104
|
-
* Gets or sets an object used to store user defined information for the node
|
|
105
|
-
*/
|
|
106
|
-
this.metadata = null;
|
|
107
|
-
/** Gets or sets a boolean indicating if the control can be hit with pointer events */
|
|
108
|
-
this.isHitTestVisible = true;
|
|
109
|
-
/** Gets or sets a boolean indicating if the control can block pointer events */
|
|
110
|
-
this.isPointerBlocker = false;
|
|
111
|
-
/** Gets or sets a boolean indicating if the control can be focusable */
|
|
112
|
-
this.isFocusInvisible = false;
|
|
113
|
-
/**
|
|
114
|
-
* Gets or sets a boolean indicating if the children are clipped to the current control bounds.
|
|
115
|
-
* Please note that not clipping children may generate issues with adt.useInvalidateRectOptimization so it is recommended to turn this optimization off if you want to use unclipped children
|
|
116
|
-
*/
|
|
117
|
-
this.clipChildren = true;
|
|
118
|
-
/**
|
|
119
|
-
* Gets or sets a boolean indicating that control content must be clipped
|
|
120
|
-
* Please note that not clipping children may generate issues with adt.useInvalidateRectOptimization so it is recommended to turn this optimization off if you want to use unclipped children
|
|
121
|
-
*/
|
|
122
|
-
this.clipContent = true;
|
|
123
|
-
/**
|
|
124
|
-
* Gets or sets a boolean indicating that the current control should cache its rendering (useful when the control does not change often)
|
|
125
|
-
*/
|
|
126
|
-
this.useBitmapCache = false;
|
|
127
|
-
this._shadowOffsetX = 0;
|
|
128
|
-
this._shadowOffsetY = 0;
|
|
129
|
-
this._shadowBlur = 0;
|
|
130
|
-
this._previousShadowBlur = 0;
|
|
131
|
-
this._shadowColor = "black";
|
|
132
|
-
/** Gets or sets the cursor to use when the control is hovered */
|
|
133
|
-
this.hoverCursor = "";
|
|
134
|
-
/** @hidden */
|
|
135
|
-
this._linkOffsetX = new ValueAndUnit(0);
|
|
136
|
-
/** @hidden */
|
|
137
|
-
this._linkOffsetY = new ValueAndUnit(0);
|
|
138
|
-
/**
|
|
139
|
-
* An event triggered when pointer wheel is scrolled
|
|
140
|
-
*/
|
|
141
|
-
this.onWheelObservable = new Observable();
|
|
142
|
-
/**
|
|
143
|
-
* An event triggered when the pointer moves over the control.
|
|
144
|
-
*/
|
|
145
|
-
this.onPointerMoveObservable = new Observable();
|
|
146
|
-
/**
|
|
147
|
-
* An event triggered when the pointer moves out of the control.
|
|
148
|
-
*/
|
|
149
|
-
this.onPointerOutObservable = new Observable();
|
|
150
|
-
/**
|
|
151
|
-
* An event triggered when the pointer taps the control
|
|
152
|
-
*/
|
|
153
|
-
this.onPointerDownObservable = new Observable();
|
|
154
|
-
/**
|
|
155
|
-
* An event triggered when pointer up
|
|
156
|
-
*/
|
|
157
|
-
this.onPointerUpObservable = new Observable();
|
|
158
|
-
/**
|
|
159
|
-
* An event triggered when a control is clicked on
|
|
160
|
-
*/
|
|
161
|
-
this.onPointerClickObservable = new Observable();
|
|
162
|
-
/**
|
|
163
|
-
* An event triggered when pointer enters the control
|
|
164
|
-
*/
|
|
165
|
-
this.onPointerEnterObservable = new Observable();
|
|
166
|
-
/**
|
|
167
|
-
* An event triggered when the control is marked as dirty
|
|
168
|
-
*/
|
|
169
|
-
this.onDirtyObservable = new Observable();
|
|
170
|
-
/**
|
|
171
|
-
* An event triggered before drawing the control
|
|
172
|
-
*/
|
|
173
|
-
this.onBeforeDrawObservable = new Observable();
|
|
174
|
-
/**
|
|
175
|
-
* An event triggered after the control was drawn
|
|
176
|
-
*/
|
|
177
|
-
this.onAfterDrawObservable = new Observable();
|
|
178
|
-
/**
|
|
179
|
-
* An event triggered when the control has been disposed
|
|
180
|
-
*/
|
|
181
|
-
this.onDisposeObservable = new Observable();
|
|
182
|
-
/**
|
|
183
|
-
* Gets or sets a fixed ratio for this control.
|
|
184
|
-
* When different from 0, the ratio is used to compute the "second" dimension.
|
|
185
|
-
* The first dimension used in the computation is the last one set (by setting width / widthInPixels or height / heightInPixels), and the
|
|
186
|
-
* second dimension is computed as first dimension * fixedRatio
|
|
187
|
-
*/
|
|
188
|
-
this.fixedRatio = 0;
|
|
189
|
-
this._fixedRatioMasterIsWidth = true;
|
|
190
|
-
this._tmpMeasureA = new Measure(0, 0, 0, 0);
|
|
191
|
-
}
|
|
192
|
-
Object.defineProperty(Control.prototype, "isReadOnly", {
|
|
193
|
-
/**
|
|
194
|
-
* Gets or sets a boolean indicating if the control is readonly (default: false).
|
|
195
|
-
* A readonly control will still raise pointer events but will not react to them
|
|
196
|
-
*/
|
|
197
|
-
get: function () {
|
|
198
|
-
return this._isReadOnly;
|
|
199
|
-
},
|
|
200
|
-
set: function (value) {
|
|
201
|
-
this._isReadOnly = value;
|
|
202
|
-
},
|
|
203
|
-
enumerable: false,
|
|
204
|
-
configurable: true
|
|
205
|
-
});
|
|
206
|
-
Object.defineProperty(Control.prototype, "transformedMeasure", {
|
|
207
|
-
/**
|
|
208
|
-
* Gets the transformed measure, that is the bounding box of the control after applying all transformations
|
|
209
|
-
*/
|
|
210
|
-
get: function () {
|
|
211
|
-
return this._evaluatedMeasure;
|
|
212
|
-
},
|
|
213
|
-
enumerable: false,
|
|
214
|
-
configurable: true
|
|
215
|
-
});
|
|
216
|
-
Object.defineProperty(Control.prototype, "shadowOffsetX", {
|
|
217
|
-
/** Gets or sets a value indicating the offset to apply on X axis to render the shadow */
|
|
218
|
-
get: function () {
|
|
219
|
-
return this._shadowOffsetX;
|
|
220
|
-
},
|
|
221
|
-
set: function (value) {
|
|
222
|
-
if (this._shadowOffsetX === value) {
|
|
223
|
-
return;
|
|
224
|
-
}
|
|
225
|
-
this._shadowOffsetX = value;
|
|
226
|
-
this._markAsDirty();
|
|
227
|
-
},
|
|
228
|
-
enumerable: false,
|
|
229
|
-
configurable: true
|
|
230
|
-
});
|
|
231
|
-
Object.defineProperty(Control.prototype, "shadowOffsetY", {
|
|
232
|
-
/** Gets or sets a value indicating the offset to apply on Y axis to render the shadow */
|
|
233
|
-
get: function () {
|
|
234
|
-
return this._shadowOffsetY;
|
|
235
|
-
},
|
|
236
|
-
set: function (value) {
|
|
237
|
-
if (this._shadowOffsetY === value) {
|
|
238
|
-
return;
|
|
239
|
-
}
|
|
240
|
-
this._shadowOffsetY = value;
|
|
241
|
-
this._markAsDirty();
|
|
242
|
-
},
|
|
243
|
-
enumerable: false,
|
|
244
|
-
configurable: true
|
|
245
|
-
});
|
|
246
|
-
Object.defineProperty(Control.prototype, "shadowBlur", {
|
|
247
|
-
/** Gets or sets a value indicating the amount of blur to use to render the shadow */
|
|
248
|
-
get: function () {
|
|
249
|
-
return this._shadowBlur;
|
|
250
|
-
},
|
|
251
|
-
set: function (value) {
|
|
252
|
-
if (this._shadowBlur === value) {
|
|
253
|
-
return;
|
|
254
|
-
}
|
|
255
|
-
this._previousShadowBlur = this._shadowBlur;
|
|
256
|
-
this._shadowBlur = value;
|
|
257
|
-
this._markAsDirty();
|
|
258
|
-
},
|
|
259
|
-
enumerable: false,
|
|
260
|
-
configurable: true
|
|
261
|
-
});
|
|
262
|
-
Object.defineProperty(Control.prototype, "shadowColor", {
|
|
263
|
-
/** Gets or sets a value indicating the color of the shadow (black by default ie. "#000") */
|
|
264
|
-
get: function () {
|
|
265
|
-
return this._shadowColor;
|
|
266
|
-
},
|
|
267
|
-
set: function (value) {
|
|
268
|
-
if (this._shadowColor === value) {
|
|
269
|
-
return;
|
|
270
|
-
}
|
|
271
|
-
this._shadowColor = value;
|
|
272
|
-
this._markAsDirty();
|
|
273
|
-
},
|
|
274
|
-
enumerable: false,
|
|
275
|
-
configurable: true
|
|
276
|
-
});
|
|
277
|
-
Object.defineProperty(Control.prototype, "typeName", {
|
|
278
|
-
// Properties
|
|
279
|
-
/** Gets the control type name */
|
|
280
|
-
get: function () {
|
|
281
|
-
return this._getTypeName();
|
|
282
|
-
},
|
|
283
|
-
enumerable: false,
|
|
284
|
-
configurable: true
|
|
285
|
-
});
|
|
286
|
-
/**
|
|
287
|
-
* Get the current class name of the control.
|
|
288
|
-
* @returns current class name
|
|
289
|
-
*/
|
|
290
|
-
Control.prototype.getClassName = function () {
|
|
291
|
-
return this._getTypeName();
|
|
292
|
-
};
|
|
293
|
-
Object.defineProperty(Control.prototype, "host", {
|
|
294
|
-
/**
|
|
295
|
-
* Get the hosting AdvancedDynamicTexture
|
|
296
|
-
*/
|
|
297
|
-
get: function () {
|
|
298
|
-
return this._host;
|
|
299
|
-
},
|
|
300
|
-
enumerable: false,
|
|
301
|
-
configurable: true
|
|
302
|
-
});
|
|
303
|
-
Object.defineProperty(Control.prototype, "fontOffset", {
|
|
304
|
-
/** Gets or set information about font offsets (used to render and align text) */
|
|
305
|
-
get: function () {
|
|
306
|
-
return this._fontOffset;
|
|
307
|
-
},
|
|
308
|
-
set: function (offset) {
|
|
309
|
-
this._fontOffset = offset;
|
|
310
|
-
},
|
|
311
|
-
enumerable: false,
|
|
312
|
-
configurable: true
|
|
313
|
-
});
|
|
314
|
-
Object.defineProperty(Control.prototype, "alpha", {
|
|
315
|
-
/** Gets or sets alpha value for the control (1 means opaque and 0 means entirely transparent) */
|
|
316
|
-
get: function () {
|
|
317
|
-
return this._alpha;
|
|
318
|
-
},
|
|
319
|
-
set: function (value) {
|
|
320
|
-
if (this._alpha === value) {
|
|
321
|
-
return;
|
|
322
|
-
}
|
|
323
|
-
this._alphaSet = true;
|
|
324
|
-
this._alpha = value;
|
|
325
|
-
this._markAsDirty();
|
|
326
|
-
},
|
|
327
|
-
enumerable: false,
|
|
328
|
-
configurable: true
|
|
329
|
-
});
|
|
330
|
-
Object.defineProperty(Control.prototype, "highlightLineWidth", {
|
|
331
|
-
/**
|
|
332
|
-
* Gets or sets a number indicating size of stroke we want to highlight the control with (mostly for debugging purpose)
|
|
333
|
-
*/
|
|
334
|
-
get: function () {
|
|
335
|
-
return this._highlightLineWidth;
|
|
336
|
-
},
|
|
337
|
-
set: function (value) {
|
|
338
|
-
if (this._highlightLineWidth === value) {
|
|
339
|
-
return;
|
|
340
|
-
}
|
|
341
|
-
this._highlightLineWidth = value;
|
|
342
|
-
this._markAsDirty();
|
|
343
|
-
},
|
|
344
|
-
enumerable: false,
|
|
345
|
-
configurable: true
|
|
346
|
-
});
|
|
347
|
-
Object.defineProperty(Control.prototype, "isHighlighted", {
|
|
348
|
-
/**
|
|
349
|
-
* Gets or sets a boolean indicating that we want to highlight the control (mostly for debugging purpose)
|
|
350
|
-
*/
|
|
351
|
-
get: function () {
|
|
352
|
-
return this._isHighlighted;
|
|
353
|
-
},
|
|
354
|
-
set: function (value) {
|
|
355
|
-
if (this._isHighlighted === value) {
|
|
356
|
-
return;
|
|
357
|
-
}
|
|
358
|
-
this._isHighlighted = value;
|
|
359
|
-
this._markAsDirty();
|
|
360
|
-
},
|
|
361
|
-
enumerable: false,
|
|
362
|
-
configurable: true
|
|
363
|
-
});
|
|
364
|
-
Object.defineProperty(Control.prototype, "highlightColor", {
|
|
365
|
-
/**
|
|
366
|
-
* Gets or sets a string defining the color to use for highlighting this control
|
|
367
|
-
*/
|
|
368
|
-
get: function () {
|
|
369
|
-
return this._highlightColor;
|
|
370
|
-
},
|
|
371
|
-
set: function (value) {
|
|
372
|
-
if (this._highlightColor === value) {
|
|
373
|
-
return;
|
|
374
|
-
}
|
|
375
|
-
this._highlightColor = value;
|
|
376
|
-
this._markAsDirty();
|
|
377
|
-
},
|
|
378
|
-
enumerable: false,
|
|
379
|
-
configurable: true
|
|
380
|
-
});
|
|
381
|
-
Object.defineProperty(Control.prototype, "scaleX", {
|
|
382
|
-
/** Gets or sets a value indicating the scale factor on X axis (1 by default)
|
|
383
|
-
* @see https://doc.babylonjs.com/how_to/gui#rotation-and-scaling
|
|
384
|
-
*/
|
|
385
|
-
get: function () {
|
|
386
|
-
return this._scaleX;
|
|
387
|
-
},
|
|
388
|
-
set: function (value) {
|
|
389
|
-
if (this._scaleX === value) {
|
|
390
|
-
return;
|
|
391
|
-
}
|
|
392
|
-
this._scaleX = value;
|
|
393
|
-
this._markAsDirty();
|
|
394
|
-
this._markMatrixAsDirty();
|
|
395
|
-
},
|
|
396
|
-
enumerable: false,
|
|
397
|
-
configurable: true
|
|
398
|
-
});
|
|
399
|
-
Object.defineProperty(Control.prototype, "scaleY", {
|
|
400
|
-
/** Gets or sets a value indicating the scale factor on Y axis (1 by default)
|
|
401
|
-
* @see https://doc.babylonjs.com/how_to/gui#rotation-and-scaling
|
|
402
|
-
*/
|
|
403
|
-
get: function () {
|
|
404
|
-
return this._scaleY;
|
|
405
|
-
},
|
|
406
|
-
set: function (value) {
|
|
407
|
-
if (this._scaleY === value) {
|
|
408
|
-
return;
|
|
409
|
-
}
|
|
410
|
-
this._scaleY = value;
|
|
411
|
-
this._markAsDirty();
|
|
412
|
-
this._markMatrixAsDirty();
|
|
413
|
-
},
|
|
414
|
-
enumerable: false,
|
|
415
|
-
configurable: true
|
|
416
|
-
});
|
|
417
|
-
Object.defineProperty(Control.prototype, "rotation", {
|
|
418
|
-
/** Gets or sets the rotation angle (0 by default)
|
|
419
|
-
* @see https://doc.babylonjs.com/how_to/gui#rotation-and-scaling
|
|
420
|
-
*/
|
|
421
|
-
get: function () {
|
|
422
|
-
return this._rotation;
|
|
423
|
-
},
|
|
424
|
-
set: function (value) {
|
|
425
|
-
if (this._rotation === value) {
|
|
426
|
-
return;
|
|
427
|
-
}
|
|
428
|
-
this._rotation = value;
|
|
429
|
-
this._markAsDirty();
|
|
430
|
-
this._markMatrixAsDirty();
|
|
431
|
-
},
|
|
432
|
-
enumerable: false,
|
|
433
|
-
configurable: true
|
|
434
|
-
});
|
|
435
|
-
Object.defineProperty(Control.prototype, "transformCenterY", {
|
|
436
|
-
/** Gets or sets the transformation center on Y axis (0 by default)
|
|
437
|
-
* @see https://doc.babylonjs.com/how_to/gui#rotation-and-scaling
|
|
438
|
-
*/
|
|
439
|
-
get: function () {
|
|
440
|
-
return this._transformCenterY;
|
|
441
|
-
},
|
|
442
|
-
set: function (value) {
|
|
443
|
-
if (this._transformCenterY === value) {
|
|
444
|
-
return;
|
|
445
|
-
}
|
|
446
|
-
this._transformCenterY = value;
|
|
447
|
-
this._markAsDirty();
|
|
448
|
-
this._markMatrixAsDirty();
|
|
449
|
-
},
|
|
450
|
-
enumerable: false,
|
|
451
|
-
configurable: true
|
|
452
|
-
});
|
|
453
|
-
Object.defineProperty(Control.prototype, "transformCenterX", {
|
|
454
|
-
/** Gets or sets the transformation center on X axis (0 by default)
|
|
455
|
-
* @see https://doc.babylonjs.com/how_to/gui#rotation-and-scaling
|
|
456
|
-
*/
|
|
457
|
-
get: function () {
|
|
458
|
-
return this._transformCenterX;
|
|
459
|
-
},
|
|
460
|
-
set: function (value) {
|
|
461
|
-
if (this._transformCenterX === value) {
|
|
462
|
-
return;
|
|
463
|
-
}
|
|
464
|
-
this._transformCenterX = value;
|
|
465
|
-
this._markAsDirty();
|
|
466
|
-
this._markMatrixAsDirty();
|
|
467
|
-
},
|
|
468
|
-
enumerable: false,
|
|
469
|
-
configurable: true
|
|
470
|
-
});
|
|
471
|
-
Object.defineProperty(Control.prototype, "horizontalAlignment", {
|
|
472
|
-
/**
|
|
473
|
-
* Gets or sets the horizontal alignment
|
|
474
|
-
* @see https://doc.babylonjs.com/how_to/gui#alignments
|
|
475
|
-
*/
|
|
476
|
-
get: function () {
|
|
477
|
-
return this._horizontalAlignment;
|
|
478
|
-
},
|
|
479
|
-
set: function (value) {
|
|
480
|
-
if (this._horizontalAlignment === value) {
|
|
481
|
-
return;
|
|
482
|
-
}
|
|
483
|
-
this._horizontalAlignment = value;
|
|
484
|
-
this._markAsDirty();
|
|
485
|
-
},
|
|
486
|
-
enumerable: false,
|
|
487
|
-
configurable: true
|
|
488
|
-
});
|
|
489
|
-
Object.defineProperty(Control.prototype, "verticalAlignment", {
|
|
490
|
-
/**
|
|
491
|
-
* Gets or sets the vertical alignment
|
|
492
|
-
* @see https://doc.babylonjs.com/how_to/gui#alignments
|
|
493
|
-
*/
|
|
494
|
-
get: function () {
|
|
495
|
-
return this._verticalAlignment;
|
|
496
|
-
},
|
|
497
|
-
set: function (value) {
|
|
498
|
-
if (this._verticalAlignment === value) {
|
|
499
|
-
return;
|
|
500
|
-
}
|
|
501
|
-
this._verticalAlignment = value;
|
|
502
|
-
this._markAsDirty();
|
|
503
|
-
},
|
|
504
|
-
enumerable: false,
|
|
505
|
-
configurable: true
|
|
506
|
-
});
|
|
507
|
-
Object.defineProperty(Control.prototype, "width", {
|
|
508
|
-
/**
|
|
509
|
-
* Gets or sets control width
|
|
510
|
-
* @see https://doc.babylonjs.com/how_to/gui#position-and-size
|
|
511
|
-
*/
|
|
512
|
-
get: function () {
|
|
513
|
-
return this._width.toString(this._host);
|
|
514
|
-
},
|
|
515
|
-
set: function (value) {
|
|
516
|
-
this._fixedRatioMasterIsWidth = true;
|
|
517
|
-
if (this._width.toString(this._host) === value) {
|
|
518
|
-
return;
|
|
519
|
-
}
|
|
520
|
-
if (this._width.fromString(value)) {
|
|
521
|
-
this._markAsDirty();
|
|
522
|
-
}
|
|
523
|
-
},
|
|
524
|
-
enumerable: false,
|
|
525
|
-
configurable: true
|
|
526
|
-
});
|
|
527
|
-
Object.defineProperty(Control.prototype, "widthInPixels", {
|
|
528
|
-
/**
|
|
529
|
-
* Gets or sets the control width in pixel
|
|
530
|
-
* @see https://doc.babylonjs.com/how_to/gui#position-and-size
|
|
531
|
-
*/
|
|
532
|
-
get: function () {
|
|
533
|
-
return this._width.getValueInPixel(this._host, this._cachedParentMeasure.width);
|
|
534
|
-
},
|
|
535
|
-
set: function (value) {
|
|
536
|
-
if (isNaN(value)) {
|
|
537
|
-
return;
|
|
538
|
-
}
|
|
539
|
-
this._fixedRatioMasterIsWidth = true;
|
|
540
|
-
this.width = value + "px";
|
|
541
|
-
},
|
|
542
|
-
enumerable: false,
|
|
543
|
-
configurable: true
|
|
544
|
-
});
|
|
545
|
-
Object.defineProperty(Control.prototype, "height", {
|
|
546
|
-
/**
|
|
547
|
-
* Gets or sets control height
|
|
548
|
-
* @see https://doc.babylonjs.com/how_to/gui#position-and-size
|
|
549
|
-
*/
|
|
550
|
-
get: function () {
|
|
551
|
-
return this._height.toString(this._host);
|
|
552
|
-
},
|
|
553
|
-
set: function (value) {
|
|
554
|
-
this._fixedRatioMasterIsWidth = false;
|
|
555
|
-
if (this._height.toString(this._host) === value) {
|
|
556
|
-
return;
|
|
557
|
-
}
|
|
558
|
-
if (this._height.fromString(value)) {
|
|
559
|
-
this._markAsDirty();
|
|
560
|
-
}
|
|
561
|
-
},
|
|
562
|
-
enumerable: false,
|
|
563
|
-
configurable: true
|
|
564
|
-
});
|
|
565
|
-
Object.defineProperty(Control.prototype, "heightInPixels", {
|
|
566
|
-
/**
|
|
567
|
-
* Gets or sets control height in pixel
|
|
568
|
-
* @see https://doc.babylonjs.com/how_to/gui#position-and-size
|
|
569
|
-
*/
|
|
570
|
-
get: function () {
|
|
571
|
-
return this._height.getValueInPixel(this._host, this._cachedParentMeasure.height);
|
|
572
|
-
},
|
|
573
|
-
set: function (value) {
|
|
574
|
-
if (isNaN(value)) {
|
|
575
|
-
return;
|
|
576
|
-
}
|
|
577
|
-
this._fixedRatioMasterIsWidth = false;
|
|
578
|
-
this.height = value + "px";
|
|
579
|
-
},
|
|
580
|
-
enumerable: false,
|
|
581
|
-
configurable: true
|
|
582
|
-
});
|
|
583
|
-
Object.defineProperty(Control.prototype, "fontFamily", {
|
|
584
|
-
/** Gets or set font family */
|
|
585
|
-
get: function () {
|
|
586
|
-
return this._fontFamily;
|
|
587
|
-
},
|
|
588
|
-
set: function (value) {
|
|
589
|
-
if (this._fontFamily === value) {
|
|
590
|
-
return;
|
|
591
|
-
}
|
|
592
|
-
this._fontFamily = value;
|
|
593
|
-
this._resetFontCache();
|
|
594
|
-
},
|
|
595
|
-
enumerable: false,
|
|
596
|
-
configurable: true
|
|
597
|
-
});
|
|
598
|
-
Object.defineProperty(Control.prototype, "fontStyle", {
|
|
599
|
-
/** Gets or sets font style */
|
|
600
|
-
get: function () {
|
|
601
|
-
return this._fontStyle;
|
|
602
|
-
},
|
|
603
|
-
set: function (value) {
|
|
604
|
-
if (this._fontStyle === value) {
|
|
605
|
-
return;
|
|
606
|
-
}
|
|
607
|
-
this._fontStyle = value;
|
|
608
|
-
this._resetFontCache();
|
|
609
|
-
},
|
|
610
|
-
enumerable: false,
|
|
611
|
-
configurable: true
|
|
612
|
-
});
|
|
613
|
-
Object.defineProperty(Control.prototype, "fontWeight", {
|
|
614
|
-
/** Gets or sets font weight */
|
|
615
|
-
get: function () {
|
|
616
|
-
return this._fontWeight;
|
|
617
|
-
},
|
|
618
|
-
set: function (value) {
|
|
619
|
-
if (this._fontWeight === value) {
|
|
620
|
-
return;
|
|
621
|
-
}
|
|
622
|
-
this._fontWeight = value;
|
|
623
|
-
this._resetFontCache();
|
|
624
|
-
},
|
|
625
|
-
enumerable: false,
|
|
626
|
-
configurable: true
|
|
627
|
-
});
|
|
628
|
-
Object.defineProperty(Control.prototype, "style", {
|
|
629
|
-
/**
|
|
630
|
-
* Gets or sets style
|
|
631
|
-
* @see https://doc.babylonjs.com/how_to/gui#styles
|
|
632
|
-
*/
|
|
633
|
-
get: function () {
|
|
634
|
-
return this._style;
|
|
635
|
-
},
|
|
636
|
-
set: function (value) {
|
|
637
|
-
var _this = this;
|
|
638
|
-
if (this._style) {
|
|
639
|
-
this._style.onChangedObservable.remove(this._styleObserver);
|
|
640
|
-
this._styleObserver = null;
|
|
641
|
-
}
|
|
642
|
-
this._style = value;
|
|
643
|
-
if (this._style) {
|
|
644
|
-
this._styleObserver = this._style.onChangedObservable.add(function () {
|
|
645
|
-
_this._markAsDirty();
|
|
646
|
-
_this._resetFontCache();
|
|
647
|
-
});
|
|
648
|
-
}
|
|
649
|
-
this._markAsDirty();
|
|
650
|
-
this._resetFontCache();
|
|
651
|
-
},
|
|
652
|
-
enumerable: false,
|
|
653
|
-
configurable: true
|
|
654
|
-
});
|
|
655
|
-
Object.defineProperty(Control.prototype, "_isFontSizeInPercentage", {
|
|
656
|
-
/** @hidden */
|
|
657
|
-
get: function () {
|
|
658
|
-
return this._fontSize.isPercentage;
|
|
659
|
-
},
|
|
660
|
-
enumerable: false,
|
|
661
|
-
configurable: true
|
|
662
|
-
});
|
|
663
|
-
Object.defineProperty(Control.prototype, "fontSizeInPixels", {
|
|
664
|
-
/** Gets or sets font size in pixels */
|
|
665
|
-
get: function () {
|
|
666
|
-
var fontSizeToUse = this._style ? this._style._fontSize : this._fontSize;
|
|
667
|
-
if (fontSizeToUse.isPixel) {
|
|
668
|
-
return fontSizeToUse.getValue(this._host);
|
|
669
|
-
}
|
|
670
|
-
return fontSizeToUse.getValueInPixel(this._host, this._tempParentMeasure.height || this._cachedParentMeasure.height);
|
|
671
|
-
},
|
|
672
|
-
set: function (value) {
|
|
673
|
-
if (isNaN(value)) {
|
|
674
|
-
return;
|
|
675
|
-
}
|
|
676
|
-
this.fontSize = value + "px";
|
|
677
|
-
},
|
|
678
|
-
enumerable: false,
|
|
679
|
-
configurable: true
|
|
680
|
-
});
|
|
681
|
-
Object.defineProperty(Control.prototype, "fontSize", {
|
|
682
|
-
/** Gets or sets font size */
|
|
683
|
-
get: function () {
|
|
684
|
-
return this._fontSize.toString(this._host);
|
|
685
|
-
},
|
|
686
|
-
set: function (value) {
|
|
687
|
-
if (this._fontSize.toString(this._host) === value) {
|
|
688
|
-
return;
|
|
689
|
-
}
|
|
690
|
-
if (this._fontSize.fromString(value)) {
|
|
691
|
-
this._markAsDirty();
|
|
692
|
-
this._resetFontCache();
|
|
693
|
-
}
|
|
694
|
-
},
|
|
695
|
-
enumerable: false,
|
|
696
|
-
configurable: true
|
|
697
|
-
});
|
|
698
|
-
Object.defineProperty(Control.prototype, "color", {
|
|
699
|
-
/** Gets or sets foreground color */
|
|
700
|
-
get: function () {
|
|
701
|
-
return this._color;
|
|
702
|
-
},
|
|
703
|
-
set: function (value) {
|
|
704
|
-
if (this._color === value) {
|
|
705
|
-
return;
|
|
706
|
-
}
|
|
707
|
-
this._color = value;
|
|
708
|
-
this._markAsDirty();
|
|
709
|
-
},
|
|
710
|
-
enumerable: false,
|
|
711
|
-
configurable: true
|
|
712
|
-
});
|
|
713
|
-
Object.defineProperty(Control.prototype, "zIndex", {
|
|
714
|
-
/** Gets or sets z index which is used to reorder controls on the z axis */
|
|
715
|
-
get: function () {
|
|
716
|
-
return this._zIndex;
|
|
717
|
-
},
|
|
718
|
-
set: function (value) {
|
|
719
|
-
if (this.zIndex === value) {
|
|
720
|
-
return;
|
|
721
|
-
}
|
|
722
|
-
this._zIndex = value;
|
|
723
|
-
if (this.parent) {
|
|
724
|
-
this.parent._reOrderControl(this);
|
|
725
|
-
}
|
|
726
|
-
},
|
|
727
|
-
enumerable: false,
|
|
728
|
-
configurable: true
|
|
729
|
-
});
|
|
730
|
-
Object.defineProperty(Control.prototype, "notRenderable", {
|
|
731
|
-
/** Gets or sets a boolean indicating if the control can be rendered */
|
|
732
|
-
get: function () {
|
|
733
|
-
return this._doNotRender;
|
|
734
|
-
},
|
|
735
|
-
set: function (value) {
|
|
736
|
-
if (this._doNotRender === value) {
|
|
737
|
-
return;
|
|
738
|
-
}
|
|
739
|
-
this._doNotRender = value;
|
|
740
|
-
this._markAsDirty();
|
|
741
|
-
},
|
|
742
|
-
enumerable: false,
|
|
743
|
-
configurable: true
|
|
744
|
-
});
|
|
745
|
-
Object.defineProperty(Control.prototype, "isVisible", {
|
|
746
|
-
/** Gets or sets a boolean indicating if the control is visible */
|
|
747
|
-
get: function () {
|
|
748
|
-
return this._isVisible;
|
|
749
|
-
},
|
|
750
|
-
set: function (value) {
|
|
751
|
-
if (this._isVisible === value) {
|
|
752
|
-
return;
|
|
753
|
-
}
|
|
754
|
-
this._isVisible = value;
|
|
755
|
-
this._markAsDirty(true);
|
|
756
|
-
},
|
|
757
|
-
enumerable: false,
|
|
758
|
-
configurable: true
|
|
759
|
-
});
|
|
760
|
-
Object.defineProperty(Control.prototype, "isDirty", {
|
|
761
|
-
/** Gets a boolean indicating that the control needs to update its rendering */
|
|
762
|
-
get: function () {
|
|
763
|
-
return this._isDirty;
|
|
764
|
-
},
|
|
765
|
-
enumerable: false,
|
|
766
|
-
configurable: true
|
|
767
|
-
});
|
|
768
|
-
Object.defineProperty(Control.prototype, "linkedMesh", {
|
|
769
|
-
/**
|
|
770
|
-
* Gets the current linked mesh (or null if none)
|
|
771
|
-
*/
|
|
772
|
-
get: function () {
|
|
773
|
-
return this._linkedMesh;
|
|
774
|
-
},
|
|
775
|
-
enumerable: false,
|
|
776
|
-
configurable: true
|
|
777
|
-
});
|
|
778
|
-
Object.defineProperty(Control.prototype, "descendantsOnlyPadding", {
|
|
779
|
-
/**
|
|
780
|
-
* Gets or sets a value indicating the padding should work like in CSS.
|
|
781
|
-
* Basically, it will add the padding amount on each side of the parent control for its children.
|
|
782
|
-
*/
|
|
783
|
-
get: function () {
|
|
784
|
-
return this._descendantsOnlyPadding;
|
|
785
|
-
},
|
|
786
|
-
set: function (value) {
|
|
787
|
-
if (this._descendantsOnlyPadding === value) {
|
|
788
|
-
return;
|
|
789
|
-
}
|
|
790
|
-
this._descendantsOnlyPadding = value;
|
|
791
|
-
this._markAsDirty();
|
|
792
|
-
},
|
|
793
|
-
enumerable: false,
|
|
794
|
-
configurable: true
|
|
795
|
-
});
|
|
796
|
-
Object.defineProperty(Control.prototype, "paddingLeft", {
|
|
797
|
-
/**
|
|
798
|
-
* Gets or sets a value indicating the padding to use on the left of the control
|
|
799
|
-
* @see https://doc.babylonjs.com/how_to/gui#position-and-size
|
|
800
|
-
*/
|
|
801
|
-
get: function () {
|
|
802
|
-
return this._paddingLeft.toString(this._host);
|
|
803
|
-
},
|
|
804
|
-
set: function (value) {
|
|
805
|
-
if (this._paddingLeft.fromString(value)) {
|
|
806
|
-
this._markAsDirty();
|
|
807
|
-
}
|
|
808
|
-
},
|
|
809
|
-
enumerable: false,
|
|
810
|
-
configurable: true
|
|
811
|
-
});
|
|
812
|
-
Object.defineProperty(Control.prototype, "paddingLeftInPixels", {
|
|
813
|
-
/**
|
|
814
|
-
* Gets or sets a value indicating the padding in pixels to use on the left of the control
|
|
815
|
-
* @see https://doc.babylonjs.com/how_to/gui#position-and-size
|
|
816
|
-
*/
|
|
817
|
-
get: function () {
|
|
818
|
-
return this._paddingLeft.getValueInPixel(this._host, this._cachedParentMeasure.width);
|
|
819
|
-
},
|
|
820
|
-
set: function (value) {
|
|
821
|
-
if (isNaN(value)) {
|
|
822
|
-
return;
|
|
823
|
-
}
|
|
824
|
-
this.paddingLeft = value + "px";
|
|
825
|
-
},
|
|
826
|
-
enumerable: false,
|
|
827
|
-
configurable: true
|
|
828
|
-
});
|
|
829
|
-
Object.defineProperty(Control.prototype, "_paddingLeftInPixels", {
|
|
830
|
-
/** @hidden */
|
|
831
|
-
get: function () {
|
|
832
|
-
if (this._descendantsOnlyPadding) {
|
|
833
|
-
return 0;
|
|
834
|
-
}
|
|
835
|
-
return this.paddingLeftInPixels;
|
|
836
|
-
},
|
|
837
|
-
enumerable: false,
|
|
838
|
-
configurable: true
|
|
839
|
-
});
|
|
840
|
-
Object.defineProperty(Control.prototype, "paddingRight", {
|
|
841
|
-
/**
|
|
842
|
-
* Gets or sets a value indicating the padding to use on the right of the control
|
|
843
|
-
* @see https://doc.babylonjs.com/how_to/gui#position-and-size
|
|
844
|
-
*/
|
|
845
|
-
get: function () {
|
|
846
|
-
return this._paddingRight.toString(this._host);
|
|
847
|
-
},
|
|
848
|
-
set: function (value) {
|
|
849
|
-
if (this._paddingRight.fromString(value)) {
|
|
850
|
-
this._markAsDirty();
|
|
851
|
-
}
|
|
852
|
-
},
|
|
853
|
-
enumerable: false,
|
|
854
|
-
configurable: true
|
|
855
|
-
});
|
|
856
|
-
Object.defineProperty(Control.prototype, "paddingRightInPixels", {
|
|
857
|
-
/**
|
|
858
|
-
* Gets or sets a value indicating the padding in pixels to use on the right of the control
|
|
859
|
-
* @see https://doc.babylonjs.com/how_to/gui#position-and-size
|
|
860
|
-
*/
|
|
861
|
-
get: function () {
|
|
862
|
-
return this._paddingRight.getValueInPixel(this._host, this._cachedParentMeasure.width);
|
|
863
|
-
},
|
|
864
|
-
set: function (value) {
|
|
865
|
-
if (isNaN(value)) {
|
|
866
|
-
return;
|
|
867
|
-
}
|
|
868
|
-
this.paddingRight = value + "px";
|
|
869
|
-
},
|
|
870
|
-
enumerable: false,
|
|
871
|
-
configurable: true
|
|
872
|
-
});
|
|
873
|
-
Object.defineProperty(Control.prototype, "_paddingRightInPixels", {
|
|
874
|
-
/** @hidden */
|
|
875
|
-
get: function () {
|
|
876
|
-
if (this._descendantsOnlyPadding) {
|
|
877
|
-
return 0;
|
|
878
|
-
}
|
|
879
|
-
return this.paddingRightInPixels;
|
|
880
|
-
},
|
|
881
|
-
enumerable: false,
|
|
882
|
-
configurable: true
|
|
883
|
-
});
|
|
884
|
-
Object.defineProperty(Control.prototype, "paddingTop", {
|
|
885
|
-
/**
|
|
886
|
-
* Gets or sets a value indicating the padding to use on the top of the control
|
|
887
|
-
* @see https://doc.babylonjs.com/how_to/gui#position-and-size
|
|
888
|
-
*/
|
|
889
|
-
get: function () {
|
|
890
|
-
return this._paddingTop.toString(this._host);
|
|
891
|
-
},
|
|
892
|
-
set: function (value) {
|
|
893
|
-
if (this._paddingTop.fromString(value)) {
|
|
894
|
-
this._markAsDirty();
|
|
895
|
-
}
|
|
896
|
-
},
|
|
897
|
-
enumerable: false,
|
|
898
|
-
configurable: true
|
|
899
|
-
});
|
|
900
|
-
Object.defineProperty(Control.prototype, "paddingTopInPixels", {
|
|
901
|
-
/**
|
|
902
|
-
* Gets or sets a value indicating the padding in pixels to use on the top of the control
|
|
903
|
-
* @see https://doc.babylonjs.com/how_to/gui#position-and-size
|
|
904
|
-
*/
|
|
905
|
-
get: function () {
|
|
906
|
-
return this._paddingTop.getValueInPixel(this._host, this._cachedParentMeasure.height);
|
|
907
|
-
},
|
|
908
|
-
set: function (value) {
|
|
909
|
-
if (isNaN(value)) {
|
|
910
|
-
return;
|
|
911
|
-
}
|
|
912
|
-
this.paddingTop = value + "px";
|
|
913
|
-
},
|
|
914
|
-
enumerable: false,
|
|
915
|
-
configurable: true
|
|
916
|
-
});
|
|
917
|
-
Object.defineProperty(Control.prototype, "_paddingTopInPixels", {
|
|
918
|
-
/** @hidden */
|
|
919
|
-
get: function () {
|
|
920
|
-
if (this._descendantsOnlyPadding) {
|
|
921
|
-
return 0;
|
|
922
|
-
}
|
|
923
|
-
return this.paddingTopInPixels;
|
|
924
|
-
},
|
|
925
|
-
enumerable: false,
|
|
926
|
-
configurable: true
|
|
927
|
-
});
|
|
928
|
-
Object.defineProperty(Control.prototype, "paddingBottom", {
|
|
929
|
-
/**
|
|
930
|
-
* Gets or sets a value indicating the padding to use on the bottom of the control
|
|
931
|
-
* @see https://doc.babylonjs.com/how_to/gui#position-and-size
|
|
932
|
-
*/
|
|
933
|
-
get: function () {
|
|
934
|
-
return this._paddingBottom.toString(this._host);
|
|
935
|
-
},
|
|
936
|
-
set: function (value) {
|
|
937
|
-
if (this._paddingBottom.fromString(value)) {
|
|
938
|
-
this._markAsDirty();
|
|
939
|
-
}
|
|
940
|
-
},
|
|
941
|
-
enumerable: false,
|
|
942
|
-
configurable: true
|
|
943
|
-
});
|
|
944
|
-
Object.defineProperty(Control.prototype, "paddingBottomInPixels", {
|
|
945
|
-
/**
|
|
946
|
-
* Gets or sets a value indicating the padding in pixels to use on the bottom of the control
|
|
947
|
-
* @see https://doc.babylonjs.com/how_to/gui#position-and-size
|
|
948
|
-
*/
|
|
949
|
-
get: function () {
|
|
950
|
-
return this._paddingBottom.getValueInPixel(this._host, this._cachedParentMeasure.height);
|
|
951
|
-
},
|
|
952
|
-
set: function (value) {
|
|
953
|
-
if (isNaN(value)) {
|
|
954
|
-
return;
|
|
955
|
-
}
|
|
956
|
-
this.paddingBottom = value + "px";
|
|
957
|
-
},
|
|
958
|
-
enumerable: false,
|
|
959
|
-
configurable: true
|
|
960
|
-
});
|
|
961
|
-
Object.defineProperty(Control.prototype, "_paddingBottomInPixels", {
|
|
962
|
-
/** @hidden */
|
|
963
|
-
get: function () {
|
|
964
|
-
if (this._descendantsOnlyPadding) {
|
|
965
|
-
return 0;
|
|
966
|
-
}
|
|
967
|
-
return this.paddingBottomInPixels;
|
|
968
|
-
},
|
|
969
|
-
enumerable: false,
|
|
970
|
-
configurable: true
|
|
971
|
-
});
|
|
972
|
-
Object.defineProperty(Control.prototype, "left", {
|
|
973
|
-
/**
|
|
974
|
-
* Gets or sets a value indicating the left coordinate of the control
|
|
975
|
-
* @see https://doc.babylonjs.com/how_to/gui#position-and-size
|
|
976
|
-
*/
|
|
977
|
-
get: function () {
|
|
978
|
-
return this._left.toString(this._host);
|
|
979
|
-
},
|
|
980
|
-
set: function (value) {
|
|
981
|
-
if (this._left.fromString(value)) {
|
|
982
|
-
this._markAsDirty();
|
|
983
|
-
}
|
|
984
|
-
},
|
|
985
|
-
enumerable: false,
|
|
986
|
-
configurable: true
|
|
987
|
-
});
|
|
988
|
-
Object.defineProperty(Control.prototype, "leftInPixels", {
|
|
989
|
-
/**
|
|
990
|
-
* Gets or sets a value indicating the left coordinate in pixels of the control
|
|
991
|
-
* @see https://doc.babylonjs.com/how_to/gui#position-and-size
|
|
992
|
-
*/
|
|
993
|
-
get: function () {
|
|
994
|
-
return this._left.getValueInPixel(this._host, this._cachedParentMeasure.width);
|
|
995
|
-
},
|
|
996
|
-
set: function (value) {
|
|
997
|
-
if (isNaN(value)) {
|
|
998
|
-
return;
|
|
999
|
-
}
|
|
1000
|
-
this.left = value + "px";
|
|
1001
|
-
},
|
|
1002
|
-
enumerable: false,
|
|
1003
|
-
configurable: true
|
|
1004
|
-
});
|
|
1005
|
-
Object.defineProperty(Control.prototype, "top", {
|
|
1006
|
-
/**
|
|
1007
|
-
* Gets or sets a value indicating the top coordinate of the control
|
|
1008
|
-
* @see https://doc.babylonjs.com/how_to/gui#position-and-size
|
|
1009
|
-
*/
|
|
1010
|
-
get: function () {
|
|
1011
|
-
return this._top.toString(this._host);
|
|
1012
|
-
},
|
|
1013
|
-
set: function (value) {
|
|
1014
|
-
if (this._top.fromString(value)) {
|
|
1015
|
-
this._markAsDirty();
|
|
1016
|
-
}
|
|
1017
|
-
},
|
|
1018
|
-
enumerable: false,
|
|
1019
|
-
configurable: true
|
|
1020
|
-
});
|
|
1021
|
-
Object.defineProperty(Control.prototype, "topInPixels", {
|
|
1022
|
-
/**
|
|
1023
|
-
* Gets or sets a value indicating the top coordinate in pixels of the control
|
|
1024
|
-
* @see https://doc.babylonjs.com/how_to/gui#position-and-size
|
|
1025
|
-
*/
|
|
1026
|
-
get: function () {
|
|
1027
|
-
return this._top.getValueInPixel(this._host, this._cachedParentMeasure.height);
|
|
1028
|
-
},
|
|
1029
|
-
set: function (value) {
|
|
1030
|
-
if (isNaN(value)) {
|
|
1031
|
-
return;
|
|
1032
|
-
}
|
|
1033
|
-
this.top = value + "px";
|
|
1034
|
-
},
|
|
1035
|
-
enumerable: false,
|
|
1036
|
-
configurable: true
|
|
1037
|
-
});
|
|
1038
|
-
Object.defineProperty(Control.prototype, "linkOffsetX", {
|
|
1039
|
-
/**
|
|
1040
|
-
* Gets or sets a value indicating the offset on X axis to the linked mesh
|
|
1041
|
-
* @see https://doc.babylonjs.com/how_to/gui#tracking-positions
|
|
1042
|
-
*/
|
|
1043
|
-
get: function () {
|
|
1044
|
-
return this._linkOffsetX.toString(this._host);
|
|
1045
|
-
},
|
|
1046
|
-
set: function (value) {
|
|
1047
|
-
if (this._linkOffsetX.fromString(value)) {
|
|
1048
|
-
this._markAsDirty();
|
|
1049
|
-
}
|
|
1050
|
-
},
|
|
1051
|
-
enumerable: false,
|
|
1052
|
-
configurable: true
|
|
1053
|
-
});
|
|
1054
|
-
Object.defineProperty(Control.prototype, "linkOffsetXInPixels", {
|
|
1055
|
-
/**
|
|
1056
|
-
* Gets or sets a value indicating the offset in pixels on X axis to the linked mesh
|
|
1057
|
-
* @see https://doc.babylonjs.com/how_to/gui#tracking-positions
|
|
1058
|
-
*/
|
|
1059
|
-
get: function () {
|
|
1060
|
-
return this._linkOffsetX.getValueInPixel(this._host, this._cachedParentMeasure.width);
|
|
1061
|
-
},
|
|
1062
|
-
set: function (value) {
|
|
1063
|
-
if (isNaN(value)) {
|
|
1064
|
-
return;
|
|
1065
|
-
}
|
|
1066
|
-
this.linkOffsetX = value + "px";
|
|
1067
|
-
},
|
|
1068
|
-
enumerable: false,
|
|
1069
|
-
configurable: true
|
|
1070
|
-
});
|
|
1071
|
-
Object.defineProperty(Control.prototype, "linkOffsetY", {
|
|
1072
|
-
/**
|
|
1073
|
-
* Gets or sets a value indicating the offset on Y axis to the linked mesh
|
|
1074
|
-
* @see https://doc.babylonjs.com/how_to/gui#tracking-positions
|
|
1075
|
-
*/
|
|
1076
|
-
get: function () {
|
|
1077
|
-
return this._linkOffsetY.toString(this._host);
|
|
1078
|
-
},
|
|
1079
|
-
set: function (value) {
|
|
1080
|
-
if (this._linkOffsetY.fromString(value)) {
|
|
1081
|
-
this._markAsDirty();
|
|
1082
|
-
}
|
|
1083
|
-
},
|
|
1084
|
-
enumerable: false,
|
|
1085
|
-
configurable: true
|
|
1086
|
-
});
|
|
1087
|
-
Object.defineProperty(Control.prototype, "linkOffsetYInPixels", {
|
|
1088
|
-
/**
|
|
1089
|
-
* Gets or sets a value indicating the offset in pixels on Y axis to the linked mesh
|
|
1090
|
-
* @see https://doc.babylonjs.com/how_to/gui#tracking-positions
|
|
1091
|
-
*/
|
|
1092
|
-
get: function () {
|
|
1093
|
-
return this._linkOffsetY.getValueInPixel(this._host, this._cachedParentMeasure.height);
|
|
1094
|
-
},
|
|
1095
|
-
set: function (value) {
|
|
1096
|
-
if (isNaN(value)) {
|
|
1097
|
-
return;
|
|
1098
|
-
}
|
|
1099
|
-
this.linkOffsetY = value + "px";
|
|
1100
|
-
},
|
|
1101
|
-
enumerable: false,
|
|
1102
|
-
configurable: true
|
|
1103
|
-
});
|
|
1104
|
-
Object.defineProperty(Control.prototype, "centerX", {
|
|
1105
|
-
/** Gets the center coordinate on X axis */
|
|
1106
|
-
get: function () {
|
|
1107
|
-
return this._currentMeasure.left + this._currentMeasure.width / 2;
|
|
1108
|
-
},
|
|
1109
|
-
enumerable: false,
|
|
1110
|
-
configurable: true
|
|
1111
|
-
});
|
|
1112
|
-
Object.defineProperty(Control.prototype, "centerY", {
|
|
1113
|
-
/** Gets the center coordinate on Y axis */
|
|
1114
|
-
get: function () {
|
|
1115
|
-
return this._currentMeasure.top + this._currentMeasure.height / 2;
|
|
1116
|
-
},
|
|
1117
|
-
enumerable: false,
|
|
1118
|
-
configurable: true
|
|
1119
|
-
});
|
|
1120
|
-
Object.defineProperty(Control.prototype, "isEnabled", {
|
|
1121
|
-
/** Gets or sets if control is Enabled */
|
|
1122
|
-
get: function () {
|
|
1123
|
-
return this._isEnabled;
|
|
1124
|
-
},
|
|
1125
|
-
set: function (value) {
|
|
1126
|
-
var _this = this;
|
|
1127
|
-
if (this._isEnabled === value) {
|
|
1128
|
-
return;
|
|
1129
|
-
}
|
|
1130
|
-
this._isEnabled = value;
|
|
1131
|
-
this._markAsDirty();
|
|
1132
|
-
// if this control or any of it's descendants are under a pointer, we need to fire a pointerOut event
|
|
1133
|
-
var recursivelyFirePointerOut = function (control) {
|
|
1134
|
-
if (!control.host) {
|
|
1135
|
-
return;
|
|
1136
|
-
}
|
|
1137
|
-
for (var pointer in control.host._lastControlOver) {
|
|
1138
|
-
if (control === _this.host._lastControlOver[pointer]) {
|
|
1139
|
-
control._onPointerOut(control, null, true);
|
|
1140
|
-
delete control.host._lastControlOver[pointer];
|
|
1141
|
-
}
|
|
1142
|
-
}
|
|
1143
|
-
if (control.children !== undefined) {
|
|
1144
|
-
control.children.forEach(recursivelyFirePointerOut);
|
|
1145
|
-
}
|
|
1146
|
-
};
|
|
1147
|
-
recursivelyFirePointerOut(this);
|
|
1148
|
-
},
|
|
1149
|
-
enumerable: false,
|
|
1150
|
-
configurable: true
|
|
1151
|
-
});
|
|
1152
|
-
Object.defineProperty(Control.prototype, "disabledColor", {
|
|
1153
|
-
/** Gets or sets background color of control if it's disabled. Only applies to Button class. */
|
|
1154
|
-
get: function () {
|
|
1155
|
-
return this._disabledColor;
|
|
1156
|
-
},
|
|
1157
|
-
set: function (value) {
|
|
1158
|
-
if (this._disabledColor === value) {
|
|
1159
|
-
return;
|
|
1160
|
-
}
|
|
1161
|
-
this._disabledColor = value;
|
|
1162
|
-
this._markAsDirty();
|
|
1163
|
-
},
|
|
1164
|
-
enumerable: false,
|
|
1165
|
-
configurable: true
|
|
1166
|
-
});
|
|
1167
|
-
Object.defineProperty(Control.prototype, "disabledColorItem", {
|
|
1168
|
-
/** Gets or sets front color of control if it's disabled. Only applies to Checkbox class. */
|
|
1169
|
-
get: function () {
|
|
1170
|
-
return this._disabledColorItem;
|
|
1171
|
-
},
|
|
1172
|
-
set: function (value) {
|
|
1173
|
-
if (this._disabledColorItem === value) {
|
|
1174
|
-
return;
|
|
1175
|
-
}
|
|
1176
|
-
this._disabledColorItem = value;
|
|
1177
|
-
this._markAsDirty();
|
|
1178
|
-
},
|
|
1179
|
-
enumerable: false,
|
|
1180
|
-
configurable: true
|
|
1181
|
-
});
|
|
1182
|
-
/** @hidden */
|
|
1183
|
-
Control.prototype._getTypeName = function () {
|
|
1184
|
-
return "Control";
|
|
1185
|
-
};
|
|
1186
|
-
/**
|
|
1187
|
-
* Gets the first ascendant in the hierarchy of the given type
|
|
1188
|
-
* @param className defines the required type
|
|
1189
|
-
* @returns the ascendant or null if not found
|
|
1190
|
-
*/
|
|
1191
|
-
Control.prototype.getAscendantOfClass = function (className) {
|
|
1192
|
-
if (!this.parent) {
|
|
1193
|
-
return null;
|
|
1194
|
-
}
|
|
1195
|
-
if (this.parent.getClassName() === className) {
|
|
1196
|
-
return this.parent;
|
|
1197
|
-
}
|
|
1198
|
-
return this.parent.getAscendantOfClass(className);
|
|
1199
|
-
};
|
|
1200
|
-
/**
|
|
1201
|
-
* Mark control element as dirty
|
|
1202
|
-
* @param force force non visible elements to be marked too
|
|
1203
|
-
*/
|
|
1204
|
-
Control.prototype.markAsDirty = function (force) {
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
this.
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
*
|
|
1221
|
-
* @
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
*
|
|
1235
|
-
* @
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
*
|
|
1245
|
-
* @param
|
|
1246
|
-
* @
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
result.
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
*
|
|
1256
|
-
* @
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
result
|
|
1261
|
-
result.
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
*
|
|
1267
|
-
* @param
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
this.
|
|
1276
|
-
|
|
1277
|
-
var
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
*
|
|
1288
|
-
* @param
|
|
1289
|
-
* @param
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
*
|
|
1298
|
-
* @param
|
|
1299
|
-
* @return
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
*
|
|
1309
|
-
* @
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
this.
|
|
1331
|
-
this.
|
|
1332
|
-
this.
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
*
|
|
1337
|
-
* @param { string | number}
|
|
1338
|
-
* @param { string | number}
|
|
1339
|
-
* @param { string | number}
|
|
1340
|
-
* @
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
var
|
|
1345
|
-
var
|
|
1346
|
-
var
|
|
1347
|
-
|
|
1348
|
-
this.
|
|
1349
|
-
this.
|
|
1350
|
-
this.
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
*
|
|
1355
|
-
* @param { number}
|
|
1356
|
-
* @param { number}
|
|
1357
|
-
* @param { number}
|
|
1358
|
-
* @
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
var
|
|
1363
|
-
var
|
|
1364
|
-
var
|
|
1365
|
-
|
|
1366
|
-
this.
|
|
1367
|
-
this.
|
|
1368
|
-
this.
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
this.
|
|
1394
|
-
this.
|
|
1395
|
-
this.
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
Control.prototype.
|
|
1404
|
-
this._isDirty = true;
|
|
1405
|
-
this._currentMeasure.
|
|
1406
|
-
};
|
|
1407
|
-
/**
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
this.
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
this.
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
this.
|
|
1539
|
-
}
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
this.
|
|
1579
|
-
}
|
|
1580
|
-
this.
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
this.
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
this.
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
this.
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
this._currentMeasure.
|
|
1695
|
-
}
|
|
1696
|
-
else {
|
|
1697
|
-
this._currentMeasure.
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
}
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
}
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
if (this.
|
|
1840
|
-
this.
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
if (
|
|
1850
|
-
|
|
1851
|
-
}
|
|
1852
|
-
if (
|
|
1853
|
-
|
|
1854
|
-
}
|
|
1855
|
-
this.
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
if (
|
|
1862
|
-
this.
|
|
1863
|
-
}
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
Control.prototype.
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
this.
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
this.
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
if (
|
|
1924
|
-
|
|
1925
|
-
}
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
if (
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
return
|
|
1978
|
-
}
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
this.
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
if (
|
|
2032
|
-
this.
|
|
2033
|
-
}
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
Control.prototype.
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
return
|
|
2080
|
-
}
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
}
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
}
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
return
|
|
2128
|
-
};
|
|
2129
|
-
/**
|
|
2130
|
-
*
|
|
2131
|
-
* @param
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
Control.
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { Observable } from "@babylonjs/core/Misc/observable.js";
|
|
3
|
+
import { Vector2, Vector3, Matrix } from "@babylonjs/core/Maths/math.vector.js";
|
|
4
|
+
import { PointerEventTypes } from "@babylonjs/core/Events/pointerEvents.js";
|
|
5
|
+
import { Logger } from "@babylonjs/core/Misc/logger.js";
|
|
6
|
+
import { Tools } from "@babylonjs/core/Misc/tools.js";
|
|
7
|
+
import { ValueAndUnit } from "../valueAndUnit";
|
|
8
|
+
import { Measure } from "../measure";
|
|
9
|
+
import { Matrix2D, Vector2WithInfo } from "../math2D";
|
|
10
|
+
import { RegisterClass } from "@babylonjs/core/Misc/typeStore.js";
|
|
11
|
+
import { SerializationHelper, serialize } from "@babylonjs/core/Misc/decorators.js";
|
|
12
|
+
import { EngineStore } from "@babylonjs/core/Engines/engineStore.js";
|
|
13
|
+
/**
|
|
14
|
+
* Root class used for all 2D controls
|
|
15
|
+
* @see https://doc.babylonjs.com/how_to/gui#controls
|
|
16
|
+
*/
|
|
17
|
+
var Control = /** @class */ (function () {
|
|
18
|
+
// Functions
|
|
19
|
+
/**
|
|
20
|
+
* Creates a new control
|
|
21
|
+
* @param name defines the name of the control
|
|
22
|
+
*/
|
|
23
|
+
function Control(
|
|
24
|
+
/** defines the name of the control */
|
|
25
|
+
name) {
|
|
26
|
+
this.name = name;
|
|
27
|
+
this._alpha = 1;
|
|
28
|
+
this._alphaSet = false;
|
|
29
|
+
this._zIndex = 0;
|
|
30
|
+
/** @hidden */
|
|
31
|
+
this._currentMeasure = Measure.Empty();
|
|
32
|
+
/** @hidden */
|
|
33
|
+
this._tempPaddingMeasure = Measure.Empty();
|
|
34
|
+
this._fontFamily = "Arial";
|
|
35
|
+
this._fontStyle = "";
|
|
36
|
+
this._fontWeight = "";
|
|
37
|
+
this._fontSize = new ValueAndUnit(18, ValueAndUnit.UNITMODE_PIXEL, false);
|
|
38
|
+
/** @hidden */
|
|
39
|
+
this._width = new ValueAndUnit(1, ValueAndUnit.UNITMODE_PERCENTAGE, false);
|
|
40
|
+
/** @hidden */
|
|
41
|
+
this._height = new ValueAndUnit(1, ValueAndUnit.UNITMODE_PERCENTAGE, false);
|
|
42
|
+
this._color = "";
|
|
43
|
+
this._style = null;
|
|
44
|
+
/** @hidden */
|
|
45
|
+
this._horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_CENTER;
|
|
46
|
+
/** @hidden */
|
|
47
|
+
this._verticalAlignment = Control.VERTICAL_ALIGNMENT_CENTER;
|
|
48
|
+
/** @hidden */
|
|
49
|
+
this._isDirty = true;
|
|
50
|
+
/** @hidden */
|
|
51
|
+
this._wasDirty = false;
|
|
52
|
+
/** @hidden */
|
|
53
|
+
this._tempParentMeasure = Measure.Empty();
|
|
54
|
+
/** @hidden */
|
|
55
|
+
this._prevCurrentMeasureTransformedIntoGlobalSpace = Measure.Empty();
|
|
56
|
+
/** @hidden */
|
|
57
|
+
this._cachedParentMeasure = Measure.Empty();
|
|
58
|
+
this._descendantsOnlyPadding = false;
|
|
59
|
+
this._paddingLeft = new ValueAndUnit(0);
|
|
60
|
+
this._paddingRight = new ValueAndUnit(0);
|
|
61
|
+
this._paddingTop = new ValueAndUnit(0);
|
|
62
|
+
this._paddingBottom = new ValueAndUnit(0);
|
|
63
|
+
/** @hidden */
|
|
64
|
+
this._left = new ValueAndUnit(0);
|
|
65
|
+
/** @hidden */
|
|
66
|
+
this._top = new ValueAndUnit(0);
|
|
67
|
+
this._scaleX = 1.0;
|
|
68
|
+
this._scaleY = 1.0;
|
|
69
|
+
this._rotation = 0;
|
|
70
|
+
this._transformCenterX = 0.5;
|
|
71
|
+
this._transformCenterY = 0.5;
|
|
72
|
+
/** @hidden */
|
|
73
|
+
this._transformMatrix = Matrix2D.Identity();
|
|
74
|
+
/** @hidden */
|
|
75
|
+
this._invertTransformMatrix = Matrix2D.Identity();
|
|
76
|
+
/** @hidden */
|
|
77
|
+
this._transformedPosition = Vector2.Zero();
|
|
78
|
+
this._isMatrixDirty = true;
|
|
79
|
+
this._isVisible = true;
|
|
80
|
+
this._isHighlighted = false;
|
|
81
|
+
this._highlightColor = "#4affff";
|
|
82
|
+
this._highlightLineWidth = 2;
|
|
83
|
+
this._fontSet = false;
|
|
84
|
+
this._dummyVector2 = Vector2.Zero();
|
|
85
|
+
this._downCount = 0;
|
|
86
|
+
this._enterCount = -1;
|
|
87
|
+
this._doNotRender = false;
|
|
88
|
+
this._downPointerIds = {};
|
|
89
|
+
this._evaluatedMeasure = new Measure(0, 0, 0, 0);
|
|
90
|
+
this._evaluatedParentMeasure = new Measure(0, 0, 0, 0);
|
|
91
|
+
this._isEnabled = true;
|
|
92
|
+
this._disabledColor = "#9a9a9a";
|
|
93
|
+
this._disabledColorItem = "#6a6a6a";
|
|
94
|
+
this._isReadOnly = false;
|
|
95
|
+
/** @hidden */
|
|
96
|
+
this._rebuildLayout = false;
|
|
97
|
+
/** @hidden */
|
|
98
|
+
this._customData = {};
|
|
99
|
+
/** @hidden */
|
|
100
|
+
this._isClipped = false;
|
|
101
|
+
/** @hidden */
|
|
102
|
+
this._automaticSize = false;
|
|
103
|
+
/**
|
|
104
|
+
* Gets or sets an object used to store user defined information for the node
|
|
105
|
+
*/
|
|
106
|
+
this.metadata = null;
|
|
107
|
+
/** Gets or sets a boolean indicating if the control can be hit with pointer events */
|
|
108
|
+
this.isHitTestVisible = true;
|
|
109
|
+
/** Gets or sets a boolean indicating if the control can block pointer events */
|
|
110
|
+
this.isPointerBlocker = false;
|
|
111
|
+
/** Gets or sets a boolean indicating if the control can be focusable */
|
|
112
|
+
this.isFocusInvisible = false;
|
|
113
|
+
/**
|
|
114
|
+
* Gets or sets a boolean indicating if the children are clipped to the current control bounds.
|
|
115
|
+
* Please note that not clipping children may generate issues with adt.useInvalidateRectOptimization so it is recommended to turn this optimization off if you want to use unclipped children
|
|
116
|
+
*/
|
|
117
|
+
this.clipChildren = true;
|
|
118
|
+
/**
|
|
119
|
+
* Gets or sets a boolean indicating that control content must be clipped
|
|
120
|
+
* Please note that not clipping children may generate issues with adt.useInvalidateRectOptimization so it is recommended to turn this optimization off if you want to use unclipped children
|
|
121
|
+
*/
|
|
122
|
+
this.clipContent = true;
|
|
123
|
+
/**
|
|
124
|
+
* Gets or sets a boolean indicating that the current control should cache its rendering (useful when the control does not change often)
|
|
125
|
+
*/
|
|
126
|
+
this.useBitmapCache = false;
|
|
127
|
+
this._shadowOffsetX = 0;
|
|
128
|
+
this._shadowOffsetY = 0;
|
|
129
|
+
this._shadowBlur = 0;
|
|
130
|
+
this._previousShadowBlur = 0;
|
|
131
|
+
this._shadowColor = "black";
|
|
132
|
+
/** Gets or sets the cursor to use when the control is hovered */
|
|
133
|
+
this.hoverCursor = "";
|
|
134
|
+
/** @hidden */
|
|
135
|
+
this._linkOffsetX = new ValueAndUnit(0);
|
|
136
|
+
/** @hidden */
|
|
137
|
+
this._linkOffsetY = new ValueAndUnit(0);
|
|
138
|
+
/**
|
|
139
|
+
* An event triggered when pointer wheel is scrolled
|
|
140
|
+
*/
|
|
141
|
+
this.onWheelObservable = new Observable();
|
|
142
|
+
/**
|
|
143
|
+
* An event triggered when the pointer moves over the control.
|
|
144
|
+
*/
|
|
145
|
+
this.onPointerMoveObservable = new Observable();
|
|
146
|
+
/**
|
|
147
|
+
* An event triggered when the pointer moves out of the control.
|
|
148
|
+
*/
|
|
149
|
+
this.onPointerOutObservable = new Observable();
|
|
150
|
+
/**
|
|
151
|
+
* An event triggered when the pointer taps the control
|
|
152
|
+
*/
|
|
153
|
+
this.onPointerDownObservable = new Observable();
|
|
154
|
+
/**
|
|
155
|
+
* An event triggered when pointer up
|
|
156
|
+
*/
|
|
157
|
+
this.onPointerUpObservable = new Observable();
|
|
158
|
+
/**
|
|
159
|
+
* An event triggered when a control is clicked on
|
|
160
|
+
*/
|
|
161
|
+
this.onPointerClickObservable = new Observable();
|
|
162
|
+
/**
|
|
163
|
+
* An event triggered when pointer enters the control
|
|
164
|
+
*/
|
|
165
|
+
this.onPointerEnterObservable = new Observable();
|
|
166
|
+
/**
|
|
167
|
+
* An event triggered when the control is marked as dirty
|
|
168
|
+
*/
|
|
169
|
+
this.onDirtyObservable = new Observable();
|
|
170
|
+
/**
|
|
171
|
+
* An event triggered before drawing the control
|
|
172
|
+
*/
|
|
173
|
+
this.onBeforeDrawObservable = new Observable();
|
|
174
|
+
/**
|
|
175
|
+
* An event triggered after the control was drawn
|
|
176
|
+
*/
|
|
177
|
+
this.onAfterDrawObservable = new Observable();
|
|
178
|
+
/**
|
|
179
|
+
* An event triggered when the control has been disposed
|
|
180
|
+
*/
|
|
181
|
+
this.onDisposeObservable = new Observable();
|
|
182
|
+
/**
|
|
183
|
+
* Gets or sets a fixed ratio for this control.
|
|
184
|
+
* When different from 0, the ratio is used to compute the "second" dimension.
|
|
185
|
+
* The first dimension used in the computation is the last one set (by setting width / widthInPixels or height / heightInPixels), and the
|
|
186
|
+
* second dimension is computed as first dimension * fixedRatio
|
|
187
|
+
*/
|
|
188
|
+
this.fixedRatio = 0;
|
|
189
|
+
this._fixedRatioMasterIsWidth = true;
|
|
190
|
+
this._tmpMeasureA = new Measure(0, 0, 0, 0);
|
|
191
|
+
}
|
|
192
|
+
Object.defineProperty(Control.prototype, "isReadOnly", {
|
|
193
|
+
/**
|
|
194
|
+
* Gets or sets a boolean indicating if the control is readonly (default: false).
|
|
195
|
+
* A readonly control will still raise pointer events but will not react to them
|
|
196
|
+
*/
|
|
197
|
+
get: function () {
|
|
198
|
+
return this._isReadOnly;
|
|
199
|
+
},
|
|
200
|
+
set: function (value) {
|
|
201
|
+
this._isReadOnly = value;
|
|
202
|
+
},
|
|
203
|
+
enumerable: false,
|
|
204
|
+
configurable: true
|
|
205
|
+
});
|
|
206
|
+
Object.defineProperty(Control.prototype, "transformedMeasure", {
|
|
207
|
+
/**
|
|
208
|
+
* Gets the transformed measure, that is the bounding box of the control after applying all transformations
|
|
209
|
+
*/
|
|
210
|
+
get: function () {
|
|
211
|
+
return this._evaluatedMeasure;
|
|
212
|
+
},
|
|
213
|
+
enumerable: false,
|
|
214
|
+
configurable: true
|
|
215
|
+
});
|
|
216
|
+
Object.defineProperty(Control.prototype, "shadowOffsetX", {
|
|
217
|
+
/** Gets or sets a value indicating the offset to apply on X axis to render the shadow */
|
|
218
|
+
get: function () {
|
|
219
|
+
return this._shadowOffsetX;
|
|
220
|
+
},
|
|
221
|
+
set: function (value) {
|
|
222
|
+
if (this._shadowOffsetX === value) {
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
this._shadowOffsetX = value;
|
|
226
|
+
this._markAsDirty();
|
|
227
|
+
},
|
|
228
|
+
enumerable: false,
|
|
229
|
+
configurable: true
|
|
230
|
+
});
|
|
231
|
+
Object.defineProperty(Control.prototype, "shadowOffsetY", {
|
|
232
|
+
/** Gets or sets a value indicating the offset to apply on Y axis to render the shadow */
|
|
233
|
+
get: function () {
|
|
234
|
+
return this._shadowOffsetY;
|
|
235
|
+
},
|
|
236
|
+
set: function (value) {
|
|
237
|
+
if (this._shadowOffsetY === value) {
|
|
238
|
+
return;
|
|
239
|
+
}
|
|
240
|
+
this._shadowOffsetY = value;
|
|
241
|
+
this._markAsDirty();
|
|
242
|
+
},
|
|
243
|
+
enumerable: false,
|
|
244
|
+
configurable: true
|
|
245
|
+
});
|
|
246
|
+
Object.defineProperty(Control.prototype, "shadowBlur", {
|
|
247
|
+
/** Gets or sets a value indicating the amount of blur to use to render the shadow */
|
|
248
|
+
get: function () {
|
|
249
|
+
return this._shadowBlur;
|
|
250
|
+
},
|
|
251
|
+
set: function (value) {
|
|
252
|
+
if (this._shadowBlur === value) {
|
|
253
|
+
return;
|
|
254
|
+
}
|
|
255
|
+
this._previousShadowBlur = this._shadowBlur;
|
|
256
|
+
this._shadowBlur = value;
|
|
257
|
+
this._markAsDirty();
|
|
258
|
+
},
|
|
259
|
+
enumerable: false,
|
|
260
|
+
configurable: true
|
|
261
|
+
});
|
|
262
|
+
Object.defineProperty(Control.prototype, "shadowColor", {
|
|
263
|
+
/** Gets or sets a value indicating the color of the shadow (black by default ie. "#000") */
|
|
264
|
+
get: function () {
|
|
265
|
+
return this._shadowColor;
|
|
266
|
+
},
|
|
267
|
+
set: function (value) {
|
|
268
|
+
if (this._shadowColor === value) {
|
|
269
|
+
return;
|
|
270
|
+
}
|
|
271
|
+
this._shadowColor = value;
|
|
272
|
+
this._markAsDirty();
|
|
273
|
+
},
|
|
274
|
+
enumerable: false,
|
|
275
|
+
configurable: true
|
|
276
|
+
});
|
|
277
|
+
Object.defineProperty(Control.prototype, "typeName", {
|
|
278
|
+
// Properties
|
|
279
|
+
/** Gets the control type name */
|
|
280
|
+
get: function () {
|
|
281
|
+
return this._getTypeName();
|
|
282
|
+
},
|
|
283
|
+
enumerable: false,
|
|
284
|
+
configurable: true
|
|
285
|
+
});
|
|
286
|
+
/**
|
|
287
|
+
* Get the current class name of the control.
|
|
288
|
+
* @returns current class name
|
|
289
|
+
*/
|
|
290
|
+
Control.prototype.getClassName = function () {
|
|
291
|
+
return this._getTypeName();
|
|
292
|
+
};
|
|
293
|
+
Object.defineProperty(Control.prototype, "host", {
|
|
294
|
+
/**
|
|
295
|
+
* Get the hosting AdvancedDynamicTexture
|
|
296
|
+
*/
|
|
297
|
+
get: function () {
|
|
298
|
+
return this._host;
|
|
299
|
+
},
|
|
300
|
+
enumerable: false,
|
|
301
|
+
configurable: true
|
|
302
|
+
});
|
|
303
|
+
Object.defineProperty(Control.prototype, "fontOffset", {
|
|
304
|
+
/** Gets or set information about font offsets (used to render and align text) */
|
|
305
|
+
get: function () {
|
|
306
|
+
return this._fontOffset;
|
|
307
|
+
},
|
|
308
|
+
set: function (offset) {
|
|
309
|
+
this._fontOffset = offset;
|
|
310
|
+
},
|
|
311
|
+
enumerable: false,
|
|
312
|
+
configurable: true
|
|
313
|
+
});
|
|
314
|
+
Object.defineProperty(Control.prototype, "alpha", {
|
|
315
|
+
/** Gets or sets alpha value for the control (1 means opaque and 0 means entirely transparent) */
|
|
316
|
+
get: function () {
|
|
317
|
+
return this._alpha;
|
|
318
|
+
},
|
|
319
|
+
set: function (value) {
|
|
320
|
+
if (this._alpha === value) {
|
|
321
|
+
return;
|
|
322
|
+
}
|
|
323
|
+
this._alphaSet = true;
|
|
324
|
+
this._alpha = value;
|
|
325
|
+
this._markAsDirty();
|
|
326
|
+
},
|
|
327
|
+
enumerable: false,
|
|
328
|
+
configurable: true
|
|
329
|
+
});
|
|
330
|
+
Object.defineProperty(Control.prototype, "highlightLineWidth", {
|
|
331
|
+
/**
|
|
332
|
+
* Gets or sets a number indicating size of stroke we want to highlight the control with (mostly for debugging purpose)
|
|
333
|
+
*/
|
|
334
|
+
get: function () {
|
|
335
|
+
return this._highlightLineWidth;
|
|
336
|
+
},
|
|
337
|
+
set: function (value) {
|
|
338
|
+
if (this._highlightLineWidth === value) {
|
|
339
|
+
return;
|
|
340
|
+
}
|
|
341
|
+
this._highlightLineWidth = value;
|
|
342
|
+
this._markAsDirty();
|
|
343
|
+
},
|
|
344
|
+
enumerable: false,
|
|
345
|
+
configurable: true
|
|
346
|
+
});
|
|
347
|
+
Object.defineProperty(Control.prototype, "isHighlighted", {
|
|
348
|
+
/**
|
|
349
|
+
* Gets or sets a boolean indicating that we want to highlight the control (mostly for debugging purpose)
|
|
350
|
+
*/
|
|
351
|
+
get: function () {
|
|
352
|
+
return this._isHighlighted;
|
|
353
|
+
},
|
|
354
|
+
set: function (value) {
|
|
355
|
+
if (this._isHighlighted === value) {
|
|
356
|
+
return;
|
|
357
|
+
}
|
|
358
|
+
this._isHighlighted = value;
|
|
359
|
+
this._markAsDirty();
|
|
360
|
+
},
|
|
361
|
+
enumerable: false,
|
|
362
|
+
configurable: true
|
|
363
|
+
});
|
|
364
|
+
Object.defineProperty(Control.prototype, "highlightColor", {
|
|
365
|
+
/**
|
|
366
|
+
* Gets or sets a string defining the color to use for highlighting this control
|
|
367
|
+
*/
|
|
368
|
+
get: function () {
|
|
369
|
+
return this._highlightColor;
|
|
370
|
+
},
|
|
371
|
+
set: function (value) {
|
|
372
|
+
if (this._highlightColor === value) {
|
|
373
|
+
return;
|
|
374
|
+
}
|
|
375
|
+
this._highlightColor = value;
|
|
376
|
+
this._markAsDirty();
|
|
377
|
+
},
|
|
378
|
+
enumerable: false,
|
|
379
|
+
configurable: true
|
|
380
|
+
});
|
|
381
|
+
Object.defineProperty(Control.prototype, "scaleX", {
|
|
382
|
+
/** Gets or sets a value indicating the scale factor on X axis (1 by default)
|
|
383
|
+
* @see https://doc.babylonjs.com/how_to/gui#rotation-and-scaling
|
|
384
|
+
*/
|
|
385
|
+
get: function () {
|
|
386
|
+
return this._scaleX;
|
|
387
|
+
},
|
|
388
|
+
set: function (value) {
|
|
389
|
+
if (this._scaleX === value) {
|
|
390
|
+
return;
|
|
391
|
+
}
|
|
392
|
+
this._scaleX = value;
|
|
393
|
+
this._markAsDirty();
|
|
394
|
+
this._markMatrixAsDirty();
|
|
395
|
+
},
|
|
396
|
+
enumerable: false,
|
|
397
|
+
configurable: true
|
|
398
|
+
});
|
|
399
|
+
Object.defineProperty(Control.prototype, "scaleY", {
|
|
400
|
+
/** Gets or sets a value indicating the scale factor on Y axis (1 by default)
|
|
401
|
+
* @see https://doc.babylonjs.com/how_to/gui#rotation-and-scaling
|
|
402
|
+
*/
|
|
403
|
+
get: function () {
|
|
404
|
+
return this._scaleY;
|
|
405
|
+
},
|
|
406
|
+
set: function (value) {
|
|
407
|
+
if (this._scaleY === value) {
|
|
408
|
+
return;
|
|
409
|
+
}
|
|
410
|
+
this._scaleY = value;
|
|
411
|
+
this._markAsDirty();
|
|
412
|
+
this._markMatrixAsDirty();
|
|
413
|
+
},
|
|
414
|
+
enumerable: false,
|
|
415
|
+
configurable: true
|
|
416
|
+
});
|
|
417
|
+
Object.defineProperty(Control.prototype, "rotation", {
|
|
418
|
+
/** Gets or sets the rotation angle (0 by default)
|
|
419
|
+
* @see https://doc.babylonjs.com/how_to/gui#rotation-and-scaling
|
|
420
|
+
*/
|
|
421
|
+
get: function () {
|
|
422
|
+
return this._rotation;
|
|
423
|
+
},
|
|
424
|
+
set: function (value) {
|
|
425
|
+
if (this._rotation === value) {
|
|
426
|
+
return;
|
|
427
|
+
}
|
|
428
|
+
this._rotation = value;
|
|
429
|
+
this._markAsDirty();
|
|
430
|
+
this._markMatrixAsDirty();
|
|
431
|
+
},
|
|
432
|
+
enumerable: false,
|
|
433
|
+
configurable: true
|
|
434
|
+
});
|
|
435
|
+
Object.defineProperty(Control.prototype, "transformCenterY", {
|
|
436
|
+
/** Gets or sets the transformation center on Y axis (0 by default)
|
|
437
|
+
* @see https://doc.babylonjs.com/how_to/gui#rotation-and-scaling
|
|
438
|
+
*/
|
|
439
|
+
get: function () {
|
|
440
|
+
return this._transformCenterY;
|
|
441
|
+
},
|
|
442
|
+
set: function (value) {
|
|
443
|
+
if (this._transformCenterY === value) {
|
|
444
|
+
return;
|
|
445
|
+
}
|
|
446
|
+
this._transformCenterY = value;
|
|
447
|
+
this._markAsDirty();
|
|
448
|
+
this._markMatrixAsDirty();
|
|
449
|
+
},
|
|
450
|
+
enumerable: false,
|
|
451
|
+
configurable: true
|
|
452
|
+
});
|
|
453
|
+
Object.defineProperty(Control.prototype, "transformCenterX", {
|
|
454
|
+
/** Gets or sets the transformation center on X axis (0 by default)
|
|
455
|
+
* @see https://doc.babylonjs.com/how_to/gui#rotation-and-scaling
|
|
456
|
+
*/
|
|
457
|
+
get: function () {
|
|
458
|
+
return this._transformCenterX;
|
|
459
|
+
},
|
|
460
|
+
set: function (value) {
|
|
461
|
+
if (this._transformCenterX === value) {
|
|
462
|
+
return;
|
|
463
|
+
}
|
|
464
|
+
this._transformCenterX = value;
|
|
465
|
+
this._markAsDirty();
|
|
466
|
+
this._markMatrixAsDirty();
|
|
467
|
+
},
|
|
468
|
+
enumerable: false,
|
|
469
|
+
configurable: true
|
|
470
|
+
});
|
|
471
|
+
Object.defineProperty(Control.prototype, "horizontalAlignment", {
|
|
472
|
+
/**
|
|
473
|
+
* Gets or sets the horizontal alignment
|
|
474
|
+
* @see https://doc.babylonjs.com/how_to/gui#alignments
|
|
475
|
+
*/
|
|
476
|
+
get: function () {
|
|
477
|
+
return this._horizontalAlignment;
|
|
478
|
+
},
|
|
479
|
+
set: function (value) {
|
|
480
|
+
if (this._horizontalAlignment === value) {
|
|
481
|
+
return;
|
|
482
|
+
}
|
|
483
|
+
this._horizontalAlignment = value;
|
|
484
|
+
this._markAsDirty();
|
|
485
|
+
},
|
|
486
|
+
enumerable: false,
|
|
487
|
+
configurable: true
|
|
488
|
+
});
|
|
489
|
+
Object.defineProperty(Control.prototype, "verticalAlignment", {
|
|
490
|
+
/**
|
|
491
|
+
* Gets or sets the vertical alignment
|
|
492
|
+
* @see https://doc.babylonjs.com/how_to/gui#alignments
|
|
493
|
+
*/
|
|
494
|
+
get: function () {
|
|
495
|
+
return this._verticalAlignment;
|
|
496
|
+
},
|
|
497
|
+
set: function (value) {
|
|
498
|
+
if (this._verticalAlignment === value) {
|
|
499
|
+
return;
|
|
500
|
+
}
|
|
501
|
+
this._verticalAlignment = value;
|
|
502
|
+
this._markAsDirty();
|
|
503
|
+
},
|
|
504
|
+
enumerable: false,
|
|
505
|
+
configurable: true
|
|
506
|
+
});
|
|
507
|
+
Object.defineProperty(Control.prototype, "width", {
|
|
508
|
+
/**
|
|
509
|
+
* Gets or sets control width
|
|
510
|
+
* @see https://doc.babylonjs.com/how_to/gui#position-and-size
|
|
511
|
+
*/
|
|
512
|
+
get: function () {
|
|
513
|
+
return this._width.toString(this._host);
|
|
514
|
+
},
|
|
515
|
+
set: function (value) {
|
|
516
|
+
this._fixedRatioMasterIsWidth = true;
|
|
517
|
+
if (this._width.toString(this._host) === value) {
|
|
518
|
+
return;
|
|
519
|
+
}
|
|
520
|
+
if (this._width.fromString(value)) {
|
|
521
|
+
this._markAsDirty();
|
|
522
|
+
}
|
|
523
|
+
},
|
|
524
|
+
enumerable: false,
|
|
525
|
+
configurable: true
|
|
526
|
+
});
|
|
527
|
+
Object.defineProperty(Control.prototype, "widthInPixels", {
|
|
528
|
+
/**
|
|
529
|
+
* Gets or sets the control width in pixel
|
|
530
|
+
* @see https://doc.babylonjs.com/how_to/gui#position-and-size
|
|
531
|
+
*/
|
|
532
|
+
get: function () {
|
|
533
|
+
return this._width.getValueInPixel(this._host, this._cachedParentMeasure.width);
|
|
534
|
+
},
|
|
535
|
+
set: function (value) {
|
|
536
|
+
if (isNaN(value)) {
|
|
537
|
+
return;
|
|
538
|
+
}
|
|
539
|
+
this._fixedRatioMasterIsWidth = true;
|
|
540
|
+
this.width = value + "px";
|
|
541
|
+
},
|
|
542
|
+
enumerable: false,
|
|
543
|
+
configurable: true
|
|
544
|
+
});
|
|
545
|
+
Object.defineProperty(Control.prototype, "height", {
|
|
546
|
+
/**
|
|
547
|
+
* Gets or sets control height
|
|
548
|
+
* @see https://doc.babylonjs.com/how_to/gui#position-and-size
|
|
549
|
+
*/
|
|
550
|
+
get: function () {
|
|
551
|
+
return this._height.toString(this._host);
|
|
552
|
+
},
|
|
553
|
+
set: function (value) {
|
|
554
|
+
this._fixedRatioMasterIsWidth = false;
|
|
555
|
+
if (this._height.toString(this._host) === value) {
|
|
556
|
+
return;
|
|
557
|
+
}
|
|
558
|
+
if (this._height.fromString(value)) {
|
|
559
|
+
this._markAsDirty();
|
|
560
|
+
}
|
|
561
|
+
},
|
|
562
|
+
enumerable: false,
|
|
563
|
+
configurable: true
|
|
564
|
+
});
|
|
565
|
+
Object.defineProperty(Control.prototype, "heightInPixels", {
|
|
566
|
+
/**
|
|
567
|
+
* Gets or sets control height in pixel
|
|
568
|
+
* @see https://doc.babylonjs.com/how_to/gui#position-and-size
|
|
569
|
+
*/
|
|
570
|
+
get: function () {
|
|
571
|
+
return this._height.getValueInPixel(this._host, this._cachedParentMeasure.height);
|
|
572
|
+
},
|
|
573
|
+
set: function (value) {
|
|
574
|
+
if (isNaN(value)) {
|
|
575
|
+
return;
|
|
576
|
+
}
|
|
577
|
+
this._fixedRatioMasterIsWidth = false;
|
|
578
|
+
this.height = value + "px";
|
|
579
|
+
},
|
|
580
|
+
enumerable: false,
|
|
581
|
+
configurable: true
|
|
582
|
+
});
|
|
583
|
+
Object.defineProperty(Control.prototype, "fontFamily", {
|
|
584
|
+
/** Gets or set font family */
|
|
585
|
+
get: function () {
|
|
586
|
+
return this._fontFamily;
|
|
587
|
+
},
|
|
588
|
+
set: function (value) {
|
|
589
|
+
if (this._fontFamily === value) {
|
|
590
|
+
return;
|
|
591
|
+
}
|
|
592
|
+
this._fontFamily = value;
|
|
593
|
+
this._resetFontCache();
|
|
594
|
+
},
|
|
595
|
+
enumerable: false,
|
|
596
|
+
configurable: true
|
|
597
|
+
});
|
|
598
|
+
Object.defineProperty(Control.prototype, "fontStyle", {
|
|
599
|
+
/** Gets or sets font style */
|
|
600
|
+
get: function () {
|
|
601
|
+
return this._fontStyle;
|
|
602
|
+
},
|
|
603
|
+
set: function (value) {
|
|
604
|
+
if (this._fontStyle === value) {
|
|
605
|
+
return;
|
|
606
|
+
}
|
|
607
|
+
this._fontStyle = value;
|
|
608
|
+
this._resetFontCache();
|
|
609
|
+
},
|
|
610
|
+
enumerable: false,
|
|
611
|
+
configurable: true
|
|
612
|
+
});
|
|
613
|
+
Object.defineProperty(Control.prototype, "fontWeight", {
|
|
614
|
+
/** Gets or sets font weight */
|
|
615
|
+
get: function () {
|
|
616
|
+
return this._fontWeight;
|
|
617
|
+
},
|
|
618
|
+
set: function (value) {
|
|
619
|
+
if (this._fontWeight === value) {
|
|
620
|
+
return;
|
|
621
|
+
}
|
|
622
|
+
this._fontWeight = value;
|
|
623
|
+
this._resetFontCache();
|
|
624
|
+
},
|
|
625
|
+
enumerable: false,
|
|
626
|
+
configurable: true
|
|
627
|
+
});
|
|
628
|
+
Object.defineProperty(Control.prototype, "style", {
|
|
629
|
+
/**
|
|
630
|
+
* Gets or sets style
|
|
631
|
+
* @see https://doc.babylonjs.com/how_to/gui#styles
|
|
632
|
+
*/
|
|
633
|
+
get: function () {
|
|
634
|
+
return this._style;
|
|
635
|
+
},
|
|
636
|
+
set: function (value) {
|
|
637
|
+
var _this = this;
|
|
638
|
+
if (this._style) {
|
|
639
|
+
this._style.onChangedObservable.remove(this._styleObserver);
|
|
640
|
+
this._styleObserver = null;
|
|
641
|
+
}
|
|
642
|
+
this._style = value;
|
|
643
|
+
if (this._style) {
|
|
644
|
+
this._styleObserver = this._style.onChangedObservable.add(function () {
|
|
645
|
+
_this._markAsDirty();
|
|
646
|
+
_this._resetFontCache();
|
|
647
|
+
});
|
|
648
|
+
}
|
|
649
|
+
this._markAsDirty();
|
|
650
|
+
this._resetFontCache();
|
|
651
|
+
},
|
|
652
|
+
enumerable: false,
|
|
653
|
+
configurable: true
|
|
654
|
+
});
|
|
655
|
+
Object.defineProperty(Control.prototype, "_isFontSizeInPercentage", {
|
|
656
|
+
/** @hidden */
|
|
657
|
+
get: function () {
|
|
658
|
+
return this._fontSize.isPercentage;
|
|
659
|
+
},
|
|
660
|
+
enumerable: false,
|
|
661
|
+
configurable: true
|
|
662
|
+
});
|
|
663
|
+
Object.defineProperty(Control.prototype, "fontSizeInPixels", {
|
|
664
|
+
/** Gets or sets font size in pixels */
|
|
665
|
+
get: function () {
|
|
666
|
+
var fontSizeToUse = this._style ? this._style._fontSize : this._fontSize;
|
|
667
|
+
if (fontSizeToUse.isPixel) {
|
|
668
|
+
return fontSizeToUse.getValue(this._host);
|
|
669
|
+
}
|
|
670
|
+
return fontSizeToUse.getValueInPixel(this._host, this._tempParentMeasure.height || this._cachedParentMeasure.height);
|
|
671
|
+
},
|
|
672
|
+
set: function (value) {
|
|
673
|
+
if (isNaN(value)) {
|
|
674
|
+
return;
|
|
675
|
+
}
|
|
676
|
+
this.fontSize = value + "px";
|
|
677
|
+
},
|
|
678
|
+
enumerable: false,
|
|
679
|
+
configurable: true
|
|
680
|
+
});
|
|
681
|
+
Object.defineProperty(Control.prototype, "fontSize", {
|
|
682
|
+
/** Gets or sets font size */
|
|
683
|
+
get: function () {
|
|
684
|
+
return this._fontSize.toString(this._host);
|
|
685
|
+
},
|
|
686
|
+
set: function (value) {
|
|
687
|
+
if (this._fontSize.toString(this._host) === value) {
|
|
688
|
+
return;
|
|
689
|
+
}
|
|
690
|
+
if (this._fontSize.fromString(value)) {
|
|
691
|
+
this._markAsDirty();
|
|
692
|
+
this._resetFontCache();
|
|
693
|
+
}
|
|
694
|
+
},
|
|
695
|
+
enumerable: false,
|
|
696
|
+
configurable: true
|
|
697
|
+
});
|
|
698
|
+
Object.defineProperty(Control.prototype, "color", {
|
|
699
|
+
/** Gets or sets foreground color */
|
|
700
|
+
get: function () {
|
|
701
|
+
return this._color;
|
|
702
|
+
},
|
|
703
|
+
set: function (value) {
|
|
704
|
+
if (this._color === value) {
|
|
705
|
+
return;
|
|
706
|
+
}
|
|
707
|
+
this._color = value;
|
|
708
|
+
this._markAsDirty();
|
|
709
|
+
},
|
|
710
|
+
enumerable: false,
|
|
711
|
+
configurable: true
|
|
712
|
+
});
|
|
713
|
+
Object.defineProperty(Control.prototype, "zIndex", {
|
|
714
|
+
/** Gets or sets z index which is used to reorder controls on the z axis */
|
|
715
|
+
get: function () {
|
|
716
|
+
return this._zIndex;
|
|
717
|
+
},
|
|
718
|
+
set: function (value) {
|
|
719
|
+
if (this.zIndex === value) {
|
|
720
|
+
return;
|
|
721
|
+
}
|
|
722
|
+
this._zIndex = value;
|
|
723
|
+
if (this.parent) {
|
|
724
|
+
this.parent._reOrderControl(this);
|
|
725
|
+
}
|
|
726
|
+
},
|
|
727
|
+
enumerable: false,
|
|
728
|
+
configurable: true
|
|
729
|
+
});
|
|
730
|
+
Object.defineProperty(Control.prototype, "notRenderable", {
|
|
731
|
+
/** Gets or sets a boolean indicating if the control can be rendered */
|
|
732
|
+
get: function () {
|
|
733
|
+
return this._doNotRender;
|
|
734
|
+
},
|
|
735
|
+
set: function (value) {
|
|
736
|
+
if (this._doNotRender === value) {
|
|
737
|
+
return;
|
|
738
|
+
}
|
|
739
|
+
this._doNotRender = value;
|
|
740
|
+
this._markAsDirty();
|
|
741
|
+
},
|
|
742
|
+
enumerable: false,
|
|
743
|
+
configurable: true
|
|
744
|
+
});
|
|
745
|
+
Object.defineProperty(Control.prototype, "isVisible", {
|
|
746
|
+
/** Gets or sets a boolean indicating if the control is visible */
|
|
747
|
+
get: function () {
|
|
748
|
+
return this._isVisible;
|
|
749
|
+
},
|
|
750
|
+
set: function (value) {
|
|
751
|
+
if (this._isVisible === value) {
|
|
752
|
+
return;
|
|
753
|
+
}
|
|
754
|
+
this._isVisible = value;
|
|
755
|
+
this._markAsDirty(true);
|
|
756
|
+
},
|
|
757
|
+
enumerable: false,
|
|
758
|
+
configurable: true
|
|
759
|
+
});
|
|
760
|
+
Object.defineProperty(Control.prototype, "isDirty", {
|
|
761
|
+
/** Gets a boolean indicating that the control needs to update its rendering */
|
|
762
|
+
get: function () {
|
|
763
|
+
return this._isDirty;
|
|
764
|
+
},
|
|
765
|
+
enumerable: false,
|
|
766
|
+
configurable: true
|
|
767
|
+
});
|
|
768
|
+
Object.defineProperty(Control.prototype, "linkedMesh", {
|
|
769
|
+
/**
|
|
770
|
+
* Gets the current linked mesh (or null if none)
|
|
771
|
+
*/
|
|
772
|
+
get: function () {
|
|
773
|
+
return this._linkedMesh;
|
|
774
|
+
},
|
|
775
|
+
enumerable: false,
|
|
776
|
+
configurable: true
|
|
777
|
+
});
|
|
778
|
+
Object.defineProperty(Control.prototype, "descendantsOnlyPadding", {
|
|
779
|
+
/**
|
|
780
|
+
* Gets or sets a value indicating the padding should work like in CSS.
|
|
781
|
+
* Basically, it will add the padding amount on each side of the parent control for its children.
|
|
782
|
+
*/
|
|
783
|
+
get: function () {
|
|
784
|
+
return this._descendantsOnlyPadding;
|
|
785
|
+
},
|
|
786
|
+
set: function (value) {
|
|
787
|
+
if (this._descendantsOnlyPadding === value) {
|
|
788
|
+
return;
|
|
789
|
+
}
|
|
790
|
+
this._descendantsOnlyPadding = value;
|
|
791
|
+
this._markAsDirty();
|
|
792
|
+
},
|
|
793
|
+
enumerable: false,
|
|
794
|
+
configurable: true
|
|
795
|
+
});
|
|
796
|
+
Object.defineProperty(Control.prototype, "paddingLeft", {
|
|
797
|
+
/**
|
|
798
|
+
* Gets or sets a value indicating the padding to use on the left of the control
|
|
799
|
+
* @see https://doc.babylonjs.com/how_to/gui#position-and-size
|
|
800
|
+
*/
|
|
801
|
+
get: function () {
|
|
802
|
+
return this._paddingLeft.toString(this._host);
|
|
803
|
+
},
|
|
804
|
+
set: function (value) {
|
|
805
|
+
if (this._paddingLeft.fromString(value)) {
|
|
806
|
+
this._markAsDirty();
|
|
807
|
+
}
|
|
808
|
+
},
|
|
809
|
+
enumerable: false,
|
|
810
|
+
configurable: true
|
|
811
|
+
});
|
|
812
|
+
Object.defineProperty(Control.prototype, "paddingLeftInPixels", {
|
|
813
|
+
/**
|
|
814
|
+
* Gets or sets a value indicating the padding in pixels to use on the left of the control
|
|
815
|
+
* @see https://doc.babylonjs.com/how_to/gui#position-and-size
|
|
816
|
+
*/
|
|
817
|
+
get: function () {
|
|
818
|
+
return this._paddingLeft.getValueInPixel(this._host, this._cachedParentMeasure.width);
|
|
819
|
+
},
|
|
820
|
+
set: function (value) {
|
|
821
|
+
if (isNaN(value)) {
|
|
822
|
+
return;
|
|
823
|
+
}
|
|
824
|
+
this.paddingLeft = value + "px";
|
|
825
|
+
},
|
|
826
|
+
enumerable: false,
|
|
827
|
+
configurable: true
|
|
828
|
+
});
|
|
829
|
+
Object.defineProperty(Control.prototype, "_paddingLeftInPixels", {
|
|
830
|
+
/** @hidden */
|
|
831
|
+
get: function () {
|
|
832
|
+
if (this._descendantsOnlyPadding) {
|
|
833
|
+
return 0;
|
|
834
|
+
}
|
|
835
|
+
return this.paddingLeftInPixels;
|
|
836
|
+
},
|
|
837
|
+
enumerable: false,
|
|
838
|
+
configurable: true
|
|
839
|
+
});
|
|
840
|
+
Object.defineProperty(Control.prototype, "paddingRight", {
|
|
841
|
+
/**
|
|
842
|
+
* Gets or sets a value indicating the padding to use on the right of the control
|
|
843
|
+
* @see https://doc.babylonjs.com/how_to/gui#position-and-size
|
|
844
|
+
*/
|
|
845
|
+
get: function () {
|
|
846
|
+
return this._paddingRight.toString(this._host);
|
|
847
|
+
},
|
|
848
|
+
set: function (value) {
|
|
849
|
+
if (this._paddingRight.fromString(value)) {
|
|
850
|
+
this._markAsDirty();
|
|
851
|
+
}
|
|
852
|
+
},
|
|
853
|
+
enumerable: false,
|
|
854
|
+
configurable: true
|
|
855
|
+
});
|
|
856
|
+
Object.defineProperty(Control.prototype, "paddingRightInPixels", {
|
|
857
|
+
/**
|
|
858
|
+
* Gets or sets a value indicating the padding in pixels to use on the right of the control
|
|
859
|
+
* @see https://doc.babylonjs.com/how_to/gui#position-and-size
|
|
860
|
+
*/
|
|
861
|
+
get: function () {
|
|
862
|
+
return this._paddingRight.getValueInPixel(this._host, this._cachedParentMeasure.width);
|
|
863
|
+
},
|
|
864
|
+
set: function (value) {
|
|
865
|
+
if (isNaN(value)) {
|
|
866
|
+
return;
|
|
867
|
+
}
|
|
868
|
+
this.paddingRight = value + "px";
|
|
869
|
+
},
|
|
870
|
+
enumerable: false,
|
|
871
|
+
configurable: true
|
|
872
|
+
});
|
|
873
|
+
Object.defineProperty(Control.prototype, "_paddingRightInPixels", {
|
|
874
|
+
/** @hidden */
|
|
875
|
+
get: function () {
|
|
876
|
+
if (this._descendantsOnlyPadding) {
|
|
877
|
+
return 0;
|
|
878
|
+
}
|
|
879
|
+
return this.paddingRightInPixels;
|
|
880
|
+
},
|
|
881
|
+
enumerable: false,
|
|
882
|
+
configurable: true
|
|
883
|
+
});
|
|
884
|
+
Object.defineProperty(Control.prototype, "paddingTop", {
|
|
885
|
+
/**
|
|
886
|
+
* Gets or sets a value indicating the padding to use on the top of the control
|
|
887
|
+
* @see https://doc.babylonjs.com/how_to/gui#position-and-size
|
|
888
|
+
*/
|
|
889
|
+
get: function () {
|
|
890
|
+
return this._paddingTop.toString(this._host);
|
|
891
|
+
},
|
|
892
|
+
set: function (value) {
|
|
893
|
+
if (this._paddingTop.fromString(value)) {
|
|
894
|
+
this._markAsDirty();
|
|
895
|
+
}
|
|
896
|
+
},
|
|
897
|
+
enumerable: false,
|
|
898
|
+
configurable: true
|
|
899
|
+
});
|
|
900
|
+
Object.defineProperty(Control.prototype, "paddingTopInPixels", {
|
|
901
|
+
/**
|
|
902
|
+
* Gets or sets a value indicating the padding in pixels to use on the top of the control
|
|
903
|
+
* @see https://doc.babylonjs.com/how_to/gui#position-and-size
|
|
904
|
+
*/
|
|
905
|
+
get: function () {
|
|
906
|
+
return this._paddingTop.getValueInPixel(this._host, this._cachedParentMeasure.height);
|
|
907
|
+
},
|
|
908
|
+
set: function (value) {
|
|
909
|
+
if (isNaN(value)) {
|
|
910
|
+
return;
|
|
911
|
+
}
|
|
912
|
+
this.paddingTop = value + "px";
|
|
913
|
+
},
|
|
914
|
+
enumerable: false,
|
|
915
|
+
configurable: true
|
|
916
|
+
});
|
|
917
|
+
Object.defineProperty(Control.prototype, "_paddingTopInPixels", {
|
|
918
|
+
/** @hidden */
|
|
919
|
+
get: function () {
|
|
920
|
+
if (this._descendantsOnlyPadding) {
|
|
921
|
+
return 0;
|
|
922
|
+
}
|
|
923
|
+
return this.paddingTopInPixels;
|
|
924
|
+
},
|
|
925
|
+
enumerable: false,
|
|
926
|
+
configurable: true
|
|
927
|
+
});
|
|
928
|
+
Object.defineProperty(Control.prototype, "paddingBottom", {
|
|
929
|
+
/**
|
|
930
|
+
* Gets or sets a value indicating the padding to use on the bottom of the control
|
|
931
|
+
* @see https://doc.babylonjs.com/how_to/gui#position-and-size
|
|
932
|
+
*/
|
|
933
|
+
get: function () {
|
|
934
|
+
return this._paddingBottom.toString(this._host);
|
|
935
|
+
},
|
|
936
|
+
set: function (value) {
|
|
937
|
+
if (this._paddingBottom.fromString(value)) {
|
|
938
|
+
this._markAsDirty();
|
|
939
|
+
}
|
|
940
|
+
},
|
|
941
|
+
enumerable: false,
|
|
942
|
+
configurable: true
|
|
943
|
+
});
|
|
944
|
+
Object.defineProperty(Control.prototype, "paddingBottomInPixels", {
|
|
945
|
+
/**
|
|
946
|
+
* Gets or sets a value indicating the padding in pixels to use on the bottom of the control
|
|
947
|
+
* @see https://doc.babylonjs.com/how_to/gui#position-and-size
|
|
948
|
+
*/
|
|
949
|
+
get: function () {
|
|
950
|
+
return this._paddingBottom.getValueInPixel(this._host, this._cachedParentMeasure.height);
|
|
951
|
+
},
|
|
952
|
+
set: function (value) {
|
|
953
|
+
if (isNaN(value)) {
|
|
954
|
+
return;
|
|
955
|
+
}
|
|
956
|
+
this.paddingBottom = value + "px";
|
|
957
|
+
},
|
|
958
|
+
enumerable: false,
|
|
959
|
+
configurable: true
|
|
960
|
+
});
|
|
961
|
+
Object.defineProperty(Control.prototype, "_paddingBottomInPixels", {
|
|
962
|
+
/** @hidden */
|
|
963
|
+
get: function () {
|
|
964
|
+
if (this._descendantsOnlyPadding) {
|
|
965
|
+
return 0;
|
|
966
|
+
}
|
|
967
|
+
return this.paddingBottomInPixels;
|
|
968
|
+
},
|
|
969
|
+
enumerable: false,
|
|
970
|
+
configurable: true
|
|
971
|
+
});
|
|
972
|
+
Object.defineProperty(Control.prototype, "left", {
|
|
973
|
+
/**
|
|
974
|
+
* Gets or sets a value indicating the left coordinate of the control
|
|
975
|
+
* @see https://doc.babylonjs.com/how_to/gui#position-and-size
|
|
976
|
+
*/
|
|
977
|
+
get: function () {
|
|
978
|
+
return this._left.toString(this._host);
|
|
979
|
+
},
|
|
980
|
+
set: function (value) {
|
|
981
|
+
if (this._left.fromString(value)) {
|
|
982
|
+
this._markAsDirty();
|
|
983
|
+
}
|
|
984
|
+
},
|
|
985
|
+
enumerable: false,
|
|
986
|
+
configurable: true
|
|
987
|
+
});
|
|
988
|
+
Object.defineProperty(Control.prototype, "leftInPixels", {
|
|
989
|
+
/**
|
|
990
|
+
* Gets or sets a value indicating the left coordinate in pixels of the control
|
|
991
|
+
* @see https://doc.babylonjs.com/how_to/gui#position-and-size
|
|
992
|
+
*/
|
|
993
|
+
get: function () {
|
|
994
|
+
return this._left.getValueInPixel(this._host, this._cachedParentMeasure.width);
|
|
995
|
+
},
|
|
996
|
+
set: function (value) {
|
|
997
|
+
if (isNaN(value)) {
|
|
998
|
+
return;
|
|
999
|
+
}
|
|
1000
|
+
this.left = value + "px";
|
|
1001
|
+
},
|
|
1002
|
+
enumerable: false,
|
|
1003
|
+
configurable: true
|
|
1004
|
+
});
|
|
1005
|
+
Object.defineProperty(Control.prototype, "top", {
|
|
1006
|
+
/**
|
|
1007
|
+
* Gets or sets a value indicating the top coordinate of the control
|
|
1008
|
+
* @see https://doc.babylonjs.com/how_to/gui#position-and-size
|
|
1009
|
+
*/
|
|
1010
|
+
get: function () {
|
|
1011
|
+
return this._top.toString(this._host);
|
|
1012
|
+
},
|
|
1013
|
+
set: function (value) {
|
|
1014
|
+
if (this._top.fromString(value)) {
|
|
1015
|
+
this._markAsDirty();
|
|
1016
|
+
}
|
|
1017
|
+
},
|
|
1018
|
+
enumerable: false,
|
|
1019
|
+
configurable: true
|
|
1020
|
+
});
|
|
1021
|
+
Object.defineProperty(Control.prototype, "topInPixels", {
|
|
1022
|
+
/**
|
|
1023
|
+
* Gets or sets a value indicating the top coordinate in pixels of the control
|
|
1024
|
+
* @see https://doc.babylonjs.com/how_to/gui#position-and-size
|
|
1025
|
+
*/
|
|
1026
|
+
get: function () {
|
|
1027
|
+
return this._top.getValueInPixel(this._host, this._cachedParentMeasure.height);
|
|
1028
|
+
},
|
|
1029
|
+
set: function (value) {
|
|
1030
|
+
if (isNaN(value)) {
|
|
1031
|
+
return;
|
|
1032
|
+
}
|
|
1033
|
+
this.top = value + "px";
|
|
1034
|
+
},
|
|
1035
|
+
enumerable: false,
|
|
1036
|
+
configurable: true
|
|
1037
|
+
});
|
|
1038
|
+
Object.defineProperty(Control.prototype, "linkOffsetX", {
|
|
1039
|
+
/**
|
|
1040
|
+
* Gets or sets a value indicating the offset on X axis to the linked mesh
|
|
1041
|
+
* @see https://doc.babylonjs.com/how_to/gui#tracking-positions
|
|
1042
|
+
*/
|
|
1043
|
+
get: function () {
|
|
1044
|
+
return this._linkOffsetX.toString(this._host);
|
|
1045
|
+
},
|
|
1046
|
+
set: function (value) {
|
|
1047
|
+
if (this._linkOffsetX.fromString(value)) {
|
|
1048
|
+
this._markAsDirty();
|
|
1049
|
+
}
|
|
1050
|
+
},
|
|
1051
|
+
enumerable: false,
|
|
1052
|
+
configurable: true
|
|
1053
|
+
});
|
|
1054
|
+
Object.defineProperty(Control.prototype, "linkOffsetXInPixels", {
|
|
1055
|
+
/**
|
|
1056
|
+
* Gets or sets a value indicating the offset in pixels on X axis to the linked mesh
|
|
1057
|
+
* @see https://doc.babylonjs.com/how_to/gui#tracking-positions
|
|
1058
|
+
*/
|
|
1059
|
+
get: function () {
|
|
1060
|
+
return this._linkOffsetX.getValueInPixel(this._host, this._cachedParentMeasure.width);
|
|
1061
|
+
},
|
|
1062
|
+
set: function (value) {
|
|
1063
|
+
if (isNaN(value)) {
|
|
1064
|
+
return;
|
|
1065
|
+
}
|
|
1066
|
+
this.linkOffsetX = value + "px";
|
|
1067
|
+
},
|
|
1068
|
+
enumerable: false,
|
|
1069
|
+
configurable: true
|
|
1070
|
+
});
|
|
1071
|
+
Object.defineProperty(Control.prototype, "linkOffsetY", {
|
|
1072
|
+
/**
|
|
1073
|
+
* Gets or sets a value indicating the offset on Y axis to the linked mesh
|
|
1074
|
+
* @see https://doc.babylonjs.com/how_to/gui#tracking-positions
|
|
1075
|
+
*/
|
|
1076
|
+
get: function () {
|
|
1077
|
+
return this._linkOffsetY.toString(this._host);
|
|
1078
|
+
},
|
|
1079
|
+
set: function (value) {
|
|
1080
|
+
if (this._linkOffsetY.fromString(value)) {
|
|
1081
|
+
this._markAsDirty();
|
|
1082
|
+
}
|
|
1083
|
+
},
|
|
1084
|
+
enumerable: false,
|
|
1085
|
+
configurable: true
|
|
1086
|
+
});
|
|
1087
|
+
Object.defineProperty(Control.prototype, "linkOffsetYInPixels", {
|
|
1088
|
+
/**
|
|
1089
|
+
* Gets or sets a value indicating the offset in pixels on Y axis to the linked mesh
|
|
1090
|
+
* @see https://doc.babylonjs.com/how_to/gui#tracking-positions
|
|
1091
|
+
*/
|
|
1092
|
+
get: function () {
|
|
1093
|
+
return this._linkOffsetY.getValueInPixel(this._host, this._cachedParentMeasure.height);
|
|
1094
|
+
},
|
|
1095
|
+
set: function (value) {
|
|
1096
|
+
if (isNaN(value)) {
|
|
1097
|
+
return;
|
|
1098
|
+
}
|
|
1099
|
+
this.linkOffsetY = value + "px";
|
|
1100
|
+
},
|
|
1101
|
+
enumerable: false,
|
|
1102
|
+
configurable: true
|
|
1103
|
+
});
|
|
1104
|
+
Object.defineProperty(Control.prototype, "centerX", {
|
|
1105
|
+
/** Gets the center coordinate on X axis */
|
|
1106
|
+
get: function () {
|
|
1107
|
+
return this._currentMeasure.left + this._currentMeasure.width / 2;
|
|
1108
|
+
},
|
|
1109
|
+
enumerable: false,
|
|
1110
|
+
configurable: true
|
|
1111
|
+
});
|
|
1112
|
+
Object.defineProperty(Control.prototype, "centerY", {
|
|
1113
|
+
/** Gets the center coordinate on Y axis */
|
|
1114
|
+
get: function () {
|
|
1115
|
+
return this._currentMeasure.top + this._currentMeasure.height / 2;
|
|
1116
|
+
},
|
|
1117
|
+
enumerable: false,
|
|
1118
|
+
configurable: true
|
|
1119
|
+
});
|
|
1120
|
+
Object.defineProperty(Control.prototype, "isEnabled", {
|
|
1121
|
+
/** Gets or sets if control is Enabled */
|
|
1122
|
+
get: function () {
|
|
1123
|
+
return this._isEnabled;
|
|
1124
|
+
},
|
|
1125
|
+
set: function (value) {
|
|
1126
|
+
var _this = this;
|
|
1127
|
+
if (this._isEnabled === value) {
|
|
1128
|
+
return;
|
|
1129
|
+
}
|
|
1130
|
+
this._isEnabled = value;
|
|
1131
|
+
this._markAsDirty();
|
|
1132
|
+
// if this control or any of it's descendants are under a pointer, we need to fire a pointerOut event
|
|
1133
|
+
var recursivelyFirePointerOut = function (control) {
|
|
1134
|
+
if (!control.host) {
|
|
1135
|
+
return;
|
|
1136
|
+
}
|
|
1137
|
+
for (var pointer in control.host._lastControlOver) {
|
|
1138
|
+
if (control === _this.host._lastControlOver[pointer]) {
|
|
1139
|
+
control._onPointerOut(control, null, true);
|
|
1140
|
+
delete control.host._lastControlOver[pointer];
|
|
1141
|
+
}
|
|
1142
|
+
}
|
|
1143
|
+
if (control.children !== undefined) {
|
|
1144
|
+
control.children.forEach(recursivelyFirePointerOut);
|
|
1145
|
+
}
|
|
1146
|
+
};
|
|
1147
|
+
recursivelyFirePointerOut(this);
|
|
1148
|
+
},
|
|
1149
|
+
enumerable: false,
|
|
1150
|
+
configurable: true
|
|
1151
|
+
});
|
|
1152
|
+
Object.defineProperty(Control.prototype, "disabledColor", {
|
|
1153
|
+
/** Gets or sets background color of control if it's disabled. Only applies to Button class. */
|
|
1154
|
+
get: function () {
|
|
1155
|
+
return this._disabledColor;
|
|
1156
|
+
},
|
|
1157
|
+
set: function (value) {
|
|
1158
|
+
if (this._disabledColor === value) {
|
|
1159
|
+
return;
|
|
1160
|
+
}
|
|
1161
|
+
this._disabledColor = value;
|
|
1162
|
+
this._markAsDirty();
|
|
1163
|
+
},
|
|
1164
|
+
enumerable: false,
|
|
1165
|
+
configurable: true
|
|
1166
|
+
});
|
|
1167
|
+
Object.defineProperty(Control.prototype, "disabledColorItem", {
|
|
1168
|
+
/** Gets or sets front color of control if it's disabled. Only applies to Checkbox class. */
|
|
1169
|
+
get: function () {
|
|
1170
|
+
return this._disabledColorItem;
|
|
1171
|
+
},
|
|
1172
|
+
set: function (value) {
|
|
1173
|
+
if (this._disabledColorItem === value) {
|
|
1174
|
+
return;
|
|
1175
|
+
}
|
|
1176
|
+
this._disabledColorItem = value;
|
|
1177
|
+
this._markAsDirty();
|
|
1178
|
+
},
|
|
1179
|
+
enumerable: false,
|
|
1180
|
+
configurable: true
|
|
1181
|
+
});
|
|
1182
|
+
/** @hidden */
|
|
1183
|
+
Control.prototype._getTypeName = function () {
|
|
1184
|
+
return "Control";
|
|
1185
|
+
};
|
|
1186
|
+
/**
|
|
1187
|
+
* Gets the first ascendant in the hierarchy of the given type
|
|
1188
|
+
* @param className defines the required type
|
|
1189
|
+
* @returns the ascendant or null if not found
|
|
1190
|
+
*/
|
|
1191
|
+
Control.prototype.getAscendantOfClass = function (className) {
|
|
1192
|
+
if (!this.parent) {
|
|
1193
|
+
return null;
|
|
1194
|
+
}
|
|
1195
|
+
if (this.parent.getClassName() === className) {
|
|
1196
|
+
return this.parent;
|
|
1197
|
+
}
|
|
1198
|
+
return this.parent.getAscendantOfClass(className);
|
|
1199
|
+
};
|
|
1200
|
+
/**
|
|
1201
|
+
* Mark control element as dirty
|
|
1202
|
+
* @param force force non visible elements to be marked too
|
|
1203
|
+
*/
|
|
1204
|
+
Control.prototype.markAsDirty = function (force) {
|
|
1205
|
+
if (force === void 0) { force = false; }
|
|
1206
|
+
this._markAsDirty(force);
|
|
1207
|
+
};
|
|
1208
|
+
/**
|
|
1209
|
+
* Mark the element and its children as dirty
|
|
1210
|
+
*/
|
|
1211
|
+
Control.prototype.markAllAsDirty = function () {
|
|
1212
|
+
this._markAllAsDirty();
|
|
1213
|
+
};
|
|
1214
|
+
/** @hidden */
|
|
1215
|
+
Control.prototype._resetFontCache = function () {
|
|
1216
|
+
this._fontSet = true;
|
|
1217
|
+
this._markAsDirty();
|
|
1218
|
+
};
|
|
1219
|
+
/**
|
|
1220
|
+
* Determines if a container is an ascendant of the current control
|
|
1221
|
+
* @param container defines the container to look for
|
|
1222
|
+
* @returns true if the container is one of the ascendant of the control
|
|
1223
|
+
*/
|
|
1224
|
+
Control.prototype.isAscendant = function (container) {
|
|
1225
|
+
if (!this.parent) {
|
|
1226
|
+
return false;
|
|
1227
|
+
}
|
|
1228
|
+
if (this.parent === container) {
|
|
1229
|
+
return true;
|
|
1230
|
+
}
|
|
1231
|
+
return this.parent.isAscendant(container);
|
|
1232
|
+
};
|
|
1233
|
+
/**
|
|
1234
|
+
* Gets coordinates in local control space
|
|
1235
|
+
* @param globalCoordinates defines the coordinates to transform
|
|
1236
|
+
* @returns the new coordinates in local space
|
|
1237
|
+
*/
|
|
1238
|
+
Control.prototype.getLocalCoordinates = function (globalCoordinates) {
|
|
1239
|
+
var result = Vector2.Zero();
|
|
1240
|
+
this.getLocalCoordinatesToRef(globalCoordinates, result);
|
|
1241
|
+
return result;
|
|
1242
|
+
};
|
|
1243
|
+
/**
|
|
1244
|
+
* Gets coordinates in local control space
|
|
1245
|
+
* @param globalCoordinates defines the coordinates to transform
|
|
1246
|
+
* @param result defines the target vector2 where to store the result
|
|
1247
|
+
* @returns the current control
|
|
1248
|
+
*/
|
|
1249
|
+
Control.prototype.getLocalCoordinatesToRef = function (globalCoordinates, result) {
|
|
1250
|
+
result.x = globalCoordinates.x - this._currentMeasure.left;
|
|
1251
|
+
result.y = globalCoordinates.y - this._currentMeasure.top;
|
|
1252
|
+
return this;
|
|
1253
|
+
};
|
|
1254
|
+
/**
|
|
1255
|
+
* Gets coordinates in parent local control space
|
|
1256
|
+
* @param globalCoordinates defines the coordinates to transform
|
|
1257
|
+
* @returns the new coordinates in parent local space
|
|
1258
|
+
*/
|
|
1259
|
+
Control.prototype.getParentLocalCoordinates = function (globalCoordinates) {
|
|
1260
|
+
var result = Vector2.Zero();
|
|
1261
|
+
result.x = globalCoordinates.x - this._cachedParentMeasure.left;
|
|
1262
|
+
result.y = globalCoordinates.y - this._cachedParentMeasure.top;
|
|
1263
|
+
return result;
|
|
1264
|
+
};
|
|
1265
|
+
/**
|
|
1266
|
+
* Move the current control to a vector3 position projected onto the screen.
|
|
1267
|
+
* @param position defines the target position
|
|
1268
|
+
* @param scene defines the hosting scene
|
|
1269
|
+
*/
|
|
1270
|
+
Control.prototype.moveToVector3 = function (position, scene) {
|
|
1271
|
+
if (!this._host || this.parent !== this._host._rootContainer) {
|
|
1272
|
+
Tools.Error("Cannot move a control to a vector3 if the control is not at root level");
|
|
1273
|
+
return;
|
|
1274
|
+
}
|
|
1275
|
+
this.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;
|
|
1276
|
+
this.verticalAlignment = Control.VERTICAL_ALIGNMENT_TOP;
|
|
1277
|
+
var globalViewport = this._host._getGlobalViewport();
|
|
1278
|
+
var projectedPosition = Vector3.Project(position, Matrix.Identity(), scene.getTransformMatrix(), globalViewport);
|
|
1279
|
+
this._moveToProjectedPosition(projectedPosition);
|
|
1280
|
+
if (projectedPosition.z < 0 || projectedPosition.z > 1) {
|
|
1281
|
+
this.notRenderable = true;
|
|
1282
|
+
return;
|
|
1283
|
+
}
|
|
1284
|
+
this.notRenderable = false;
|
|
1285
|
+
};
|
|
1286
|
+
/**
|
|
1287
|
+
* Will store all controls that have this control as ascendant in a given array
|
|
1288
|
+
* @param results defines the array where to store the descendants
|
|
1289
|
+
* @param directDescendantsOnly defines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered
|
|
1290
|
+
* @param predicate defines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored
|
|
1291
|
+
*/
|
|
1292
|
+
Control.prototype.getDescendantsToRef = function (results, directDescendantsOnly, predicate) {
|
|
1293
|
+
if (directDescendantsOnly === void 0) { directDescendantsOnly = false; }
|
|
1294
|
+
// Do nothing by default
|
|
1295
|
+
};
|
|
1296
|
+
/**
|
|
1297
|
+
* Will return all controls that have this control as ascendant
|
|
1298
|
+
* @param directDescendantsOnly defines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered
|
|
1299
|
+
* @param predicate defines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored
|
|
1300
|
+
* @return all child controls
|
|
1301
|
+
*/
|
|
1302
|
+
Control.prototype.getDescendants = function (directDescendantsOnly, predicate) {
|
|
1303
|
+
var results = new Array();
|
|
1304
|
+
this.getDescendantsToRef(results, directDescendantsOnly, predicate);
|
|
1305
|
+
return results;
|
|
1306
|
+
};
|
|
1307
|
+
/**
|
|
1308
|
+
* Link current control with a target mesh
|
|
1309
|
+
* @param mesh defines the mesh to link with
|
|
1310
|
+
* @see https://doc.babylonjs.com/how_to/gui#tracking-positions
|
|
1311
|
+
*/
|
|
1312
|
+
Control.prototype.linkWithMesh = function (mesh) {
|
|
1313
|
+
if (!this._host || (this.parent && this.parent !== this._host._rootContainer)) {
|
|
1314
|
+
if (mesh) {
|
|
1315
|
+
Tools.Error("Cannot link a control to a mesh if the control is not at root level");
|
|
1316
|
+
}
|
|
1317
|
+
return;
|
|
1318
|
+
}
|
|
1319
|
+
var index = this._host._linkedControls.indexOf(this);
|
|
1320
|
+
if (index !== -1) {
|
|
1321
|
+
this._linkedMesh = mesh;
|
|
1322
|
+
if (!mesh) {
|
|
1323
|
+
this._host._linkedControls.splice(index, 1);
|
|
1324
|
+
}
|
|
1325
|
+
return;
|
|
1326
|
+
}
|
|
1327
|
+
else if (!mesh) {
|
|
1328
|
+
return;
|
|
1329
|
+
}
|
|
1330
|
+
this.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;
|
|
1331
|
+
this.verticalAlignment = Control.VERTICAL_ALIGNMENT_TOP;
|
|
1332
|
+
this._linkedMesh = mesh;
|
|
1333
|
+
this._host._linkedControls.push(this);
|
|
1334
|
+
};
|
|
1335
|
+
/**
|
|
1336
|
+
* Shorthand function to set the top, right, bottom, and left padding values on the control.
|
|
1337
|
+
* @param { string | number} paddingTop - The value of the top padding.
|
|
1338
|
+
* @param { string | number} paddingRight - The value of the right padding. If omitted, top is used.
|
|
1339
|
+
* @param { string | number} paddingBottom - The value of the bottom padding. If omitted, top is used.
|
|
1340
|
+
* @param { string | number} paddingLeft - The value of the left padding. If omitted, right is used.
|
|
1341
|
+
* @see https://doc.babylonjs.com/how_to/gui#position-and-size
|
|
1342
|
+
*/
|
|
1343
|
+
Control.prototype.setPadding = function (paddingTop, paddingRight, paddingBottom, paddingLeft) {
|
|
1344
|
+
var top = paddingTop;
|
|
1345
|
+
var right = paddingRight !== null && paddingRight !== void 0 ? paddingRight : top;
|
|
1346
|
+
var bottom = paddingBottom !== null && paddingBottom !== void 0 ? paddingBottom : top;
|
|
1347
|
+
var left = paddingLeft !== null && paddingLeft !== void 0 ? paddingLeft : right;
|
|
1348
|
+
this.paddingTop = top;
|
|
1349
|
+
this.paddingRight = right;
|
|
1350
|
+
this.paddingBottom = bottom;
|
|
1351
|
+
this.paddingLeft = left;
|
|
1352
|
+
};
|
|
1353
|
+
/**
|
|
1354
|
+
* Shorthand funtion to set the top, right, bottom, and left padding values in pixels on the control.
|
|
1355
|
+
* @param { number} paddingTop - The value in pixels of the top padding.
|
|
1356
|
+
* @param { number} paddingRight - The value in pixels of the right padding. If omitted, top is used.
|
|
1357
|
+
* @param { number} paddingBottom - The value in pixels of the bottom padding. If omitted, top is used.
|
|
1358
|
+
* @param { number} paddingLeft - The value in pixels of the left padding. If omitted, right is used.
|
|
1359
|
+
* @see https://doc.babylonjs.com/how_to/gui#position-and-size
|
|
1360
|
+
*/
|
|
1361
|
+
Control.prototype.setPaddingInPixels = function (paddingTop, paddingRight, paddingBottom, paddingLeft) {
|
|
1362
|
+
var top = paddingTop;
|
|
1363
|
+
var right = paddingRight !== null && paddingRight !== void 0 ? paddingRight : top;
|
|
1364
|
+
var bottom = paddingBottom !== null && paddingBottom !== void 0 ? paddingBottom : top;
|
|
1365
|
+
var left = paddingLeft !== null && paddingLeft !== void 0 ? paddingLeft : right;
|
|
1366
|
+
this.paddingTopInPixels = top;
|
|
1367
|
+
this.paddingRightInPixels = right;
|
|
1368
|
+
this.paddingBottomInPixels = bottom;
|
|
1369
|
+
this.paddingLeftInPixels = left;
|
|
1370
|
+
};
|
|
1371
|
+
/**
|
|
1372
|
+
* @param projectedPosition
|
|
1373
|
+
* @hidden
|
|
1374
|
+
*/
|
|
1375
|
+
Control.prototype._moveToProjectedPosition = function (projectedPosition) {
|
|
1376
|
+
var _a;
|
|
1377
|
+
var oldLeft = this._left.getValue(this._host);
|
|
1378
|
+
var oldTop = this._top.getValue(this._host);
|
|
1379
|
+
var parentMeasure = (_a = this.parent) === null || _a === void 0 ? void 0 : _a._currentMeasure;
|
|
1380
|
+
if (parentMeasure) {
|
|
1381
|
+
this._processMeasures(parentMeasure, this._host.getContext());
|
|
1382
|
+
}
|
|
1383
|
+
var newLeft = projectedPosition.x + this._linkOffsetX.getValue(this._host) - this._currentMeasure.width / 2;
|
|
1384
|
+
var newTop = projectedPosition.y + this._linkOffsetY.getValue(this._host) - this._currentMeasure.height / 2;
|
|
1385
|
+
if (this._left.ignoreAdaptiveScaling && this._top.ignoreAdaptiveScaling) {
|
|
1386
|
+
if (Math.abs(newLeft - oldLeft) < 0.5) {
|
|
1387
|
+
newLeft = oldLeft;
|
|
1388
|
+
}
|
|
1389
|
+
if (Math.abs(newTop - oldTop) < 0.5) {
|
|
1390
|
+
newTop = oldTop;
|
|
1391
|
+
}
|
|
1392
|
+
}
|
|
1393
|
+
this.left = newLeft + "px";
|
|
1394
|
+
this.top = newTop + "px";
|
|
1395
|
+
this._left.ignoreAdaptiveScaling = true;
|
|
1396
|
+
this._top.ignoreAdaptiveScaling = true;
|
|
1397
|
+
this._markAsDirty();
|
|
1398
|
+
};
|
|
1399
|
+
/**
|
|
1400
|
+
* @param offset
|
|
1401
|
+
* @hidden
|
|
1402
|
+
*/
|
|
1403
|
+
Control.prototype._offsetLeft = function (offset) {
|
|
1404
|
+
this._isDirty = true;
|
|
1405
|
+
this._currentMeasure.left += offset;
|
|
1406
|
+
};
|
|
1407
|
+
/**
|
|
1408
|
+
* @param offset
|
|
1409
|
+
* @hidden
|
|
1410
|
+
*/
|
|
1411
|
+
Control.prototype._offsetTop = function (offset) {
|
|
1412
|
+
this._isDirty = true;
|
|
1413
|
+
this._currentMeasure.top += offset;
|
|
1414
|
+
};
|
|
1415
|
+
/** @hidden */
|
|
1416
|
+
Control.prototype._markMatrixAsDirty = function () {
|
|
1417
|
+
this._isMatrixDirty = true;
|
|
1418
|
+
this._flagDescendantsAsMatrixDirty();
|
|
1419
|
+
};
|
|
1420
|
+
/** @hidden */
|
|
1421
|
+
Control.prototype._flagDescendantsAsMatrixDirty = function () {
|
|
1422
|
+
// No child
|
|
1423
|
+
};
|
|
1424
|
+
/**
|
|
1425
|
+
* @param rect
|
|
1426
|
+
* @param context
|
|
1427
|
+
* @hidden
|
|
1428
|
+
*/
|
|
1429
|
+
Control.prototype._intersectsRect = function (rect, context) {
|
|
1430
|
+
// make sure we are transformed correctly before checking intersections. no-op if nothing is dirty.
|
|
1431
|
+
this._transform(context);
|
|
1432
|
+
if (this._evaluatedMeasure.left >= rect.left + rect.width) {
|
|
1433
|
+
return false;
|
|
1434
|
+
}
|
|
1435
|
+
if (this._evaluatedMeasure.top >= rect.top + rect.height) {
|
|
1436
|
+
return false;
|
|
1437
|
+
}
|
|
1438
|
+
if (this._evaluatedMeasure.left + this._evaluatedMeasure.width <= rect.left) {
|
|
1439
|
+
return false;
|
|
1440
|
+
}
|
|
1441
|
+
if (this._evaluatedMeasure.top + this._evaluatedMeasure.height <= rect.top) {
|
|
1442
|
+
return false;
|
|
1443
|
+
}
|
|
1444
|
+
return true;
|
|
1445
|
+
};
|
|
1446
|
+
/** @hidden */
|
|
1447
|
+
Control.prototype._computeAdditionnalOffsetX = function () {
|
|
1448
|
+
return 0;
|
|
1449
|
+
};
|
|
1450
|
+
/** @hidden */
|
|
1451
|
+
Control.prototype._computeAdditionnalOffsetY = function () {
|
|
1452
|
+
return 0;
|
|
1453
|
+
};
|
|
1454
|
+
/** @hidden */
|
|
1455
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
1456
|
+
Control.prototype.invalidateRect = function () {
|
|
1457
|
+
this._transform();
|
|
1458
|
+
if (this.host && this.host.useInvalidateRectOptimization) {
|
|
1459
|
+
// Rotate by transform to get the measure transformed to global space
|
|
1460
|
+
this._currentMeasure.transformToRef(this._transformMatrix, this._tmpMeasureA);
|
|
1461
|
+
// get the boudning box of the current measure and last frames measure in global space and invalidate it
|
|
1462
|
+
// the previous measure is used to properly clear a control that is scaled down
|
|
1463
|
+
Measure.CombineToRef(this._tmpMeasureA, this._prevCurrentMeasureTransformedIntoGlobalSpace, this._tmpMeasureA);
|
|
1464
|
+
// Expand rect based on shadows
|
|
1465
|
+
var shadowOffsetX = this.shadowOffsetX;
|
|
1466
|
+
var shadowOffsetY = this.shadowOffsetY;
|
|
1467
|
+
var shadowBlur = Math.max(this._previousShadowBlur, this.shadowBlur);
|
|
1468
|
+
var leftShadowOffset = Math.min(Math.min(shadowOffsetX, 0) - shadowBlur * 2, 0);
|
|
1469
|
+
var rightShadowOffset = Math.max(Math.max(shadowOffsetX, 0) + shadowBlur * 2, 0);
|
|
1470
|
+
var topShadowOffset = Math.min(Math.min(shadowOffsetY, 0) - shadowBlur * 2, 0);
|
|
1471
|
+
var bottomShadowOffset = Math.max(Math.max(shadowOffsetY, 0) + shadowBlur * 2, 0);
|
|
1472
|
+
var offsetX = this._computeAdditionnalOffsetX();
|
|
1473
|
+
var offsetY = this._computeAdditionnalOffsetY();
|
|
1474
|
+
this.host.invalidateRect(Math.floor(this._tmpMeasureA.left + leftShadowOffset - offsetX), Math.floor(this._tmpMeasureA.top + topShadowOffset - offsetY), Math.ceil(this._tmpMeasureA.left + this._tmpMeasureA.width + rightShadowOffset + offsetX), Math.ceil(this._tmpMeasureA.top + this._tmpMeasureA.height + bottomShadowOffset + offsetY));
|
|
1475
|
+
}
|
|
1476
|
+
};
|
|
1477
|
+
/**
|
|
1478
|
+
* @param force
|
|
1479
|
+
* @hidden
|
|
1480
|
+
*/
|
|
1481
|
+
Control.prototype._markAsDirty = function (force) {
|
|
1482
|
+
if (force === void 0) { force = false; }
|
|
1483
|
+
if (!this._isVisible && !force) {
|
|
1484
|
+
return;
|
|
1485
|
+
}
|
|
1486
|
+
this._isDirty = true;
|
|
1487
|
+
this._markMatrixAsDirty();
|
|
1488
|
+
// Redraw only this rectangle
|
|
1489
|
+
if (this._host) {
|
|
1490
|
+
this._host.markAsDirty();
|
|
1491
|
+
}
|
|
1492
|
+
};
|
|
1493
|
+
/** @hidden */
|
|
1494
|
+
Control.prototype._markAllAsDirty = function () {
|
|
1495
|
+
this._markAsDirty();
|
|
1496
|
+
if (this._font) {
|
|
1497
|
+
this._prepareFont();
|
|
1498
|
+
}
|
|
1499
|
+
};
|
|
1500
|
+
/**
|
|
1501
|
+
* @param host
|
|
1502
|
+
* @hidden
|
|
1503
|
+
*/
|
|
1504
|
+
Control.prototype._link = function (host) {
|
|
1505
|
+
this._host = host;
|
|
1506
|
+
if (this._host) {
|
|
1507
|
+
this.uniqueId = this._host.getScene().getUniqueId();
|
|
1508
|
+
}
|
|
1509
|
+
};
|
|
1510
|
+
/**
|
|
1511
|
+
* @param context
|
|
1512
|
+
* @hidden
|
|
1513
|
+
*/
|
|
1514
|
+
Control.prototype._transform = function (context) {
|
|
1515
|
+
if (!this._isMatrixDirty && this._scaleX === 1 && this._scaleY === 1 && this._rotation === 0) {
|
|
1516
|
+
return;
|
|
1517
|
+
}
|
|
1518
|
+
// postTranslate
|
|
1519
|
+
var offsetX = this._currentMeasure.width * this._transformCenterX + this._currentMeasure.left;
|
|
1520
|
+
var offsetY = this._currentMeasure.height * this._transformCenterY + this._currentMeasure.top;
|
|
1521
|
+
if (context) {
|
|
1522
|
+
context.translate(offsetX, offsetY);
|
|
1523
|
+
// rotate
|
|
1524
|
+
context.rotate(this._rotation);
|
|
1525
|
+
// scale
|
|
1526
|
+
context.scale(this._scaleX, this._scaleY);
|
|
1527
|
+
// preTranslate
|
|
1528
|
+
context.translate(-offsetX, -offsetY);
|
|
1529
|
+
}
|
|
1530
|
+
// Need to update matrices?
|
|
1531
|
+
if (this._isMatrixDirty || this._cachedOffsetX !== offsetX || this._cachedOffsetY !== offsetY) {
|
|
1532
|
+
this._cachedOffsetX = offsetX;
|
|
1533
|
+
this._cachedOffsetY = offsetY;
|
|
1534
|
+
this._isMatrixDirty = false;
|
|
1535
|
+
this._flagDescendantsAsMatrixDirty();
|
|
1536
|
+
Matrix2D.ComposeToRef(-offsetX, -offsetY, this._rotation, this._scaleX, this._scaleY, this.parent ? this.parent._transformMatrix : null, this._transformMatrix);
|
|
1537
|
+
this._transformMatrix.invertToRef(this._invertTransformMatrix);
|
|
1538
|
+
this._currentMeasure.transformToRef(this._transformMatrix, this._evaluatedMeasure);
|
|
1539
|
+
}
|
|
1540
|
+
};
|
|
1541
|
+
/**
|
|
1542
|
+
* @param context
|
|
1543
|
+
* @hidden
|
|
1544
|
+
*/
|
|
1545
|
+
Control.prototype._renderHighlight = function (context) {
|
|
1546
|
+
if (!this.isHighlighted) {
|
|
1547
|
+
return;
|
|
1548
|
+
}
|
|
1549
|
+
context.save();
|
|
1550
|
+
context.strokeStyle = this._highlightColor;
|
|
1551
|
+
context.lineWidth = this._highlightLineWidth;
|
|
1552
|
+
this._renderHighlightSpecific(context);
|
|
1553
|
+
context.restore();
|
|
1554
|
+
};
|
|
1555
|
+
/**
|
|
1556
|
+
* @param context
|
|
1557
|
+
* @hidden
|
|
1558
|
+
*/
|
|
1559
|
+
Control.prototype._renderHighlightSpecific = function (context) {
|
|
1560
|
+
context.strokeRect(this._currentMeasure.left, this._currentMeasure.top, this._currentMeasure.width, this._currentMeasure.height);
|
|
1561
|
+
};
|
|
1562
|
+
/**
|
|
1563
|
+
* @param context
|
|
1564
|
+
* @hidden
|
|
1565
|
+
*/
|
|
1566
|
+
Control.prototype._applyStates = function (context) {
|
|
1567
|
+
if (this._isFontSizeInPercentage) {
|
|
1568
|
+
this._fontSet = true;
|
|
1569
|
+
}
|
|
1570
|
+
if (this._host && this._host.useSmallestIdeal && !this._font) {
|
|
1571
|
+
this._fontSet = true;
|
|
1572
|
+
}
|
|
1573
|
+
if (this._fontSet) {
|
|
1574
|
+
this._prepareFont();
|
|
1575
|
+
this._fontSet = false;
|
|
1576
|
+
}
|
|
1577
|
+
if (this._font) {
|
|
1578
|
+
context.font = this._font;
|
|
1579
|
+
}
|
|
1580
|
+
if (this._color) {
|
|
1581
|
+
context.fillStyle = this._color;
|
|
1582
|
+
}
|
|
1583
|
+
if (Control.AllowAlphaInheritance) {
|
|
1584
|
+
context.globalAlpha *= this._alpha;
|
|
1585
|
+
}
|
|
1586
|
+
else if (this._alphaSet) {
|
|
1587
|
+
context.globalAlpha = this.parent && !this.parent.renderToIntermediateTexture ? this.parent.alpha * this._alpha : this._alpha;
|
|
1588
|
+
}
|
|
1589
|
+
};
|
|
1590
|
+
/**
|
|
1591
|
+
* @param parentMeasure
|
|
1592
|
+
* @param context
|
|
1593
|
+
* @hidden
|
|
1594
|
+
*/
|
|
1595
|
+
Control.prototype._layout = function (parentMeasure, context) {
|
|
1596
|
+
if (!this.isDirty && (!this.isVisible || this.notRenderable)) {
|
|
1597
|
+
return false;
|
|
1598
|
+
}
|
|
1599
|
+
if (this._isDirty || !this._cachedParentMeasure.isEqualsTo(parentMeasure)) {
|
|
1600
|
+
this.host._numLayoutCalls++;
|
|
1601
|
+
this._currentMeasure.addAndTransformToRef(this._transformMatrix, -this._paddingLeftInPixels | 0, -this._paddingTopInPixels | 0, this._paddingRightInPixels | 0, this._paddingBottomInPixels | 0, this._prevCurrentMeasureTransformedIntoGlobalSpace);
|
|
1602
|
+
context.save();
|
|
1603
|
+
this._applyStates(context);
|
|
1604
|
+
var rebuildCount = 0;
|
|
1605
|
+
do {
|
|
1606
|
+
this._rebuildLayout = false;
|
|
1607
|
+
this._processMeasures(parentMeasure, context);
|
|
1608
|
+
rebuildCount++;
|
|
1609
|
+
} while (this._rebuildLayout && rebuildCount < 3);
|
|
1610
|
+
if (rebuildCount >= 3) {
|
|
1611
|
+
Logger.Error("Layout cycle detected in GUI (Control name=".concat(this.name, ", uniqueId=").concat(this.uniqueId, ")"));
|
|
1612
|
+
}
|
|
1613
|
+
context.restore();
|
|
1614
|
+
this.invalidateRect();
|
|
1615
|
+
this._evaluateClippingState(parentMeasure);
|
|
1616
|
+
}
|
|
1617
|
+
this._wasDirty = this._isDirty;
|
|
1618
|
+
this._isDirty = false;
|
|
1619
|
+
return true;
|
|
1620
|
+
};
|
|
1621
|
+
/**
|
|
1622
|
+
* @param parentMeasure
|
|
1623
|
+
* @param context
|
|
1624
|
+
* @hidden
|
|
1625
|
+
*/
|
|
1626
|
+
Control.prototype._processMeasures = function (parentMeasure, context) {
|
|
1627
|
+
this._tempPaddingMeasure.copyFrom(parentMeasure);
|
|
1628
|
+
// Apply padding if in correct mode
|
|
1629
|
+
if (this.parent && this.parent.descendantsOnlyPadding) {
|
|
1630
|
+
this._tempPaddingMeasure.left += this.parent.paddingLeftInPixels;
|
|
1631
|
+
this._tempPaddingMeasure.top += this.parent.paddingTopInPixels;
|
|
1632
|
+
this._tempPaddingMeasure.width -= this.parent.paddingLeftInPixels + this.parent.paddingRightInPixels;
|
|
1633
|
+
this._tempPaddingMeasure.height -= this.parent.paddingTopInPixels + this.parent.paddingBottomInPixels;
|
|
1634
|
+
}
|
|
1635
|
+
this._currentMeasure.copyFrom(this._tempPaddingMeasure);
|
|
1636
|
+
// Let children take some pre-measurement actions
|
|
1637
|
+
this._preMeasure(this._tempPaddingMeasure, context);
|
|
1638
|
+
this._measure();
|
|
1639
|
+
this._computeAlignment(this._tempPaddingMeasure, context);
|
|
1640
|
+
// Convert to int values
|
|
1641
|
+
this._currentMeasure.left = this._currentMeasure.left | 0;
|
|
1642
|
+
this._currentMeasure.top = this._currentMeasure.top | 0;
|
|
1643
|
+
this._currentMeasure.width = this._currentMeasure.width | 0;
|
|
1644
|
+
this._currentMeasure.height = this._currentMeasure.height | 0;
|
|
1645
|
+
// Let children add more features
|
|
1646
|
+
this._additionalProcessing(this._tempPaddingMeasure, context);
|
|
1647
|
+
this._cachedParentMeasure.copyFrom(this._tempPaddingMeasure);
|
|
1648
|
+
this._currentMeasure.transformToRef(this._transformMatrix, this._evaluatedMeasure);
|
|
1649
|
+
if (this.onDirtyObservable.hasObservers()) {
|
|
1650
|
+
this.onDirtyObservable.notifyObservers(this);
|
|
1651
|
+
}
|
|
1652
|
+
};
|
|
1653
|
+
Control.prototype._evaluateClippingState = function (parentMeasure) {
|
|
1654
|
+
this._currentMeasure.transformToRef(this._transformMatrix, this._evaluatedMeasure);
|
|
1655
|
+
if (this.parent && this.parent.clipChildren) {
|
|
1656
|
+
parentMeasure.transformToRef(this.parent._transformMatrix, this._evaluatedParentMeasure);
|
|
1657
|
+
// Early clip
|
|
1658
|
+
if (this._evaluatedMeasure.left > this._evaluatedParentMeasure.left + this._evaluatedParentMeasure.width) {
|
|
1659
|
+
this._isClipped = true;
|
|
1660
|
+
return;
|
|
1661
|
+
}
|
|
1662
|
+
if (this._evaluatedMeasure.left + this._evaluatedMeasure.width < this._evaluatedParentMeasure.left) {
|
|
1663
|
+
this._isClipped = true;
|
|
1664
|
+
return;
|
|
1665
|
+
}
|
|
1666
|
+
if (this._evaluatedMeasure.top > this._evaluatedParentMeasure.top + this._evaluatedParentMeasure.height) {
|
|
1667
|
+
this._isClipped = true;
|
|
1668
|
+
return;
|
|
1669
|
+
}
|
|
1670
|
+
if (this._evaluatedMeasure.top + this._evaluatedMeasure.height < this._evaluatedParentMeasure.top) {
|
|
1671
|
+
this._isClipped = true;
|
|
1672
|
+
return;
|
|
1673
|
+
}
|
|
1674
|
+
}
|
|
1675
|
+
this._isClipped = false;
|
|
1676
|
+
};
|
|
1677
|
+
/** @hidden */
|
|
1678
|
+
Control.prototype._measure = function () {
|
|
1679
|
+
// Width / Height
|
|
1680
|
+
if (this._width.isPixel) {
|
|
1681
|
+
this._currentMeasure.width = this._width.getValue(this._host);
|
|
1682
|
+
}
|
|
1683
|
+
else {
|
|
1684
|
+
this._currentMeasure.width *= this._width.getValue(this._host);
|
|
1685
|
+
}
|
|
1686
|
+
if (this._height.isPixel) {
|
|
1687
|
+
this._currentMeasure.height = this._height.getValue(this._host);
|
|
1688
|
+
}
|
|
1689
|
+
else {
|
|
1690
|
+
this._currentMeasure.height *= this._height.getValue(this._host);
|
|
1691
|
+
}
|
|
1692
|
+
if (this.fixedRatio !== 0) {
|
|
1693
|
+
if (this._fixedRatioMasterIsWidth) {
|
|
1694
|
+
this._currentMeasure.height = this._currentMeasure.width * this.fixedRatio;
|
|
1695
|
+
}
|
|
1696
|
+
else {
|
|
1697
|
+
this._currentMeasure.width = this._currentMeasure.height * this.fixedRatio;
|
|
1698
|
+
}
|
|
1699
|
+
}
|
|
1700
|
+
};
|
|
1701
|
+
/**
|
|
1702
|
+
* @param parentMeasure
|
|
1703
|
+
* @param context
|
|
1704
|
+
* @hidden
|
|
1705
|
+
*/
|
|
1706
|
+
Control.prototype._computeAlignment = function (parentMeasure, context) {
|
|
1707
|
+
var width = this._currentMeasure.width;
|
|
1708
|
+
var height = this._currentMeasure.height;
|
|
1709
|
+
var parentWidth = parentMeasure.width;
|
|
1710
|
+
var parentHeight = parentMeasure.height;
|
|
1711
|
+
// Left / top
|
|
1712
|
+
var x = 0;
|
|
1713
|
+
var y = 0;
|
|
1714
|
+
switch (this.horizontalAlignment) {
|
|
1715
|
+
case Control.HORIZONTAL_ALIGNMENT_LEFT:
|
|
1716
|
+
x = 0;
|
|
1717
|
+
break;
|
|
1718
|
+
case Control.HORIZONTAL_ALIGNMENT_RIGHT:
|
|
1719
|
+
x = parentWidth - width;
|
|
1720
|
+
break;
|
|
1721
|
+
case Control.HORIZONTAL_ALIGNMENT_CENTER:
|
|
1722
|
+
x = (parentWidth - width) / 2;
|
|
1723
|
+
break;
|
|
1724
|
+
}
|
|
1725
|
+
switch (this.verticalAlignment) {
|
|
1726
|
+
case Control.VERTICAL_ALIGNMENT_TOP:
|
|
1727
|
+
y = 0;
|
|
1728
|
+
break;
|
|
1729
|
+
case Control.VERTICAL_ALIGNMENT_BOTTOM:
|
|
1730
|
+
y = parentHeight - height;
|
|
1731
|
+
break;
|
|
1732
|
+
case Control.VERTICAL_ALIGNMENT_CENTER:
|
|
1733
|
+
y = (parentHeight - height) / 2;
|
|
1734
|
+
break;
|
|
1735
|
+
}
|
|
1736
|
+
if (!this.descendantsOnlyPadding) {
|
|
1737
|
+
if (this._paddingLeft.isPixel) {
|
|
1738
|
+
this._currentMeasure.left += this._paddingLeft.getValue(this._host);
|
|
1739
|
+
this._currentMeasure.width -= this._paddingLeft.getValue(this._host);
|
|
1740
|
+
}
|
|
1741
|
+
else {
|
|
1742
|
+
this._currentMeasure.left += parentWidth * this._paddingLeft.getValue(this._host);
|
|
1743
|
+
this._currentMeasure.width -= parentWidth * this._paddingLeft.getValue(this._host);
|
|
1744
|
+
}
|
|
1745
|
+
if (this._paddingRight.isPixel) {
|
|
1746
|
+
this._currentMeasure.width -= this._paddingRight.getValue(this._host);
|
|
1747
|
+
}
|
|
1748
|
+
else {
|
|
1749
|
+
this._currentMeasure.width -= parentWidth * this._paddingRight.getValue(this._host);
|
|
1750
|
+
}
|
|
1751
|
+
if (this._paddingTop.isPixel) {
|
|
1752
|
+
this._currentMeasure.top += this._paddingTop.getValue(this._host);
|
|
1753
|
+
this._currentMeasure.height -= this._paddingTop.getValue(this._host);
|
|
1754
|
+
}
|
|
1755
|
+
else {
|
|
1756
|
+
this._currentMeasure.top += parentHeight * this._paddingTop.getValue(this._host);
|
|
1757
|
+
this._currentMeasure.height -= parentHeight * this._paddingTop.getValue(this._host);
|
|
1758
|
+
}
|
|
1759
|
+
if (this._paddingBottom.isPixel) {
|
|
1760
|
+
this._currentMeasure.height -= this._paddingBottom.getValue(this._host);
|
|
1761
|
+
}
|
|
1762
|
+
else {
|
|
1763
|
+
this._currentMeasure.height -= parentHeight * this._paddingBottom.getValue(this._host);
|
|
1764
|
+
}
|
|
1765
|
+
}
|
|
1766
|
+
if (this._left.isPixel) {
|
|
1767
|
+
this._currentMeasure.left += this._left.getValue(this._host);
|
|
1768
|
+
}
|
|
1769
|
+
else {
|
|
1770
|
+
this._currentMeasure.left += parentWidth * this._left.getValue(this._host);
|
|
1771
|
+
}
|
|
1772
|
+
if (this._top.isPixel) {
|
|
1773
|
+
this._currentMeasure.top += this._top.getValue(this._host);
|
|
1774
|
+
}
|
|
1775
|
+
else {
|
|
1776
|
+
this._currentMeasure.top += parentHeight * this._top.getValue(this._host);
|
|
1777
|
+
}
|
|
1778
|
+
this._currentMeasure.left += x;
|
|
1779
|
+
this._currentMeasure.top += y;
|
|
1780
|
+
};
|
|
1781
|
+
/**
|
|
1782
|
+
* @param parentMeasure
|
|
1783
|
+
* @param context
|
|
1784
|
+
* @hidden
|
|
1785
|
+
*/
|
|
1786
|
+
Control.prototype._preMeasure = function (parentMeasure, context) {
|
|
1787
|
+
// Do nothing
|
|
1788
|
+
};
|
|
1789
|
+
/**
|
|
1790
|
+
* @param parentMeasure
|
|
1791
|
+
* @param context
|
|
1792
|
+
* @hidden
|
|
1793
|
+
*/
|
|
1794
|
+
Control.prototype._additionalProcessing = function (parentMeasure, context) {
|
|
1795
|
+
// Do nothing
|
|
1796
|
+
};
|
|
1797
|
+
/**
|
|
1798
|
+
* @param context
|
|
1799
|
+
* @hidden
|
|
1800
|
+
*/
|
|
1801
|
+
Control.prototype._clipForChildren = function (context) {
|
|
1802
|
+
// DO nothing
|
|
1803
|
+
};
|
|
1804
|
+
Control.prototype._clip = function (context, invalidatedRectangle) {
|
|
1805
|
+
context.beginPath();
|
|
1806
|
+
Control._ClipMeasure.copyFrom(this._currentMeasure);
|
|
1807
|
+
if (invalidatedRectangle) {
|
|
1808
|
+
// Rotate the invalidated rect into the control's space
|
|
1809
|
+
invalidatedRectangle.transformToRef(this._invertTransformMatrix, this._tmpMeasureA);
|
|
1810
|
+
// Get the intersection of the rect in context space and the current context
|
|
1811
|
+
var intersection = new Measure(0, 0, 0, 0);
|
|
1812
|
+
intersection.left = Math.max(this._tmpMeasureA.left, this._currentMeasure.left);
|
|
1813
|
+
intersection.top = Math.max(this._tmpMeasureA.top, this._currentMeasure.top);
|
|
1814
|
+
intersection.width = Math.min(this._tmpMeasureA.left + this._tmpMeasureA.width, this._currentMeasure.left + this._currentMeasure.width) - intersection.left;
|
|
1815
|
+
intersection.height = Math.min(this._tmpMeasureA.top + this._tmpMeasureA.height, this._currentMeasure.top + this._currentMeasure.height) - intersection.top;
|
|
1816
|
+
Control._ClipMeasure.copyFrom(intersection);
|
|
1817
|
+
}
|
|
1818
|
+
if (this.shadowBlur || this.shadowOffsetX || this.shadowOffsetY) {
|
|
1819
|
+
var shadowOffsetX = this.shadowOffsetX;
|
|
1820
|
+
var shadowOffsetY = this.shadowOffsetY;
|
|
1821
|
+
var shadowBlur = this.shadowBlur;
|
|
1822
|
+
var leftShadowOffset = Math.min(Math.min(shadowOffsetX, 0) - shadowBlur * 2, 0);
|
|
1823
|
+
var rightShadowOffset = Math.max(Math.max(shadowOffsetX, 0) + shadowBlur * 2, 0);
|
|
1824
|
+
var topShadowOffset = Math.min(Math.min(shadowOffsetY, 0) - shadowBlur * 2, 0);
|
|
1825
|
+
var bottomShadowOffset = Math.max(Math.max(shadowOffsetY, 0) + shadowBlur * 2, 0);
|
|
1826
|
+
context.rect(Control._ClipMeasure.left + leftShadowOffset, Control._ClipMeasure.top + topShadowOffset, Control._ClipMeasure.width + rightShadowOffset - leftShadowOffset, Control._ClipMeasure.height + bottomShadowOffset - topShadowOffset);
|
|
1827
|
+
}
|
|
1828
|
+
else {
|
|
1829
|
+
context.rect(Control._ClipMeasure.left, Control._ClipMeasure.top, Control._ClipMeasure.width, Control._ClipMeasure.height);
|
|
1830
|
+
}
|
|
1831
|
+
context.clip();
|
|
1832
|
+
};
|
|
1833
|
+
/**
|
|
1834
|
+
* @param context
|
|
1835
|
+
* @param invalidatedRectangle
|
|
1836
|
+
* @hidden
|
|
1837
|
+
*/
|
|
1838
|
+
Control.prototype._render = function (context, invalidatedRectangle) {
|
|
1839
|
+
if (!this.isVisible || this.notRenderable || this._isClipped) {
|
|
1840
|
+
this._isDirty = false;
|
|
1841
|
+
return false;
|
|
1842
|
+
}
|
|
1843
|
+
this.host._numRenderCalls++;
|
|
1844
|
+
context.save();
|
|
1845
|
+
this._applyStates(context);
|
|
1846
|
+
// Transform
|
|
1847
|
+
this._transform(context);
|
|
1848
|
+
// Clip
|
|
1849
|
+
if (this.clipContent) {
|
|
1850
|
+
this._clip(context, invalidatedRectangle);
|
|
1851
|
+
}
|
|
1852
|
+
if (this.onBeforeDrawObservable.hasObservers()) {
|
|
1853
|
+
this.onBeforeDrawObservable.notifyObservers(this);
|
|
1854
|
+
}
|
|
1855
|
+
if (this.useBitmapCache && !this._wasDirty && this._cacheData) {
|
|
1856
|
+
context.putImageData(this._cacheData, this._currentMeasure.left, this._currentMeasure.top);
|
|
1857
|
+
}
|
|
1858
|
+
else {
|
|
1859
|
+
this._draw(context, invalidatedRectangle);
|
|
1860
|
+
}
|
|
1861
|
+
if (this.useBitmapCache && this._wasDirty) {
|
|
1862
|
+
this._cacheData = context.getImageData(this._currentMeasure.left, this._currentMeasure.top, this._currentMeasure.width, this._currentMeasure.height);
|
|
1863
|
+
}
|
|
1864
|
+
this._renderHighlight(context);
|
|
1865
|
+
if (this.onAfterDrawObservable.hasObservers()) {
|
|
1866
|
+
this.onAfterDrawObservable.notifyObservers(this);
|
|
1867
|
+
}
|
|
1868
|
+
context.restore();
|
|
1869
|
+
return true;
|
|
1870
|
+
};
|
|
1871
|
+
/**
|
|
1872
|
+
* @param context
|
|
1873
|
+
* @param invalidatedRectangle
|
|
1874
|
+
* @hidden
|
|
1875
|
+
*/
|
|
1876
|
+
Control.prototype._draw = function (context, invalidatedRectangle) {
|
|
1877
|
+
// Do nothing
|
|
1878
|
+
};
|
|
1879
|
+
/**
|
|
1880
|
+
* Tests if a given coordinates belong to the current control
|
|
1881
|
+
* @param x defines x coordinate to test
|
|
1882
|
+
* @param y defines y coordinate to test
|
|
1883
|
+
* @returns true if the coordinates are inside the control
|
|
1884
|
+
*/
|
|
1885
|
+
Control.prototype.contains = function (x, y) {
|
|
1886
|
+
// Invert transform
|
|
1887
|
+
this._invertTransformMatrix.transformCoordinates(x, y, this._transformedPosition);
|
|
1888
|
+
x = this._transformedPosition.x;
|
|
1889
|
+
y = this._transformedPosition.y;
|
|
1890
|
+
// Check
|
|
1891
|
+
if (x < this._currentMeasure.left) {
|
|
1892
|
+
return false;
|
|
1893
|
+
}
|
|
1894
|
+
if (x > this._currentMeasure.left + this._currentMeasure.width) {
|
|
1895
|
+
return false;
|
|
1896
|
+
}
|
|
1897
|
+
if (y < this._currentMeasure.top) {
|
|
1898
|
+
return false;
|
|
1899
|
+
}
|
|
1900
|
+
if (y > this._currentMeasure.top + this._currentMeasure.height) {
|
|
1901
|
+
return false;
|
|
1902
|
+
}
|
|
1903
|
+
if (this.isPointerBlocker) {
|
|
1904
|
+
this._host._shouldBlockPointer = true;
|
|
1905
|
+
}
|
|
1906
|
+
return true;
|
|
1907
|
+
};
|
|
1908
|
+
/**
|
|
1909
|
+
* @param x
|
|
1910
|
+
* @param y
|
|
1911
|
+
* @param pi
|
|
1912
|
+
* @param type
|
|
1913
|
+
* @param pointerId
|
|
1914
|
+
* @param buttonIndex
|
|
1915
|
+
* @param deltaX
|
|
1916
|
+
* @param deltaY
|
|
1917
|
+
* @hidden
|
|
1918
|
+
*/
|
|
1919
|
+
Control.prototype._processPicking = function (x, y, pi, type, pointerId, buttonIndex, deltaX, deltaY) {
|
|
1920
|
+
if (!this._isEnabled) {
|
|
1921
|
+
return false;
|
|
1922
|
+
}
|
|
1923
|
+
if (!this.isHitTestVisible || !this.isVisible || this._doNotRender) {
|
|
1924
|
+
return false;
|
|
1925
|
+
}
|
|
1926
|
+
if (!this.contains(x, y)) {
|
|
1927
|
+
return false;
|
|
1928
|
+
}
|
|
1929
|
+
this._processObservables(type, x, y, pi, pointerId, buttonIndex, deltaX, deltaY);
|
|
1930
|
+
return true;
|
|
1931
|
+
};
|
|
1932
|
+
/**
|
|
1933
|
+
* @param target
|
|
1934
|
+
* @param coordinates
|
|
1935
|
+
* @param pointerId
|
|
1936
|
+
* @param pi
|
|
1937
|
+
* @hidden
|
|
1938
|
+
*/
|
|
1939
|
+
Control.prototype._onPointerMove = function (target, coordinates, pointerId, pi) {
|
|
1940
|
+
var canNotify = this.onPointerMoveObservable.notifyObservers(coordinates, -1, target, this, pi);
|
|
1941
|
+
if (canNotify && this.parent != null) {
|
|
1942
|
+
this.parent._onPointerMove(target, coordinates, pointerId, pi);
|
|
1943
|
+
}
|
|
1944
|
+
};
|
|
1945
|
+
/**
|
|
1946
|
+
* @param target
|
|
1947
|
+
* @param pi
|
|
1948
|
+
* @hidden
|
|
1949
|
+
*/
|
|
1950
|
+
Control.prototype._onPointerEnter = function (target, pi) {
|
|
1951
|
+
if (!this._isEnabled) {
|
|
1952
|
+
return false;
|
|
1953
|
+
}
|
|
1954
|
+
if (this._enterCount > 0) {
|
|
1955
|
+
return false;
|
|
1956
|
+
}
|
|
1957
|
+
if (this._enterCount === -1) {
|
|
1958
|
+
// -1 is for touch input, we are now sure we are with a mouse or pencil
|
|
1959
|
+
this._enterCount = 0;
|
|
1960
|
+
}
|
|
1961
|
+
this._enterCount++;
|
|
1962
|
+
var canNotify = this.onPointerEnterObservable.notifyObservers(this, -1, target, this, pi);
|
|
1963
|
+
if (canNotify && this.parent != null) {
|
|
1964
|
+
this.parent._onPointerEnter(target, pi);
|
|
1965
|
+
}
|
|
1966
|
+
return true;
|
|
1967
|
+
};
|
|
1968
|
+
/**
|
|
1969
|
+
* @param target
|
|
1970
|
+
* @param pi
|
|
1971
|
+
* @param force
|
|
1972
|
+
* @hidden
|
|
1973
|
+
*/
|
|
1974
|
+
Control.prototype._onPointerOut = function (target, pi, force) {
|
|
1975
|
+
if (force === void 0) { force = false; }
|
|
1976
|
+
if (!force && (!this._isEnabled || target === this)) {
|
|
1977
|
+
return;
|
|
1978
|
+
}
|
|
1979
|
+
this._enterCount = 0;
|
|
1980
|
+
var canNotify = true;
|
|
1981
|
+
if (!target.isAscendant(this)) {
|
|
1982
|
+
canNotify = this.onPointerOutObservable.notifyObservers(this, -1, target, this, pi);
|
|
1983
|
+
}
|
|
1984
|
+
if (canNotify && this.parent != null) {
|
|
1985
|
+
this.parent._onPointerOut(target, pi, force);
|
|
1986
|
+
}
|
|
1987
|
+
};
|
|
1988
|
+
/**
|
|
1989
|
+
* @param target
|
|
1990
|
+
* @param coordinates
|
|
1991
|
+
* @param pointerId
|
|
1992
|
+
* @param buttonIndex
|
|
1993
|
+
* @param pi
|
|
1994
|
+
* @hidden
|
|
1995
|
+
*/
|
|
1996
|
+
Control.prototype._onPointerDown = function (target, coordinates, pointerId, buttonIndex, pi) {
|
|
1997
|
+
// Prevent pointerout to lose control context.
|
|
1998
|
+
// Event redundancy is checked inside the function.
|
|
1999
|
+
this._onPointerEnter(this, pi);
|
|
2000
|
+
if (this._downCount !== 0) {
|
|
2001
|
+
return false;
|
|
2002
|
+
}
|
|
2003
|
+
this._downCount++;
|
|
2004
|
+
this._downPointerIds[pointerId] = true;
|
|
2005
|
+
var canNotify = this.onPointerDownObservable.notifyObservers(new Vector2WithInfo(coordinates, buttonIndex), -1, target, this, pi);
|
|
2006
|
+
if (canNotify && this.parent != null) {
|
|
2007
|
+
this.parent._onPointerDown(target, coordinates, pointerId, buttonIndex, pi);
|
|
2008
|
+
}
|
|
2009
|
+
return true;
|
|
2010
|
+
};
|
|
2011
|
+
/**
|
|
2012
|
+
* @param target
|
|
2013
|
+
* @param coordinates
|
|
2014
|
+
* @param pointerId
|
|
2015
|
+
* @param buttonIndex
|
|
2016
|
+
* @param notifyClick
|
|
2017
|
+
* @param pi
|
|
2018
|
+
* @hidden
|
|
2019
|
+
*/
|
|
2020
|
+
Control.prototype._onPointerUp = function (target, coordinates, pointerId, buttonIndex, notifyClick, pi) {
|
|
2021
|
+
if (!this._isEnabled) {
|
|
2022
|
+
return;
|
|
2023
|
+
}
|
|
2024
|
+
this._downCount = 0;
|
|
2025
|
+
delete this._downPointerIds[pointerId];
|
|
2026
|
+
var canNotifyClick = notifyClick;
|
|
2027
|
+
if (notifyClick && (this._enterCount > 0 || this._enterCount === -1)) {
|
|
2028
|
+
canNotifyClick = this.onPointerClickObservable.notifyObservers(new Vector2WithInfo(coordinates, buttonIndex), -1, target, this, pi);
|
|
2029
|
+
}
|
|
2030
|
+
var canNotify = this.onPointerUpObservable.notifyObservers(new Vector2WithInfo(coordinates, buttonIndex), -1, target, this, pi);
|
|
2031
|
+
if (canNotify && this.parent != null) {
|
|
2032
|
+
this.parent._onPointerUp(target, coordinates, pointerId, buttonIndex, canNotifyClick, pi);
|
|
2033
|
+
}
|
|
2034
|
+
};
|
|
2035
|
+
/**
|
|
2036
|
+
* @param pointerId
|
|
2037
|
+
* @hidden
|
|
2038
|
+
*/
|
|
2039
|
+
Control.prototype._forcePointerUp = function (pointerId) {
|
|
2040
|
+
if (pointerId === void 0) { pointerId = null; }
|
|
2041
|
+
if (pointerId !== null) {
|
|
2042
|
+
this._onPointerUp(this, Vector2.Zero(), pointerId, 0, true);
|
|
2043
|
+
}
|
|
2044
|
+
else {
|
|
2045
|
+
for (var key in this._downPointerIds) {
|
|
2046
|
+
this._onPointerUp(this, Vector2.Zero(), +key, 0, true);
|
|
2047
|
+
}
|
|
2048
|
+
}
|
|
2049
|
+
};
|
|
2050
|
+
/**
|
|
2051
|
+
* @param deltaX
|
|
2052
|
+
* @param deltaY
|
|
2053
|
+
* @hidden
|
|
2054
|
+
*/
|
|
2055
|
+
Control.prototype._onWheelScroll = function (deltaX, deltaY) {
|
|
2056
|
+
if (!this._isEnabled) {
|
|
2057
|
+
return;
|
|
2058
|
+
}
|
|
2059
|
+
var canNotify = this.onWheelObservable.notifyObservers(new Vector2(deltaX, deltaY));
|
|
2060
|
+
if (canNotify && this.parent != null) {
|
|
2061
|
+
this.parent._onWheelScroll(deltaX, deltaY);
|
|
2062
|
+
}
|
|
2063
|
+
};
|
|
2064
|
+
/** @hidden */
|
|
2065
|
+
Control.prototype._onCanvasBlur = function () { };
|
|
2066
|
+
/**
|
|
2067
|
+
* @param type
|
|
2068
|
+
* @param x
|
|
2069
|
+
* @param y
|
|
2070
|
+
* @param pi
|
|
2071
|
+
* @param pointerId
|
|
2072
|
+
* @param buttonIndex
|
|
2073
|
+
* @param deltaX
|
|
2074
|
+
* @param deltaY
|
|
2075
|
+
* @hidden
|
|
2076
|
+
*/
|
|
2077
|
+
Control.prototype._processObservables = function (type, x, y, pi, pointerId, buttonIndex, deltaX, deltaY) {
|
|
2078
|
+
if (!this._isEnabled) {
|
|
2079
|
+
return false;
|
|
2080
|
+
}
|
|
2081
|
+
this._dummyVector2.copyFromFloats(x, y);
|
|
2082
|
+
if (type === PointerEventTypes.POINTERMOVE) {
|
|
2083
|
+
this._onPointerMove(this, this._dummyVector2, pointerId, pi);
|
|
2084
|
+
var previousControlOver = this._host._lastControlOver[pointerId];
|
|
2085
|
+
if (previousControlOver && previousControlOver !== this) {
|
|
2086
|
+
previousControlOver._onPointerOut(this, pi);
|
|
2087
|
+
}
|
|
2088
|
+
if (previousControlOver !== this) {
|
|
2089
|
+
this._onPointerEnter(this, pi);
|
|
2090
|
+
}
|
|
2091
|
+
this._host._lastControlOver[pointerId] = this;
|
|
2092
|
+
return true;
|
|
2093
|
+
}
|
|
2094
|
+
if (type === PointerEventTypes.POINTERDOWN) {
|
|
2095
|
+
this._onPointerDown(this, this._dummyVector2, pointerId, buttonIndex, pi);
|
|
2096
|
+
this._host._registerLastControlDown(this, pointerId);
|
|
2097
|
+
this._host._lastPickedControl = this;
|
|
2098
|
+
return true;
|
|
2099
|
+
}
|
|
2100
|
+
if (type === PointerEventTypes.POINTERUP) {
|
|
2101
|
+
if (this._host._lastControlDown[pointerId]) {
|
|
2102
|
+
this._host._lastControlDown[pointerId]._onPointerUp(this, this._dummyVector2, pointerId, buttonIndex, true, pi);
|
|
2103
|
+
}
|
|
2104
|
+
delete this._host._lastControlDown[pointerId];
|
|
2105
|
+
return true;
|
|
2106
|
+
}
|
|
2107
|
+
if (type === PointerEventTypes.POINTERWHEEL) {
|
|
2108
|
+
if (this._host._lastControlOver[pointerId]) {
|
|
2109
|
+
this._host._lastControlOver[pointerId]._onWheelScroll(deltaX, deltaY);
|
|
2110
|
+
return true;
|
|
2111
|
+
}
|
|
2112
|
+
}
|
|
2113
|
+
return false;
|
|
2114
|
+
};
|
|
2115
|
+
Control.prototype._prepareFont = function () {
|
|
2116
|
+
if (!this._font && !this._fontSet) {
|
|
2117
|
+
return;
|
|
2118
|
+
}
|
|
2119
|
+
if (this._style) {
|
|
2120
|
+
this._font = this._style.fontStyle + " " + this._style.fontWeight + " " + this.fontSizeInPixels + "px " + this._style.fontFamily;
|
|
2121
|
+
}
|
|
2122
|
+
else {
|
|
2123
|
+
this._font = this._fontStyle + " " + this._fontWeight + " " + this.fontSizeInPixels + "px " + this._fontFamily;
|
|
2124
|
+
}
|
|
2125
|
+
this._fontOffset = Control._GetFontOffset(this._font);
|
|
2126
|
+
//children need to be refreshed
|
|
2127
|
+
this.getDescendants().forEach(function (child) { return child._markAllAsDirty(); });
|
|
2128
|
+
};
|
|
2129
|
+
/**
|
|
2130
|
+
* Serializes the current control
|
|
2131
|
+
* @param serializationObject defined the JSON serialized object
|
|
2132
|
+
*/
|
|
2133
|
+
Control.prototype.serialize = function (serializationObject) {
|
|
2134
|
+
SerializationHelper.Serialize(this, serializationObject);
|
|
2135
|
+
serializationObject.name = this.name;
|
|
2136
|
+
serializationObject.className = this.getClassName();
|
|
2137
|
+
if (this._font) {
|
|
2138
|
+
serializationObject.fontFamily = this._fontFamily;
|
|
2139
|
+
serializationObject.fontSize = this.fontSize;
|
|
2140
|
+
serializationObject.fontWeight = this.fontWeight;
|
|
2141
|
+
serializationObject.fontStyle = this.fontStyle;
|
|
2142
|
+
}
|
|
2143
|
+
};
|
|
2144
|
+
/**
|
|
2145
|
+
* @param serializedObject
|
|
2146
|
+
* @param host
|
|
2147
|
+
* @hidden
|
|
2148
|
+
*/
|
|
2149
|
+
Control.prototype._parseFromContent = function (serializedObject, host) {
|
|
2150
|
+
if (serializedObject.fontFamily) {
|
|
2151
|
+
this.fontFamily = serializedObject.fontFamily;
|
|
2152
|
+
}
|
|
2153
|
+
if (serializedObject.fontSize) {
|
|
2154
|
+
this.fontSize = serializedObject.fontSize;
|
|
2155
|
+
}
|
|
2156
|
+
if (serializedObject.fontWeight) {
|
|
2157
|
+
this.fontWeight = serializedObject.fontWeight;
|
|
2158
|
+
}
|
|
2159
|
+
if (serializedObject.fontStyle) {
|
|
2160
|
+
this.fontStyle = serializedObject.fontStyle;
|
|
2161
|
+
}
|
|
2162
|
+
};
|
|
2163
|
+
/** Releases associated resources */
|
|
2164
|
+
Control.prototype.dispose = function () {
|
|
2165
|
+
this.onDirtyObservable.clear();
|
|
2166
|
+
this.onBeforeDrawObservable.clear();
|
|
2167
|
+
this.onAfterDrawObservable.clear();
|
|
2168
|
+
this.onPointerDownObservable.clear();
|
|
2169
|
+
this.onPointerEnterObservable.clear();
|
|
2170
|
+
this.onPointerMoveObservable.clear();
|
|
2171
|
+
this.onPointerOutObservable.clear();
|
|
2172
|
+
this.onPointerUpObservable.clear();
|
|
2173
|
+
this.onPointerClickObservable.clear();
|
|
2174
|
+
this.onWheelObservable.clear();
|
|
2175
|
+
if (this._styleObserver && this._style) {
|
|
2176
|
+
this._style.onChangedObservable.remove(this._styleObserver);
|
|
2177
|
+
this._styleObserver = null;
|
|
2178
|
+
}
|
|
2179
|
+
if (this.parent) {
|
|
2180
|
+
this.parent.removeControl(this);
|
|
2181
|
+
this.parent = null;
|
|
2182
|
+
}
|
|
2183
|
+
if (this._host) {
|
|
2184
|
+
var index = this._host._linkedControls.indexOf(this);
|
|
2185
|
+
if (index > -1) {
|
|
2186
|
+
this.linkWithMesh(null);
|
|
2187
|
+
}
|
|
2188
|
+
}
|
|
2189
|
+
// Callback
|
|
2190
|
+
this.onDisposeObservable.notifyObservers(this);
|
|
2191
|
+
this.onDisposeObservable.clear();
|
|
2192
|
+
};
|
|
2193
|
+
Object.defineProperty(Control, "HORIZONTAL_ALIGNMENT_LEFT", {
|
|
2194
|
+
/** HORIZONTAL_ALIGNMENT_LEFT */
|
|
2195
|
+
get: function () {
|
|
2196
|
+
return Control._HORIZONTAL_ALIGNMENT_LEFT;
|
|
2197
|
+
},
|
|
2198
|
+
enumerable: false,
|
|
2199
|
+
configurable: true
|
|
2200
|
+
});
|
|
2201
|
+
Object.defineProperty(Control, "HORIZONTAL_ALIGNMENT_RIGHT", {
|
|
2202
|
+
/** HORIZONTAL_ALIGNMENT_RIGHT */
|
|
2203
|
+
get: function () {
|
|
2204
|
+
return Control._HORIZONTAL_ALIGNMENT_RIGHT;
|
|
2205
|
+
},
|
|
2206
|
+
enumerable: false,
|
|
2207
|
+
configurable: true
|
|
2208
|
+
});
|
|
2209
|
+
Object.defineProperty(Control, "HORIZONTAL_ALIGNMENT_CENTER", {
|
|
2210
|
+
/** HORIZONTAL_ALIGNMENT_CENTER */
|
|
2211
|
+
get: function () {
|
|
2212
|
+
return Control._HORIZONTAL_ALIGNMENT_CENTER;
|
|
2213
|
+
},
|
|
2214
|
+
enumerable: false,
|
|
2215
|
+
configurable: true
|
|
2216
|
+
});
|
|
2217
|
+
Object.defineProperty(Control, "VERTICAL_ALIGNMENT_TOP", {
|
|
2218
|
+
/** VERTICAL_ALIGNMENT_TOP */
|
|
2219
|
+
get: function () {
|
|
2220
|
+
return Control._VERTICAL_ALIGNMENT_TOP;
|
|
2221
|
+
},
|
|
2222
|
+
enumerable: false,
|
|
2223
|
+
configurable: true
|
|
2224
|
+
});
|
|
2225
|
+
Object.defineProperty(Control, "VERTICAL_ALIGNMENT_BOTTOM", {
|
|
2226
|
+
/** VERTICAL_ALIGNMENT_BOTTOM */
|
|
2227
|
+
get: function () {
|
|
2228
|
+
return Control._VERTICAL_ALIGNMENT_BOTTOM;
|
|
2229
|
+
},
|
|
2230
|
+
enumerable: false,
|
|
2231
|
+
configurable: true
|
|
2232
|
+
});
|
|
2233
|
+
Object.defineProperty(Control, "VERTICAL_ALIGNMENT_CENTER", {
|
|
2234
|
+
/** VERTICAL_ALIGNMENT_CENTER */
|
|
2235
|
+
get: function () {
|
|
2236
|
+
return Control._VERTICAL_ALIGNMENT_CENTER;
|
|
2237
|
+
},
|
|
2238
|
+
enumerable: false,
|
|
2239
|
+
configurable: true
|
|
2240
|
+
});
|
|
2241
|
+
/**
|
|
2242
|
+
* @param font
|
|
2243
|
+
* @hidden
|
|
2244
|
+
*/
|
|
2245
|
+
Control._GetFontOffset = function (font) {
|
|
2246
|
+
if (Control._FontHeightSizes[font]) {
|
|
2247
|
+
return Control._FontHeightSizes[font];
|
|
2248
|
+
}
|
|
2249
|
+
var engine = EngineStore.LastCreatedEngine;
|
|
2250
|
+
if (!engine) {
|
|
2251
|
+
throw new Error("Invalid engine. Unable to create a canvas.");
|
|
2252
|
+
}
|
|
2253
|
+
var result = engine.getFontOffset(font);
|
|
2254
|
+
Control._FontHeightSizes[font] = result;
|
|
2255
|
+
return result;
|
|
2256
|
+
};
|
|
2257
|
+
/**
|
|
2258
|
+
* Creates a Control from parsed data
|
|
2259
|
+
* @param serializedObject defines parsed data
|
|
2260
|
+
* @param host defines the hosting AdvancedDynamicTexture
|
|
2261
|
+
* @returns a new Control
|
|
2262
|
+
*/
|
|
2263
|
+
Control.Parse = function (serializedObject, host) {
|
|
2264
|
+
var controlType = Tools.Instantiate("BABYLON.GUI." + serializedObject.className);
|
|
2265
|
+
var control = SerializationHelper.Parse(function () { return new controlType(); }, serializedObject, null);
|
|
2266
|
+
control.name = serializedObject.name;
|
|
2267
|
+
control._parseFromContent(serializedObject, host);
|
|
2268
|
+
return control;
|
|
2269
|
+
};
|
|
2270
|
+
/**
|
|
2271
|
+
* @param x
|
|
2272
|
+
* @param y
|
|
2273
|
+
* @param width
|
|
2274
|
+
* @param height
|
|
2275
|
+
* @param context
|
|
2276
|
+
* @hidden
|
|
2277
|
+
*/
|
|
2278
|
+
Control.drawEllipse = function (x, y, width, height, context) {
|
|
2279
|
+
context.translate(x, y);
|
|
2280
|
+
context.scale(width, height);
|
|
2281
|
+
context.beginPath();
|
|
2282
|
+
context.arc(0, 0, 1, 0, 2 * Math.PI);
|
|
2283
|
+
context.closePath();
|
|
2284
|
+
context.scale(1 / width, 1 / height);
|
|
2285
|
+
context.translate(-x, -y);
|
|
2286
|
+
};
|
|
2287
|
+
/**
|
|
2288
|
+
* Gets or sets a boolean indicating if alpha must be an inherited value (false by default)
|
|
2289
|
+
*/
|
|
2290
|
+
Control.AllowAlphaInheritance = false;
|
|
2291
|
+
Control._ClipMeasure = new Measure(0, 0, 0, 0);
|
|
2292
|
+
// Statics
|
|
2293
|
+
Control._HORIZONTAL_ALIGNMENT_LEFT = 0;
|
|
2294
|
+
Control._HORIZONTAL_ALIGNMENT_RIGHT = 1;
|
|
2295
|
+
Control._HORIZONTAL_ALIGNMENT_CENTER = 2;
|
|
2296
|
+
Control._VERTICAL_ALIGNMENT_TOP = 0;
|
|
2297
|
+
Control._VERTICAL_ALIGNMENT_BOTTOM = 1;
|
|
2298
|
+
Control._VERTICAL_ALIGNMENT_CENTER = 2;
|
|
2299
|
+
Control._FontHeightSizes = {};
|
|
2300
|
+
Control.AddHeader = function () { };
|
|
2301
|
+
__decorate([
|
|
2302
|
+
serialize()
|
|
2303
|
+
], Control.prototype, "metadata", void 0);
|
|
2304
|
+
__decorate([
|
|
2305
|
+
serialize()
|
|
2306
|
+
], Control.prototype, "isHitTestVisible", void 0);
|
|
2307
|
+
__decorate([
|
|
2308
|
+
serialize()
|
|
2309
|
+
], Control.prototype, "isPointerBlocker", void 0);
|
|
2310
|
+
__decorate([
|
|
2311
|
+
serialize()
|
|
2312
|
+
], Control.prototype, "isFocusInvisible", void 0);
|
|
2313
|
+
__decorate([
|
|
2314
|
+
serialize()
|
|
2315
|
+
], Control.prototype, "clipChildren", void 0);
|
|
2316
|
+
__decorate([
|
|
2317
|
+
serialize()
|
|
2318
|
+
], Control.prototype, "clipContent", void 0);
|
|
2319
|
+
__decorate([
|
|
2320
|
+
serialize()
|
|
2321
|
+
], Control.prototype, "useBitmapCache", void 0);
|
|
2322
|
+
__decorate([
|
|
2323
|
+
serialize()
|
|
2324
|
+
], Control.prototype, "shadowOffsetX", null);
|
|
2325
|
+
__decorate([
|
|
2326
|
+
serialize()
|
|
2327
|
+
], Control.prototype, "shadowOffsetY", null);
|
|
2328
|
+
__decorate([
|
|
2329
|
+
serialize()
|
|
2330
|
+
], Control.prototype, "shadowBlur", null);
|
|
2331
|
+
__decorate([
|
|
2332
|
+
serialize()
|
|
2333
|
+
], Control.prototype, "shadowColor", null);
|
|
2334
|
+
__decorate([
|
|
2335
|
+
serialize()
|
|
2336
|
+
], Control.prototype, "hoverCursor", void 0);
|
|
2337
|
+
__decorate([
|
|
2338
|
+
serialize()
|
|
2339
|
+
], Control.prototype, "fontOffset", null);
|
|
2340
|
+
__decorate([
|
|
2341
|
+
serialize()
|
|
2342
|
+
], Control.prototype, "alpha", null);
|
|
2343
|
+
__decorate([
|
|
2344
|
+
serialize()
|
|
2345
|
+
], Control.prototype, "scaleX", null);
|
|
2346
|
+
__decorate([
|
|
2347
|
+
serialize()
|
|
2348
|
+
], Control.prototype, "scaleY", null);
|
|
2349
|
+
__decorate([
|
|
2350
|
+
serialize()
|
|
2351
|
+
], Control.prototype, "rotation", null);
|
|
2352
|
+
__decorate([
|
|
2353
|
+
serialize()
|
|
2354
|
+
], Control.prototype, "transformCenterY", null);
|
|
2355
|
+
__decorate([
|
|
2356
|
+
serialize()
|
|
2357
|
+
], Control.prototype, "transformCenterX", null);
|
|
2358
|
+
__decorate([
|
|
2359
|
+
serialize()
|
|
2360
|
+
], Control.prototype, "horizontalAlignment", null);
|
|
2361
|
+
__decorate([
|
|
2362
|
+
serialize()
|
|
2363
|
+
], Control.prototype, "verticalAlignment", null);
|
|
2364
|
+
__decorate([
|
|
2365
|
+
serialize()
|
|
2366
|
+
], Control.prototype, "fixedRatio", void 0);
|
|
2367
|
+
__decorate([
|
|
2368
|
+
serialize()
|
|
2369
|
+
], Control.prototype, "width", null);
|
|
2370
|
+
__decorate([
|
|
2371
|
+
serialize()
|
|
2372
|
+
], Control.prototype, "height", null);
|
|
2373
|
+
__decorate([
|
|
2374
|
+
serialize()
|
|
2375
|
+
], Control.prototype, "style", null);
|
|
2376
|
+
__decorate([
|
|
2377
|
+
serialize()
|
|
2378
|
+
], Control.prototype, "color", null);
|
|
2379
|
+
__decorate([
|
|
2380
|
+
serialize()
|
|
2381
|
+
], Control.prototype, "zIndex", null);
|
|
2382
|
+
__decorate([
|
|
2383
|
+
serialize()
|
|
2384
|
+
], Control.prototype, "notRenderable", null);
|
|
2385
|
+
__decorate([
|
|
2386
|
+
serialize()
|
|
2387
|
+
], Control.prototype, "isVisible", null);
|
|
2388
|
+
__decorate([
|
|
2389
|
+
serialize()
|
|
2390
|
+
], Control.prototype, "descendantsOnlyPadding", null);
|
|
2391
|
+
__decorate([
|
|
2392
|
+
serialize()
|
|
2393
|
+
], Control.prototype, "paddingLeft", null);
|
|
2394
|
+
__decorate([
|
|
2395
|
+
serialize()
|
|
2396
|
+
], Control.prototype, "paddingRight", null);
|
|
2397
|
+
__decorate([
|
|
2398
|
+
serialize()
|
|
2399
|
+
], Control.prototype, "paddingTop", null);
|
|
2400
|
+
__decorate([
|
|
2401
|
+
serialize()
|
|
2402
|
+
], Control.prototype, "paddingBottom", null);
|
|
2403
|
+
__decorate([
|
|
2404
|
+
serialize()
|
|
2405
|
+
], Control.prototype, "left", null);
|
|
2406
|
+
__decorate([
|
|
2407
|
+
serialize()
|
|
2408
|
+
], Control.prototype, "top", null);
|
|
2409
|
+
__decorate([
|
|
2410
|
+
serialize()
|
|
2411
|
+
], Control.prototype, "linkOffsetX", null);
|
|
2412
|
+
__decorate([
|
|
2413
|
+
serialize()
|
|
2414
|
+
], Control.prototype, "linkOffsetY", null);
|
|
2415
|
+
__decorate([
|
|
2416
|
+
serialize()
|
|
2417
|
+
], Control.prototype, "isEnabled", null);
|
|
2418
|
+
__decorate([
|
|
2419
|
+
serialize()
|
|
2420
|
+
], Control.prototype, "disabledColor", null);
|
|
2421
|
+
__decorate([
|
|
2422
|
+
serialize()
|
|
2423
|
+
], Control.prototype, "disabledColorItem", null);
|
|
2424
|
+
__decorate([
|
|
2425
|
+
serialize()
|
|
2426
|
+
], Control.prototype, "overlapGroup", void 0);
|
|
2427
|
+
__decorate([
|
|
2428
|
+
serialize()
|
|
2429
|
+
], Control.prototype, "overlapDeltaMultiplier", void 0);
|
|
2430
|
+
return Control;
|
|
2431
|
+
}());
|
|
2432
|
+
export { Control };
|
|
2433
|
+
RegisterClass("BABYLON.GUI.Control", Control);
|
|
2309
2434
|
//# sourceMappingURL=control.js.map
|