babylonjs-gui 5.38.0 → 5.40.0
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/babylon.gui.d.ts +33 -0
- package/babylon.gui.js +64 -0
- package/babylon.gui.js.map +1 -1
- package/babylon.gui.min.js +1 -1
- package/babylon.gui.min.js.map +1 -1
- package/babylon.gui.module.d.ts +66 -0
- package/package.json +2 -2
package/babylon.gui.d.ts
CHANGED
|
@@ -71,6 +71,7 @@ declare module BABYLON.GUI {
|
|
|
71
71
|
private _pointerObserver;
|
|
72
72
|
private _canvasPointerOutObserver;
|
|
73
73
|
private _canvasBlurObserver;
|
|
74
|
+
private _controlAddedObserver;
|
|
74
75
|
private _background;
|
|
75
76
|
/** @internal */
|
|
76
77
|
_rootContainer: Container;
|
|
@@ -1674,6 +1675,19 @@ declare module BABYLON.GUI {
|
|
|
1674
1675
|
*/
|
|
1675
1676
|
_processObservables(type: number, x: number, y: number, pi: BABYLON.Nullable<BABYLON.PointerInfoBase>, pointerId: number, buttonIndex: number, deltaX?: number, deltaY?: number): boolean;
|
|
1676
1677
|
private _prepareFont;
|
|
1678
|
+
/**
|
|
1679
|
+
* Clones a control and its descendants
|
|
1680
|
+
* @param host the texture where the control will be instantiated. Can be empty, in which case the control will be created on the same texture
|
|
1681
|
+
* @returns the cloned control
|
|
1682
|
+
*/
|
|
1683
|
+
clone(host?: AdvancedDynamicTexture): Control;
|
|
1684
|
+
/**
|
|
1685
|
+
* Parses a serialized object into this control
|
|
1686
|
+
* @param serializedObject the object with the serialized properties
|
|
1687
|
+
* @param host the texture where the control will be instantiated. Can be empty, in which case the control will be created on the same texture
|
|
1688
|
+
* @returns this control
|
|
1689
|
+
*/
|
|
1690
|
+
parse(serializedObject: any, host?: AdvancedDynamicTexture): Control;
|
|
1677
1691
|
/**
|
|
1678
1692
|
* Serializes the current control
|
|
1679
1693
|
* @param serializationObject defined the JSON serialized object
|
|
@@ -4062,6 +4076,25 @@ declare module BABYLON.GUI {
|
|
|
4062
4076
|
*/
|
|
4063
4077
|
static ComposeToRef(tx: number, ty: number, angle: number, scaleX: number, scaleY: number, parentMatrix: BABYLON.Nullable<Matrix2D>, result: Matrix2D): void;
|
|
4064
4078
|
}
|
|
4079
|
+
/**
|
|
4080
|
+
* Useful math functions
|
|
4081
|
+
*/
|
|
4082
|
+
export class MathTools {
|
|
4083
|
+
/**
|
|
4084
|
+
* Default rounding precision for GUI elements. It should be
|
|
4085
|
+
* set to a power of ten, where the exponent means the number
|
|
4086
|
+
* of decimal digits to round to, i.e, 100 means 2 decimal digits,
|
|
4087
|
+
* 1000 means 3 decimal digits, etc. Default is 100 (2 decimal digits).
|
|
4088
|
+
*/
|
|
4089
|
+
static DefaultRoundingPrecision: number;
|
|
4090
|
+
/**
|
|
4091
|
+
* Rounds a number to the nearest multiple of a given precision
|
|
4092
|
+
* @param value the value to be rounded
|
|
4093
|
+
* @param precision the multiple to which the value will be rounded. Default is 100 (2 decimal digits)
|
|
4094
|
+
* @returns
|
|
4095
|
+
*/
|
|
4096
|
+
static Round(value: number, precision?: number): number;
|
|
4097
|
+
}
|
|
4065
4098
|
|
|
4066
4099
|
|
|
4067
4100
|
/**
|
package/babylon.gui.js
CHANGED
|
@@ -617,6 +617,11 @@ var AdvancedDynamicTexture = /** @class */ (function (_super) {
|
|
|
617
617
|
_this.applyYInversionOnUpdate = invertY;
|
|
618
618
|
_this._rootElement = scene.getEngine().getInputElement();
|
|
619
619
|
_this._renderObserver = scene.onBeforeCameraRenderObservable.add(function (camera) { return _this._checkUpdate(camera); });
|
|
620
|
+
_this._controlAddedObserver = _this._rootContainer.onControlAddedObservable.add(function (control) {
|
|
621
|
+
if (control && _this._scene && _this._scene.activeCamera) {
|
|
622
|
+
_this._checkUpdate(_this._scene.activeCamera);
|
|
623
|
+
}
|
|
624
|
+
});
|
|
620
625
|
_this._preKeyboardObserver = scene.onPreKeyboardObservable.add(function (info) {
|
|
621
626
|
if (!_this._focusedControl) {
|
|
622
627
|
return;
|
|
@@ -1073,6 +1078,9 @@ var AdvancedDynamicTexture = /** @class */ (function (_super) {
|
|
|
1073
1078
|
if (this._canvasBlurObserver) {
|
|
1074
1079
|
scene.getEngine().onCanvasBlurObservable.remove(this._canvasBlurObserver);
|
|
1075
1080
|
}
|
|
1081
|
+
if (this._controlAddedObserver) {
|
|
1082
|
+
this._rootContainer.onControlAddedObservable.remove(this._controlAddedObserver);
|
|
1083
|
+
}
|
|
1076
1084
|
if (this._layerToDispose) {
|
|
1077
1085
|
this._layerToDispose.texture = null;
|
|
1078
1086
|
this._layerToDispose.dispose();
|
|
@@ -6525,6 +6533,32 @@ var Control = /** @class */ (function () {
|
|
|
6525
6533
|
//children need to be refreshed
|
|
6526
6534
|
this.getDescendants().forEach(function (child) { return child._markAllAsDirty(); });
|
|
6527
6535
|
};
|
|
6536
|
+
/**
|
|
6537
|
+
* Clones a control and its descendants
|
|
6538
|
+
* @param host the texture where the control will be instantiated. Can be empty, in which case the control will be created on the same texture
|
|
6539
|
+
* @returns the cloned control
|
|
6540
|
+
*/
|
|
6541
|
+
Control.prototype.clone = function (host) {
|
|
6542
|
+
var serialization = {};
|
|
6543
|
+
this.serialize(serialization);
|
|
6544
|
+
var controlType = core_Misc_observable__WEBPACK_IMPORTED_MODULE_1__.Tools.Instantiate("BABYLON.GUI." + serialization.className);
|
|
6545
|
+
var cloned = new controlType();
|
|
6546
|
+
cloned.parse(serialization, host);
|
|
6547
|
+
return cloned;
|
|
6548
|
+
};
|
|
6549
|
+
/**
|
|
6550
|
+
* Parses a serialized object into this control
|
|
6551
|
+
* @param serializedObject the object with the serialized properties
|
|
6552
|
+
* @param host the texture where the control will be instantiated. Can be empty, in which case the control will be created on the same texture
|
|
6553
|
+
* @returns this control
|
|
6554
|
+
*/
|
|
6555
|
+
Control.prototype.parse = function (serializedObject, host) {
|
|
6556
|
+
var _this = this;
|
|
6557
|
+
core_Misc_observable__WEBPACK_IMPORTED_MODULE_1__.SerializationHelper.Parse(function () { return _this; }, serializedObject, null);
|
|
6558
|
+
this.name = serializedObject.name;
|
|
6559
|
+
this._parseFromContent(serializedObject, host !== null && host !== void 0 ? host : this._host);
|
|
6560
|
+
return this;
|
|
6561
|
+
};
|
|
6528
6562
|
/**
|
|
6529
6563
|
* Serializes the current control
|
|
6530
6564
|
* @param serializationObject defined the JSON serialized object
|
|
@@ -16850,6 +16884,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
16850
16884
|
/* harmony export */ "InputTextArea": () => (/* reexport safe */ _controls_index__WEBPACK_IMPORTED_MODULE_0__.InputTextArea),
|
|
16851
16885
|
/* harmony export */ "KeyPropertySet": () => (/* reexport safe */ _controls_index__WEBPACK_IMPORTED_MODULE_0__.KeyPropertySet),
|
|
16852
16886
|
/* harmony export */ "Line": () => (/* reexport safe */ _controls_index__WEBPACK_IMPORTED_MODULE_0__.Line),
|
|
16887
|
+
/* harmony export */ "MathTools": () => (/* reexport safe */ _math2D__WEBPACK_IMPORTED_MODULE_3__.MathTools),
|
|
16853
16888
|
/* harmony export */ "Matrix2D": () => (/* reexport safe */ _math2D__WEBPACK_IMPORTED_MODULE_3__.Matrix2D),
|
|
16854
16889
|
/* harmony export */ "Measure": () => (/* reexport safe */ _measure__WEBPACK_IMPORTED_MODULE_4__.Measure),
|
|
16855
16890
|
/* harmony export */ "MultiLine": () => (/* reexport safe */ _controls_index__WEBPACK_IMPORTED_MODULE_0__.MultiLine),
|
|
@@ -16906,6 +16941,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
16906
16941
|
|
|
16907
16942
|
__webpack_require__.r(__webpack_exports__);
|
|
16908
16943
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
16944
|
+
/* harmony export */ "MathTools": () => (/* binding */ MathTools),
|
|
16909
16945
|
/* harmony export */ "Matrix2D": () => (/* binding */ Matrix2D),
|
|
16910
16946
|
/* harmony export */ "Vector2WithInfo": () => (/* binding */ Vector2WithInfo)
|
|
16911
16947
|
/* harmony export */ });
|
|
@@ -17133,6 +17169,32 @@ var Matrix2D = /** @class */ (function () {
|
|
|
17133
17169
|
return Matrix2D;
|
|
17134
17170
|
}());
|
|
17135
17171
|
|
|
17172
|
+
/**
|
|
17173
|
+
* Useful math functions
|
|
17174
|
+
*/
|
|
17175
|
+
var MathTools = /** @class */ (function () {
|
|
17176
|
+
function MathTools() {
|
|
17177
|
+
}
|
|
17178
|
+
/**
|
|
17179
|
+
* Rounds a number to the nearest multiple of a given precision
|
|
17180
|
+
* @param value the value to be rounded
|
|
17181
|
+
* @param precision the multiple to which the value will be rounded. Default is 100 (2 decimal digits)
|
|
17182
|
+
* @returns
|
|
17183
|
+
*/
|
|
17184
|
+
MathTools.Round = function (value, precision) {
|
|
17185
|
+
if (precision === void 0) { precision = MathTools.DefaultRoundingPrecision; }
|
|
17186
|
+
return Math.round(value * precision) / precision;
|
|
17187
|
+
};
|
|
17188
|
+
/**
|
|
17189
|
+
* Default rounding precision for GUI elements. It should be
|
|
17190
|
+
* set to a power of ten, where the exponent means the number
|
|
17191
|
+
* of decimal digits to round to, i.e, 100 means 2 decimal digits,
|
|
17192
|
+
* 1000 means 3 decimal digits, etc. Default is 100 (2 decimal digits).
|
|
17193
|
+
*/
|
|
17194
|
+
MathTools.DefaultRoundingPrecision = 100;
|
|
17195
|
+
return MathTools;
|
|
17196
|
+
}());
|
|
17197
|
+
|
|
17136
17198
|
|
|
17137
17199
|
|
|
17138
17200
|
/***/ }),
|
|
@@ -29865,6 +29927,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
29865
29927
|
/* harmony export */ "MRDLBackplateMaterial": () => (/* reexport safe */ _3D_index__WEBPACK_IMPORTED_MODULE_1__.MRDLBackplateMaterial),
|
|
29866
29928
|
/* harmony export */ "MRDLSliderBarMaterial": () => (/* reexport safe */ _3D_index__WEBPACK_IMPORTED_MODULE_1__.MRDLSliderBarMaterial),
|
|
29867
29929
|
/* harmony export */ "MRDLSliderThumbMaterial": () => (/* reexport safe */ _3D_index__WEBPACK_IMPORTED_MODULE_1__.MRDLSliderThumbMaterial),
|
|
29930
|
+
/* harmony export */ "MathTools": () => (/* reexport safe */ _2D_index__WEBPACK_IMPORTED_MODULE_0__.MathTools),
|
|
29868
29931
|
/* harmony export */ "Matrix2D": () => (/* reexport safe */ _2D_index__WEBPACK_IMPORTED_MODULE_0__.Matrix2D),
|
|
29869
29932
|
/* harmony export */ "Measure": () => (/* reexport safe */ _2D_index__WEBPACK_IMPORTED_MODULE_0__.Measure),
|
|
29870
29933
|
/* harmony export */ "MeshButton3D": () => (/* reexport safe */ _3D_index__WEBPACK_IMPORTED_MODULE_1__.MeshButton3D),
|
|
@@ -29965,6 +30028,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
29965
30028
|
/* harmony export */ "MRDLBackplateMaterial": () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_0__.MRDLBackplateMaterial),
|
|
29966
30029
|
/* harmony export */ "MRDLSliderBarMaterial": () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_0__.MRDLSliderBarMaterial),
|
|
29967
30030
|
/* harmony export */ "MRDLSliderThumbMaterial": () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_0__.MRDLSliderThumbMaterial),
|
|
30031
|
+
/* harmony export */ "MathTools": () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_0__.MathTools),
|
|
29968
30032
|
/* harmony export */ "Matrix2D": () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_0__.Matrix2D),
|
|
29969
30033
|
/* harmony export */ "Measure": () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_0__.Measure),
|
|
29970
30034
|
/* harmony export */ "MeshButton3D": () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_0__.MeshButton3D),
|