@babylonjs/gui 5.0.0-alpha.6 → 5.0.0-alpha.63
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 +165 -125
- package/2D/advancedDynamicTexture.js +342 -181
- package/2D/advancedDynamicTexture.js.map +1 -1
- package/2D/controls/button.js +10 -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 +93 -15
- package/2D/controls/container.js.map +1 -1
- package/2D/controls/control.d.ts +99 -44
- package/2D/controls/control.js +267 -129
- 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 +4 -2
- package/2D/controls/focusableButton.js +9 -6
- package/2D/controls/focusableButton.js.map +1 -1
- package/2D/controls/focusableControl.d.ts +2 -1
- package/2D/controls/focusableControl.js.map +1 -1
- package/2D/controls/grid.d.ts +13 -2
- package/2D/controls/grid.js +108 -24
- package/2D/controls/grid.js.map +1 -1
- package/2D/controls/image.d.ts +20 -12
- package/2D/controls/image.js +154 -111
- 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 +6 -4
- package/2D/controls/inputText.js +40 -14
- 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 +35 -13
- 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 +9 -8
- package/2D/controls/textBlock.js +30 -20
- 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.js +2 -2
- 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 +7 -83
- 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 +42 -28
- 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 +27 -24
- package/3D/controls/holographicButton.js.map +1 -1
- package/3D/controls/holographicSlate.d.ts +118 -0
- package/3D/controls/holographicSlate.js +360 -0
- package/3D/controls/holographicSlate.js.map +1 -0
- package/3D/controls/index.d.ts +10 -0
- package/3D/controls/index.js +22 -12
- 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 +45 -0
- package/3D/controls/nearMenu.js +111 -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 +43 -0
- package/3D/controls/touchButton3D.js +133 -0
- package/3D/controls/touchButton3D.js.map +1 -0
- package/3D/controls/touchHolographicButton.d.ts +100 -0
- package/3D/controls/touchHolographicButton.js +408 -0
- package/3D/controls/touchHolographicButton.js.map +1 -0
- 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 +22 -0
- package/3D/controls/touchMeshButton3D.js +63 -0
- package/3D/controls/touchMeshButton3D.js.map +1 -0
- package/3D/controls/touchToggleButton3D.d.ts +35 -0
- package/3D/controls/touchToggleButton3D.js +60 -0
- package/3D/controls/touchToggleButton3D.js.map +1 -0
- 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 +19 -0
- package/3D/gui3DManager.js +73 -13
- 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 +126 -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 { Engine } from "@babylonjs/core/Engines/engine.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._descendentsOnlyPadding = 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,20 @@ 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
|
+
});
|
|
182
206
|
Object.defineProperty(Control.prototype, "shadowOffsetX", {
|
|
183
207
|
/** Gets or sets a value indicating the offset to apply on X axis to render the shadow */
|
|
184
208
|
get: function () {
|
|
@@ -218,6 +242,7 @@ var Control = /** @class */ (function () {
|
|
|
218
242
|
if (this._shadowBlur === value) {
|
|
219
243
|
return;
|
|
220
244
|
}
|
|
245
|
+
this._previousShadowBlur = this._shadowBlur;
|
|
221
246
|
this._shadowBlur = value;
|
|
222
247
|
this._markAsDirty();
|
|
223
248
|
},
|
|
@@ -292,6 +317,23 @@ var Control = /** @class */ (function () {
|
|
|
292
317
|
enumerable: false,
|
|
293
318
|
configurable: true
|
|
294
319
|
});
|
|
320
|
+
Object.defineProperty(Control.prototype, "highlightLineWidth", {
|
|
321
|
+
/**
|
|
322
|
+
* Gets or sets a number indicating size of stroke we want to highlight the control with (mostly for debugging purpose)
|
|
323
|
+
*/
|
|
324
|
+
get: function () {
|
|
325
|
+
return this._highlightLineWidth;
|
|
326
|
+
},
|
|
327
|
+
set: function (value) {
|
|
328
|
+
if (this._highlightLineWidth === value) {
|
|
329
|
+
return;
|
|
330
|
+
}
|
|
331
|
+
this._highlightLineWidth = value;
|
|
332
|
+
this._markAsDirty();
|
|
333
|
+
},
|
|
334
|
+
enumerable: false,
|
|
335
|
+
configurable: true
|
|
336
|
+
});
|
|
295
337
|
Object.defineProperty(Control.prototype, "isHighlighted", {
|
|
296
338
|
/**
|
|
297
339
|
* Gets or sets a boolean indicating that we want to highlight the control (mostly for debugging purpose)
|
|
@@ -309,10 +351,27 @@ var Control = /** @class */ (function () {
|
|
|
309
351
|
enumerable: false,
|
|
310
352
|
configurable: true
|
|
311
353
|
});
|
|
354
|
+
Object.defineProperty(Control.prototype, "highlightColor", {
|
|
355
|
+
/**
|
|
356
|
+
* Gets or sets a string defining the color to use for highlighting this control
|
|
357
|
+
*/
|
|
358
|
+
get: function () {
|
|
359
|
+
return this._highlightColor;
|
|
360
|
+
},
|
|
361
|
+
set: function (value) {
|
|
362
|
+
if (this._highlightColor === value) {
|
|
363
|
+
return;
|
|
364
|
+
}
|
|
365
|
+
this._highlightColor = value;
|
|
366
|
+
this._markAsDirty();
|
|
367
|
+
},
|
|
368
|
+
enumerable: false,
|
|
369
|
+
configurable: true
|
|
370
|
+
});
|
|
312
371
|
Object.defineProperty(Control.prototype, "scaleX", {
|
|
313
372
|
/** Gets or sets a value indicating the scale factor on X axis (1 by default)
|
|
314
373
|
* @see https://doc.babylonjs.com/how_to/gui#rotation-and-scaling
|
|
315
|
-
|
|
374
|
+
*/
|
|
316
375
|
get: function () {
|
|
317
376
|
return this._scaleX;
|
|
318
377
|
},
|
|
@@ -330,7 +389,7 @@ var Control = /** @class */ (function () {
|
|
|
330
389
|
Object.defineProperty(Control.prototype, "scaleY", {
|
|
331
390
|
/** Gets or sets a value indicating the scale factor on Y axis (1 by default)
|
|
332
391
|
* @see https://doc.babylonjs.com/how_to/gui#rotation-and-scaling
|
|
333
|
-
|
|
392
|
+
*/
|
|
334
393
|
get: function () {
|
|
335
394
|
return this._scaleY;
|
|
336
395
|
},
|
|
@@ -348,7 +407,7 @@ var Control = /** @class */ (function () {
|
|
|
348
407
|
Object.defineProperty(Control.prototype, "rotation", {
|
|
349
408
|
/** Gets or sets the rotation angle (0 by default)
|
|
350
409
|
* @see https://doc.babylonjs.com/how_to/gui#rotation-and-scaling
|
|
351
|
-
|
|
410
|
+
*/
|
|
352
411
|
get: function () {
|
|
353
412
|
return this._rotation;
|
|
354
413
|
},
|
|
@@ -366,7 +425,7 @@ var Control = /** @class */ (function () {
|
|
|
366
425
|
Object.defineProperty(Control.prototype, "transformCenterY", {
|
|
367
426
|
/** Gets or sets the transformation center on Y axis (0 by default)
|
|
368
427
|
* @see https://doc.babylonjs.com/how_to/gui#rotation-and-scaling
|
|
369
|
-
|
|
428
|
+
*/
|
|
370
429
|
get: function () {
|
|
371
430
|
return this._transformCenterY;
|
|
372
431
|
},
|
|
@@ -384,7 +443,7 @@ var Control = /** @class */ (function () {
|
|
|
384
443
|
Object.defineProperty(Control.prototype, "transformCenterX", {
|
|
385
444
|
/** Gets or sets the transformation center on X axis (0 by default)
|
|
386
445
|
* @see https://doc.babylonjs.com/how_to/gui#rotation-and-scaling
|
|
387
|
-
|
|
446
|
+
*/
|
|
388
447
|
get: function () {
|
|
389
448
|
return this._transformCenterX;
|
|
390
449
|
},
|
|
@@ -514,9 +573,6 @@ var Control = /** @class */ (function () {
|
|
|
514
573
|
Object.defineProperty(Control.prototype, "fontFamily", {
|
|
515
574
|
/** Gets or set font family */
|
|
516
575
|
get: function () {
|
|
517
|
-
if (!this._fontSet) {
|
|
518
|
-
return "";
|
|
519
|
-
}
|
|
520
576
|
return this._fontFamily;
|
|
521
577
|
},
|
|
522
578
|
set: function (value) {
|
|
@@ -709,6 +765,24 @@ var Control = /** @class */ (function () {
|
|
|
709
765
|
enumerable: false,
|
|
710
766
|
configurable: true
|
|
711
767
|
});
|
|
768
|
+
Object.defineProperty(Control.prototype, "descendentsOnlyPadding", {
|
|
769
|
+
/**
|
|
770
|
+
* Gets or sets a value indicating the padding should work like in CSS.
|
|
771
|
+
* Basically, it will add the padding amount on each side of the parent control for its children.
|
|
772
|
+
*/
|
|
773
|
+
get: function () {
|
|
774
|
+
return this._descendentsOnlyPadding;
|
|
775
|
+
},
|
|
776
|
+
set: function (value) {
|
|
777
|
+
if (this._descendentsOnlyPadding === value) {
|
|
778
|
+
return;
|
|
779
|
+
}
|
|
780
|
+
this._descendentsOnlyPadding = value;
|
|
781
|
+
this._markAsDirty();
|
|
782
|
+
},
|
|
783
|
+
enumerable: false,
|
|
784
|
+
configurable: true
|
|
785
|
+
});
|
|
712
786
|
Object.defineProperty(Control.prototype, "paddingLeft", {
|
|
713
787
|
/**
|
|
714
788
|
* Gets or sets a value indicating the padding to use on the left of the control
|
|
@@ -742,6 +816,17 @@ var Control = /** @class */ (function () {
|
|
|
742
816
|
enumerable: false,
|
|
743
817
|
configurable: true
|
|
744
818
|
});
|
|
819
|
+
Object.defineProperty(Control.prototype, "_paddingLeftInPixels", {
|
|
820
|
+
/** @hidden */
|
|
821
|
+
get: function () {
|
|
822
|
+
if (this._descendentsOnlyPadding) {
|
|
823
|
+
return 0;
|
|
824
|
+
}
|
|
825
|
+
return this.paddingLeftInPixels;
|
|
826
|
+
},
|
|
827
|
+
enumerable: false,
|
|
828
|
+
configurable: true
|
|
829
|
+
});
|
|
745
830
|
Object.defineProperty(Control.prototype, "paddingRight", {
|
|
746
831
|
/**
|
|
747
832
|
* Gets or sets a value indicating the padding to use on the right of the control
|
|
@@ -775,6 +860,17 @@ var Control = /** @class */ (function () {
|
|
|
775
860
|
enumerable: false,
|
|
776
861
|
configurable: true
|
|
777
862
|
});
|
|
863
|
+
Object.defineProperty(Control.prototype, "_paddingRightInPixels", {
|
|
864
|
+
/** @hidden */
|
|
865
|
+
get: function () {
|
|
866
|
+
if (this._descendentsOnlyPadding) {
|
|
867
|
+
return 0;
|
|
868
|
+
}
|
|
869
|
+
return this.paddingRightInPixels;
|
|
870
|
+
},
|
|
871
|
+
enumerable: false,
|
|
872
|
+
configurable: true
|
|
873
|
+
});
|
|
778
874
|
Object.defineProperty(Control.prototype, "paddingTop", {
|
|
779
875
|
/**
|
|
780
876
|
* Gets or sets a value indicating the padding to use on the top of the control
|
|
@@ -808,6 +904,17 @@ var Control = /** @class */ (function () {
|
|
|
808
904
|
enumerable: false,
|
|
809
905
|
configurable: true
|
|
810
906
|
});
|
|
907
|
+
Object.defineProperty(Control.prototype, "_paddingTopInPixels", {
|
|
908
|
+
/** @hidden */
|
|
909
|
+
get: function () {
|
|
910
|
+
if (this._descendentsOnlyPadding) {
|
|
911
|
+
return 0;
|
|
912
|
+
}
|
|
913
|
+
return this.paddingTopInPixels;
|
|
914
|
+
},
|
|
915
|
+
enumerable: false,
|
|
916
|
+
configurable: true
|
|
917
|
+
});
|
|
811
918
|
Object.defineProperty(Control.prototype, "paddingBottom", {
|
|
812
919
|
/**
|
|
813
920
|
* Gets or sets a value indicating the padding to use on the bottom of the control
|
|
@@ -841,6 +948,17 @@ var Control = /** @class */ (function () {
|
|
|
841
948
|
enumerable: false,
|
|
842
949
|
configurable: true
|
|
843
950
|
});
|
|
951
|
+
Object.defineProperty(Control.prototype, "_paddingBottomInPixels", {
|
|
952
|
+
/** @hidden */
|
|
953
|
+
get: function () {
|
|
954
|
+
if (this._descendentsOnlyPadding) {
|
|
955
|
+
return 0;
|
|
956
|
+
}
|
|
957
|
+
return this.paddingBottomInPixels;
|
|
958
|
+
},
|
|
959
|
+
enumerable: false,
|
|
960
|
+
configurable: true
|
|
961
|
+
});
|
|
844
962
|
Object.defineProperty(Control.prototype, "left", {
|
|
845
963
|
/**
|
|
846
964
|
* Gets or sets a value indicating the left coordinate of the control
|
|
@@ -1115,7 +1233,7 @@ var Control = /** @class */ (function () {
|
|
|
1115
1233
|
}
|
|
1116
1234
|
this.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;
|
|
1117
1235
|
this.verticalAlignment = Control.VERTICAL_ALIGNMENT_TOP;
|
|
1118
|
-
var globalViewport = this._host._getGlobalViewport(
|
|
1236
|
+
var globalViewport = this._host._getGlobalViewport();
|
|
1119
1237
|
var projectedPosition = Vector3.Project(position, Matrix.Identity(), scene.getTransformMatrix(), globalViewport);
|
|
1120
1238
|
this._moveToProjectedPosition(projectedPosition);
|
|
1121
1239
|
if (projectedPosition.z < 0 || projectedPosition.z > 1) {
|
|
@@ -1151,7 +1269,7 @@ var Control = /** @class */ (function () {
|
|
|
1151
1269
|
* @see https://doc.babylonjs.com/how_to/gui#tracking-positions
|
|
1152
1270
|
*/
|
|
1153
1271
|
Control.prototype.linkWithMesh = function (mesh) {
|
|
1154
|
-
if (!this._host || this.parent && this.parent !== this._host._rootContainer) {
|
|
1272
|
+
if (!this._host || (this.parent && this.parent !== this._host._rootContainer)) {
|
|
1155
1273
|
if (mesh) {
|
|
1156
1274
|
Tools.Error("Cannot link a control to a mesh if the control is not at root level");
|
|
1157
1275
|
}
|
|
@@ -1174,13 +1292,13 @@ var Control = /** @class */ (function () {
|
|
|
1174
1292
|
this._host._linkedControls.push(this);
|
|
1175
1293
|
};
|
|
1176
1294
|
/**
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1295
|
+
* Shorthand funtion to set the top, right, bottom, and left padding values on the control.
|
|
1296
|
+
* @param { string | number} paddingTop - The value of the top padding.
|
|
1297
|
+
* @param { string | number} paddingRight - The value of the right padding. If omitted, top is used.
|
|
1298
|
+
* @param { string | number} paddingBottom - The value of the bottom padding. If omitted, top is used.
|
|
1299
|
+
* @param { string | number} paddingLeft - The value of the left padding. If omitted, right is used.
|
|
1300
|
+
* @see https://doc.babylonjs.com/how_to/gui#position-and-size
|
|
1301
|
+
*/
|
|
1184
1302
|
Control.prototype.setPadding = function (paddingTop, paddingRight, paddingBottom, paddingLeft) {
|
|
1185
1303
|
var top = paddingTop;
|
|
1186
1304
|
var right = paddingRight !== null && paddingRight !== void 0 ? paddingRight : top;
|
|
@@ -1211,10 +1329,17 @@ var Control = /** @class */ (function () {
|
|
|
1211
1329
|
};
|
|
1212
1330
|
/** @hidden */
|
|
1213
1331
|
Control.prototype._moveToProjectedPosition = function (projectedPosition) {
|
|
1332
|
+
var _a;
|
|
1214
1333
|
var oldLeft = this._left.getValue(this._host);
|
|
1215
1334
|
var oldTop = this._top.getValue(this._host);
|
|
1216
|
-
|
|
1217
|
-
|
|
1335
|
+
if (this._currentMeasure.width === 0 && this._currentMeasure.height === 0) {
|
|
1336
|
+
var parentMeasure = (_a = this.parent) === null || _a === void 0 ? void 0 : _a._currentMeasure;
|
|
1337
|
+
if (parentMeasure) {
|
|
1338
|
+
this._processMeasures(parentMeasure, this._host.getContext());
|
|
1339
|
+
}
|
|
1340
|
+
}
|
|
1341
|
+
var newLeft = projectedPosition.x + this._linkOffsetX.getValue(this._host) - this._currentMeasure.width / 2;
|
|
1342
|
+
var newTop = projectedPosition.y + this._linkOffsetY.getValue(this._host) - this._currentMeasure.height / 2;
|
|
1218
1343
|
if (this._left.ignoreAdaptiveScaling && this._top.ignoreAdaptiveScaling) {
|
|
1219
1344
|
if (Math.abs(newLeft - oldLeft) < 0.5) {
|
|
1220
1345
|
newLeft = oldLeft;
|
|
@@ -1267,6 +1392,14 @@ var Control = /** @class */ (function () {
|
|
|
1267
1392
|
return true;
|
|
1268
1393
|
};
|
|
1269
1394
|
/** @hidden */
|
|
1395
|
+
Control.prototype._computeAdditionnalOffsetX = function () {
|
|
1396
|
+
return 0;
|
|
1397
|
+
};
|
|
1398
|
+
/** @hidden */
|
|
1399
|
+
Control.prototype._computeAdditionnalOffsetY = function () {
|
|
1400
|
+
return 0;
|
|
1401
|
+
};
|
|
1402
|
+
/** @hidden */
|
|
1270
1403
|
Control.prototype.invalidateRect = function () {
|
|
1271
1404
|
this._transform();
|
|
1272
1405
|
if (this.host && this.host.useInvalidateRectOptimization) {
|
|
@@ -1275,20 +1408,17 @@ var Control = /** @class */ (function () {
|
|
|
1275
1408
|
// get the boudning box of the current measure and last frames measure in global space and invalidate it
|
|
1276
1409
|
// the previous measure is used to properly clear a control that is scaled down
|
|
1277
1410
|
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
|
-
}
|
|
1411
|
+
// Expand rect based on shadows
|
|
1412
|
+
var shadowOffsetX = this.shadowOffsetX;
|
|
1413
|
+
var shadowOffsetY = this.shadowOffsetY;
|
|
1414
|
+
var shadowBlur = Math.max(this._previousShadowBlur, this.shadowBlur);
|
|
1415
|
+
var leftShadowOffset = Math.min(Math.min(shadowOffsetX, 0) - shadowBlur * 2, 0);
|
|
1416
|
+
var rightShadowOffset = Math.max(Math.max(shadowOffsetX, 0) + shadowBlur * 2, 0);
|
|
1417
|
+
var topShadowOffset = Math.min(Math.min(shadowOffsetY, 0) - shadowBlur * 2, 0);
|
|
1418
|
+
var bottomShadowOffset = Math.max(Math.max(shadowOffsetY, 0) + shadowBlur * 2, 0);
|
|
1419
|
+
var offsetX = this._computeAdditionnalOffsetX();
|
|
1420
|
+
var offsetY = this._computeAdditionnalOffsetY();
|
|
1421
|
+
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
1422
|
}
|
|
1293
1423
|
};
|
|
1294
1424
|
/** @hidden */
|
|
@@ -1350,8 +1480,8 @@ var Control = /** @class */ (function () {
|
|
|
1350
1480
|
return;
|
|
1351
1481
|
}
|
|
1352
1482
|
context.save();
|
|
1353
|
-
context.strokeStyle =
|
|
1354
|
-
context.lineWidth =
|
|
1483
|
+
context.strokeStyle = this._highlightColor;
|
|
1484
|
+
context.lineWidth = this._highlightLineWidth;
|
|
1355
1485
|
this._renderHighlightSpecific(context);
|
|
1356
1486
|
context.restore();
|
|
1357
1487
|
};
|
|
@@ -1364,6 +1494,9 @@ var Control = /** @class */ (function () {
|
|
|
1364
1494
|
if (this._isFontSizeInPercentage) {
|
|
1365
1495
|
this._fontSet = true;
|
|
1366
1496
|
}
|
|
1497
|
+
if (this._host && this._host.useSmallestIdeal && !this._font) {
|
|
1498
|
+
this._fontSet = true;
|
|
1499
|
+
}
|
|
1367
1500
|
if (this._fontSet) {
|
|
1368
1501
|
this._prepareFont();
|
|
1369
1502
|
this._fontSet = false;
|
|
@@ -1378,7 +1511,7 @@ var Control = /** @class */ (function () {
|
|
|
1378
1511
|
context.globalAlpha *= this._alpha;
|
|
1379
1512
|
}
|
|
1380
1513
|
else if (this._alphaSet) {
|
|
1381
|
-
context.globalAlpha = this.parent ? this.parent.alpha * this._alpha : this._alpha;
|
|
1514
|
+
context.globalAlpha = this.parent && !this.parent.renderToIntermediateTexture ? this.parent.alpha * this._alpha : this._alpha;
|
|
1382
1515
|
}
|
|
1383
1516
|
};
|
|
1384
1517
|
/** @hidden */
|
|
@@ -1388,7 +1521,7 @@ var Control = /** @class */ (function () {
|
|
|
1388
1521
|
}
|
|
1389
1522
|
if (this._isDirty || !this._cachedParentMeasure.isEqualsTo(parentMeasure)) {
|
|
1390
1523
|
this.host._numLayoutCalls++;
|
|
1391
|
-
this._currentMeasure.addAndTransformToRef(this._transformMatrix, -this.
|
|
1524
|
+
this._currentMeasure.addAndTransformToRef(this._transformMatrix, -this._paddingLeftInPixels | 0, -this._paddingTopInPixels | 0, this._paddingRightInPixels | 0, this._paddingBottomInPixels | 0, this._prevCurrentMeasureTransformedIntoGlobalSpace);
|
|
1392
1525
|
context.save();
|
|
1393
1526
|
this._applyStates(context);
|
|
1394
1527
|
var rebuildCount = 0;
|
|
@@ -1410,39 +1543,49 @@ var Control = /** @class */ (function () {
|
|
|
1410
1543
|
};
|
|
1411
1544
|
/** @hidden */
|
|
1412
1545
|
Control.prototype._processMeasures = function (parentMeasure, context) {
|
|
1413
|
-
this.
|
|
1546
|
+
this._tempPaddingMeasure.copyFrom(parentMeasure);
|
|
1547
|
+
// Apply padding if in correct mode
|
|
1548
|
+
if (this.parent && this.parent.descendentsOnlyPadding) {
|
|
1549
|
+
this._tempPaddingMeasure.left += this.parent.paddingLeftInPixels;
|
|
1550
|
+
this._tempPaddingMeasure.top += this.parent.paddingTopInPixels;
|
|
1551
|
+
this._tempPaddingMeasure.width -= this.parent.paddingLeftInPixels + this.parent.paddingRightInPixels;
|
|
1552
|
+
this._tempPaddingMeasure.height -= this.parent.paddingTopInPixels + this.parent.paddingBottomInPixels;
|
|
1553
|
+
}
|
|
1554
|
+
this._currentMeasure.copyFrom(this._tempPaddingMeasure);
|
|
1414
1555
|
// Let children take some pre-measurement actions
|
|
1415
|
-
this._preMeasure(
|
|
1556
|
+
this._preMeasure(this._tempPaddingMeasure, context);
|
|
1416
1557
|
this._measure();
|
|
1417
|
-
this._computeAlignment(
|
|
1558
|
+
this._computeAlignment(this._tempPaddingMeasure, context);
|
|
1418
1559
|
// Convert to int values
|
|
1419
1560
|
this._currentMeasure.left = this._currentMeasure.left | 0;
|
|
1420
1561
|
this._currentMeasure.top = this._currentMeasure.top | 0;
|
|
1421
1562
|
this._currentMeasure.width = this._currentMeasure.width | 0;
|
|
1422
1563
|
this._currentMeasure.height = this._currentMeasure.height | 0;
|
|
1423
1564
|
// Let children add more features
|
|
1424
|
-
this._additionalProcessing(
|
|
1425
|
-
this._cachedParentMeasure.copyFrom(
|
|
1565
|
+
this._additionalProcessing(this._tempPaddingMeasure, context);
|
|
1566
|
+
this._cachedParentMeasure.copyFrom(this._tempPaddingMeasure);
|
|
1426
1567
|
if (this.onDirtyObservable.hasObservers()) {
|
|
1427
1568
|
this.onDirtyObservable.notifyObservers(this);
|
|
1428
1569
|
}
|
|
1429
1570
|
};
|
|
1430
1571
|
Control.prototype._evaluateClippingState = function (parentMeasure) {
|
|
1572
|
+
this._currentMeasure.transformToRef(this._transformMatrix, this._evaluatedMeasure);
|
|
1431
1573
|
if (this.parent && this.parent.clipChildren) {
|
|
1574
|
+
parentMeasure.transformToRef(this.parent._transformMatrix, this._evaluatedParentMeasure);
|
|
1432
1575
|
// Early clip
|
|
1433
|
-
if (this.
|
|
1576
|
+
if (this._evaluatedMeasure.left > this._evaluatedParentMeasure.left + this._evaluatedParentMeasure.width) {
|
|
1434
1577
|
this._isClipped = true;
|
|
1435
1578
|
return;
|
|
1436
1579
|
}
|
|
1437
|
-
if (this.
|
|
1580
|
+
if (this._evaluatedMeasure.left + this._evaluatedMeasure.width < this._evaluatedParentMeasure.left) {
|
|
1438
1581
|
this._isClipped = true;
|
|
1439
1582
|
return;
|
|
1440
1583
|
}
|
|
1441
|
-
if (this.
|
|
1584
|
+
if (this._evaluatedMeasure.top > this._evaluatedParentMeasure.top + this._evaluatedParentMeasure.height) {
|
|
1442
1585
|
this._isClipped = true;
|
|
1443
1586
|
return;
|
|
1444
1587
|
}
|
|
1445
|
-
if (this.
|
|
1588
|
+
if (this._evaluatedMeasure.top + this._evaluatedMeasure.height < this._evaluatedParentMeasure.top) {
|
|
1446
1589
|
this._isClipped = true;
|
|
1447
1590
|
return;
|
|
1448
1591
|
}
|
|
@@ -1504,33 +1647,35 @@ var Control = /** @class */ (function () {
|
|
|
1504
1647
|
y = (parentHeight - height) / 2;
|
|
1505
1648
|
break;
|
|
1506
1649
|
}
|
|
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
|
-
|
|
1650
|
+
if (!this.descendentsOnlyPadding) {
|
|
1651
|
+
if (this._paddingLeft.isPixel) {
|
|
1652
|
+
this._currentMeasure.left += this._paddingLeft.getValue(this._host);
|
|
1653
|
+
this._currentMeasure.width -= this._paddingLeft.getValue(this._host);
|
|
1654
|
+
}
|
|
1655
|
+
else {
|
|
1656
|
+
this._currentMeasure.left += parentWidth * this._paddingLeft.getValue(this._host);
|
|
1657
|
+
this._currentMeasure.width -= parentWidth * this._paddingLeft.getValue(this._host);
|
|
1658
|
+
}
|
|
1659
|
+
if (this._paddingRight.isPixel) {
|
|
1660
|
+
this._currentMeasure.width -= this._paddingRight.getValue(this._host);
|
|
1661
|
+
}
|
|
1662
|
+
else {
|
|
1663
|
+
this._currentMeasure.width -= parentWidth * this._paddingRight.getValue(this._host);
|
|
1664
|
+
}
|
|
1665
|
+
if (this._paddingTop.isPixel) {
|
|
1666
|
+
this._currentMeasure.top += this._paddingTop.getValue(this._host);
|
|
1667
|
+
this._currentMeasure.height -= this._paddingTop.getValue(this._host);
|
|
1668
|
+
}
|
|
1669
|
+
else {
|
|
1670
|
+
this._currentMeasure.top += parentHeight * this._paddingTop.getValue(this._host);
|
|
1671
|
+
this._currentMeasure.height -= parentHeight * this._paddingTop.getValue(this._host);
|
|
1672
|
+
}
|
|
1673
|
+
if (this._paddingBottom.isPixel) {
|
|
1674
|
+
this._currentMeasure.height -= this._paddingBottom.getValue(this._host);
|
|
1675
|
+
}
|
|
1676
|
+
else {
|
|
1677
|
+
this._currentMeasure.height -= parentHeight * this._paddingBottom.getValue(this._host);
|
|
1678
|
+
}
|
|
1534
1679
|
}
|
|
1535
1680
|
if (this._left.isPixel) {
|
|
1536
1681
|
this._currentMeasure.left += this._left.getValue(this._host);
|
|
@@ -1684,7 +1829,8 @@ var Control = /** @class */ (function () {
|
|
|
1684
1829
|
if (this._enterCount > 0) {
|
|
1685
1830
|
return false;
|
|
1686
1831
|
}
|
|
1687
|
-
if (this._enterCount === -1) {
|
|
1832
|
+
if (this._enterCount === -1) {
|
|
1833
|
+
// -1 is for touch input, we are now sure we are with a mouse or pencil
|
|
1688
1834
|
this._enterCount = 0;
|
|
1689
1835
|
}
|
|
1690
1836
|
this._enterCount++;
|
|
@@ -1815,6 +1961,8 @@ var Control = /** @class */ (function () {
|
|
|
1815
1961
|
this._font = this._fontStyle + " " + this._fontWeight + " " + this.fontSizeInPixels + "px " + this._fontFamily;
|
|
1816
1962
|
}
|
|
1817
1963
|
this._fontOffset = Control._GetFontOffset(this._font);
|
|
1964
|
+
//children need to be refreshed
|
|
1965
|
+
this.getDescendants().forEach(function (child) { return child._markAllAsDirty(); });
|
|
1818
1966
|
};
|
|
1819
1967
|
/**
|
|
1820
1968
|
* Serializes the current control
|
|
@@ -1825,7 +1973,7 @@ var Control = /** @class */ (function () {
|
|
|
1825
1973
|
serializationObject.name = this.name;
|
|
1826
1974
|
serializationObject.className = this.getClassName();
|
|
1827
1975
|
if (this._font) {
|
|
1828
|
-
serializationObject.fontFamily = this.
|
|
1976
|
+
serializationObject.fontFamily = this._fontFamily;
|
|
1829
1977
|
serializationObject.fontSize = this.fontSize;
|
|
1830
1978
|
serializationObject.fontWeight = this.fontWeight;
|
|
1831
1979
|
serializationObject.fontStyle = this.fontStyle;
|
|
@@ -1929,30 +2077,11 @@ var Control = /** @class */ (function () {
|
|
|
1929
2077
|
if (Control._FontHeightSizes[font]) {
|
|
1930
2078
|
return Control._FontHeightSizes[font];
|
|
1931
2079
|
}
|
|
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 };
|
|
2080
|
+
var engine = Engine.LastCreatedEngine;
|
|
2081
|
+
if (!engine) {
|
|
2082
|
+
throw new Error("Invalid engine. Unable to create a canvas.");
|
|
2083
|
+
}
|
|
2084
|
+
var result = engine.getFontOffset(font);
|
|
1956
2085
|
Control._FontHeightSizes[font] = result;
|
|
1957
2086
|
return result;
|
|
1958
2087
|
};
|
|
@@ -2090,6 +2219,9 @@ var Control = /** @class */ (function () {
|
|
|
2090
2219
|
__decorate([
|
|
2091
2220
|
serialize()
|
|
2092
2221
|
], Control.prototype, "isVisible", null);
|
|
2222
|
+
__decorate([
|
|
2223
|
+
serialize()
|
|
2224
|
+
], Control.prototype, "descendentsOnlyPadding", null);
|
|
2093
2225
|
__decorate([
|
|
2094
2226
|
serialize()
|
|
2095
2227
|
], Control.prototype, "paddingLeft", null);
|
|
@@ -2123,8 +2255,14 @@ var Control = /** @class */ (function () {
|
|
|
2123
2255
|
__decorate([
|
|
2124
2256
|
serialize()
|
|
2125
2257
|
], Control.prototype, "disabledColorItem", null);
|
|
2258
|
+
__decorate([
|
|
2259
|
+
serialize()
|
|
2260
|
+
], Control.prototype, "overlapGroup", void 0);
|
|
2261
|
+
__decorate([
|
|
2262
|
+
serialize()
|
|
2263
|
+
], Control.prototype, "overlapDeltaMultiplier", void 0);
|
|
2126
2264
|
return Control;
|
|
2127
2265
|
}());
|
|
2128
2266
|
export { Control };
|
|
2129
|
-
|
|
2267
|
+
RegisterClass("BABYLON.GUI.Control", Control);
|
|
2130
2268
|
//# sourceMappingURL=control.js.map
|