@babylonjs/gui 5.0.0-alpha.6 → 5.0.0-alpha.60
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 +26 -4
- package/2D/advancedDynamicTexture.js +107 -47
- 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 +89 -11
- package/2D/controls/container.js.map +1 -1
- package/2D/controls/control.d.ts +40 -15
- package/2D/controls/control.js +103 -59
- 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 +11 -2
- package/2D/controls/grid.js +63 -6
- 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 +39 -13
- 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 +3 -2
- package/2D/controls/stackPanel.js +6 -6
- 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 +25 -15
- 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/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 +8 -7
- package/3D/controls/control3D.js +39 -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 +147 -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 +9 -0
- package/3D/gui3DManager.js +30 -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 '@babylonjs/core/Events/pointerEvents';
|
|
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 '@babylonjs/core/Misc/decorators';
|
|
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
|
|
@@ -74,6 +75,8 @@ var Control = /** @class */ (function () {
|
|
|
74
75
|
this._isMatrixDirty = true;
|
|
75
76
|
this._isVisible = true;
|
|
76
77
|
this._isHighlighted = false;
|
|
78
|
+
this._highlightColor = "#4affff";
|
|
79
|
+
this._highlightLineWidth = 2;
|
|
77
80
|
this._fontSet = false;
|
|
78
81
|
this._dummyVector2 = Vector2.Zero();
|
|
79
82
|
this._downCount = 0;
|
|
@@ -83,6 +86,7 @@ var Control = /** @class */ (function () {
|
|
|
83
86
|
this._isEnabled = true;
|
|
84
87
|
this._disabledColor = "#9a9a9a";
|
|
85
88
|
this._disabledColorItem = "#6a6a6a";
|
|
89
|
+
this._isReadOnly = false;
|
|
86
90
|
/** @hidden */
|
|
87
91
|
this._rebuildLayout = false;
|
|
88
92
|
/** @hidden */
|
|
@@ -118,6 +122,7 @@ var Control = /** @class */ (function () {
|
|
|
118
122
|
this._shadowOffsetX = 0;
|
|
119
123
|
this._shadowOffsetY = 0;
|
|
120
124
|
this._shadowBlur = 0;
|
|
125
|
+
this._previousShadowBlur = 0;
|
|
121
126
|
this._shadowColor = 'black';
|
|
122
127
|
/** Gets or sets the cursor to use when the control is hovered */
|
|
123
128
|
this.hoverCursor = "";
|
|
@@ -130,11 +135,11 @@ var Control = /** @class */ (function () {
|
|
|
130
135
|
*/
|
|
131
136
|
this.onWheelObservable = new Observable();
|
|
132
137
|
/**
|
|
133
|
-
* An event triggered when the pointer
|
|
138
|
+
* An event triggered when the pointer moves over the control.
|
|
134
139
|
*/
|
|
135
140
|
this.onPointerMoveObservable = new Observable();
|
|
136
141
|
/**
|
|
137
|
-
* An event triggered when the pointer
|
|
142
|
+
* An event triggered when the pointer moves out of the control.
|
|
138
143
|
*/
|
|
139
144
|
this.onPointerOutObservable = new Observable();
|
|
140
145
|
/**
|
|
@@ -179,6 +184,20 @@ var Control = /** @class */ (function () {
|
|
|
179
184
|
this._fixedRatioMasterIsWidth = true;
|
|
180
185
|
this._tmpMeasureA = new Measure(0, 0, 0, 0);
|
|
181
186
|
}
|
|
187
|
+
Object.defineProperty(Control.prototype, "isReadOnly", {
|
|
188
|
+
/**
|
|
189
|
+
* Gets or sets a boolean indicating if the control is readonly (default: false).
|
|
190
|
+
* A readonly control will still raise pointer events but will not react to them
|
|
191
|
+
*/
|
|
192
|
+
get: function () {
|
|
193
|
+
return this._isReadOnly;
|
|
194
|
+
},
|
|
195
|
+
set: function (value) {
|
|
196
|
+
this._isReadOnly = value;
|
|
197
|
+
},
|
|
198
|
+
enumerable: false,
|
|
199
|
+
configurable: true
|
|
200
|
+
});
|
|
182
201
|
Object.defineProperty(Control.prototype, "shadowOffsetX", {
|
|
183
202
|
/** Gets or sets a value indicating the offset to apply on X axis to render the shadow */
|
|
184
203
|
get: function () {
|
|
@@ -218,6 +237,7 @@ var Control = /** @class */ (function () {
|
|
|
218
237
|
if (this._shadowBlur === value) {
|
|
219
238
|
return;
|
|
220
239
|
}
|
|
240
|
+
this._previousShadowBlur = this._shadowBlur;
|
|
221
241
|
this._shadowBlur = value;
|
|
222
242
|
this._markAsDirty();
|
|
223
243
|
},
|
|
@@ -292,6 +312,23 @@ var Control = /** @class */ (function () {
|
|
|
292
312
|
enumerable: false,
|
|
293
313
|
configurable: true
|
|
294
314
|
});
|
|
315
|
+
Object.defineProperty(Control.prototype, "highlightLineWidth", {
|
|
316
|
+
/**
|
|
317
|
+
* Gets or sets a number indicating size of stroke we want to highlight the control with (mostly for debugging purpose)
|
|
318
|
+
*/
|
|
319
|
+
get: function () {
|
|
320
|
+
return this._highlightLineWidth;
|
|
321
|
+
},
|
|
322
|
+
set: function (value) {
|
|
323
|
+
if (this._highlightLineWidth === value) {
|
|
324
|
+
return;
|
|
325
|
+
}
|
|
326
|
+
this._highlightLineWidth = value;
|
|
327
|
+
this._markAsDirty();
|
|
328
|
+
},
|
|
329
|
+
enumerable: false,
|
|
330
|
+
configurable: true
|
|
331
|
+
});
|
|
295
332
|
Object.defineProperty(Control.prototype, "isHighlighted", {
|
|
296
333
|
/**
|
|
297
334
|
* Gets or sets a boolean indicating that we want to highlight the control (mostly for debugging purpose)
|
|
@@ -309,6 +346,23 @@ var Control = /** @class */ (function () {
|
|
|
309
346
|
enumerable: false,
|
|
310
347
|
configurable: true
|
|
311
348
|
});
|
|
349
|
+
Object.defineProperty(Control.prototype, "highlightColor", {
|
|
350
|
+
/**
|
|
351
|
+
* Gets or sets a string defining the color to use for highlighting this control
|
|
352
|
+
*/
|
|
353
|
+
get: function () {
|
|
354
|
+
return this._highlightColor;
|
|
355
|
+
},
|
|
356
|
+
set: function (value) {
|
|
357
|
+
if (this._highlightColor === value) {
|
|
358
|
+
return;
|
|
359
|
+
}
|
|
360
|
+
this._highlightColor = value;
|
|
361
|
+
this._markAsDirty();
|
|
362
|
+
},
|
|
363
|
+
enumerable: false,
|
|
364
|
+
configurable: true
|
|
365
|
+
});
|
|
312
366
|
Object.defineProperty(Control.prototype, "scaleX", {
|
|
313
367
|
/** Gets or sets a value indicating the scale factor on X axis (1 by default)
|
|
314
368
|
* @see https://doc.babylonjs.com/how_to/gui#rotation-and-scaling
|
|
@@ -514,9 +568,6 @@ var Control = /** @class */ (function () {
|
|
|
514
568
|
Object.defineProperty(Control.prototype, "fontFamily", {
|
|
515
569
|
/** Gets or set font family */
|
|
516
570
|
get: function () {
|
|
517
|
-
if (!this._fontSet) {
|
|
518
|
-
return "";
|
|
519
|
-
}
|
|
520
571
|
return this._fontFamily;
|
|
521
572
|
},
|
|
522
573
|
set: function (value) {
|
|
@@ -1115,7 +1166,7 @@ var Control = /** @class */ (function () {
|
|
|
1115
1166
|
}
|
|
1116
1167
|
this.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;
|
|
1117
1168
|
this.verticalAlignment = Control.VERTICAL_ALIGNMENT_TOP;
|
|
1118
|
-
var globalViewport = this._host._getGlobalViewport(
|
|
1169
|
+
var globalViewport = this._host._getGlobalViewport();
|
|
1119
1170
|
var projectedPosition = Vector3.Project(position, Matrix.Identity(), scene.getTransformMatrix(), globalViewport);
|
|
1120
1171
|
this._moveToProjectedPosition(projectedPosition);
|
|
1121
1172
|
if (projectedPosition.z < 0 || projectedPosition.z > 1) {
|
|
@@ -1211,8 +1262,15 @@ var Control = /** @class */ (function () {
|
|
|
1211
1262
|
};
|
|
1212
1263
|
/** @hidden */
|
|
1213
1264
|
Control.prototype._moveToProjectedPosition = function (projectedPosition) {
|
|
1265
|
+
var _a;
|
|
1214
1266
|
var oldLeft = this._left.getValue(this._host);
|
|
1215
1267
|
var oldTop = this._top.getValue(this._host);
|
|
1268
|
+
if (this._currentMeasure.width === 0 && this._currentMeasure.height === 0) {
|
|
1269
|
+
var parentMeasure = (_a = this.parent) === null || _a === void 0 ? void 0 : _a._currentMeasure;
|
|
1270
|
+
if (parentMeasure) {
|
|
1271
|
+
this._processMeasures(parentMeasure, this._host.getContext());
|
|
1272
|
+
}
|
|
1273
|
+
}
|
|
1216
1274
|
var newLeft = ((projectedPosition.x + this._linkOffsetX.getValue(this._host)) - this._currentMeasure.width / 2);
|
|
1217
1275
|
var newTop = ((projectedPosition.y + this._linkOffsetY.getValue(this._host)) - this._currentMeasure.height / 2);
|
|
1218
1276
|
if (this._left.ignoreAdaptiveScaling && this._top.ignoreAdaptiveScaling) {
|
|
@@ -1267,6 +1325,14 @@ var Control = /** @class */ (function () {
|
|
|
1267
1325
|
return true;
|
|
1268
1326
|
};
|
|
1269
1327
|
/** @hidden */
|
|
1328
|
+
Control.prototype._computeAdditionnalOffsetX = function () {
|
|
1329
|
+
return 0;
|
|
1330
|
+
};
|
|
1331
|
+
/** @hidden */
|
|
1332
|
+
Control.prototype._computeAdditionnalOffsetY = function () {
|
|
1333
|
+
return 0;
|
|
1334
|
+
};
|
|
1335
|
+
/** @hidden */
|
|
1270
1336
|
Control.prototype.invalidateRect = function () {
|
|
1271
1337
|
this._transform();
|
|
1272
1338
|
if (this.host && this.host.useInvalidateRectOptimization) {
|
|
@@ -1275,20 +1341,17 @@ var Control = /** @class */ (function () {
|
|
|
1275
1341
|
// get the boudning box of the current measure and last frames measure in global space and invalidate it
|
|
1276
1342
|
// the previous measure is used to properly clear a control that is scaled down
|
|
1277
1343
|
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
|
-
}
|
|
1344
|
+
// Expand rect based on shadows
|
|
1345
|
+
var shadowOffsetX = this.shadowOffsetX;
|
|
1346
|
+
var shadowOffsetY = this.shadowOffsetY;
|
|
1347
|
+
var shadowBlur = Math.max(this._previousShadowBlur, this.shadowBlur);
|
|
1348
|
+
var leftShadowOffset = Math.min(Math.min(shadowOffsetX, 0) - shadowBlur * 2, 0);
|
|
1349
|
+
var rightShadowOffset = Math.max(Math.max(shadowOffsetX, 0) + shadowBlur * 2, 0);
|
|
1350
|
+
var topShadowOffset = Math.min(Math.min(shadowOffsetY, 0) - shadowBlur * 2, 0);
|
|
1351
|
+
var bottomShadowOffset = Math.max(Math.max(shadowOffsetY, 0) + shadowBlur * 2, 0);
|
|
1352
|
+
var offsetX = this._computeAdditionnalOffsetX();
|
|
1353
|
+
var offsetY = this._computeAdditionnalOffsetY();
|
|
1354
|
+
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
1355
|
}
|
|
1293
1356
|
};
|
|
1294
1357
|
/** @hidden */
|
|
@@ -1350,8 +1413,8 @@ var Control = /** @class */ (function () {
|
|
|
1350
1413
|
return;
|
|
1351
1414
|
}
|
|
1352
1415
|
context.save();
|
|
1353
|
-
context.strokeStyle =
|
|
1354
|
-
context.lineWidth =
|
|
1416
|
+
context.strokeStyle = this._highlightColor;
|
|
1417
|
+
context.lineWidth = this._highlightLineWidth;
|
|
1355
1418
|
this._renderHighlightSpecific(context);
|
|
1356
1419
|
context.restore();
|
|
1357
1420
|
};
|
|
@@ -1378,7 +1441,7 @@ var Control = /** @class */ (function () {
|
|
|
1378
1441
|
context.globalAlpha *= this._alpha;
|
|
1379
1442
|
}
|
|
1380
1443
|
else if (this._alphaSet) {
|
|
1381
|
-
context.globalAlpha = this.parent ? this.parent.alpha * this._alpha : this._alpha;
|
|
1444
|
+
context.globalAlpha = (this.parent && !this.parent.renderToIntermediateTexture) ? this.parent.alpha * this._alpha : this._alpha;
|
|
1382
1445
|
}
|
|
1383
1446
|
};
|
|
1384
1447
|
/** @hidden */
|
|
@@ -1825,7 +1888,7 @@ var Control = /** @class */ (function () {
|
|
|
1825
1888
|
serializationObject.name = this.name;
|
|
1826
1889
|
serializationObject.className = this.getClassName();
|
|
1827
1890
|
if (this._font) {
|
|
1828
|
-
serializationObject.fontFamily = this.
|
|
1891
|
+
serializationObject.fontFamily = this._fontFamily;
|
|
1829
1892
|
serializationObject.fontSize = this.fontSize;
|
|
1830
1893
|
serializationObject.fontWeight = this.fontWeight;
|
|
1831
1894
|
serializationObject.fontStyle = this.fontStyle;
|
|
@@ -1929,30 +1992,11 @@ var Control = /** @class */ (function () {
|
|
|
1929
1992
|
if (Control._FontHeightSizes[font]) {
|
|
1930
1993
|
return Control._FontHeightSizes[font];
|
|
1931
1994
|
}
|
|
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 };
|
|
1995
|
+
var engine = Engine.LastCreatedEngine;
|
|
1996
|
+
if (!engine) {
|
|
1997
|
+
throw new Error("Invalid engine. Unable to create a canvas.");
|
|
1998
|
+
}
|
|
1999
|
+
var result = engine.getFontOffset(font);
|
|
1956
2000
|
Control._FontHeightSizes[font] = result;
|
|
1957
2001
|
return result;
|
|
1958
2002
|
};
|
|
@@ -2126,5 +2170,5 @@ var Control = /** @class */ (function () {
|
|
|
2126
2170
|
return Control;
|
|
2127
2171
|
}());
|
|
2128
2172
|
export { Control };
|
|
2129
|
-
|
|
2173
|
+
RegisterClass("BABYLON.GUI.Control", Control);
|
|
2130
2174
|
//# sourceMappingURL=control.js.map
|