@babylonjs/gui 7.4.0 → 7.6.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -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;IAwBlC,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;QAC3C,IAAI,IAAI,CAAC,sBAAsB,KAAK,KAAK,EAAE;YACvC,OAAO;SACV;QAED,IAAI,CAAC,sBAAsB,GAAG,KAAK,CAAC;QAEpC,IAAI,KAAK,EAAE;YACP,IAAI,CAAC,MAAM,GAAG,MAAM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kBAAkB,EAAE;YACrC,MAAM,SAAS,GAAG,KAAK,CAAC,WAAW,CAAC,cAAc,GAAG,gBAAgB,CAAC,kBAAkB,CAAC,SAAS,CAAC,CAAC;YACpG,IAAI,CAAC,mBAAmB,GAAG,IAAI,SAAS,EAAE,CAAC;YAC3C,IAAI,CAAC,mBAAmB,EAAE,KAAK,CAAC,gBAAgB,CAAC,kBAAkB,CAAC,CAAC;SACxE;QAED,IAAI,CAAC,gBAAgB,CAAC,QAAQ,EAAE;YAC5B,OAAO;SACV;QAED,KAAK,MAAM,SAAS,IAAI,gBAAgB,CAAC,QAAQ,EAAE;YAC/C,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,KAAK,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC,CAAC;SACnD;IACL,CAAC;IAEe,OAAO;QACnB,KAAK,MAAM,KAAK,IAAI,IAAI,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;AA7rBU;IADN,SAAS,EAAE;4DAC6B;AAIzC;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;AAymBL,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 /**\r\n * Gets or sets a boolean indicating that the container will let internal controls handle picking instead of doing it directly using its bounding info\r\n */\r\n @serialize()\r\n public delegatePickingToChildren = false;\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 override get isReadOnly() {\r\n return this._isReadOnly;\r\n }\r\n\r\n public override 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 override name?: string) {\r\n super(name);\r\n }\r\n\r\n protected override _getTypeName(): string {\r\n return \"Container\";\r\n }\r\n\r\n public override _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 override _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 override _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 override _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 override _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 override _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 override _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 override _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 override _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 override 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 override _processPicking(\r\n x: number,\r\n y: number,\r\n pi: Nullable<PointerInfoBase>,\r\n type: number,\r\n pointerId: number,\r\n buttonIndex: number,\r\n deltaX?: number,\r\n deltaY?: number\r\n ): 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 if (this.delegatePickingToChildren) {\r\n let contains = false;\r\n for (let index = this._children.length - 1; index >= 0; index--) {\r\n const child = this._children[index];\r\n if (child.isEnabled && child.isHitTestVisible && child.isVisible && !child.notRenderable && child.contains(x, y)) {\r\n contains = true;\r\n break;\r\n }\r\n }\r\n\r\n if (!contains) {\r\n return false;\r\n }\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 override _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 override 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 * @param force force serialization even if isSerializable === false\r\n * @param allowCanvas defines if the control is allowed to use a Canvas2D object to serialize (true by default)\r\n */\r\n public override serialize(serializationObject: any, force: boolean = false, allowCanvas: boolean = true) {\r\n super.serialize(serializationObject, force, allowCanvas);\r\n if (!this.isSerializable && !force) {\r\n return;\r\n }\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 if (child.isSerializable || force) {\r\n const childSerializationObject = {};\r\n child.serialize(childSerializationObject, force, allowCanvas);\r\n serializationObject.children.push(childSerializationObject);\r\n }\r\n }\r\n }\r\n\r\n /** Releases associated resources */\r\n public override 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 override _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 override 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;IAwBlC,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,C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2CAGX;AAaD;IADC,SAAS,EAAE;mDAGX;AAymBL,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 /**\r\n * Gets or sets a boolean indicating that the container will let internal controls handle picking instead of doing it directly using its bounding info\r\n */\r\n @serialize()\r\n public delegatePickingToChildren = false;\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 override get isReadOnly() {\r\n return this._isReadOnly;\r\n }\r\n\r\n public override 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 override name?: string) {\r\n super(name);\r\n }\r\n\r\n protected override _getTypeName(): string {\r\n return \"Container\";\r\n }\r\n\r\n public override _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 override _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 override _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 override _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 override _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 override _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 override _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 override _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 override _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 override 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 override _processPicking(\r\n x: number,\r\n y: number,\r\n pi: Nullable<PointerInfoBase>,\r\n type: number,\r\n pointerId: number,\r\n buttonIndex: number,\r\n deltaX?: number,\r\n deltaY?: number\r\n ): 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 if (this.delegatePickingToChildren) {\r\n let contains = false;\r\n for (let index = this._children.length - 1; index >= 0; index--) {\r\n const child = this._children[index];\r\n if (child.isEnabled && child.isHitTestVisible && child.isVisible && !child.notRenderable && child.contains(x, y)) {\r\n contains = true;\r\n break;\r\n }\r\n }\r\n\r\n if (!contains) {\r\n return false;\r\n }\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 override _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 override 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 * @param force force serialization even if isSerializable === false\r\n * @param allowCanvas defines if the control is allowed to use a Canvas2D object to serialize (true by default)\r\n */\r\n public override serialize(serializationObject: any, force: boolean = false, allowCanvas: boolean = true) {\r\n super.serialize(serializationObject, force, allowCanvas);\r\n if (!this.isSerializable && !force) {\r\n return;\r\n }\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 if (child.isSerializable || force) {\r\n const childSerializationObject = {};\r\n child.serialize(childSerializationObject, force, allowCanvas);\r\n serializationObject.children.push(childSerializationObject);\r\n }\r\n }\r\n }\r\n\r\n /** Releases associated resources */\r\n public override 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 override _parseFromContent(serializedObject: any, host: AdvancedDynamicTexture, urlRewriter?: (url: string) => string) {\r\n super._parseFromContent(serializedObject, host, urlRewriter);\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, urlRewriter));\r\n }\r\n }\r\n\r\n public override 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"]}
@@ -15,6 +15,7 @@ import type { IAccessibilityTag } from "@babylonjs/core/IAccessibilityTag.js";
15
15
  import type { IAnimatable } from "@babylonjs/core/Animations/animatable.interface.js";
