@babylonjs/gui 5.0.0-alpha.9 → 5.0.0-beta.11
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.js +1 -1
- package/2D/advancedDynamicTexture.d.ts +179 -127
- package/2D/advancedDynamicTexture.js +368 -183
- package/2D/advancedDynamicTexture.js.map +1 -1
- package/2D/controls/button.d.ts +8 -0
- package/2D/controls/button.js +33 -10
- package/2D/controls/button.js.map +1 -1
- package/2D/controls/checkbox.d.ts +2 -1
- package/2D/controls/checkbox.js +10 -8
- package/2D/controls/checkbox.js.map +1 -1
- package/2D/controls/colorpicker.d.ts +4 -3
- package/2D/controls/colorpicker.js +40 -23
- package/2D/controls/colorpicker.js.map +1 -1
- package/2D/controls/container.d.ts +16 -5
- package/2D/controls/container.js +99 -15
- package/2D/controls/container.js.map +1 -1
- package/2D/controls/control.d.ts +115 -47
- package/2D/controls/control.js +318 -139
- package/2D/controls/control.js.map +1 -1
- package/2D/controls/displayGrid.d.ts +2 -1
- package/2D/controls/displayGrid.js +6 -6
- package/2D/controls/displayGrid.js.map +1 -1
- package/2D/controls/ellipse.d.ts +5 -3
- package/2D/controls/ellipse.js +9 -5
- package/2D/controls/ellipse.js.map +1 -1
- package/2D/controls/focusableButton.d.ts +1 -0
- package/2D/controls/focusableButton.js +9 -6
- package/2D/controls/focusableButton.js.map +1 -1
- package/2D/controls/grid.d.ts +13 -2
- package/2D/controls/grid.js +117 -33
- package/2D/controls/grid.js.map +1 -1
- package/2D/controls/image.d.ts +5 -4
- package/2D/controls/image.js +52 -31
- package/2D/controls/image.js.map +1 -1
- package/2D/controls/index.js +29 -29
- package/2D/controls/inputPassword.js +4 -4
- package/2D/controls/inputPassword.js.map +1 -1
- package/2D/controls/inputText.d.ts +4 -1
- package/2D/controls/inputText.js +42 -15
- package/2D/controls/inputText.js.map +1 -1
- package/2D/controls/line.d.ts +3 -2
- package/2D/controls/line.js +8 -8
- package/2D/controls/line.js.map +1 -1
- package/2D/controls/multiLine.d.ts +4 -3
- package/2D/controls/multiLine.js +6 -6
- package/2D/controls/multiLine.js.map +1 -1
- package/2D/controls/radioButton.d.ts +2 -1
- package/2D/controls/radioButton.js +10 -7
- package/2D/controls/radioButton.js.map +1 -1
- package/2D/controls/rectangle.d.ts +8 -3
- package/2D/controls/rectangle.js +21 -5
- package/2D/controls/rectangle.js.map +1 -1
- package/2D/controls/scrollViewers/scrollViewer.d.ts +3 -2
- package/2D/controls/scrollViewers/scrollViewer.js +9 -9
- package/2D/controls/scrollViewers/scrollViewer.js.map +1 -1
- package/2D/controls/scrollViewers/scrollViewerWindow.d.ts +4 -3
- package/2D/controls/scrollViewers/scrollViewerWindow.js +4 -4
- package/2D/controls/scrollViewers/scrollViewerWindow.js.map +1 -1
- package/2D/controls/selector.js +8 -8
- package/2D/controls/selector.js.map +1 -1
- package/2D/controls/sliders/baseSlider.d.ts +1 -1
- package/2D/controls/sliders/baseSlider.js +12 -10
- package/2D/controls/sliders/baseSlider.js.map +1 -1
- package/2D/controls/sliders/imageBasedSlider.d.ts +10 -1
- package/2D/controls/sliders/imageBasedSlider.js +29 -5
- package/2D/controls/sliders/imageBasedSlider.js.map +1 -1
- package/2D/controls/sliders/imageScrollBar.d.ts +2 -1
- package/2D/controls/sliders/imageScrollBar.js +3 -3
- package/2D/controls/sliders/imageScrollBar.js.map +1 -1
- package/2D/controls/sliders/scrollBar.d.ts +2 -1
- package/2D/controls/sliders/scrollBar.js +3 -3
- package/2D/controls/sliders/scrollBar.js.map +1 -1
- package/2D/controls/sliders/slider.d.ts +2 -1
- package/2D/controls/sliders/slider.js +4 -4
- package/2D/controls/sliders/slider.js.map +1 -1
- package/2D/controls/stackPanel.d.ts +10 -3
- package/2D/controls/stackPanel.js +37 -15
- package/2D/controls/stackPanel.js.map +1 -1
- package/2D/controls/statics.js +3 -3
- package/2D/controls/statics.js.map +1 -1
- package/2D/controls/textBlock.d.ts +17 -9
- package/2D/controls/textBlock.js +91 -40
- package/2D/controls/textBlock.js.map +1 -1
- package/2D/controls/textWrapper.js +2 -2
- package/2D/controls/textWrapper.js.map +1 -1
- package/2D/controls/toggleButton.d.ts +1 -13
- package/2D/controls/toggleButton.js +29 -38
- package/2D/controls/toggleButton.js.map +1 -1
- package/2D/controls/virtualKeyboard.js +5 -5
- package/2D/controls/virtualKeyboard.js.map +1 -1
- package/2D/index.d.ts +1 -1
- package/2D/index.js +9 -9
- package/2D/index.js.map +1 -1
- package/2D/math2D.d.ts +5 -0
- package/2D/math2D.js +14 -2
- package/2D/math2D.js.map +1 -1
- package/2D/measure.js +1 -1
- package/2D/measure.js.map +1 -1
- package/2D/multiLinePoint.js +3 -3
- package/2D/style.js +2 -2
- package/2D/valueAndUnit.d.ts +21 -6
- package/2D/valueAndUnit.js +57 -13
- package/2D/valueAndUnit.js.map +1 -1
- package/2D/xmlLoader.d.ts +17 -3
- package/2D/xmlLoader.js +54 -15
- package/2D/xmlLoader.js.map +1 -1
- package/3D/behaviors/defaultBehavior.d.ts +73 -0
- package/3D/behaviors/defaultBehavior.js +122 -0
- package/3D/behaviors/defaultBehavior.js.map +1 -0
- package/3D/controls/abstractButton3D.d.ts +2 -2
- package/3D/controls/abstractButton3D.js +3 -3
- package/3D/controls/abstractButton3D.js.map +1 -1
- package/3D/controls/button3D.d.ts +0 -24
- package/3D/controls/button3D.js +15 -84
- package/3D/controls/button3D.js.map +1 -1
- package/3D/controls/container3D.js +2 -2
- package/3D/controls/contentDisplay3D.d.ts +30 -0
- package/3D/controls/contentDisplay3D.js +79 -0
- package/3D/controls/contentDisplay3D.js.map +1 -0
- package/3D/controls/control3D.d.ts +10 -7
- package/3D/controls/control3D.js +27 -19
- package/3D/controls/control3D.js.map +1 -1
- package/3D/controls/cylinderPanel.js +5 -5
- package/3D/controls/handMenu.d.ts +28 -0
- package/3D/controls/handMenu.js +48 -0
- package/3D/controls/handMenu.js.map +1 -0
- package/3D/controls/holographicBackplate.d.ts +48 -0
- package/3D/controls/holographicBackplate.js +121 -0
- package/3D/controls/holographicBackplate.js.map +1 -0
- package/3D/controls/holographicButton.d.ts +1 -1
- package/3D/controls/holographicButton.js +35 -31
- package/3D/controls/holographicButton.js.map +1 -1
- package/3D/controls/holographicSlate.d.ts +120 -0
- package/3D/controls/holographicSlate.js +372 -0
- package/3D/controls/holographicSlate.js.map +1 -0
- package/3D/controls/index.d.ts +6 -0
- package/3D/controls/index.js +21 -15
- package/3D/controls/index.js.map +1 -1
- package/3D/controls/meshButton3D.js +2 -2
- package/3D/controls/meshButton3D.js.map +1 -1
- package/3D/controls/nearMenu.d.ts +44 -0
- package/3D/controls/nearMenu.js +113 -0
- package/3D/controls/nearMenu.js.map +1 -0
- package/3D/controls/planePanel.js +3 -3
- package/3D/controls/scatterPanel.js +4 -4
- package/3D/controls/slider3D.d.ts +80 -0
- package/3D/controls/slider3D.js +268 -0
- package/3D/controls/slider3D.js.map +1 -0
- package/3D/controls/spherePanel.js +5 -5
- package/3D/controls/stackPanel3D.js +3 -3
- package/3D/controls/touchButton3D.d.ts +30 -21
- package/3D/controls/touchButton3D.js +127 -228
- package/3D/controls/touchButton3D.js.map +1 -1
- package/3D/controls/touchHolographicButton.d.ts +23 -2
- package/3D/controls/touchHolographicButton.js +162 -67
- package/3D/controls/touchHolographicButton.js.map +1 -1
- package/3D/controls/touchHolographicMenu.d.ts +61 -0
- package/3D/controls/touchHolographicMenu.js +149 -0
- package/3D/controls/touchHolographicMenu.js.map +1 -0
- package/3D/controls/touchMeshButton3D.d.ts +3 -6
- package/3D/controls/touchMeshButton3D.js +6 -14
- package/3D/controls/touchMeshButton3D.js.map +1 -1
- package/3D/controls/volumeBasedPanel.d.ts +1 -1
- package/3D/controls/volumeBasedPanel.js +5 -5
- package/3D/controls/volumeBasedPanel.js.map +1 -1
- package/3D/gizmos/gizmoHandle.d.ts +108 -0
- package/3D/gizmos/gizmoHandle.js +210 -0
- package/3D/gizmos/gizmoHandle.js.map +1 -0
- package/3D/gizmos/index.d.ts +2 -0
- package/3D/gizmos/index.js +3 -0
- package/3D/gizmos/index.js.map +1 -0
- package/3D/gizmos/slateGizmo.d.ts +59 -0
- package/3D/gizmos/slateGizmo.js +364 -0
- package/3D/gizmos/slateGizmo.js.map +1 -0
- package/3D/gui3DManager.d.ts +15 -2
- package/3D/gui3DManager.js +62 -41
- package/3D/gui3DManager.js.map +1 -1
- package/3D/index.d.ts +3 -2
- package/3D/index.js +5 -4
- package/3D/index.js.map +1 -1
- package/3D/materials/fluent/fluentMaterial.d.ts +90 -0
- package/3D/materials/fluent/fluentMaterial.js +282 -0
- package/3D/materials/fluent/fluentMaterial.js.map +1 -0
- package/3D/materials/fluent/index.d.ts +1 -0
- package/3D/materials/fluent/index.js +2 -0
- package/3D/materials/fluent/index.js.map +1 -0
- package/3D/materials/{shaders → fluent/shaders}/fluent.fragment.d.ts +0 -0
- package/3D/materials/fluent/shaders/fluent.fragment.js +7 -0
- package/3D/materials/fluent/shaders/fluent.fragment.js.map +1 -0
- package/3D/materials/{shaders → fluent/shaders}/fluent.vertex.d.ts +0 -0
- package/3D/materials/{shaders → fluent/shaders}/fluent.vertex.js +2 -2
- package/3D/materials/fluent/shaders/fluent.vertex.js.map +1 -0
- package/3D/materials/fluentBackplate/fluentBackplateMaterial.d.ts +154 -0
- package/3D/materials/fluentBackplate/fluentBackplateMaterial.js +435 -0
- package/3D/materials/fluentBackplate/fluentBackplateMaterial.js.map +1 -0
- package/3D/materials/fluentBackplate/index.d.ts +1 -0
- package/3D/materials/fluentBackplate/index.js +2 -0
- package/3D/materials/fluentBackplate/index.js.map +1 -0
- package/3D/materials/fluentBackplate/shaders/fluentBackplate.fragment.d.ts +5 -0
- package/3D/materials/fluentBackplate/shaders/fluentBackplate.fragment.js +7 -0
- package/3D/materials/fluentBackplate/shaders/fluentBackplate.fragment.js.map +1 -0
- package/3D/materials/fluentBackplate/shaders/fluentBackplate.vertex.d.ts +5 -0
- package/3D/materials/fluentBackplate/shaders/fluentBackplate.vertex.js +7 -0
- package/3D/materials/fluentBackplate/shaders/fluentBackplate.vertex.js.map +1 -0
- package/3D/materials/fluentButton/fluentButtonMaterial.d.ts +189 -0
- package/3D/materials/fluentButton/fluentButtonMaterial.js +538 -0
- package/3D/materials/fluentButton/fluentButtonMaterial.js.map +1 -0
- package/3D/materials/fluentButton/index.d.ts +1 -0
- package/3D/materials/fluentButton/index.js +2 -0
- package/3D/materials/fluentButton/index.js.map +1 -0
- package/3D/materials/fluentButton/shaders/fluentButton.fragment.d.ts +5 -0
- package/3D/materials/fluentButton/shaders/fluentButton.fragment.js +7 -0
- package/3D/materials/fluentButton/shaders/fluentButton.fragment.js.map +1 -0
- package/3D/materials/fluentButton/shaders/fluentButton.vertex.d.ts +5 -0
- package/3D/materials/fluentButton/shaders/fluentButton.vertex.js +7 -0
- package/3D/materials/fluentButton/shaders/fluentButton.vertex.js.map +1 -0
- package/3D/materials/fluentMaterial.d.ts +2 -88
- package/3D/materials/fluentMaterial.js +2 -277
- package/3D/materials/fluentMaterial.js.map +1 -1
- package/3D/materials/handle/handleMaterial.d.ts +68 -0
- package/3D/materials/handle/handleMaterial.js +127 -0
- package/3D/materials/handle/handleMaterial.js.map +1 -0
- package/3D/materials/handle/index.d.ts +1 -0
- package/3D/materials/handle/index.js +2 -0
- package/3D/materials/handle/index.js.map +1 -0
- package/3D/materials/handle/shaders/handle.fragment.d.ts +5 -0
- package/3D/materials/handle/shaders/handle.fragment.js +7 -0
- package/3D/materials/handle/shaders/handle.fragment.js.map +1 -0
- package/3D/materials/handle/shaders/handle.vertex.d.ts +5 -0
- package/3D/materials/handle/shaders/handle.vertex.js +7 -0
- package/3D/materials/handle/shaders/handle.vertex.js.map +1 -0
- package/3D/materials/index.d.ts +5 -1
- package/3D/materials/index.js +5 -1
- package/3D/materials/index.js.map +1 -1
- package/3D/materials/mrdl/index.d.ts +3 -0
- package/3D/materials/mrdl/index.js +4 -0
- package/3D/materials/mrdl/index.js.map +1 -0
- package/3D/materials/mrdl/mrdlBackplateMaterial.d.ts +147 -0
- package/3D/materials/mrdl/mrdlBackplateMaterial.js +410 -0
- package/3D/materials/mrdl/mrdlBackplateMaterial.js.map +1 -0
- package/3D/materials/mrdl/mrdlSliderBarMaterial.d.ts +333 -0
- package/3D/materials/mrdl/mrdlSliderBarMaterial.js +787 -0
- package/3D/materials/mrdl/mrdlSliderBarMaterial.js.map +1 -0
- package/3D/materials/mrdl/mrdlSliderThumbMaterial.d.ts +333 -0
- package/3D/materials/mrdl/mrdlSliderThumbMaterial.js +787 -0
- package/3D/materials/mrdl/mrdlSliderThumbMaterial.js.map +1 -0
- package/3D/materials/mrdl/shaders/mrdlBackplate.fragment.d.ts +5 -0
- package/3D/materials/mrdl/shaders/mrdlBackplate.fragment.js +7 -0
- package/3D/materials/mrdl/shaders/mrdlBackplate.fragment.js.map +1 -0
- package/3D/materials/mrdl/shaders/mrdlBackplate.vertex.d.ts +5 -0
- package/3D/materials/mrdl/shaders/mrdlBackplate.vertex.js +7 -0
- package/3D/materials/mrdl/shaders/mrdlBackplate.vertex.js.map +1 -0
- package/3D/materials/mrdl/shaders/mrdlSliderBar.fragment.d.ts +5 -0
- package/3D/materials/mrdl/shaders/mrdlSliderBar.fragment.js +7 -0
- package/3D/materials/mrdl/shaders/mrdlSliderBar.fragment.js.map +1 -0
- package/3D/materials/mrdl/shaders/mrdlSliderBar.vertex.d.ts +5 -0
- package/3D/materials/mrdl/shaders/mrdlSliderBar.vertex.js +7 -0
- package/3D/materials/mrdl/shaders/mrdlSliderBar.vertex.js.map +1 -0
- package/3D/materials/mrdl/shaders/mrdlSliderThumb.fragment.d.ts +5 -0
- package/3D/materials/mrdl/shaders/mrdlSliderThumb.fragment.js +7 -0
- package/3D/materials/mrdl/shaders/mrdlSliderThumb.fragment.js.map +1 -0
- package/3D/materials/mrdl/shaders/mrdlSliderThumb.vertex.d.ts +5 -0
- package/3D/materials/mrdl/shaders/mrdlSliderThumb.vertex.js +7 -0
- package/3D/materials/mrdl/shaders/mrdlSliderThumb.vertex.js.map +1 -0
- package/3D/vector3WithInfo.js +1 -1
- package/index.d.ts +2 -2
- package/index.js +2 -2
- package/index.js.map +1 -1
- package/legacy/legacy.js +2 -2
- package/package.json +114 -9
- package/3D/materials/shaders/fluent.fragment.js +0 -7
- package/3D/materials/shaders/fluent.fragment.js.map +0 -1
- package/3D/materials/shaders/fluent.vertex.js.map +0 -1
package/2D/controls/control.js
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
|
-
import { Observable } from "@babylonjs/core/Misc/observable";
|
|
3
|
-
import { Vector2, Vector3, Matrix } from "@babylonjs/core/Maths/math.vector";
|
|
4
|
-
import { PointerEventTypes } from
|
|
5
|
-
import { Logger } from "@babylonjs/core/Misc/logger";
|
|
6
|
-
import { Tools } from "@babylonjs/core/Misc/tools";
|
|
7
|
-
import { ValueAndUnit } from "../valueAndUnit";
|
|
8
|
-
import { Measure } from "../measure";
|
|
9
|
-
import { Matrix2D, Vector2WithInfo } from "../math2D";
|
|
10
|
-
import {
|
|
11
|
-
import { SerializationHelper, serialize } from
|
|
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.js";
|
|
8
|
+
import { Measure } from "../measure.js";
|
|
9
|
+
import { Matrix2D, Vector2WithInfo } from "../math2D.js";
|
|
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";
|
|
12
13
|
/**
|
|
13
14
|
* Root class used for all 2D controls
|
|
14
15
|
* @see https://doc.babylonjs.com/how_to/gui#controls
|
|
@@ -28,6 +29,8 @@ var Control = /** @class */ (function () {
|
|
|
28
29
|
this._zIndex = 0;
|
|
29
30
|
/** @hidden */
|
|
30
31
|
this._currentMeasure = Measure.Empty();
|
|
32
|
+
/** @hidden */
|
|
33
|
+
this._tempPaddingMeasure = Measure.Empty();
|
|
31
34
|
this._fontFamily = "Arial";
|
|
32
35
|
this._fontStyle = "";
|
|
33
36
|
this._fontWeight = "";
|
|
@@ -52,6 +55,7 @@ var Control = /** @class */ (function () {
|
|
|
52
55
|
this._prevCurrentMeasureTransformedIntoGlobalSpace = Measure.Empty();
|
|
53
56
|
/** @hidden */
|
|
54
57
|
this._cachedParentMeasure = Measure.Empty();
|
|
58
|
+
this._descendantsOnlyPadding = false;
|
|
55
59
|
this._paddingLeft = new ValueAndUnit(0);
|
|
56
60
|
this._paddingRight = new ValueAndUnit(0);
|
|
57
61
|
this._paddingTop = new ValueAndUnit(0);
|
|
@@ -74,15 +78,20 @@ var Control = /** @class */ (function () {
|
|
|
74
78
|
this._isMatrixDirty = true;
|
|
75
79
|
this._isVisible = true;
|
|
76
80
|
this._isHighlighted = false;
|
|
81
|
+
this._highlightColor = "#4affff";
|
|
82
|
+
this._highlightLineWidth = 2;
|
|
77
83
|
this._fontSet = false;
|
|
78
84
|
this._dummyVector2 = Vector2.Zero();
|
|
79
85
|
this._downCount = 0;
|
|
80
86
|
this._enterCount = -1;
|
|
81
87
|
this._doNotRender = false;
|
|
82
88
|
this._downPointerIds = {};
|
|
89
|
+
this._evaluatedMeasure = new Measure(0, 0, 0, 0);
|
|
90
|
+
this._evaluatedParentMeasure = new Measure(0, 0, 0, 0);
|
|
83
91
|
this._isEnabled = true;
|
|
84
92
|
this._disabledColor = "#9a9a9a";
|
|
85
93
|
this._disabledColorItem = "#6a6a6a";
|
|
94
|
+
this._isReadOnly = false;
|
|
86
95
|
/** @hidden */
|
|
87
96
|
this._rebuildLayout = false;
|
|
88
97
|
/** @hidden */
|
|
@@ -118,7 +127,8 @@ var Control = /** @class */ (function () {
|
|
|
118
127
|
this._shadowOffsetX = 0;
|
|
119
128
|
this._shadowOffsetY = 0;
|
|
120
129
|
this._shadowBlur = 0;
|
|
121
|
-
this.
|
|
130
|
+
this._previousShadowBlur = 0;
|
|
131
|
+
this._shadowColor = "black";
|
|
122
132
|
/** Gets or sets the cursor to use when the control is hovered */
|
|
123
133
|
this.hoverCursor = "";
|
|
124
134
|
/** @hidden */
|
|
@@ -126,36 +136,36 @@ var Control = /** @class */ (function () {
|
|
|
126
136
|
/** @hidden */
|
|
127
137
|
this._linkOffsetY = new ValueAndUnit(0);
|
|
128
138
|
/**
|
|
129
|
-
|
|
130
|
-
|
|
139
|
+
* An event triggered when pointer wheel is scrolled
|
|
140
|
+
*/
|
|
131
141
|
this.onWheelObservable = new Observable();
|
|
132
142
|
/**
|
|
133
|
-
|
|
134
|
-
|
|
143
|
+
* An event triggered when the pointer moves over the control.
|
|
144
|
+
*/
|
|
135
145
|
this.onPointerMoveObservable = new Observable();
|
|
136
146
|
/**
|
|
137
|
-
|
|
138
|
-
|
|
147
|
+
* An event triggered when the pointer moves out of the control.
|
|
148
|
+
*/
|
|
139
149
|
this.onPointerOutObservable = new Observable();
|
|
140
150
|
/**
|
|
141
|
-
|
|
142
|
-
|
|
151
|
+
* An event triggered when the pointer taps the control
|
|
152
|
+
*/
|
|
143
153
|
this.onPointerDownObservable = new Observable();
|
|
144
154
|
/**
|
|
145
|
-
|
|
146
|
-
|
|
155
|
+
* An event triggered when pointer up
|
|
156
|
+
*/
|
|
147
157
|
this.onPointerUpObservable = new Observable();
|
|
148
158
|
/**
|
|
149
|
-
|
|
150
|
-
|
|
159
|
+
* An event triggered when a control is clicked on
|
|
160
|
+
*/
|
|
151
161
|
this.onPointerClickObservable = new Observable();
|
|
152
162
|
/**
|
|
153
|
-
|
|
154
|
-
|
|
163
|
+
* An event triggered when pointer enters the control
|
|
164
|
+
*/
|
|
155
165
|
this.onPointerEnterObservable = new Observable();
|
|
156
166
|
/**
|
|
157
|
-
|
|
158
|
-
|
|
167
|
+
* An event triggered when the control is marked as dirty
|
|
168
|
+
*/
|
|
159
169
|
this.onDirtyObservable = new Observable();
|
|
160
170
|
/**
|
|
161
171
|
* An event triggered before drawing the control
|
|
@@ -166,8 +176,8 @@ var Control = /** @class */ (function () {
|
|
|
166
176
|
*/
|
|
167
177
|
this.onAfterDrawObservable = new Observable();
|
|
168
178
|
/**
|
|
169
|
-
|
|
170
|
-
|
|
179
|
+
* An event triggered when the control has been disposed
|
|
180
|
+
*/
|
|
171
181
|
this.onDisposeObservable = new Observable();
|
|
172
182
|
/**
|
|
173
183
|
* Gets or sets a fixed ratio for this control.
|
|
@@ -179,6 +189,30 @@ var Control = /** @class */ (function () {
|
|
|
179
189
|
this._fixedRatioMasterIsWidth = true;
|
|
180
190
|
this._tmpMeasureA = new Measure(0, 0, 0, 0);
|
|
181
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
|
+
});
|
|
182
216
|
Object.defineProperty(Control.prototype, "shadowOffsetX", {
|
|
183
217
|
/** Gets or sets a value indicating the offset to apply on X axis to render the shadow */
|
|
184
218
|
get: function () {
|
|
@@ -218,6 +252,7 @@ var Control = /** @class */ (function () {
|
|
|
218
252
|
if (this._shadowBlur === value) {
|
|
219
253
|
return;
|
|
220
254
|
}
|
|
255
|
+
this._previousShadowBlur = this._shadowBlur;
|
|
221
256
|
this._shadowBlur = value;
|
|
222
257
|
this._markAsDirty();
|
|
223
258
|
},
|
|
@@ -292,6 +327,23 @@ var Control = /** @class */ (function () {
|
|
|
292
327
|
enumerable: false,
|
|
293
328
|
configurable: true
|
|
294
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
|
+
});
|
|
295
347
|
Object.defineProperty(Control.prototype, "isHighlighted", {
|
|
296
348
|
/**
|
|
297
349
|
* Gets or sets a boolean indicating that we want to highlight the control (mostly for debugging purpose)
|
|
@@ -309,10 +361,27 @@ var Control = /** @class */ (function () {
|
|
|
309
361
|
enumerable: false,
|
|
310
362
|
configurable: true
|
|
311
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
|
+
});
|
|
312
381
|
Object.defineProperty(Control.prototype, "scaleX", {
|
|
313
382
|
/** Gets or sets a value indicating the scale factor on X axis (1 by default)
|
|
314
383
|
* @see https://doc.babylonjs.com/how_to/gui#rotation-and-scaling
|
|
315
|
-
|
|
384
|
+
*/
|
|
316
385
|
get: function () {
|
|
317
386
|
return this._scaleX;
|
|
318
387
|
},
|
|
@@ -330,7 +399,7 @@ var Control = /** @class */ (function () {
|
|
|
330
399
|
Object.defineProperty(Control.prototype, "scaleY", {
|
|
331
400
|
/** Gets or sets a value indicating the scale factor on Y axis (1 by default)
|
|
332
401
|
* @see https://doc.babylonjs.com/how_to/gui#rotation-and-scaling
|
|
333
|
-
|
|
402
|
+
*/
|
|
334
403
|
get: function () {
|
|
335
404
|
return this._scaleY;
|
|
336
405
|
},
|
|
@@ -348,7 +417,7 @@ var Control = /** @class */ (function () {
|
|
|
348
417
|
Object.defineProperty(Control.prototype, "rotation", {
|
|
349
418
|
/** Gets or sets the rotation angle (0 by default)
|
|
350
419
|
* @see https://doc.babylonjs.com/how_to/gui#rotation-and-scaling
|
|
351
|
-
|
|
420
|
+
*/
|
|
352
421
|
get: function () {
|
|
353
422
|
return this._rotation;
|
|
354
423
|
},
|
|
@@ -366,7 +435,7 @@ var Control = /** @class */ (function () {
|
|
|
366
435
|
Object.defineProperty(Control.prototype, "transformCenterY", {
|
|
367
436
|
/** Gets or sets the transformation center on Y axis (0 by default)
|
|
368
437
|
* @see https://doc.babylonjs.com/how_to/gui#rotation-and-scaling
|
|
369
|
-
|
|
438
|
+
*/
|
|
370
439
|
get: function () {
|
|
371
440
|
return this._transformCenterY;
|
|
372
441
|
},
|
|
@@ -384,7 +453,7 @@ var Control = /** @class */ (function () {
|
|
|
384
453
|
Object.defineProperty(Control.prototype, "transformCenterX", {
|
|
385
454
|
/** Gets or sets the transformation center on X axis (0 by default)
|
|
386
455
|
* @see https://doc.babylonjs.com/how_to/gui#rotation-and-scaling
|
|
387
|
-
|
|
456
|
+
*/
|
|
388
457
|
get: function () {
|
|
389
458
|
return this._transformCenterX;
|
|
390
459
|
},
|
|
@@ -514,9 +583,6 @@ var Control = /** @class */ (function () {
|
|
|
514
583
|
Object.defineProperty(Control.prototype, "fontFamily", {
|
|
515
584
|
/** Gets or set font family */
|
|
516
585
|
get: function () {
|
|
517
|
-
if (!this._fontSet) {
|
|
518
|
-
return "";
|
|
519
|
-
}
|
|
520
586
|
return this._fontFamily;
|
|
521
587
|
},
|
|
522
588
|
set: function (value) {
|
|
@@ -709,6 +775,24 @@ var Control = /** @class */ (function () {
|
|
|
709
775
|
enumerable: false,
|
|
710
776
|
configurable: true
|
|
711
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
|
+
});
|
|
712
796
|
Object.defineProperty(Control.prototype, "paddingLeft", {
|
|
713
797
|
/**
|
|
714
798
|
* Gets or sets a value indicating the padding to use on the left of the control
|
|
@@ -742,6 +826,17 @@ var Control = /** @class */ (function () {
|
|
|
742
826
|
enumerable: false,
|
|
743
827
|
configurable: true
|
|
744
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
|
+
});
|
|
745
840
|
Object.defineProperty(Control.prototype, "paddingRight", {
|
|
746
841
|
/**
|
|
747
842
|
* Gets or sets a value indicating the padding to use on the right of the control
|
|
@@ -775,6 +870,17 @@ var Control = /** @class */ (function () {
|
|
|
775
870
|
enumerable: false,
|
|
776
871
|
configurable: true
|
|
777
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
|
+
});
|
|
778
884
|
Object.defineProperty(Control.prototype, "paddingTop", {
|
|
779
885
|
/**
|
|
780
886
|
* Gets or sets a value indicating the padding to use on the top of the control
|
|
@@ -808,6 +914,17 @@ var Control = /** @class */ (function () {
|
|
|
808
914
|
enumerable: false,
|
|
809
915
|
configurable: true
|
|
810
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
|
+
});
|
|
811
928
|
Object.defineProperty(Control.prototype, "paddingBottom", {
|
|
812
929
|
/**
|
|
813
930
|
* Gets or sets a value indicating the padding to use on the bottom of the control
|
|
@@ -841,6 +958,17 @@ var Control = /** @class */ (function () {
|
|
|
841
958
|
enumerable: false,
|
|
842
959
|
configurable: true
|
|
843
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
|
+
});
|
|
844
972
|
Object.defineProperty(Control.prototype, "left", {
|
|
845
973
|
/**
|
|
846
974
|
* Gets or sets a value indicating the left coordinate of the control
|
|
@@ -995,17 +1123,34 @@ var Control = /** @class */ (function () {
|
|
|
995
1123
|
return this._isEnabled;
|
|
996
1124
|
},
|
|
997
1125
|
set: function (value) {
|
|
1126
|
+
var _this = this;
|
|
998
1127
|
if (this._isEnabled === value) {
|
|
999
1128
|
return;
|
|
1000
1129
|
}
|
|
1001
1130
|
this._isEnabled = value;
|
|
1002
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);
|
|
1003
1148
|
},
|
|
1004
1149
|
enumerable: false,
|
|
1005
1150
|
configurable: true
|
|
1006
1151
|
});
|
|
1007
1152
|
Object.defineProperty(Control.prototype, "disabledColor", {
|
|
1008
|
-
/** Gets or sets background color of control if it's disabled */
|
|
1153
|
+
/** Gets or sets background color of control if it's disabled. Only applies to Button class. */
|
|
1009
1154
|
get: function () {
|
|
1010
1155
|
return this._disabledColor;
|
|
1011
1156
|
},
|
|
@@ -1020,7 +1165,7 @@ var Control = /** @class */ (function () {
|
|
|
1020
1165
|
configurable: true
|
|
1021
1166
|
});
|
|
1022
1167
|
Object.defineProperty(Control.prototype, "disabledColorItem", {
|
|
1023
|
-
/** Gets or sets front color of control if it's disabled */
|
|
1168
|
+
/** Gets or sets front color of control if it's disabled. Only applies to Checkbox class. */
|
|
1024
1169
|
get: function () {
|
|
1025
1170
|
return this._disabledColorItem;
|
|
1026
1171
|
},
|
|
@@ -1052,6 +1197,19 @@ var Control = /** @class */ (function () {
|
|
|
1052
1197
|
}
|
|
1053
1198
|
return this.parent.getAscendantOfClass(className);
|
|
1054
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
|
+
this._markAsDirty(force);
|
|
1206
|
+
};
|
|
1207
|
+
/**
|
|
1208
|
+
* Mark the element and its children as dirty
|
|
1209
|
+
*/
|
|
1210
|
+
Control.prototype.markAllAsDirty = function () {
|
|
1211
|
+
this._markAllAsDirty();
|
|
1212
|
+
};
|
|
1055
1213
|
/** @hidden */
|
|
1056
1214
|
Control.prototype._resetFontCache = function () {
|
|
1057
1215
|
this._fontSet = true;
|
|
@@ -1115,7 +1273,7 @@ var Control = /** @class */ (function () {
|
|
|
1115
1273
|
}
|
|
1116
1274
|
this.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;
|
|
1117
1275
|
this.verticalAlignment = Control.VERTICAL_ALIGNMENT_TOP;
|
|
1118
|
-
var globalViewport = this._host._getGlobalViewport(
|
|
1276
|
+
var globalViewport = this._host._getGlobalViewport();
|
|
1119
1277
|
var projectedPosition = Vector3.Project(position, Matrix.Identity(), scene.getTransformMatrix(), globalViewport);
|
|
1120
1278
|
this._moveToProjectedPosition(projectedPosition);
|
|
1121
1279
|
if (projectedPosition.z < 0 || projectedPosition.z > 1) {
|
|
@@ -1151,7 +1309,7 @@ var Control = /** @class */ (function () {
|
|
|
1151
1309
|
* @see https://doc.babylonjs.com/how_to/gui#tracking-positions
|
|
1152
1310
|
*/
|
|
1153
1311
|
Control.prototype.linkWithMesh = function (mesh) {
|
|
1154
|
-
if (!this._host || this.parent && this.parent !== this._host._rootContainer) {
|
|
1312
|
+
if (!this._host || (this.parent && this.parent !== this._host._rootContainer)) {
|
|
1155
1313
|
if (mesh) {
|
|
1156
1314
|
Tools.Error("Cannot link a control to a mesh if the control is not at root level");
|
|
1157
1315
|
}
|
|
@@ -1174,13 +1332,13 @@ var Control = /** @class */ (function () {
|
|
|
1174
1332
|
this._host._linkedControls.push(this);
|
|
1175
1333
|
};
|
|
1176
1334
|
/**
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1335
|
+
* Shorthand funtion to set the top, right, bottom, and left padding values on the control.
|
|
1336
|
+
* @param { string | number} paddingTop - The value of the top padding.
|
|
1337
|
+
* @param { string | number} paddingRight - The value of the right padding. If omitted, top is used.
|
|
1338
|
+
* @param { string | number} paddingBottom - The value of the bottom padding. If omitted, top is used.
|
|
1339
|
+
* @param { string | number} paddingLeft - The value of the left padding. If omitted, right is used.
|
|
1340
|
+
* @see https://doc.babylonjs.com/how_to/gui#position-and-size
|
|
1341
|
+
*/
|
|
1184
1342
|
Control.prototype.setPadding = function (paddingTop, paddingRight, paddingBottom, paddingLeft) {
|
|
1185
1343
|
var top = paddingTop;
|
|
1186
1344
|
var right = paddingRight !== null && paddingRight !== void 0 ? paddingRight : top;
|
|
@@ -1211,10 +1369,15 @@ var Control = /** @class */ (function () {
|
|
|
1211
1369
|
};
|
|
1212
1370
|
/** @hidden */
|
|
1213
1371
|
Control.prototype._moveToProjectedPosition = function (projectedPosition) {
|
|
1372
|
+
var _a;
|
|
1214
1373
|
var oldLeft = this._left.getValue(this._host);
|
|
1215
1374
|
var oldTop = this._top.getValue(this._host);
|
|
1216
|
-
var
|
|
1217
|
-
|
|
1375
|
+
var parentMeasure = (_a = this.parent) === null || _a === void 0 ? void 0 : _a._currentMeasure;
|
|
1376
|
+
if (parentMeasure) {
|
|
1377
|
+
this._processMeasures(parentMeasure, this._host.getContext());
|
|
1378
|
+
}
|
|
1379
|
+
var newLeft = projectedPosition.x + this._linkOffsetX.getValue(this._host) - this._currentMeasure.width / 2;
|
|
1380
|
+
var newTop = projectedPosition.y + this._linkOffsetY.getValue(this._host) - this._currentMeasure.height / 2;
|
|
1218
1381
|
if (this._left.ignoreAdaptiveScaling && this._top.ignoreAdaptiveScaling) {
|
|
1219
1382
|
if (Math.abs(newLeft - oldLeft) < 0.5) {
|
|
1220
1383
|
newLeft = oldLeft;
|
|
@@ -1249,24 +1412,32 @@ var Control = /** @class */ (function () {
|
|
|
1249
1412
|
// No child
|
|
1250
1413
|
};
|
|
1251
1414
|
/** @hidden */
|
|
1252
|
-
Control.prototype._intersectsRect = function (rect) {
|
|
1253
|
-
//
|
|
1254
|
-
this.
|
|
1255
|
-
if (this.
|
|
1415
|
+
Control.prototype._intersectsRect = function (rect, context) {
|
|
1416
|
+
// make sure we are transformed correctly before checking intersections. no-op if nothing is dirty.
|
|
1417
|
+
this._transform(context);
|
|
1418
|
+
if (this._evaluatedMeasure.left >= rect.left + rect.width) {
|
|
1256
1419
|
return false;
|
|
1257
1420
|
}
|
|
1258
|
-
if (this.
|
|
1421
|
+
if (this._evaluatedMeasure.top >= rect.top + rect.height) {
|
|
1259
1422
|
return false;
|
|
1260
1423
|
}
|
|
1261
|
-
if (this.
|
|
1424
|
+
if (this._evaluatedMeasure.left + this._evaluatedMeasure.width <= rect.left) {
|
|
1262
1425
|
return false;
|
|
1263
1426
|
}
|
|
1264
|
-
if (this.
|
|
1427
|
+
if (this._evaluatedMeasure.top + this._evaluatedMeasure.height <= rect.top) {
|
|
1265
1428
|
return false;
|
|
1266
1429
|
}
|
|
1267
1430
|
return true;
|
|
1268
1431
|
};
|
|
1269
1432
|
/** @hidden */
|
|
1433
|
+
Control.prototype._computeAdditionnalOffsetX = function () {
|
|
1434
|
+
return 0;
|
|
1435
|
+
};
|
|
1436
|
+
/** @hidden */
|
|
1437
|
+
Control.prototype._computeAdditionnalOffsetY = function () {
|
|
1438
|
+
return 0;
|
|
1439
|
+
};
|
|
1440
|
+
/** @hidden */
|
|
1270
1441
|
Control.prototype.invalidateRect = function () {
|
|
1271
1442
|
this._transform();
|
|
1272
1443
|
if (this.host && this.host.useInvalidateRectOptimization) {
|
|
@@ -1275,20 +1446,17 @@ var Control = /** @class */ (function () {
|
|
|
1275
1446
|
// get the boudning box of the current measure and last frames measure in global space and invalidate it
|
|
1276
1447
|
// the previous measure is used to properly clear a control that is scaled down
|
|
1277
1448
|
Measure.CombineToRef(this._tmpMeasureA, this._prevCurrentMeasureTransformedIntoGlobalSpace, this._tmpMeasureA);
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
else {
|
|
1290
|
-
this.host.invalidateRect(Math.floor(this._tmpMeasureA.left), Math.floor(this._tmpMeasureA.top), Math.ceil(this._tmpMeasureA.left + this._tmpMeasureA.width), Math.ceil(this._tmpMeasureA.top + this._tmpMeasureA.height));
|
|
1291
|
-
}
|
|
1449
|
+
// Expand rect based on shadows
|
|
1450
|
+
var shadowOffsetX = this.shadowOffsetX;
|
|
1451
|
+
var shadowOffsetY = this.shadowOffsetY;
|
|
1452
|
+
var shadowBlur = Math.max(this._previousShadowBlur, this.shadowBlur);
|
|
1453
|
+
var leftShadowOffset = Math.min(Math.min(shadowOffsetX, 0) - shadowBlur * 2, 0);
|
|
1454
|
+
var rightShadowOffset = Math.max(Math.max(shadowOffsetX, 0) + shadowBlur * 2, 0);
|
|
1455
|
+
var topShadowOffset = Math.min(Math.min(shadowOffsetY, 0) - shadowBlur * 2, 0);
|
|
1456
|
+
var bottomShadowOffset = Math.max(Math.max(shadowOffsetY, 0) + shadowBlur * 2, 0);
|
|
1457
|
+
var offsetX = this._computeAdditionnalOffsetX();
|
|
1458
|
+
var offsetY = this._computeAdditionnalOffsetY();
|
|
1459
|
+
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));
|
|
1292
1460
|
}
|
|
1293
1461
|
};
|
|
1294
1462
|
/** @hidden */
|
|
@@ -1298,6 +1466,7 @@ var Control = /** @class */ (function () {
|
|
|
1298
1466
|
return;
|
|
1299
1467
|
}
|
|
1300
1468
|
this._isDirty = true;
|
|
1469
|
+
this._markMatrixAsDirty();
|
|
1301
1470
|
// Redraw only this rectangle
|
|
1302
1471
|
if (this._host) {
|
|
1303
1472
|
this._host.markAsDirty();
|
|
@@ -1342,6 +1511,7 @@ var Control = /** @class */ (function () {
|
|
|
1342
1511
|
this._flagDescendantsAsMatrixDirty();
|
|
1343
1512
|
Matrix2D.ComposeToRef(-offsetX, -offsetY, this._rotation, this._scaleX, this._scaleY, this.parent ? this.parent._transformMatrix : null, this._transformMatrix);
|
|
1344
1513
|
this._transformMatrix.invertToRef(this._invertTransformMatrix);
|
|
1514
|
+
this._currentMeasure.transformToRef(this._transformMatrix, this._evaluatedMeasure);
|
|
1345
1515
|
}
|
|
1346
1516
|
};
|
|
1347
1517
|
/** @hidden */
|
|
@@ -1350,8 +1520,8 @@ var Control = /** @class */ (function () {
|
|
|
1350
1520
|
return;
|
|
1351
1521
|
}
|
|
1352
1522
|
context.save();
|
|
1353
|
-
context.strokeStyle =
|
|
1354
|
-
context.lineWidth =
|
|
1523
|
+
context.strokeStyle = this._highlightColor;
|
|
1524
|
+
context.lineWidth = this._highlightLineWidth;
|
|
1355
1525
|
this._renderHighlightSpecific(context);
|
|
1356
1526
|
context.restore();
|
|
1357
1527
|
};
|
|
@@ -1364,6 +1534,9 @@ var Control = /** @class */ (function () {
|
|
|
1364
1534
|
if (this._isFontSizeInPercentage) {
|
|
1365
1535
|
this._fontSet = true;
|
|
1366
1536
|
}
|
|
1537
|
+
if (this._host && this._host.useSmallestIdeal && !this._font) {
|
|
1538
|
+
this._fontSet = true;
|
|
1539
|
+
}
|
|
1367
1540
|
if (this._fontSet) {
|
|
1368
1541
|
this._prepareFont();
|
|
1369
1542
|
this._fontSet = false;
|
|
@@ -1378,7 +1551,7 @@ var Control = /** @class */ (function () {
|
|
|
1378
1551
|
context.globalAlpha *= this._alpha;
|
|
1379
1552
|
}
|
|
1380
1553
|
else if (this._alphaSet) {
|
|
1381
|
-
context.globalAlpha = this.parent ? this.parent.alpha * this._alpha : this._alpha;
|
|
1554
|
+
context.globalAlpha = this.parent && !this.parent.renderToIntermediateTexture ? this.parent.alpha * this._alpha : this._alpha;
|
|
1382
1555
|
}
|
|
1383
1556
|
};
|
|
1384
1557
|
/** @hidden */
|
|
@@ -1388,7 +1561,7 @@ var Control = /** @class */ (function () {
|
|
|
1388
1561
|
}
|
|
1389
1562
|
if (this._isDirty || !this._cachedParentMeasure.isEqualsTo(parentMeasure)) {
|
|
1390
1563
|
this.host._numLayoutCalls++;
|
|
1391
|
-
this._currentMeasure.addAndTransformToRef(this._transformMatrix, -this.
|
|
1564
|
+
this._currentMeasure.addAndTransformToRef(this._transformMatrix, -this._paddingLeftInPixels | 0, -this._paddingTopInPixels | 0, this._paddingRightInPixels | 0, this._paddingBottomInPixels | 0, this._prevCurrentMeasureTransformedIntoGlobalSpace);
|
|
1392
1565
|
context.save();
|
|
1393
1566
|
this._applyStates(context);
|
|
1394
1567
|
var rebuildCount = 0;
|
|
@@ -1398,7 +1571,7 @@ var Control = /** @class */ (function () {
|
|
|
1398
1571
|
rebuildCount++;
|
|
1399
1572
|
} while (this._rebuildLayout && rebuildCount < 3);
|
|
1400
1573
|
if (rebuildCount >= 3) {
|
|
1401
|
-
Logger.Error("Layout cycle detected in GUI (Control name="
|
|
1574
|
+
Logger.Error("Layout cycle detected in GUI (Control name=".concat(this.name, ", uniqueId=").concat(this.uniqueId, ")"));
|
|
1402
1575
|
}
|
|
1403
1576
|
context.restore();
|
|
1404
1577
|
this.invalidateRect();
|
|
@@ -1410,39 +1583,50 @@ var Control = /** @class */ (function () {
|
|
|
1410
1583
|
};
|
|
1411
1584
|
/** @hidden */
|
|
1412
1585
|
Control.prototype._processMeasures = function (parentMeasure, context) {
|
|
1413
|
-
this.
|
|
1586
|
+
this._tempPaddingMeasure.copyFrom(parentMeasure);
|
|
1587
|
+
// Apply padding if in correct mode
|
|
1588
|
+
if (this.parent && this.parent.descendantsOnlyPadding) {
|
|
1589
|
+
this._tempPaddingMeasure.left += this.parent.paddingLeftInPixels;
|
|
1590
|
+
this._tempPaddingMeasure.top += this.parent.paddingTopInPixels;
|
|
1591
|
+
this._tempPaddingMeasure.width -= this.parent.paddingLeftInPixels + this.parent.paddingRightInPixels;
|
|
1592
|
+
this._tempPaddingMeasure.height -= this.parent.paddingTopInPixels + this.parent.paddingBottomInPixels;
|
|
1593
|
+
}
|
|
1594
|
+
this._currentMeasure.copyFrom(this._tempPaddingMeasure);
|
|
1414
1595
|
// Let children take some pre-measurement actions
|
|
1415
|
-
this._preMeasure(
|
|
1596
|
+
this._preMeasure(this._tempPaddingMeasure, context);
|
|
1416
1597
|
this._measure();
|
|
1417
|
-
this._computeAlignment(
|
|
1598
|
+
this._computeAlignment(this._tempPaddingMeasure, context);
|
|
1418
1599
|
// Convert to int values
|
|
1419
1600
|
this._currentMeasure.left = this._currentMeasure.left | 0;
|
|
1420
1601
|
this._currentMeasure.top = this._currentMeasure.top | 0;
|
|
1421
1602
|
this._currentMeasure.width = this._currentMeasure.width | 0;
|
|
1422
1603
|
this._currentMeasure.height = this._currentMeasure.height | 0;
|
|
1423
1604
|
// Let children add more features
|
|
1424
|
-
this._additionalProcessing(
|
|
1425
|
-
this._cachedParentMeasure.copyFrom(
|
|
1605
|
+
this._additionalProcessing(this._tempPaddingMeasure, context);
|
|
1606
|
+
this._cachedParentMeasure.copyFrom(this._tempPaddingMeasure);
|
|
1607
|
+
this._currentMeasure.transformToRef(this._transformMatrix, this._evaluatedMeasure);
|
|
1426
1608
|
if (this.onDirtyObservable.hasObservers()) {
|
|
1427
1609
|
this.onDirtyObservable.notifyObservers(this);
|
|
1428
1610
|
}
|
|
1429
1611
|
};
|
|
1430
1612
|
Control.prototype._evaluateClippingState = function (parentMeasure) {
|
|
1613
|
+
this._currentMeasure.transformToRef(this._transformMatrix, this._evaluatedMeasure);
|
|
1431
1614
|
if (this.parent && this.parent.clipChildren) {
|
|
1615
|
+
parentMeasure.transformToRef(this.parent._transformMatrix, this._evaluatedParentMeasure);
|
|
1432
1616
|
// Early clip
|
|
1433
|
-
if (this.
|
|
1617
|
+
if (this._evaluatedMeasure.left > this._evaluatedParentMeasure.left + this._evaluatedParentMeasure.width) {
|
|
1434
1618
|
this._isClipped = true;
|
|
1435
1619
|
return;
|
|
1436
1620
|
}
|
|
1437
|
-
if (this.
|
|
1621
|
+
if (this._evaluatedMeasure.left + this._evaluatedMeasure.width < this._evaluatedParentMeasure.left) {
|
|
1438
1622
|
this._isClipped = true;
|
|
1439
1623
|
return;
|
|
1440
1624
|
}
|
|
1441
|
-
if (this.
|
|
1625
|
+
if (this._evaluatedMeasure.top > this._evaluatedParentMeasure.top + this._evaluatedParentMeasure.height) {
|
|
1442
1626
|
this._isClipped = true;
|
|
1443
1627
|
return;
|
|
1444
1628
|
}
|
|
1445
|
-
if (this.
|
|
1629
|
+
if (this._evaluatedMeasure.top + this._evaluatedMeasure.height < this._evaluatedParentMeasure.top) {
|
|
1446
1630
|
this._isClipped = true;
|
|
1447
1631
|
return;
|
|
1448
1632
|
}
|
|
@@ -1504,33 +1688,35 @@ var Control = /** @class */ (function () {
|
|
|
1504
1688
|
y = (parentHeight - height) / 2;
|
|
1505
1689
|
break;
|
|
1506
1690
|
}
|
|
1507
|
-
if (this.
|
|
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
|
-
|
|
1691
|
+
if (!this.descendantsOnlyPadding) {
|
|
1692
|
+
if (this._paddingLeft.isPixel) {
|
|
1693
|
+
this._currentMeasure.left += this._paddingLeft.getValue(this._host);
|
|
1694
|
+
this._currentMeasure.width -= this._paddingLeft.getValue(this._host);
|
|
1695
|
+
}
|
|
1696
|
+
else {
|
|
1697
|
+
this._currentMeasure.left += parentWidth * this._paddingLeft.getValue(this._host);
|
|
1698
|
+
this._currentMeasure.width -= parentWidth * this._paddingLeft.getValue(this._host);
|
|
1699
|
+
}
|
|
1700
|
+
if (this._paddingRight.isPixel) {
|
|
1701
|
+
this._currentMeasure.width -= this._paddingRight.getValue(this._host);
|
|
1702
|
+
}
|
|
1703
|
+
else {
|
|
1704
|
+
this._currentMeasure.width -= parentWidth * this._paddingRight.getValue(this._host);
|
|
1705
|
+
}
|
|
1706
|
+
if (this._paddingTop.isPixel) {
|
|
1707
|
+
this._currentMeasure.top += this._paddingTop.getValue(this._host);
|
|
1708
|
+
this._currentMeasure.height -= this._paddingTop.getValue(this._host);
|
|
1709
|
+
}
|
|
1710
|
+
else {
|
|
1711
|
+
this._currentMeasure.top += parentHeight * this._paddingTop.getValue(this._host);
|
|
1712
|
+
this._currentMeasure.height -= parentHeight * this._paddingTop.getValue(this._host);
|
|
1713
|
+
}
|
|
1714
|
+
if (this._paddingBottom.isPixel) {
|
|
1715
|
+
this._currentMeasure.height -= this._paddingBottom.getValue(this._host);
|
|
1716
|
+
}
|
|
1717
|
+
else {
|
|
1718
|
+
this._currentMeasure.height -= parentHeight * this._paddingBottom.getValue(this._host);
|
|
1719
|
+
}
|
|
1534
1720
|
}
|
|
1535
1721
|
if (this._left.isPixel) {
|
|
1536
1722
|
this._currentMeasure.left += this._left.getValue(this._host);
|
|
@@ -1684,7 +1870,8 @@ var Control = /** @class */ (function () {
|
|
|
1684
1870
|
if (this._enterCount > 0) {
|
|
1685
1871
|
return false;
|
|
1686
1872
|
}
|
|
1687
|
-
if (this._enterCount === -1) {
|
|
1873
|
+
if (this._enterCount === -1) {
|
|
1874
|
+
// -1 is for touch input, we are now sure we are with a mouse or pencil
|
|
1688
1875
|
this._enterCount = 0;
|
|
1689
1876
|
}
|
|
1690
1877
|
this._enterCount++;
|
|
@@ -1815,6 +2002,8 @@ var Control = /** @class */ (function () {
|
|
|
1815
2002
|
this._font = this._fontStyle + " " + this._fontWeight + " " + this.fontSizeInPixels + "px " + this._fontFamily;
|
|
1816
2003
|
}
|
|
1817
2004
|
this._fontOffset = Control._GetFontOffset(this._font);
|
|
2005
|
+
//children need to be refreshed
|
|
2006
|
+
this.getDescendants().forEach(function (child) { return child._markAllAsDirty(); });
|
|
1818
2007
|
};
|
|
1819
2008
|
/**
|
|
1820
2009
|
* Serializes the current control
|
|
@@ -1825,7 +2014,7 @@ var Control = /** @class */ (function () {
|
|
|
1825
2014
|
serializationObject.name = this.name;
|
|
1826
2015
|
serializationObject.className = this.getClassName();
|
|
1827
2016
|
if (this._font) {
|
|
1828
|
-
serializationObject.fontFamily = this.
|
|
2017
|
+
serializationObject.fontFamily = this._fontFamily;
|
|
1829
2018
|
serializationObject.fontSize = this.fontSize;
|
|
1830
2019
|
serializationObject.fontWeight = this.fontWeight;
|
|
1831
2020
|
serializationObject.fontStyle = this.fontStyle;
|
|
@@ -1929,30 +2118,11 @@ var Control = /** @class */ (function () {
|
|
|
1929
2118
|
if (Control._FontHeightSizes[font]) {
|
|
1930
2119
|
return Control._FontHeightSizes[font];
|
|
1931
2120
|
}
|
|
1932
|
-
var
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
block.style.width = "1px";
|
|
1938
|
-
block.style.height = "0px";
|
|
1939
|
-
block.style.verticalAlign = "bottom";
|
|
1940
|
-
var div = document.createElement("div");
|
|
1941
|
-
div.style.whiteSpace = "nowrap";
|
|
1942
|
-
div.appendChild(text);
|
|
1943
|
-
div.appendChild(block);
|
|
1944
|
-
document.body.appendChild(div);
|
|
1945
|
-
var fontAscent = 0;
|
|
1946
|
-
var fontHeight = 0;
|
|
1947
|
-
try {
|
|
1948
|
-
fontHeight = block.getBoundingClientRect().top - text.getBoundingClientRect().top;
|
|
1949
|
-
block.style.verticalAlign = "baseline";
|
|
1950
|
-
fontAscent = block.getBoundingClientRect().top - text.getBoundingClientRect().top;
|
|
1951
|
-
}
|
|
1952
|
-
finally {
|
|
1953
|
-
document.body.removeChild(div);
|
|
1954
|
-
}
|
|
1955
|
-
var result = { ascent: fontAscent, height: fontHeight, descent: fontHeight - fontAscent };
|
|
2121
|
+
var engine = EngineStore.LastCreatedEngine;
|
|
2122
|
+
if (!engine) {
|
|
2123
|
+
throw new Error("Invalid engine. Unable to create a canvas.");
|
|
2124
|
+
}
|
|
2125
|
+
var result = engine.getFontOffset(font);
|
|
1956
2126
|
Control._FontHeightSizes[font] = result;
|
|
1957
2127
|
return result;
|
|
1958
2128
|
};
|
|
@@ -2090,6 +2260,9 @@ var Control = /** @class */ (function () {
|
|
|
2090
2260
|
__decorate([
|
|
2091
2261
|
serialize()
|
|
2092
2262
|
], Control.prototype, "isVisible", null);
|
|
2263
|
+
__decorate([
|
|
2264
|
+
serialize()
|
|
2265
|
+
], Control.prototype, "descendantsOnlyPadding", null);
|
|
2093
2266
|
__decorate([
|
|
2094
2267
|
serialize()
|
|
2095
2268
|
], Control.prototype, "paddingLeft", null);
|
|
@@ -2123,8 +2296,14 @@ var Control = /** @class */ (function () {
|
|
|
2123
2296
|
__decorate([
|
|
2124
2297
|
serialize()
|
|
2125
2298
|
], Control.prototype, "disabledColorItem", null);
|
|
2299
|
+
__decorate([
|
|
2300
|
+
serialize()
|
|
2301
|
+
], Control.prototype, "overlapGroup", void 0);
|
|
2302
|
+
__decorate([
|
|
2303
|
+
serialize()
|
|
2304
|
+
], Control.prototype, "overlapDeltaMultiplier", void 0);
|
|
2126
2305
|
return Control;
|
|
2127
2306
|
}());
|
|
2128
2307
|
export { Control };
|
|
2129
|
-
|
|
2308
|
+
RegisterClass("BABYLON.GUI.Control", Control);
|
|
2130
2309
|
//# sourceMappingURL=control.js.map
|