@babylonjs/gui 6.38.0 → 6.39.0
Sign up to get free protection for your applications and to get access to all the features.
- package/2D/advancedDynamicTexture.js +6 -8
- package/2D/advancedDynamicTexture.js.map +1 -1
- package/2D/controls/container.js +4 -7
- package/2D/controls/container.js.map +1 -1
- package/2D/controls/control.js +11 -14
- package/2D/controls/control.js.map +1 -1
- package/2D/controls/gradient/LinearGradient.js +4 -4
- package/2D/controls/gradient/LinearGradient.js.map +1 -1
- package/2D/controls/gradient/RadialGradient.js +6 -6
- package/2D/controls/gradient/RadialGradient.js.map +1 -1
- package/2D/controls/grid.js +2 -2
- package/2D/controls/grid.js.map +1 -1
- package/2D/controls/image.js +4 -8
- package/2D/controls/image.js.map +1 -1
- package/2D/controls/inputText.js +6 -5
- package/2D/controls/inputText.js.map +1 -1
- package/2D/controls/inputTextArea.js +7 -9
- package/2D/controls/inputTextArea.js.map +1 -1
- package/2D/controls/textBlock.js +1 -2
- package/2D/controls/textBlock.js.map +1 -1
- package/2D/controls/toggleButton.js +3 -4
- package/2D/controls/toggleButton.js.map +1 -1
- package/3D/controls/MRTK3/touchHolographicButton.js +7 -14
- package/3D/controls/MRTK3/touchHolographicButton.js.map +1 -1
- package/3D/controls/contentDisplay3D.js +1 -2
- package/3D/controls/contentDisplay3D.js.map +1 -1
- package/3D/controls/control3D.js +2 -3
- package/3D/controls/control3D.js.map +1 -1
- package/3D/controls/holographicBackplate.js +1 -2
- package/3D/controls/holographicBackplate.js.map +1 -1
- package/3D/controls/holographicSlate.js +1 -2
- package/3D/controls/holographicSlate.js.map +1 -1
- package/3D/controls/slider3D.js +10 -13
- package/3D/controls/slider3D.js.map +1 -1
- package/3D/controls/touchButton3D.js +2 -4
- package/3D/controls/touchButton3D.js.map +1 -1
- package/3D/controls/touchHolographicButton.js +1 -2
- package/3D/controls/touchHolographicButton.js.map +1 -1
- package/3D/gui3DManager.js +3 -5
- package/3D/gui3DManager.js.map +1 -1
- package/3D/materials/fluentBackplate/fluentBackplateMaterial.js +1 -2
- package/3D/materials/fluentBackplate/fluentBackplateMaterial.js.map +1 -1
- package/package.json +2 -2
package/2D/controls/container.js
CHANGED
@@ -332,7 +332,6 @@ export class Container extends Control {
|
|
332
332
|
* @internal
|
333
333
|
*/
|
334
334
|
_layout(parentMeasure, context) {
|
335
|
-
var _a, _b;
|
336
335
|
if (!this.isDirty && (!this.isVisible || this.notRenderable)) {
|
337
336
|
return false;
|
338
337
|
}
|
@@ -366,7 +365,7 @@ export class Container extends Control {
|
|
366
365
|
if (this.adaptWidthToChildren && computedWidth >= 0) {
|
367
366
|
computedWidth += this.paddingLeftInPixels + this.paddingRightInPixels;
|
368
367
|
if (this.width !== computedWidth + "px") {
|
369
|
-
|
368
|
+
this.parent?._markAsDirty();
|
370
369
|
this.width = computedWidth + "px";
|
371
370
|
this._width.ignoreAdaptiveScaling = true;
|
372
371
|
this._rebuildLayout = true;
|
@@ -375,7 +374,7 @@ export class Container extends Control {
|
|
375
374
|
if (this.adaptHeightToChildren && computedHeight >= 0) {
|
376
375
|
computedHeight += this.paddingTopInPixels + this.paddingBottomInPixels;
|
377
376
|
if (this.height !== computedHeight + "px") {
|
378
|
-
|
377
|
+
this.parent?._markAsDirty();
|
379
378
|
this.height = computedHeight + "px";
|
380
379
|
this._height.ignoreAdaptiveScaling = true;
|
381
380
|
this._rebuildLayout = true;
|
@@ -532,25 +531,23 @@ export class Container extends Control {
|
|
532
531
|
}
|
533
532
|
/** Releases associated resources */
|
534
533
|
dispose() {
|
535
|
-
var _a;
|
536
534
|
super.dispose();
|
537
535
|
for (let index = this.children.length - 1; index >= 0; index--) {
|
538
536
|
this.children[index].dispose();
|
539
537
|
}
|
540
|
-
|
538
|
+
this._intermediateTexture?.dispose();
|
541
539
|
}
|
542
540
|
/**
|
543
541
|
* @internal
|
544
542
|
*/
|
545
543
|
_parseFromContent(serializedObject, host) {
|
546
|
-
var _a;
|
547
544
|
super._parseFromContent(serializedObject, host);
|
548
545
|
this._link(host);
|
549
546
|
// Gradient
|
550
547
|
if (serializedObject.backgroundGradient) {
|
551
548
|
const className = Tools.Instantiate("BABYLON.GUI." + serializedObject.backgroundGradient.className);
|
552
549
|
this._backgroundGradient = new className();
|
553
|
-
|
550
|
+
this._backgroundGradient?.parse(serializedObject.backgroundGradient);
|
554
551
|
}
|
555
552
|
if (!serializedObject.children) {
|
556
553
|
return;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"container.js","sourceRoot":"","sources":["../../../../../dev/gui/src/2D/controls/container.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,MAAM,EAAE,uCAAyB;AAE1C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAErC,OAAO,EAAE,aAAa,EAAE,0CAA4B;AAEpD,OAAO,EAAE,SAAS,EAAE,2CAA6B;AAEjD,OAAO,EAAE,cAAc,EAAE,6DAA+C;AACxE,OAAO,EAAE,OAAO,EAAE,sDAAwC;AAC1D,OAAO,EAAE,SAAS,EAAE,6CAA+B;AACnD,OAAO,EAAE,UAAU,EAAE,2CAA6B;AAElD,OAAO,EAAE,KAAK,EAAE,sCAAwB;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAErC;;;GAGG;AACH,MAAM,OAAO,SAAU,SAAQ,OAAO;IAkBlC,wJAAwJ;IAExJ,IAAW,2BAA2B;QAClC,OAAO,IAAI,CAAC,4BAA4B,CAAC;IAC7C,CAAC;IACD,IAAW,2BAA2B,CAAC,KAAc;QACjD,IAAI,IAAI,CAAC,4BAA4B,KAAK,KAAK,EAAE;YAC7C,OAAO;SACV;QACD,IAAI,CAAC,4BAA4B,GAAG,KAAK,CAAC;QAC1C,IAAI,CAAC,YAAY,EAAE,CAAC;IACxB,CAAC;IAaD,oGAAoG;IAEpG,IAAW,qBAAqB;QAC5B,OAAO,IAAI,CAAC,sBAAsB,CAAC;IACvC,CAAC;IAED,IAAW,qBAAqB,CAAC,KAAc;QAC3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QAED,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AA1pBG;IADC,SAAS,EAAE;4DAGX;AAkBM;IADN,SAAS,EAAE;iDACc;AAI1B;IADC,SAAS,EAAE;sDAGX;AAkBD;IADC,SAAS,EAAE;qDAGX;AAkBD;IADC,SAAS,EAAE;2CAGX;AAaD;IADC,SAAS,EAAE;mDAGX;AA0kBL,aAAa,CAAC,uBAAuB,EAAE,SAAS,CAAC,CAAC","sourcesContent":["import type { Nullable } from \"core/types\";\r\nimport { Logger } from \"core/Misc/logger\";\r\n\r\nimport { Control } from \"./control\";\r\nimport { Measure } from \"../measure\";\r\nimport type { AdvancedDynamicTexture } from \"../advancedDynamicTexture\";\r\nimport { RegisterClass } from \"core/Misc/typeStore\";\r\nimport type { PointerInfoBase } from \"core/Events/pointerEvents\";\r\nimport { serialize } from \"core/Misc/decorators\";\r\nimport type { ICanvasRenderingContext } from \"core/Engines/ICanvas\";\r\nimport { DynamicTexture } from \"core/Materials/Textures/dynamicTexture\";\r\nimport { Texture } from \"core/Materials/Textures/texture\";\r\nimport { Constants } from \"core/Engines/constants\";\r\nimport { Observable } from \"core/Misc/observable\";\r\nimport type { BaseGradient } from \"./gradient/BaseGradient\";\r\nimport { Tools } from \"core/Misc/tools\";\r\nimport { Matrix2D } from \"../math2D\";\r\n\r\n/**\r\n * Root class for 2D containers\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/gui/gui#containers\r\n */\r\nexport class Container extends Control {\r\n /** @internal */\r\n public _children = new Array<Control>();\r\n /** @internal */\r\n protected _measureForChildren = Measure.Empty();\r\n /** @internal */\r\n protected _background = \"\";\r\n /** @internal */\r\n protected _backgroundGradient: Nullable<BaseGradient> = null;\r\n /** @internal */\r\n protected _adaptWidthToChildren = false;\r\n /** @internal */\r\n protected _adaptHeightToChildren = false;\r\n /** @internal */\r\n protected _renderToIntermediateTexture: boolean = false;\r\n /** @internal */\r\n protected _intermediateTexture: Nullable<DynamicTexture> = null;\r\n\r\n /** Gets or sets boolean indicating if children should be rendered to an intermediate texture rather than directly to host, useful for alpha blending */\r\n @serialize()\r\n public get renderToIntermediateTexture(): boolean {\r\n return this._renderToIntermediateTexture;\r\n }\r\n public set renderToIntermediateTexture(value: boolean) {\r\n if (this._renderToIntermediateTexture === value) {\r\n return;\r\n }\r\n this._renderToIntermediateTexture = value;\r\n this._markAsDirty();\r\n }\r\n\r\n /**\r\n * Gets or sets a boolean indicating that layout cycle errors should be displayed on the console\r\n */\r\n public logLayoutCycleErrors = false;\r\n\r\n /**\r\n * Gets or sets the number of layout cycles (a change involved by a control while evaluating the layout) allowed\r\n */\r\n @serialize()\r\n public maxLayoutCycle = 3;\r\n\r\n /** Gets or sets a boolean indicating if the container should try to adapt to its children height */\r\n @serialize()\r\n public get adaptHeightToChildren(): boolean {\r\n return this._adaptHeightToChildren;\r\n }\r\n\r\n public set adaptHeightToChildren(value: boolean) {\r\n if (this._adaptHeightToChildren === value) {\r\n return;\r\n }\r\n\r\n this._adaptHeightToChildren = value;\r\n\r\n if (value) {\r\n this.height = \"100%\";\r\n }\r\n\r\n this._markAsDirty();\r\n }\r\n\r\n /** Gets or sets a boolean indicating if the container should try to adapt to its children width */\r\n @serialize()\r\n public get adaptWidthToChildren(): boolean {\r\n return this._adaptWidthToChildren;\r\n }\r\n\r\n public set adaptWidthToChildren(value: boolean) {\r\n if (this._adaptWidthToChildren === value) {\r\n return;\r\n }\r\n\r\n this._adaptWidthToChildren = value;\r\n\r\n if (value) {\r\n this.width = \"100%\";\r\n }\r\n\r\n this._markAsDirty();\r\n }\r\n\r\n /** Gets or sets background color */\r\n @serialize()\r\n public get background(): string {\r\n return this._background;\r\n }\r\n\r\n public set background(value: string) {\r\n if (this._background === value) {\r\n return;\r\n }\r\n\r\n this._background = value;\r\n this._markAsDirty();\r\n }\r\n\r\n /** Gets or sets background gradient color. Takes precedence over background */\r\n @serialize()\r\n public get backgroundGradient() {\r\n return this._backgroundGradient;\r\n }\r\n\r\n public set backgroundGradient(value: Nullable<BaseGradient>) {\r\n if (this._backgroundGradient === value) {\r\n return;\r\n }\r\n this._backgroundGradient = value;\r\n this._markAsDirty();\r\n }\r\n\r\n /** Gets the list of children */\r\n public get children(): Control[] {\r\n return this._children;\r\n }\r\n\r\n public get isReadOnly() {\r\n return this._isReadOnly;\r\n }\r\n\r\n public set isReadOnly(value: boolean) {\r\n this._isReadOnly = value;\r\n\r\n for (const child of this._children) {\r\n child.isReadOnly = value;\r\n }\r\n }\r\n\r\n /**\r\n * Creates a new Container\r\n * @param name defines the name of the container\r\n */\r\n constructor(public name?: string) {\r\n super(name);\r\n }\r\n\r\n protected _getTypeName(): string {\r\n return \"Container\";\r\n }\r\n\r\n public _flagDescendantsAsMatrixDirty(): void {\r\n for (const child of this.children) {\r\n child._isClipped = false;\r\n child._markMatrixAsDirty();\r\n }\r\n }\r\n\r\n /**\r\n * Gets a child using its name\r\n * @param name defines the child name to look for\r\n * @returns the child control if found\r\n */\r\n public getChildByName(name: string): Nullable<Control> {\r\n for (const child of this.children) {\r\n if (child.name === name) {\r\n return child;\r\n }\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /**\r\n * Gets a child using its type and its name\r\n * @param name defines the child name to look for\r\n * @param type defines the child type to look for\r\n * @returns the child control if found\r\n */\r\n public getChildByType(name: string, type: string): Nullable<Control> {\r\n for (const child of this.children) {\r\n if (child.typeName === type) {\r\n return child;\r\n }\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /**\r\n * Search for a specific control in children\r\n * @param control defines the control to look for\r\n * @returns true if the control is in child list\r\n */\r\n public containsControl(control: Control): boolean {\r\n return this.children.indexOf(control) !== -1;\r\n }\r\n\r\n /**\r\n * Adds a new control to the current container\r\n * @param control defines the control to add\r\n * @returns the current container\r\n */\r\n public addControl(control: Nullable<Control>): Container {\r\n if (!control) {\r\n return this;\r\n }\r\n\r\n const index = this._children.indexOf(control);\r\n\r\n if (index !== -1) {\r\n return this;\r\n }\r\n control._link(this._host);\r\n\r\n control._markAllAsDirty();\r\n\r\n this._reOrderControl(control);\r\n\r\n this._markAsDirty();\r\n\r\n this.onControlAddedObservable.notifyObservers(control);\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Removes all controls from the current container\r\n * @returns the current container\r\n */\r\n public clearControls(): Container {\r\n const children = this.children.slice();\r\n\r\n for (const child of children) {\r\n this.removeControl(child);\r\n }\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Removes a control from the current container\r\n * @param control defines the control to remove\r\n * @returns the current container\r\n */\r\n public removeControl(control: Control): Container {\r\n const index = this._children.indexOf(control);\r\n\r\n if (index !== -1) {\r\n this._children.splice(index, 1);\r\n\r\n control.parent = null;\r\n }\r\n\r\n control.linkWithMesh(null);\r\n\r\n if (this._host) {\r\n this._host._cleanControlAfterRemoval(control);\r\n }\r\n\r\n this._markAsDirty();\r\n\r\n this.onControlRemovedObservable.notifyObservers(control);\r\n return this;\r\n }\r\n\r\n /**\r\n * An event triggered when any control is added to this container.\r\n */\r\n public onControlAddedObservable = new Observable<Nullable<Control>>();\r\n\r\n /**\r\n * An event triggered when any control is removed from this container.\r\n */\r\n public onControlRemovedObservable = new Observable<Nullable<Control>>();\r\n\r\n /**\r\n * @internal\r\n */\r\n public _reOrderControl(control: Control): void {\r\n const linkedMesh = control.linkedMesh;\r\n\r\n this.removeControl(control);\r\n\r\n let wasAdded = false;\r\n for (let index = 0; index < this._children.length; index++) {\r\n if (this._children[index].zIndex > control.zIndex) {\r\n this._children.splice(index, 0, control);\r\n wasAdded = true;\r\n break;\r\n }\r\n }\r\n\r\n if (!wasAdded) {\r\n this._children.push(control);\r\n }\r\n\r\n control.parent = this;\r\n\r\n if (linkedMesh) {\r\n control.linkWithMesh(linkedMesh);\r\n }\r\n\r\n this._markAsDirty();\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _offsetLeft(offset: number) {\r\n super._offsetLeft(offset);\r\n\r\n for (const child of this._children) {\r\n child._offsetLeft(offset);\r\n }\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _offsetTop(offset: number) {\r\n super._offsetTop(offset);\r\n\r\n for (const child of this._children) {\r\n child._offsetTop(offset);\r\n }\r\n }\r\n\r\n /** @internal */\r\n public _markAllAsDirty(): void {\r\n super._markAllAsDirty();\r\n\r\n for (let index = 0; index < this._children.length; index++) {\r\n this._children[index]._markAllAsDirty();\r\n }\r\n }\r\n\r\n protected _getBackgroundColor(context: ICanvasRenderingContext) {\r\n return this._backgroundGradient ? this._backgroundGradient.getCanvasGradient(context) : this._background;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n protected _localDraw(context: ICanvasRenderingContext): void {\r\n if (this._background || this._backgroundGradient) {\r\n context.save();\r\n if (this.shadowBlur || this.shadowOffsetX || this.shadowOffsetY) {\r\n context.shadowColor = this.shadowColor;\r\n context.shadowBlur = this.shadowBlur;\r\n context.shadowOffsetX = this.shadowOffsetX;\r\n context.shadowOffsetY = this.shadowOffsetY;\r\n }\r\n\r\n context.fillStyle = this._getBackgroundColor(context);\r\n\r\n context.fillRect(this._currentMeasure.left, this._currentMeasure.top, this._currentMeasure.width, this._currentMeasure.height);\r\n context.restore();\r\n }\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _link(host: AdvancedDynamicTexture): void {\r\n super._link(host);\r\n\r\n for (const child of this._children) {\r\n child._link(host);\r\n }\r\n }\r\n\r\n /** @internal */\r\n protected _beforeLayout() {\r\n // Do nothing\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n protected _processMeasures(parentMeasure: Measure, context: ICanvasRenderingContext): void {\r\n if (this._isDirty || !this._cachedParentMeasure.isEqualsTo(parentMeasure)) {\r\n super._processMeasures(parentMeasure, context);\r\n this._evaluateClippingState(parentMeasure);\r\n if (this._renderToIntermediateTexture) {\r\n if (this._intermediateTexture && this._host.getScene() != this._intermediateTexture.getScene()) {\r\n this._intermediateTexture.dispose();\r\n this._intermediateTexture = null;\r\n }\r\n if (!this._intermediateTexture) {\r\n this._intermediateTexture = new DynamicTexture(\r\n \"\",\r\n { width: this._currentMeasure.width, height: this._currentMeasure.height },\r\n this._host.getScene(),\r\n false,\r\n Texture.NEAREST_SAMPLINGMODE,\r\n Constants.TEXTUREFORMAT_RGBA,\r\n false\r\n );\r\n this._intermediateTexture.hasAlpha = true;\r\n } else {\r\n this._intermediateTexture.scaleTo(this._currentMeasure.width, this._currentMeasure.height);\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _layout(parentMeasure: Measure, context: ICanvasRenderingContext): boolean {\r\n if (!this.isDirty && (!this.isVisible || this.notRenderable)) {\r\n return false;\r\n }\r\n\r\n this.host._numLayoutCalls++;\r\n\r\n if (this._isDirty) {\r\n this._currentMeasure.transformToRef(this._transformMatrix, this._prevCurrentMeasureTransformedIntoGlobalSpace);\r\n }\r\n\r\n let rebuildCount = 0;\r\n\r\n context.save();\r\n\r\n this._applyStates(context);\r\n\r\n this._beforeLayout();\r\n\r\n do {\r\n let computedWidth = -1;\r\n let computedHeight = -1;\r\n this._rebuildLayout = false;\r\n this._processMeasures(parentMeasure, context);\r\n\r\n if (!this._isClipped) {\r\n for (const child of this._children) {\r\n child._tempParentMeasure.copyFrom(this._measureForChildren);\r\n\r\n if (child._layout(this._measureForChildren, context)) {\r\n if (child.isVisible && !child.notRenderable) {\r\n if (this.adaptWidthToChildren && child._width.isPixel) {\r\n computedWidth = Math.max(computedWidth, child._currentMeasure.width + child._paddingLeftInPixels + child._paddingRightInPixels);\r\n }\r\n if (this.adaptHeightToChildren && child._height.isPixel) {\r\n computedHeight = Math.max(computedHeight, child._currentMeasure.height + child._paddingTopInPixels + child._paddingBottomInPixels);\r\n }\r\n }\r\n }\r\n }\r\n\r\n if (this.adaptWidthToChildren && computedWidth >= 0) {\r\n computedWidth += this.paddingLeftInPixels + this.paddingRightInPixels;\r\n if (this.width !== computedWidth + \"px\") {\r\n this.parent?._markAsDirty();\r\n this.width = computedWidth + \"px\";\r\n this._width.ignoreAdaptiveScaling = true;\r\n this._rebuildLayout = true;\r\n }\r\n }\r\n if (this.adaptHeightToChildren && computedHeight >= 0) {\r\n computedHeight += this.paddingTopInPixels + this.paddingBottomInPixels;\r\n if (this.height !== computedHeight + \"px\") {\r\n this.parent?._markAsDirty();\r\n this.height = computedHeight + \"px\";\r\n this._height.ignoreAdaptiveScaling = true;\r\n this._rebuildLayout = true;\r\n }\r\n }\r\n\r\n this._postMeasure();\r\n }\r\n rebuildCount++;\r\n } while (this._rebuildLayout && rebuildCount < this.maxLayoutCycle);\r\n\r\n if (rebuildCount >= 3 && this.logLayoutCycleErrors) {\r\n Logger.Error(`Layout cycle detected in GUI (Container name=${this.name}, uniqueId=${this.uniqueId})`);\r\n }\r\n\r\n context.restore();\r\n\r\n if (this._isDirty) {\r\n this.invalidateRect();\r\n\r\n this._isDirty = false;\r\n }\r\n\r\n return true;\r\n }\r\n\r\n protected _postMeasure() {\r\n // Do nothing by default\r\n }\r\n\r\n private _inverseTransformMatrix = Matrix2D.Identity();\r\n private _inverseMeasure = new Measure(0, 0, 0, 0);\r\n\r\n /**\r\n * @internal\r\n */\r\n public _draw(context: ICanvasRenderingContext, invalidatedRectangle?: Measure): void {\r\n const renderToIntermediateTextureThisDraw = this._renderToIntermediateTexture && this._intermediateTexture;\r\n const contextToDrawTo = renderToIntermediateTextureThisDraw ? (<DynamicTexture>this._intermediateTexture).getContext() : context;\r\n\r\n if (renderToIntermediateTextureThisDraw) {\r\n contextToDrawTo.save();\r\n contextToDrawTo.translate(-this._currentMeasure.left, -this._currentMeasure.top);\r\n if (invalidatedRectangle) {\r\n this._transformMatrix.invertToRef(this._inverseTransformMatrix);\r\n invalidatedRectangle.transformToRef(this._inverseTransformMatrix, this._inverseMeasure);\r\n contextToDrawTo.clearRect(this._inverseMeasure.left, this._inverseMeasure.top, this._inverseMeasure.width, this._inverseMeasure.height);\r\n } else {\r\n contextToDrawTo.clearRect(this._currentMeasure.left, this._currentMeasure.top, this._currentMeasure.width, this._currentMeasure.height);\r\n }\r\n }\r\n\r\n this._localDraw(contextToDrawTo);\r\n\r\n context.save();\r\n\r\n if (this.clipChildren) {\r\n this._clipForChildren(contextToDrawTo);\r\n }\r\n\r\n for (const child of this._children) {\r\n // Only redraw parts of the screen that are invalidated\r\n if (invalidatedRectangle) {\r\n if (!child._intersectsRect(invalidatedRectangle)) {\r\n continue;\r\n }\r\n }\r\n child._render(contextToDrawTo, invalidatedRectangle);\r\n }\r\n\r\n if (renderToIntermediateTextureThisDraw) {\r\n contextToDrawTo.restore();\r\n context.save();\r\n context.globalAlpha = this.alpha;\r\n context.drawImage(contextToDrawTo.canvas, this._currentMeasure.left, this._currentMeasure.top);\r\n context.restore();\r\n }\r\n\r\n context.restore();\r\n }\r\n\r\n public getDescendantsToRef(results: Control[], directDescendantsOnly: boolean = false, predicate?: (control: Control) => boolean): void {\r\n if (!this.children) {\r\n return;\r\n }\r\n\r\n for (let index = 0; index < this.children.length; index++) {\r\n const item = this.children[index];\r\n\r\n if (!predicate || predicate(item)) {\r\n results.push(item);\r\n }\r\n\r\n if (!directDescendantsOnly) {\r\n item.getDescendantsToRef(results, false, predicate);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _processPicking(x: number, y: number, pi: Nullable<PointerInfoBase>, type: number, pointerId: number, buttonIndex: number, deltaX?: number, deltaY?: number): boolean {\r\n if (!this._isEnabled || !this.isVisible || this.notRenderable) {\r\n return false;\r\n }\r\n\r\n // checks if the picking position is within the container\r\n const contains = super.contains(x, y);\r\n\r\n // if clipChildren is off, we should still pass picking events to children even if we don't contain the pointer\r\n if (!contains && this.clipChildren) {\r\n return false;\r\n }\r\n\r\n // Checking backwards to pick closest first\r\n for (let index = this._children.length - 1; index >= 0; index--) {\r\n const child = this._children[index];\r\n if (child._processPicking(x, y, pi, type, pointerId, buttonIndex, deltaX, deltaY)) {\r\n if (child.hoverCursor) {\r\n this._host._changeCursor(child.hoverCursor);\r\n }\r\n return true;\r\n }\r\n }\r\n\r\n if (!contains) {\r\n return false;\r\n }\r\n\r\n if (!this.isHitTestVisible) {\r\n return false;\r\n }\r\n\r\n return this._processObservables(type, x, y, pi, pointerId, buttonIndex, deltaX, deltaY);\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n protected _additionalProcessing(parentMeasure: Measure, context: ICanvasRenderingContext): void {\r\n super._additionalProcessing(parentMeasure, context);\r\n\r\n this._measureForChildren.copyFrom(this._currentMeasure);\r\n }\r\n\r\n protected _getAdaptDimTo(dim: \"width\" | \"height\"): boolean {\r\n if (dim === \"width\") {\r\n return this.adaptWidthToChildren;\r\n } else {\r\n return this.adaptHeightToChildren;\r\n }\r\n }\r\n\r\n public isDimensionFullyDefined(dim: \"width\" | \"height\"): boolean {\r\n if (this._getAdaptDimTo(dim)) {\r\n for (const child of this.children) {\r\n if (!child.isDimensionFullyDefined(dim)) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n }\r\n return super.isDimensionFullyDefined(dim);\r\n }\r\n\r\n /**\r\n * Serializes the current control\r\n * @param serializationObject defined the JSON serialized object\r\n */\r\n public serialize(serializationObject: any) {\r\n super.serialize(serializationObject);\r\n\r\n if (this.backgroundGradient) {\r\n serializationObject.backgroundGradient = {};\r\n this.backgroundGradient.serialize(serializationObject.backgroundGradient);\r\n }\r\n\r\n if (!this.children.length) {\r\n return;\r\n }\r\n\r\n serializationObject.children = [];\r\n\r\n for (const child of this.children) {\r\n const childSerializationObject = {};\r\n child.serialize(childSerializationObject);\r\n serializationObject.children.push(childSerializationObject);\r\n }\r\n }\r\n\r\n /** Releases associated resources */\r\n public dispose() {\r\n super.dispose();\r\n\r\n for (let index = this.children.length - 1; index >= 0; index--) {\r\n this.children[index].dispose();\r\n }\r\n this._intermediateTexture?.dispose();\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _parseFromContent(serializedObject: any, host: AdvancedDynamicTexture) {\r\n super._parseFromContent(serializedObject, host);\r\n this._link(host);\r\n\r\n // Gradient\r\n if (serializedObject.backgroundGradient) {\r\n const className = Tools.Instantiate(\"BABYLON.GUI.\" + serializedObject.backgroundGradient.className);\r\n this._backgroundGradient = new className();\r\n this._backgroundGradient?.parse(serializedObject.backgroundGradient);\r\n }\r\n\r\n if (!serializedObject.children) {\r\n return;\r\n }\r\n\r\n for (const childData of serializedObject.children) {\r\n this.addControl(Control.Parse(childData, host));\r\n }\r\n }\r\n\r\n public isReady(): boolean {\r\n for (const child of this.children) {\r\n if (!child.isReady()) {\r\n return false;\r\n }\r\n }\r\n\r\n return true;\r\n }\r\n}\r\nRegisterClass(\"BABYLON.GUI.Container\", Container);\r\n"]}
|
1
|
+
{"version":3,"file":"container.js","sourceRoot":"","sources":["../../../../../dev/gui/src/2D/controls/container.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,MAAM,EAAE,uCAAyB;AAE1C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAErC,OAAO,EAAE,aAAa,EAAE,0CAA4B;AAEpD,OAAO,EAAE,SAAS,EAAE,2CAA6B;AAEjD,OAAO,EAAE,cAAc,EAAE,6DAA+C;AACxE,OAAO,EAAE,OAAO,EAAE,sDAAwC;AAC1D,OAAO,EAAE,SAAS,EAAE,6CAA+B;AACnD,OAAO,EAAE,UAAU,EAAE,2CAA6B;AAElD,OAAO,EAAE,KAAK,EAAE,sCAAwB;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAErC;;;GAGG;AACH,MAAM,OAAO,SAAU,SAAQ,OAAO;IAkBlC,wJAAwJ;IAExJ,IAAW,2BAA2B;QAClC,OAAO,IAAI,CAAC,4BAA4B,CAAC;IAC7C,CAAC;IACD,IAAW,2BAA2B,CAAC,KAAc;QACjD,IAAI,IAAI,CAAC,4BAA4B,KAAK,KAAK,EAAE;YAC7C,OAAO;SACV;QACD,IAAI,CAAC,4BAA4B,GAAG,KAAK,CAAC;QAC1C,IAAI,CAAC,YAAY,EAAE,CAA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CAAC,QAAQ,EAAE;YAC/B,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,EAAE;gBAClB,OAAO,KAAK,CAAC;aAChB;SACJ;QAED,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AA1pBG;IADC,SAAS,EAAE;4DAGX;AAkBM;IADN,SAAS,EAAE;iDACc;AAI1B;IADC,SAAS,EAAE;sDAGX;AAkBD;IADC,SAAS,EAAE;qDAGX;AAkBD;IADC,SAAS,EAAE;2CAGX;AAaD;IADC,SAAS,EAAE;mDAGX;AA0kBL,aAAa,CAAC,uBAAuB,EAAE,SAAS,CAAC,CAAC","sourcesContent":["import type { Nullable } from \"core/types\";\r\nimport { Logger } from \"core/Misc/logger\";\r\n\r\nimport { Control } from \"./control\";\r\nimport { Measure } from \"../measure\";\r\nimport type { AdvancedDynamicTexture } from \"../advancedDynamicTexture\";\r\nimport { RegisterClass } from \"core/Misc/typeStore\";\r\nimport type { PointerInfoBase } from \"core/Events/pointerEvents\";\r\nimport { serialize } from \"core/Misc/decorators\";\r\nimport type { ICanvasRenderingContext } from \"core/Engines/ICanvas\";\r\nimport { DynamicTexture } from \"core/Materials/Textures/dynamicTexture\";\r\nimport { Texture } from \"core/Materials/Textures/texture\";\r\nimport { Constants } from \"core/Engines/constants\";\r\nimport { Observable } from \"core/Misc/observable\";\r\nimport type { BaseGradient } from \"./gradient/BaseGradient\";\r\nimport { Tools } from \"core/Misc/tools\";\r\nimport { Matrix2D } from \"../math2D\";\r\n\r\n/**\r\n * Root class for 2D containers\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/gui/gui#containers\r\n */\r\nexport class Container extends Control {\r\n /** @internal */\r\n public _children = new Array<Control>();\r\n /** @internal */\r\n protected _measureForChildren = Measure.Empty();\r\n /** @internal */\r\n protected _background = \"\";\r\n /** @internal */\r\n protected _backgroundGradient: Nullable<BaseGradient> = null;\r\n /** @internal */\r\n protected _adaptWidthToChildren = false;\r\n /** @internal */\r\n protected _adaptHeightToChildren = false;\r\n /** @internal */\r\n protected _renderToIntermediateTexture: boolean = false;\r\n /** @internal */\r\n protected _intermediateTexture: Nullable<DynamicTexture> = null;\r\n\r\n /** Gets or sets boolean indicating if children should be rendered to an intermediate texture rather than directly to host, useful for alpha blending */\r\n @serialize()\r\n public get renderToIntermediateTexture(): boolean {\r\n return this._renderToIntermediateTexture;\r\n }\r\n public set renderToIntermediateTexture(value: boolean) {\r\n if (this._renderToIntermediateTexture === value) {\r\n return;\r\n }\r\n this._renderToIntermediateTexture = value;\r\n this._markAsDirty();\r\n }\r\n\r\n /**\r\n * Gets or sets a boolean indicating that layout cycle errors should be displayed on the console\r\n */\r\n public logLayoutCycleErrors = false;\r\n\r\n /**\r\n * Gets or sets the number of layout cycles (a change involved by a control while evaluating the layout) allowed\r\n */\r\n @serialize()\r\n public maxLayoutCycle = 3;\r\n\r\n /** Gets or sets a boolean indicating if the container should try to adapt to its children height */\r\n @serialize()\r\n public get adaptHeightToChildren(): boolean {\r\n return this._adaptHeightToChildren;\r\n }\r\n\r\n public set adaptHeightToChildren(value: boolean) {\r\n if (this._adaptHeightToChildren === value) {\r\n return;\r\n }\r\n\r\n this._adaptHeightToChildren = value;\r\n\r\n if (value) {\r\n this.height = \"100%\";\r\n }\r\n\r\n this._markAsDirty();\r\n }\r\n\r\n /** Gets or sets a boolean indicating if the container should try to adapt to its children width */\r\n @serialize()\r\n public get adaptWidthToChildren(): boolean {\r\n return this._adaptWidthToChildren;\r\n }\r\n\r\n public set adaptWidthToChildren(value: boolean) {\r\n if (this._adaptWidthToChildren === value) {\r\n return;\r\n }\r\n\r\n this._adaptWidthToChildren = value;\r\n\r\n if (value) {\r\n this.width = \"100%\";\r\n }\r\n\r\n this._markAsDirty();\r\n }\r\n\r\n /** Gets or sets background color */\r\n @serialize()\r\n public get background(): string {\r\n return this._background;\r\n }\r\n\r\n public set background(value: string) {\r\n if (this._background === value) {\r\n return;\r\n }\r\n\r\n this._background = value;\r\n this._markAsDirty();\r\n }\r\n\r\n /** Gets or sets background gradient color. Takes precedence over background */\r\n @serialize()\r\n public get backgroundGradient() {\r\n return this._backgroundGradient;\r\n }\r\n\r\n public set backgroundGradient(value: Nullable<BaseGradient>) {\r\n if (this._backgroundGradient === value) {\r\n return;\r\n }\r\n this._backgroundGradient = value;\r\n this._markAsDirty();\r\n }\r\n\r\n /** Gets the list of children */\r\n public get children(): Control[] {\r\n return this._children;\r\n }\r\n\r\n public get isReadOnly() {\r\n return this._isReadOnly;\r\n }\r\n\r\n public set isReadOnly(value: boolean) {\r\n this._isReadOnly = value;\r\n\r\n for (const child of this._children) {\r\n child.isReadOnly = value;\r\n }\r\n }\r\n\r\n /**\r\n * Creates a new Container\r\n * @param name defines the name of the container\r\n */\r\n constructor(public name?: string) {\r\n super(name);\r\n }\r\n\r\n protected _getTypeName(): string {\r\n return \"Container\";\r\n }\r\n\r\n public _flagDescendantsAsMatrixDirty(): void {\r\n for (const child of this.children) {\r\n child._isClipped = false;\r\n child._markMatrixAsDirty();\r\n }\r\n }\r\n\r\n /**\r\n * Gets a child using its name\r\n * @param name defines the child name to look for\r\n * @returns the child control if found\r\n */\r\n public getChildByName(name: string): Nullable<Control> {\r\n for (const child of this.children) {\r\n if (child.name === name) {\r\n return child;\r\n }\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /**\r\n * Gets a child using its type and its name\r\n * @param name defines the child name to look for\r\n * @param type defines the child type to look for\r\n * @returns the child control if found\r\n */\r\n public getChildByType(name: string, type: string): Nullable<Control> {\r\n for (const child of this.children) {\r\n if (child.typeName === type) {\r\n return child;\r\n }\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /**\r\n * Search for a specific control in children\r\n * @param control defines the control to look for\r\n * @returns true if the control is in child list\r\n */\r\n public containsControl(control: Control): boolean {\r\n return this.children.indexOf(control) !== -1;\r\n }\r\n\r\n /**\r\n * Adds a new control to the current container\r\n * @param control defines the control to add\r\n * @returns the current container\r\n */\r\n public addControl(control: Nullable<Control>): Container {\r\n if (!control) {\r\n return this;\r\n }\r\n\r\n const index = this._children.indexOf(control);\r\n\r\n if (index !== -1) {\r\n return this;\r\n }\r\n control._link(this._host);\r\n\r\n control._markAllAsDirty();\r\n\r\n this._reOrderControl(control);\r\n\r\n this._markAsDirty();\r\n\r\n this.onControlAddedObservable.notifyObservers(control);\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Removes all controls from the current container\r\n * @returns the current container\r\n */\r\n public clearControls(): Container {\r\n const children = this.children.slice();\r\n\r\n for (const child of children) {\r\n this.removeControl(child);\r\n }\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Removes a control from the current container\r\n * @param control defines the control to remove\r\n * @returns the current container\r\n */\r\n public removeControl(control: Control): Container {\r\n const index = this._children.indexOf(control);\r\n\r\n if (index !== -1) {\r\n this._children.splice(index, 1);\r\n\r\n control.parent = null;\r\n }\r\n\r\n control.linkWithMesh(null);\r\n\r\n if (this._host) {\r\n this._host._cleanControlAfterRemoval(control);\r\n }\r\n\r\n this._markAsDirty();\r\n\r\n this.onControlRemovedObservable.notifyObservers(control);\r\n return this;\r\n }\r\n\r\n /**\r\n * An event triggered when any control is added to this container.\r\n */\r\n public onControlAddedObservable = new Observable<Nullable<Control>>();\r\n\r\n /**\r\n * An event triggered when any control is removed from this container.\r\n */\r\n public onControlRemovedObservable = new Observable<Nullable<Control>>();\r\n\r\n /**\r\n * @internal\r\n */\r\n public _reOrderControl(control: Control): void {\r\n const linkedMesh = control.linkedMesh;\r\n\r\n this.removeControl(control);\r\n\r\n let wasAdded = false;\r\n for (let index = 0; index < this._children.length; index++) {\r\n if (this._children[index].zIndex > control.zIndex) {\r\n this._children.splice(index, 0, control);\r\n wasAdded = true;\r\n break;\r\n }\r\n }\r\n\r\n if (!wasAdded) {\r\n this._children.push(control);\r\n }\r\n\r\n control.parent = this;\r\n\r\n if (linkedMesh) {\r\n control.linkWithMesh(linkedMesh);\r\n }\r\n\r\n this._markAsDirty();\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _offsetLeft(offset: number) {\r\n super._offsetLeft(offset);\r\n\r\n for (const child of this._children) {\r\n child._offsetLeft(offset);\r\n }\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _offsetTop(offset: number) {\r\n super._offsetTop(offset);\r\n\r\n for (const child of this._children) {\r\n child._offsetTop(offset);\r\n }\r\n }\r\n\r\n /** @internal */\r\n public _markAllAsDirty(): void {\r\n super._markAllAsDirty();\r\n\r\n for (let index = 0; index < this._children.length; index++) {\r\n this._children[index]._markAllAsDirty();\r\n }\r\n }\r\n\r\n protected _getBackgroundColor(context: ICanvasRenderingContext) {\r\n return this._backgroundGradient ? this._backgroundGradient.getCanvasGradient(context) : this._background;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n protected _localDraw(context: ICanvasRenderingContext): void {\r\n if (this._background || this._backgroundGradient) {\r\n context.save();\r\n if (this.shadowBlur || this.shadowOffsetX || this.shadowOffsetY) {\r\n context.shadowColor = this.shadowColor;\r\n context.shadowBlur = this.shadowBlur;\r\n context.shadowOffsetX = this.shadowOffsetX;\r\n context.shadowOffsetY = this.shadowOffsetY;\r\n }\r\n\r\n context.fillStyle = this._getBackgroundColor(context);\r\n\r\n context.fillRect(this._currentMeasure.left, this._currentMeasure.top, this._currentMeasure.width, this._currentMeasure.height);\r\n context.restore();\r\n }\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _link(host: AdvancedDynamicTexture): void {\r\n super._link(host);\r\n\r\n for (const child of this._children) {\r\n child._link(host);\r\n }\r\n }\r\n\r\n /** @internal */\r\n protected _beforeLayout() {\r\n // Do nothing\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n protected _processMeasures(parentMeasure: Measure, context: ICanvasRenderingContext): void {\r\n if (this._isDirty || !this._cachedParentMeasure.isEqualsTo(parentMeasure)) {\r\n super._processMeasures(parentMeasure, context);\r\n this._evaluateClippingState(parentMeasure);\r\n if (this._renderToIntermediateTexture) {\r\n if (this._intermediateTexture && this._host.getScene() != this._intermediateTexture.getScene()) {\r\n this._intermediateTexture.dispose();\r\n this._intermediateTexture = null;\r\n }\r\n if (!this._intermediateTexture) {\r\n this._intermediateTexture = new DynamicTexture(\r\n \"\",\r\n { width: this._currentMeasure.width, height: this._currentMeasure.height },\r\n this._host.getScene(),\r\n false,\r\n Texture.NEAREST_SAMPLINGMODE,\r\n Constants.TEXTUREFORMAT_RGBA,\r\n false\r\n );\r\n this._intermediateTexture.hasAlpha = true;\r\n } else {\r\n this._intermediateTexture.scaleTo(this._currentMeasure.width, this._currentMeasure.height);\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _layout(parentMeasure: Measure, context: ICanvasRenderingContext): boolean {\r\n if (!this.isDirty && (!this.isVisible || this.notRenderable)) {\r\n return false;\r\n }\r\n\r\n this.host._numLayoutCalls++;\r\n\r\n if (this._isDirty) {\r\n this._currentMeasure.transformToRef(this._transformMatrix, this._prevCurrentMeasureTransformedIntoGlobalSpace);\r\n }\r\n\r\n let rebuildCount = 0;\r\n\r\n context.save();\r\n\r\n this._applyStates(context);\r\n\r\n this._beforeLayout();\r\n\r\n do {\r\n let computedWidth = -1;\r\n let computedHeight = -1;\r\n this._rebuildLayout = false;\r\n this._processMeasures(parentMeasure, context);\r\n\r\n if (!this._isClipped) {\r\n for (const child of this._children) {\r\n child._tempParentMeasure.copyFrom(this._measureForChildren);\r\n\r\n if (child._layout(this._measureForChildren, context)) {\r\n if (child.isVisible && !child.notRenderable) {\r\n if (this.adaptWidthToChildren && child._width.isPixel) {\r\n computedWidth = Math.max(computedWidth, child._currentMeasure.width + child._paddingLeftInPixels + child._paddingRightInPixels);\r\n }\r\n if (this.adaptHeightToChildren && child._height.isPixel) {\r\n computedHeight = Math.max(computedHeight, child._currentMeasure.height + child._paddingTopInPixels + child._paddingBottomInPixels);\r\n }\r\n }\r\n }\r\n }\r\n\r\n if (this.adaptWidthToChildren && computedWidth >= 0) {\r\n computedWidth += this.paddingLeftInPixels + this.paddingRightInPixels;\r\n if (this.width !== computedWidth + \"px\") {\r\n this.parent?._markAsDirty();\r\n this.width = computedWidth + \"px\";\r\n this._width.ignoreAdaptiveScaling = true;\r\n this._rebuildLayout = true;\r\n }\r\n }\r\n if (this.adaptHeightToChildren && computedHeight >= 0) {\r\n computedHeight += this.paddingTopInPixels + this.paddingBottomInPixels;\r\n if (this.height !== computedHeight + \"px\") {\r\n this.parent?._markAsDirty();\r\n this.height = computedHeight + \"px\";\r\n this._height.ignoreAdaptiveScaling = true;\r\n this._rebuildLayout = true;\r\n }\r\n }\r\n\r\n this._postMeasure();\r\n }\r\n rebuildCount++;\r\n } while (this._rebuildLayout && rebuildCount < this.maxLayoutCycle);\r\n\r\n if (rebuildCount >= 3 && this.logLayoutCycleErrors) {\r\n Logger.Error(`Layout cycle detected in GUI (Container name=${this.name}, uniqueId=${this.uniqueId})`);\r\n }\r\n\r\n context.restore();\r\n\r\n if (this._isDirty) {\r\n this.invalidateRect();\r\n\r\n this._isDirty = false;\r\n }\r\n\r\n return true;\r\n }\r\n\r\n protected _postMeasure() {\r\n // Do nothing by default\r\n }\r\n\r\n private _inverseTransformMatrix = Matrix2D.Identity();\r\n private _inverseMeasure = new Measure(0, 0, 0, 0);\r\n\r\n /**\r\n * @internal\r\n */\r\n public _draw(context: ICanvasRenderingContext, invalidatedRectangle?: Measure): void {\r\n const renderToIntermediateTextureThisDraw = this._renderToIntermediateTexture && this._intermediateTexture;\r\n const contextToDrawTo = renderToIntermediateTextureThisDraw ? (<DynamicTexture>this._intermediateTexture).getContext() : context;\r\n\r\n if (renderToIntermediateTextureThisDraw) {\r\n contextToDrawTo.save();\r\n contextToDrawTo.translate(-this._currentMeasure.left, -this._currentMeasure.top);\r\n if (invalidatedRectangle) {\r\n this._transformMatrix.invertToRef(this._inverseTransformMatrix);\r\n invalidatedRectangle.transformToRef(this._inverseTransformMatrix, this._inverseMeasure);\r\n contextToDrawTo.clearRect(this._inverseMeasure.left, this._inverseMeasure.top, this._inverseMeasure.width, this._inverseMeasure.height);\r\n } else {\r\n contextToDrawTo.clearRect(this._currentMeasure.left, this._currentMeasure.top, this._currentMeasure.width, this._currentMeasure.height);\r\n }\r\n }\r\n\r\n this._localDraw(contextToDrawTo);\r\n\r\n context.save();\r\n\r\n if (this.clipChildren) {\r\n this._clipForChildren(contextToDrawTo);\r\n }\r\n\r\n for (const child of this._children) {\r\n // Only redraw parts of the screen that are invalidated\r\n if (invalidatedRectangle) {\r\n if (!child._intersectsRect(invalidatedRectangle)) {\r\n continue;\r\n }\r\n }\r\n child._render(contextToDrawTo, invalidatedRectangle);\r\n }\r\n\r\n if (renderToIntermediateTextureThisDraw) {\r\n contextToDrawTo.restore();\r\n context.save();\r\n context.globalAlpha = this.alpha;\r\n context.drawImage(contextToDrawTo.canvas, this._currentMeasure.left, this._currentMeasure.top);\r\n context.restore();\r\n }\r\n\r\n context.restore();\r\n }\r\n\r\n public getDescendantsToRef(results: Control[], directDescendantsOnly: boolean = false, predicate?: (control: Control) => boolean): void {\r\n if (!this.children) {\r\n return;\r\n }\r\n\r\n for (let index = 0; index < this.children.length; index++) {\r\n const item = this.children[index];\r\n\r\n if (!predicate || predicate(item)) {\r\n results.push(item);\r\n }\r\n\r\n if (!directDescendantsOnly) {\r\n item.getDescendantsToRef(results, false, predicate);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _processPicking(x: number, y: number, pi: Nullable<PointerInfoBase>, type: number, pointerId: number, buttonIndex: number, deltaX?: number, deltaY?: number): boolean {\r\n if (!this._isEnabled || !this.isVisible || this.notRenderable) {\r\n return false;\r\n }\r\n\r\n // checks if the picking position is within the container\r\n const contains = super.contains(x, y);\r\n\r\n // if clipChildren is off, we should still pass picking events to children even if we don't contain the pointer\r\n if (!contains && this.clipChildren) {\r\n return false;\r\n }\r\n\r\n // Checking backwards to pick closest first\r\n for (let index = this._children.length - 1; index >= 0; index--) {\r\n const child = this._children[index];\r\n if (child._processPicking(x, y, pi, type, pointerId, buttonIndex, deltaX, deltaY)) {\r\n if (child.hoverCursor) {\r\n this._host._changeCursor(child.hoverCursor);\r\n }\r\n return true;\r\n }\r\n }\r\n\r\n if (!contains) {\r\n return false;\r\n }\r\n\r\n if (!this.isHitTestVisible) {\r\n return false;\r\n }\r\n\r\n return this._processObservables(type, x, y, pi, pointerId, buttonIndex, deltaX, deltaY);\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n protected _additionalProcessing(parentMeasure: Measure, context: ICanvasRenderingContext): void {\r\n super._additionalProcessing(parentMeasure, context);\r\n\r\n this._measureForChildren.copyFrom(this._currentMeasure);\r\n }\r\n\r\n protected _getAdaptDimTo(dim: \"width\" | \"height\"): boolean {\r\n if (dim === \"width\") {\r\n return this.adaptWidthToChildren;\r\n } else {\r\n return this.adaptHeightToChildren;\r\n }\r\n }\r\n\r\n public isDimensionFullyDefined(dim: \"width\" | \"height\"): boolean {\r\n if (this._getAdaptDimTo(dim)) {\r\n for (const child of this.children) {\r\n if (!child.isDimensionFullyDefined(dim)) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n }\r\n return super.isDimensionFullyDefined(dim);\r\n }\r\n\r\n /**\r\n * Serializes the current control\r\n * @param serializationObject defined the JSON serialized object\r\n */\r\n public serialize(serializationObject: any) {\r\n super.serialize(serializationObject);\r\n\r\n if (this.backgroundGradient) {\r\n serializationObject.backgroundGradient = {};\r\n this.backgroundGradient.serialize(serializationObject.backgroundGradient);\r\n }\r\n\r\n if (!this.children.length) {\r\n return;\r\n }\r\n\r\n serializationObject.children = [];\r\n\r\n for (const child of this.children) {\r\n const childSerializationObject = {};\r\n child.serialize(childSerializationObject);\r\n serializationObject.children.push(childSerializationObject);\r\n }\r\n }\r\n\r\n /** Releases associated resources */\r\n public dispose() {\r\n super.dispose();\r\n\r\n for (let index = this.children.length - 1; index >= 0; index--) {\r\n this.children[index].dispose();\r\n }\r\n this._intermediateTexture?.dispose();\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _parseFromContent(serializedObject: any, host: AdvancedDynamicTexture) {\r\n super._parseFromContent(serializedObject, host);\r\n this._link(host);\r\n\r\n // Gradient\r\n if (serializedObject.backgroundGradient) {\r\n const className = Tools.Instantiate(\"BABYLON.GUI.\" + serializedObject.backgroundGradient.className);\r\n this._backgroundGradient = new className();\r\n this._backgroundGradient?.parse(serializedObject.backgroundGradient);\r\n }\r\n\r\n if (!serializedObject.children) {\r\n return;\r\n }\r\n\r\n for (const childData of serializedObject.children) {\r\n this.addControl(Control.Parse(childData, host));\r\n }\r\n }\r\n\r\n public isReady(): boolean {\r\n for (const child of this.children) {\r\n if (!child.isReady()) {\r\n return false;\r\n }\r\n }\r\n\r\n return true;\r\n }\r\n}\r\nRegisterClass(\"BABYLON.GUI.Container\", Container);\r\n"]}
|
package/2D/controls/control.js
CHANGED
@@ -1167,9 +1167,9 @@ export class Control {
|
|
1167
1167
|
*/
|
1168
1168
|
setPadding(paddingTop, paddingRight, paddingBottom, paddingLeft) {
|
1169
1169
|
const top = paddingTop;
|
1170
|
-
const right = paddingRight
|
1171
|
-
const bottom = paddingBottom
|
1172
|
-
const left = paddingLeft
|
1170
|
+
const right = paddingRight ?? top;
|
1171
|
+
const bottom = paddingBottom ?? top;
|
1172
|
+
const left = paddingLeft ?? right;
|
1173
1173
|
this.paddingTop = top;
|
1174
1174
|
this.paddingRight = right;
|
1175
1175
|
this.paddingBottom = bottom;
|
@@ -1185,9 +1185,9 @@ export class Control {
|
|
1185
1185
|
*/
|
1186
1186
|
setPaddingInPixels(paddingTop, paddingRight, paddingBottom, paddingLeft) {
|
1187
1187
|
const top = paddingTop;
|
1188
|
-
const right = paddingRight
|
1189
|
-
const bottom = paddingBottom
|
1190
|
-
const left = paddingLeft
|
1188
|
+
const right = paddingRight ?? top;
|
1189
|
+
const bottom = paddingBottom ?? top;
|
1190
|
+
const left = paddingLeft ?? right;
|
1191
1191
|
this.paddingTopInPixels = top;
|
1192
1192
|
this.paddingRightInPixels = right;
|
1193
1193
|
this.paddingBottomInPixels = bottom;
|
@@ -1197,10 +1197,9 @@ export class Control {
|
|
1197
1197
|
* @internal
|
1198
1198
|
*/
|
1199
1199
|
_moveToProjectedPosition(projectedPosition) {
|
1200
|
-
var _a;
|
1201
1200
|
const oldLeft = this._left.getValue(this._host);
|
1202
1201
|
const oldTop = this._top.getValue(this._host);
|
1203
|
-
const parentMeasure =
|
1202
|
+
const parentMeasure = this.parent?._currentMeasure;
|
1204
1203
|
if (parentMeasure) {
|
1205
1204
|
this._processMeasures(parentMeasure, this._host.getContext());
|
1206
1205
|
}
|
@@ -1893,8 +1892,7 @@ export class Control {
|
|
1893
1892
|
return false;
|
1894
1893
|
}
|
1895
1894
|
_getStyleProperty(propName, defaultValue) {
|
1896
|
-
|
1897
|
-
const prop = (_a = (this._style && this._style[propName])) !== null && _a !== void 0 ? _a : this[propName];
|
1895
|
+
const prop = (this._style && this._style[propName]) ?? this[propName];
|
1898
1896
|
if (!prop && this.parent) {
|
1899
1897
|
return this.parent._getStyleProperty(propName, defaultValue);
|
1900
1898
|
}
|
@@ -1965,7 +1963,7 @@ export class Control {
|
|
1965
1963
|
parse(serializedObject, host) {
|
1966
1964
|
SerializationHelper.Parse(() => this, serializedObject, null);
|
1967
1965
|
this.name = serializedObject.name;
|
1968
|
-
this._parseFromContent(serializedObject, host
|
1966
|
+
this._parseFromContent(serializedObject, host ?? this._host);
|
1969
1967
|
return this;
|
1970
1968
|
}
|
1971
1969
|
/**
|
@@ -1995,7 +1993,6 @@ export class Control {
|
|
1995
1993
|
* @internal
|
1996
1994
|
*/
|
1997
1995
|
_parseFromContent(serializedObject, host) {
|
1998
|
-
var _a, _b;
|
1999
1996
|
if (serializedObject.fontFamily) {
|
2000
1997
|
this.fontFamily = serializedObject.fontFamily;
|
2001
1998
|
}
|
@@ -2012,7 +2009,7 @@ export class Control {
|
|
2012
2009
|
if (serializedObject.gradient) {
|
2013
2010
|
const className = Tools.Instantiate("BABYLON.GUI." + serializedObject.gradient.className);
|
2014
2011
|
this._gradient = new className();
|
2015
|
-
|
2012
|
+
this._gradient?.parse(serializedObject.gradient);
|
2016
2013
|
}
|
2017
2014
|
// Animations
|
2018
2015
|
if (serializedObject.animations) {
|
@@ -2030,7 +2027,7 @@ export class Control {
|
|
2030
2027
|
.beginAnimation(this, serializedObject.autoAnimateFrom, serializedObject.autoAnimateTo, serializedObject.autoAnimateLoop, serializedObject.autoAnimateSpeed || 1.0);
|
2031
2028
|
}
|
2032
2029
|
}
|
2033
|
-
this.fixedRatioMasterIsWidth =
|
2030
|
+
this.fixedRatioMasterIsWidth = serializedObject.fixedRatioMasterIsWidth ?? this.fixedRatioMasterIsWidth;
|
2034
2031
|
}
|
2035
2032
|
/** Releases associated resources */
|
2036
2033
|
dispose() {
|