16
16
  import type { Animation } from "@babylonjs/core/Animations/animation.js";
17
17
  import type { BaseGradient } from "./gradient/BaseGradient";
18
+ import type { AbstractEngine } from "@babylonjs/core/Engines/abstractEngine.js";
18
19
  /**
19
20
  * Root class used for all 2D controls
20
21
  * @see https://doc.babylonjs.com/features/featuresDeepDive/gui/gui#controls
@@ -113,6 +114,8 @@ export declare class Control implements IAnimatable {
113
114
  private _gradient;
114
115
  /** @internal */
115
116
  protected _rebuildLayout: boolean;
117
+ /** @internal */
118
+ protected _urlRewriter?: (url: string) => string;
116
119
  /**
117
120
  * Observable that fires when the control's enabled state changes
118
121
  */
@@ -819,9 +822,10 @@ export declare class Control implements IAnimatable {
819
822
  * Parses a serialized object into this control
820
823
  * @param serializedObject the object with the serialized properties
821
824
  * @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
825
+ * @param urlRewriter defines an url rewriter to update urls before sending them to the controls
822
826
  * @returns this control
823
827
  */
824
- parse(serializedObject: any, host?: AdvancedDynamicTexture): Control;
828
+ parse(serializedObject: any, host?: AdvancedDynamicTexture, urlRewriter?: (url: string) => string): Control;
825
829
  /**
826
830
  * Serializes the current control
827
831
  * @param serializationObject defined the JSON serialized object
@@ -832,7 +836,7 @@ export declare class Control implements IAnimatable {
832
836
  /**
833
837
  * @internal
834
838
  */
835
- _parseFromContent(serializedObject: any, host: AdvancedDynamicTexture): void;
839
+ _parseFromContent(serializedObject: any, host: AdvancedDynamicTexture, urlRewriter?: (url: string) => string): void;
836
840
  /** Releases associated resources */
837
841
  dispose(): void;
838
842
  private static _HORIZONTAL_ALIGNMENT_LEFT;
@@ -857,7 +861,7 @@ export declare class Control implements IAnimatable {
857
861
  /**
858
862
  * @internal
859
863
  */
860
- static _GetFontOffset(font: string): {
864
+ static _GetFontOffset(font: string, engineToUse?: AbstractEngine): {
861
865
  ascent: number;
862
866
  height: number;
863
867
  descent: number;
@@ -866,9 +870,10 @@ export declare class Control implements IAnimatable {
866
870
  * Creates a Control from parsed data
867
871
  * @param serializedObject defines parsed data
868
872
  * @param host defines the hosting AdvancedDynamicTexture
873
+ * @param urlRewriter defines an url rewriter to update urls before sending them to the controls
869
874
  * @returns a new Control
870
875
  */
871
- static Parse(serializedObject: any, host: AdvancedDynamicTexture): Control;
876
+ static Parse(serializedObject: any, host: AdvancedDynamicTexture, urlRewriter?: (url: string) => string): Control;
872
877
  static AddHeader: (control: Control, text: string, size: string | number, options: {
873
878
  isHorizontal: boolean;
874
879
  controlFirst: boolean;
@@ -1923,7 +1923,7 @@ export class Control {
1923
1923
  this.fontSizeInPixels +
1924
1924
  "px " +
1925
1925
  this._getStyleProperty("fontFamily", "Arial");
1926
- this._fontOffset = Control._GetFontOffset(this._font);
1926
+ this._fontOffset = Control._GetFontOffset(this._font, this._host.getScene()?.getEngine());
1927
1927
  //children need to be refreshed
1928
1928
  this.getDescendants().forEach((child) => child._markAllAsDirty());
1929
1929
  }
@@ -1966,9 +1966,11 @@ export class Control {
1966
1966
  * Parses a serialized object into this control
1967
1967
  * @param serializedObject the object with the serialized properties
1968
1968
  * @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
1969
+ * @param urlRewriter defines an url rewriter to update urls before sending them to the controls
1969
1970
  * @returns this control
1970
1971
  */
1971
- parse(serializedObject, host) {
1972
+ parse(serializedObject, host, urlRewriter) {
1973
+ this._urlRewriter = urlRewriter;
1972
1974
  SerializationHelper.Parse(() => this, serializedObject, null);
1973
1975
  this.name = serializedObject.name;
1974
1976
  this._parseFromContent(serializedObject, host ?? this._host);
@@ -1991,10 +1993,16 @@ export class Control {
1991
1993
  if (allowCanvas) {
1992
1994
  this._prepareFont();
1993
1995
  }
1994
- if (this._font) {
1996
+ if (this._fontFamily) {
1995
1997
  serializationObject.fontFamily = this._fontFamily;
1998
+ }
1999
+ if (this.fontSize) {
1996
2000
  serializationObject.fontSize = this.fontSize;
2001
+ }
2002
+ if (this.fontWeight) {
1997
2003
  serializationObject.fontWeight = this.fontWeight;
2004
+ }
2005
+ if (this.fontStyle) {
1998
2006
  serializationObject.fontStyle = this.fontStyle;
1999
2007
  }
2000
2008
  if (this._gradient) {
@@ -2007,7 +2015,7 @@ export class Control {
2007
2015
  /**
2008
2016
  * @internal
2009
2017
  */
2010
- _parseFromContent(serializedObject, host) {
2018
+ _parseFromContent(serializedObject, host, urlRewriter) {
2011
2019
  if (serializedObject.fontFamily) {
2012
2020
  this.fontFamily = serializedObject.fontFamily;
2013
2021
  }
@@ -2101,11 +2109,11 @@ export class Control {
2101
2109
  /**
2102
2110
  * @internal
2103
2111
  */
2104
- static _GetFontOffset(font) {
2112
+ static _GetFontOffset(font, engineToUse) {
2105
2113
  if (Control._FontHeightSizes[font]) {
2106
2114
  return Control._FontHeightSizes[font];
2107
2115
  }
2108
- const engine = EngineStore.LastCreatedEngine;
2116
+ const engine = engineToUse || EngineStore.LastCreatedEngine;
2109
2117
  if (!engine) {
2110
2118
  throw new Error("Invalid engine. Unable to create a canvas.");
2111
2119
  }
@@ -2117,13 +2125,18 @@ export class Control {
2117
2125
  * Creates a Control from parsed data
2118
2126
  * @param serializedObject defines parsed data
2119
2127
  * @param host defines the hosting AdvancedDynamicTexture
2128
+ * @param urlRewriter defines an url rewriter to update urls before sending them to the controls
2120
2129
  * @returns a new Control
2121
2130
  */
2122
- static Parse(serializedObject, host) {
2131
+ static Parse(serializedObject, host, urlRewriter) {
2123
2132
  const controlType = Tools.Instantiate("BABYLON.GUI." + serializedObject.className);
2124
- const control = SerializationHelper.Parse(() => new controlType(), serializedObject, null);
2133
+ const control = SerializationHelper.Parse(() => {
2134
+ const newControl = new controlType();
2135
+ newControl._urlRewriter = urlRewriter;
2136
+ return newControl;
2137
+ }, serializedObject, null);
2125
2138
  control.name = serializedObject.name;
2126
- control._parseFromContent(serializedObject, host);
2139
+ control._parseFromContent(serializedObject, host, urlRewriter);
2127
2140
  return control;
2128
2141
  }
2129
2142
  /**