babylonjs-gui 5.44.0 → 5.45.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 +14 -0
- package/babylon.gui.js +38 -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 +28 -0
- package/package.json +2 -2
package/babylon.gui.d.ts
CHANGED
@@ -62,6 +62,8 @@ declare module BABYLON.GUI {
|
|
62
62
|
static AllowGPUOptimizations: boolean;
|
63
63
|
/** Snippet ID if the content was created from the snippet server */
|
64
64
|
snippetId: string;
|
65
|
+
/** BABYLON.Observable that fires when the GUI is ready */
|
66
|
+
onGuiReadyObservable: BABYLON.Observable<AdvancedDynamicTexture>;
|
65
67
|
private _isDirty;
|
66
68
|
private _renderObserver;
|
67
69
|
private _resizeObserver;
|
@@ -524,6 +526,11 @@ declare module BABYLON.GUI {
|
|
524
526
|
* @param height the new height
|
525
527
|
*/
|
526
528
|
scaleTo(width: number, height: number): void;
|
529
|
+
private _checkGuiIsReady;
|
530
|
+
/**
|
531
|
+
* Returns true if all the GUI components are ready to render
|
532
|
+
*/
|
533
|
+
guiIsReady(): boolean;
|
527
534
|
}
|
528
535
|
|
529
536
|
|
@@ -933,6 +940,7 @@ declare module BABYLON.GUI {
|
|
933
940
|
* @internal
|
934
941
|
*/
|
935
942
|
_parseFromContent(serializedObject: any, host: AdvancedDynamicTexture): void;
|
943
|
+
isReady(): boolean;
|
936
944
|
}
|
937
945
|
|
938
946
|
|
@@ -1755,6 +1763,11 @@ declare module BABYLON.GUI {
|
|
1755
1763
|
* @internal
|
1756
1764
|
*/
|
1757
1765
|
protected static drawEllipse(x: number, y: number, width: number, height: number, context: BABYLON.ICanvasRenderingContext): void;
|
1766
|
+
/**
|
1767
|
+
* Returns true if the control is ready to be used
|
1768
|
+
* @returns
|
1769
|
+
*/
|
1770
|
+
isReady(): boolean;
|
1758
1771
|
}
|
1759
1772
|
|
1760
1773
|
|
@@ -2259,6 +2272,7 @@ declare module BABYLON.GUI {
|
|
2259
2272
|
* Gets a boolean indicating that the content is loaded
|
2260
2273
|
*/
|
2261
2274
|
get isLoaded(): boolean;
|
2275
|
+
isReady(): boolean;
|
2262
2276
|
/**
|
2263
2277
|
* Gets or sets a boolean indicating if pointers should only be validated on pixels with alpha > 0.
|
2264
2278
|
* Beware using this as this will consume more memory as the image has to be stored twice
|
package/babylon.gui.js
CHANGED
@@ -501,6 +501,8 @@ var AdvancedDynamicTexture = /** @class */ (function (_super) {
|
|
501
501
|
if (samplingMode === void 0) { samplingMode = core_Misc_observable__WEBPACK_IMPORTED_MODULE_1__.Texture.NEAREST_SAMPLINGMODE; }
|
502
502
|
if (invertY === void 0) { invertY = true; }
|
503
503
|
var _this = _super.call(this, name, { width: width, height: height }, scene, generateMipMaps, samplingMode, core_Misc_observable__WEBPACK_IMPORTED_MODULE_1__.Constants.TEXTUREFORMAT_RGBA, invertY) || this;
|
504
|
+
/** Observable that fires when the GUI is ready */
|
505
|
+
_this.onGuiReadyObservable = new core_Misc_observable__WEBPACK_IMPORTED_MODULE_1__.Observable();
|
504
506
|
_this._isDirty = false;
|
505
507
|
/** @internal */
|
506
508
|
_this._rootContainer = new _controls_container__WEBPACK_IMPORTED_MODULE_2__.Container("root");
|
@@ -1103,6 +1105,7 @@ var AdvancedDynamicTexture = /** @class */ (function (_super) {
|
|
1103
1105
|
this.onEndRenderObservable.clear();
|
1104
1106
|
this.onBeginLayoutObservable.clear();
|
1105
1107
|
this.onEndLayoutObservable.clear();
|
1108
|
+
this.onGuiReadyObservable.clear();
|
1106
1109
|
_super.prototype.dispose.call(this);
|
1107
1110
|
};
|
1108
1111
|
AdvancedDynamicTexture.prototype._onResize = function () {
|
@@ -1229,6 +1232,9 @@ var AdvancedDynamicTexture = /** @class */ (function (_super) {
|
|
1229
1232
|
var context = this.getContext();
|
1230
1233
|
context.font = "18px Arial";
|
1231
1234
|
context.strokeStyle = "white";
|
1235
|
+
if (this.onGuiReadyObservable.hasObservers()) {
|
1236
|
+
this._checkGuiIsReady();
|
1237
|
+
}
|
1232
1238
|
/** We have to recheck the camera projection in the case the root control's children have changed */
|
1233
1239
|
if (this._rootChildrenHaveChanged) {
|
1234
1240
|
var camera = (_a = this.getScene()) === null || _a === void 0 ? void 0 : _a.activeCamera;
|
@@ -1936,6 +1942,18 @@ var AdvancedDynamicTexture = /** @class */ (function (_super) {
|
|
1936
1942
|
_super.prototype.scaleTo.call(this, width, height);
|
1937
1943
|
this.markAsDirty();
|
1938
1944
|
};
|
1945
|
+
AdvancedDynamicTexture.prototype._checkGuiIsReady = function () {
|
1946
|
+
if (this.guiIsReady()) {
|
1947
|
+
this.onGuiReadyObservable.notifyObservers(this);
|
1948
|
+
this.onGuiReadyObservable.clear();
|
1949
|
+
}
|
1950
|
+
};
|
1951
|
+
/**
|
1952
|
+
* Returns true if all the GUI components are ready to render
|
1953
|
+
*/
|
1954
|
+
AdvancedDynamicTexture.prototype.guiIsReady = function () {
|
1955
|
+
return this._rootContainer.isReady();
|
1956
|
+
};
|
1939
1957
|
/** Define the Uurl to load snippets */
|
1940
1958
|
AdvancedDynamicTexture.SnippetUrl = core_Misc_observable__WEBPACK_IMPORTED_MODULE_1__.Constants.SnippetUrl;
|
1941
1959
|
/** Indicates if some optimizations can be performed in GUI GPU management (the downside is additional memory/GPU texture memory used) */
|
@@ -4461,6 +4479,15 @@ var Container = /** @class */ (function (_super) {
|
|
4461
4479
|
this.addControl(_control__WEBPACK_IMPORTED_MODULE_2__.Control.Parse(childData, host));
|
4462
4480
|
}
|
4463
4481
|
};
|
4482
|
+
Container.prototype.isReady = function () {
|
4483
|
+
for (var _i = 0, _a = this.children; _i < _a.length; _i++) {
|
4484
|
+
var child = _a[_i];
|
4485
|
+
if (!child.isReady()) {
|
4486
|
+
return false;
|
4487
|
+
}
|
4488
|
+
}
|
4489
|
+
return true;
|
4490
|
+
};
|
4464
4491
|
(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([
|
4465
4492
|
(0,core_Misc_logger__WEBPACK_IMPORTED_MODULE_1__.serialize)()
|
4466
4493
|
], Container.prototype, "renderToIntermediateTexture", null);
|
@@ -6831,6 +6858,14 @@ var Control = /** @class */ (function () {
|
|
6831
6858
|
context.scale(1 / width, 1 / height);
|
6832
6859
|
context.translate(-x, -y);
|
6833
6860
|
};
|
6861
|
+
/**
|
6862
|
+
* Returns true if the control is ready to be used
|
6863
|
+
* @returns
|
6864
|
+
*/
|
6865
|
+
Control.prototype.isReady = function () {
|
6866
|
+
// Most controls are ready by default, so the default implementation is to return true
|
6867
|
+
return true;
|
6868
|
+
};
|
6834
6869
|
/**
|
6835
6870
|
* Gets or sets a boolean indicating if alpha must be an inherited value (false by default)
|
6836
6871
|
*/
|
@@ -8432,6 +8467,9 @@ var Image = /** @class */ (function (_super) {
|
|
8432
8467
|
enumerable: false,
|
8433
8468
|
configurable: true
|
8434
8469
|
});
|
8470
|
+
Image.prototype.isReady = function () {
|
8471
|
+
return this.isLoaded;
|
8472
|
+
};
|
8435
8473
|
Object.defineProperty(Image.prototype, "detectPointerOnOpaqueOnly", {
|
8436
8474
|
/**
|
8437
8475
|
* Gets or sets a boolean indicating if pointers should only be validated on pixels with alpha > 0.
|