@babylonjs/gui 6.39.0 → 6.40.0
Sign up to get free protection for your applications and to get access to all the features.
- package/2D/advancedDynamicTexture.d.ts +1 -1
- package/2D/advancedDynamicTexture.js +2 -1
- package/2D/advancedDynamicTexture.js.map +1 -1
- package/2D/controls/button.d.ts +2 -5
- package/2D/controls/button.js +6 -6
- package/2D/controls/button.js.map +1 -1
- package/2D/controls/container.d.ts +6 -1
- package/2D/controls/container.js +31 -5
- package/2D/controls/container.js.map +1 -1
- package/2D/controls/control.d.ts +9 -1
- package/2D/controls/control.js +16 -2
- package/2D/controls/control.js.map +1 -1
- package/2D/controls/focusableButton.d.ts +1 -1
- package/2D/controls/focusableButton.js +1 -1
- package/2D/controls/focusableButton.js.map +1 -1
- package/2D/controls/gradient/BaseGradient.d.ts +17 -5
- package/2D/controls/gradient/BaseGradient.js +17 -5
- package/2D/controls/gradient/BaseGradient.js.map +1 -1
- package/2D/controls/grid.d.ts +2 -1
- package/2D/controls/grid.js +6 -2
- package/2D/controls/grid.js.map +1 -1
- package/2D/controls/image.d.ts +2 -1
- package/2D/controls/image.js +2 -1
- package/2D/controls/image.js.map +1 -1
- package/2D/controls/stackPanel.d.ts +2 -1
- package/2D/controls/stackPanel.js +6 -2
- package/2D/controls/stackPanel.js.map +1 -1
- package/2D/xmlLoader.js +9 -0
- package/2D/xmlLoader.js.map +1 -1
- package/3D/controls/button3D.d.ts +1 -0
- package/3D/controls/button3D.js +1 -0
- package/3D/controls/button3D.js.map +1 -1
- package/3D/controls/control3D.d.ts +1 -1
- package/3D/controls/control3D.js +1 -1
- package/3D/controls/control3D.js.map +1 -1
- package/3D/controls/holographicSlate.d.ts +1 -1
- package/3D/controls/holographicSlate.js +1 -1
- package/3D/controls/holographicSlate.js.map +1 -1
- package/3D/controls/touchHolographicMenu.d.ts +2 -2
- package/3D/controls/touchHolographicMenu.js +2 -2
- package/3D/controls/touchHolographicMenu.js.map +1 -1
- package/package.json +2 -2
package/2D/controls/button.js
CHANGED
@@ -26,10 +26,6 @@ export class Button extends Rectangle {
|
|
26
26
|
constructor(name) {
|
27
27
|
super(name);
|
28
28
|
this.name = name;
|
29
|
-
/**
|
30
|
-
* Gets or sets a boolean indicating that the button will let internal controls handle picking instead of doing it directly using its bounding info
|
31
|
-
*/
|
32
|
-
this.delegatePickingToChildren = false;
|
33
29
|
this.thickness = 1;
|
34
30
|
this.isPointerBlocker = true;
|
35
31
|
let alphaStore = null;
|
@@ -134,9 +130,13 @@ export class Button extends Rectangle {
|
|
134
130
|
/**
|
135
131
|
* Serializes the current button
|
136
132
|
* @param serializationObject defines the JSON serialized object
|
133
|
+
* @param force force serialization even if isSerializable === false
|
137
134
|
*/
|
138
|
-
serialize(serializationObject) {
|
139
|
-
super.serialize(serializationObject);
|
135
|
+
serialize(serializationObject, force) {
|
136
|
+
super.serialize(serializationObject, force);
|
137
|
+
if (!this.isSerializable && !force) {
|
138
|
+
return;
|
139
|
+
}
|
140
140
|
if (this._textBlock) {
|
141
141
|
serializationObject.textBlockName = this._textBlock.name;
|
142
142
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"button.js","sourceRoot":"","sources":["../../../../../dev/gui/src/2D/controls/button.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,aAAa,EAAE,0CAA4B;AAKpD;;GAEG;AACH,MAAM,OAAO,MAAO,SAAQ,SAAS;IAwBjC;;OAEG;IACH,IAAW,KAAK;QACZ,OAAO,IAAI,CAAC,MAAM,CAAC;IACvB,CAAC;IAGD;;OAEG;IACH,IAAW,SAAS;QAChB,OAAO,IAAI,CAAC,UAAU,CAAC;IAC3B,CAAC;IAED;;;OAGG;IACH,YAAmB,IAAa;QAC5B,KAAK,CAAC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Ae;QACf,MAAM,SAAS,GAAG,IAAI,KAAK,CAAC,IAAI,GAAG,OAAO,EAAE,QAAQ,CAAC,CAAC;QACtD,SAAS,CAAC,OAAO,GAAG,KAAK,CAAC,YAAY,CAAC;QACvC,MAAM,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;QAE7B,cAAc;QACd,MAAM,SAAS,GAAG,IAAI,SAAS,CAAC,IAAI,GAAG,SAAS,EAAE,IAAI,CAAC,CAAC;QACxD,SAAS,CAAC,YAAY,GAAG,IAAI,CAAC;QAC9B,SAAS,CAAC,uBAAuB,GAAG,OAAO,CAAC,2BAA2B,CAAC;QACxE,MAAM,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;QAE7B,QAAQ;QACR,MAAM,CAAC,MAAM,GAAG,SAAS,CAAC;QAC1B,MAAM,CAAC,UAAU,GAAG,SAAS,CAAC;QAE9B,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ;AACD,aAAa,CAAC,oBAAoB,EAAE,MAAM,CAAC,CAAC","sourcesContent":["import type { Nullable } from \"core/types\";\r\nimport type { Vector2 } from \"core/Maths/math.vector\";\r\n\r\nimport { Rectangle } from \"./rectangle\";\r\nimport { Control } from \"./control\";\r\nimport { TextBlock } from \"./textBlock\";\r\nimport { Image } from \"./image\";\r\nimport { RegisterClass } from \"core/Misc/typeStore\";\r\nimport type { PointerInfoBase } from \"core/Events/pointerEvents\";\r\nimport type { AdvancedDynamicTexture } from \"../advancedDynamicTexture\";\r\nimport type { ICanvasRenderingContext } from \"core/Engines/ICanvas\";\r\n\r\n/**\r\n * Class used to create 2D buttons\r\n */\r\nexport class Button extends Rectangle {\r\n /**\r\n * Function called to generate a pointer enter animation\r\n */\r\n public pointerEnterAnimation: () => void;\r\n /**\r\n * Function called to generate a pointer out animation\r\n */\r\n public pointerOutAnimation: () => void;\r\n /**\r\n * Function called to generate a pointer down animation\r\n */\r\n public pointerDownAnimation: () => void;\r\n /**\r\n * Function called to generate a pointer up animation\r\n */\r\n public pointerUpAnimation: () => void;\r\n\r\n /**\r\n * Gets or sets a boolean indicating that the button will let internal controls handle picking instead of doing it directly using its bounding info\r\n */\r\n public delegatePickingToChildren = false;\r\n\r\n private _image: Nullable<Image>;\r\n /**\r\n * Returns the image part of the button (if any)\r\n */\r\n public get image(): Nullable<Image> {\r\n return this._image;\r\n }\r\n\r\n private _textBlock: Nullable<TextBlock>;\r\n /**\r\n * Returns the TextBlock part of the button (if any)\r\n */\r\n public get textBlock(): Nullable<TextBlock> {\r\n return this._textBlock;\r\n }\r\n\r\n /**\r\n * Creates a new Button\r\n * @param name defines the name of the button\r\n */\r\n constructor(public name?: string) {\r\n super(name);\r\n\r\n this.thickness = 1;\r\n this.isPointerBlocker = true;\r\n\r\n let alphaStore: Nullable<number> = null;\r\n\r\n this.pointerEnterAnimation = () => {\r\n alphaStore = this.alpha;\r\n this.alpha -= 0.1;\r\n };\r\n\r\n this.pointerOutAnimation = () => {\r\n if (alphaStore !== null) {\r\n this.alpha = alphaStore;\r\n }\r\n };\r\n\r\n this.pointerDownAnimation = () => {\r\n this.scaleX -= 0.05;\r\n this.scaleY -= 0.05;\r\n };\r\n\r\n this.pointerUpAnimation = () => {\r\n this.scaleX += 0.05;\r\n this.scaleY += 0.05;\r\n };\r\n }\r\n\r\n protected _getTypeName(): string {\r\n return \"Button\";\r\n }\r\n\r\n // While being a container, the button behaves like a control.\r\n /**\r\n * @internal\r\n */\r\n public _processPicking(x: number, y: number, pi: PointerInfoBase, type: number, pointerId: number, buttonIndex: number, deltaX?: number, deltaY?: number): boolean {\r\n if (!this._isEnabled || !this.isHitTestVisible || !this.isVisible || this.notRenderable) {\r\n return false;\r\n }\r\n\r\n if (!super.contains(x, y)) {\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 this._processObservables(type, x, y, pi, pointerId, buttonIndex, deltaX, deltaY);\r\n\r\n return true;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _onPointerEnter(target: Control, pi: PointerInfoBase): boolean {\r\n if (!super._onPointerEnter(target, pi)) {\r\n return false;\r\n }\r\n\r\n if (!this.isReadOnly && this.pointerEnterAnimation) {\r\n this.pointerEnterAnimation();\r\n }\r\n\r\n return true;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _onPointerOut(target: Control, pi: PointerInfoBase, force = false): void {\r\n if (!this.isReadOnly && this.pointerOutAnimation) {\r\n this.pointerOutAnimation();\r\n }\r\n\r\n super._onPointerOut(target, pi, force);\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _onPointerDown(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number, pi: PointerInfoBase): boolean {\r\n if (!super._onPointerDown(target, coordinates, pointerId, buttonIndex, pi)) {\r\n return false;\r\n }\r\n\r\n if (!this.isReadOnly && this.pointerDownAnimation) {\r\n this.pointerDownAnimation();\r\n }\r\n\r\n return true;\r\n }\r\n\r\n protected _getRectangleFill(context: ICanvasRenderingContext) {\r\n if (this.isEnabled) {\r\n return this._getBackgroundColor(context);\r\n } else {\r\n return this._disabledColor;\r\n }\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _onPointerUp(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean, pi: PointerInfoBase): void {\r\n if (!this.isReadOnly && this.pointerUpAnimation) {\r\n this.pointerUpAnimation();\r\n }\r\n\r\n super._onPointerUp(target, coordinates, pointerId, buttonIndex, notifyClick, pi);\r\n }\r\n\r\n /**\r\n * Serializes the current button\r\n * @param serializationObject defines the JSON serialized object\r\n */\r\n public serialize(serializationObject: any) {\r\n super.serialize(serializationObject);\r\n\r\n if (this._textBlock) {\r\n serializationObject.textBlockName = this._textBlock.name;\r\n }\r\n if (this._image) {\r\n serializationObject.imageName = this._image.name;\r\n }\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\r\n if (serializedObject.textBlockName) {\r\n this._textBlock = this.getChildByName(serializedObject.textBlockName) as Nullable<TextBlock>;\r\n }\r\n\r\n if (serializedObject.imageName) {\r\n this._image = this.getChildByName(serializedObject.imageName) as Nullable<Image>;\r\n }\r\n }\r\n\r\n // Statics\r\n /**\r\n * Creates a new button made with an image and a text\r\n * @param name defines the name of the button\r\n * @param text defines the text of the button\r\n * @param imageUrl defines the url of the image\r\n * @returns a new Button\r\n */\r\n public static CreateImageButton(name: string, text: string, imageUrl: string): Button {\r\n const result = new this(name);\r\n\r\n // Adding text\r\n const textBlock = new TextBlock(name + \"_button\", text);\r\n textBlock.textWrapping = true;\r\n textBlock.textHorizontalAlignment = Control.HORIZONTAL_ALIGNMENT_CENTER;\r\n textBlock.paddingLeft = \"20%\";\r\n result.addControl(textBlock);\r\n\r\n // Adding image\r\n const iconImage = new Image(name + \"_icon\", imageUrl);\r\n iconImage.width = \"20%\";\r\n iconImage.stretch = Image.STRETCH_UNIFORM;\r\n iconImage.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;\r\n result.addControl(iconImage);\r\n\r\n // Store\r\n result._image = iconImage;\r\n result._textBlock = textBlock;\r\n\r\n return result;\r\n }\r\n\r\n /**\r\n * Creates a new button made with an image\r\n * @param name defines the name of the button\r\n * @param imageUrl defines the url of the image\r\n * @returns a new Button\r\n */\r\n public static CreateImageOnlyButton(name: string, imageUrl: string): Button {\r\n const result = new this(name);\r\n\r\n // Adding image\r\n const iconImage = new Image(name + \"_icon\", imageUrl);\r\n iconImage.stretch = Image.STRETCH_FILL;\r\n iconImage.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;\r\n result.addControl(iconImage);\r\n\r\n // Store\r\n result._image = iconImage;\r\n\r\n return result;\r\n }\r\n\r\n /**\r\n * Creates a new button made with a text\r\n * @param name defines the name of the button\r\n * @param text defines the text of the button\r\n * @returns a new Button\r\n */\r\n public static CreateSimpleButton(name: string, text: string): Button {\r\n const result = new this(name);\r\n\r\n // Adding text\r\n const textBlock = new TextBlock(name + \"_button\", text);\r\n textBlock.textWrapping = true;\r\n textBlock.textHorizontalAlignment = Control.HORIZONTAL_ALIGNMENT_CENTER;\r\n result.addControl(textBlock);\r\n\r\n // Store\r\n result._textBlock = textBlock;\r\n\r\n return result;\r\n }\r\n\r\n /**\r\n * Creates a new button made with an image and a centered text\r\n * @param name defines the name of the button\r\n * @param text defines the text of the button\r\n * @param imageUrl defines the url of the image\r\n * @returns a new Button\r\n */\r\n public static CreateImageWithCenterTextButton(name: string, text: string, imageUrl: string): Button {\r\n const result = new this(name);\r\n\r\n // Adding image\r\n const iconImage = new Image(name + \"_icon\", imageUrl);\r\n iconImage.stretch = Image.STRETCH_FILL;\r\n result.addControl(iconImage);\r\n\r\n // Adding text\r\n const textBlock = new TextBlock(name + \"_button\", text);\r\n textBlock.textWrapping = true;\r\n textBlock.textHorizontalAlignment = Control.HORIZONTAL_ALIGNMENT_CENTER;\r\n result.addControl(textBlock);\r\n\r\n // Store\r\n result._image = iconImage;\r\n result._textBlock = textBlock;\r\n\r\n return result;\r\n }\r\n}\r\nRegisterClass(\"BABYLON.GUI.Button\", Button);\r\n"]}
|
1
|
+
{"version":3,"file":"button.js","sourceRoot":"","sources":["../../../../../dev/gui/src/2D/controls/button.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,aAAa,EAAE,0CAA4B;AAKpD;;GAEG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A2B,CAAC;QACxE,MAAM,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;QAE7B,QAAQ;QACR,MAAM,CAAC,UAAU,GAAG,SAAS,CAAC;QAE9B,OAAO,MAAM,CAAC;IAClB,CAAC;IAED;;;;;;OAMG;IACI,MAAM,CAAC,+BAA+B,CAAC,IAAY,EAAE,IAAY,EAAE,QAAgB;QACtF,MAAM,MAAM,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC;QAE9B,eAAe;QACf,MAAM,SAAS,GAAG,IAAI,KAAK,CAAC,IAAI,GAAG,OAAO,EAAE,QAAQ,CAAC,CAAC;QACtD,SAAS,CAAC,OAAO,GAAG,KAAK,CAAC,YAAY,CAAC;QACvC,MAAM,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;QAE7B,cAAc;QACd,MAAM,SAAS,GAAG,IAAI,SAAS,CAAC,IAAI,GAAG,SAAS,EAAE,IAAI,CAAC,CAAC;QACxD,SAAS,CAAC,YAAY,GAAG,IAAI,CAAC;QAC9B,SAAS,CAAC,uBAAuB,GAAG,OAAO,CAAC,2BAA2B,CAAC;QACxE,MAAM,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;QAE7B,QAAQ;QACR,MAAM,CAAC,MAAM,GAAG,SAAS,CAAC;QAC1B,MAAM,CAAC,UAAU,GAAG,SAAS,CAAC;QAE9B,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ;AACD,aAAa,CAAC,oBAAoB,EAAE,MAAM,CAAC,CAAC","sourcesContent":["import type { Nullable } from \"core/types\";\r\nimport type { Vector2 } from \"core/Maths/math.vector\";\r\n\r\nimport { Rectangle } from \"./rectangle\";\r\nimport { Control } from \"./control\";\r\nimport { TextBlock } from \"./textBlock\";\r\nimport { Image } from \"./image\";\r\nimport { RegisterClass } from \"core/Misc/typeStore\";\r\nimport type { PointerInfoBase } from \"core/Events/pointerEvents\";\r\nimport type { AdvancedDynamicTexture } from \"../advancedDynamicTexture\";\r\nimport type { ICanvasRenderingContext } from \"core/Engines/ICanvas\";\r\n\r\n/**\r\n * Class used to create 2D buttons\r\n */\r\nexport class Button extends Rectangle {\r\n /**\r\n * Function called to generate a pointer enter animation\r\n */\r\n public pointerEnterAnimation: () => void;\r\n /**\r\n * Function called to generate a pointer out animation\r\n */\r\n public pointerOutAnimation: () => void;\r\n /**\r\n * Function called to generate a pointer down animation\r\n */\r\n public pointerDownAnimation: () => void;\r\n /**\r\n * Function called to generate a pointer up animation\r\n */\r\n public pointerUpAnimation: () => void;\r\n\r\n private _image: Nullable<Image>;\r\n /**\r\n * Returns the image part of the button (if any)\r\n */\r\n public get image(): Nullable<Image> {\r\n return this._image;\r\n }\r\n\r\n private _textBlock: Nullable<TextBlock>;\r\n /**\r\n * Returns the TextBlock part of the button (if any)\r\n */\r\n public get textBlock(): Nullable<TextBlock> {\r\n return this._textBlock;\r\n }\r\n\r\n /**\r\n * Creates a new Button\r\n * @param name defines the name of the button\r\n */\r\n constructor(public name?: string) {\r\n super(name);\r\n\r\n this.thickness = 1;\r\n this.isPointerBlocker = true;\r\n\r\n let alphaStore: Nullable<number> = null;\r\n\r\n this.pointerEnterAnimation = () => {\r\n alphaStore = this.alpha;\r\n this.alpha -= 0.1;\r\n };\r\n\r\n this.pointerOutAnimation = () => {\r\n if (alphaStore !== null) {\r\n this.alpha = alphaStore;\r\n }\r\n };\r\n\r\n this.pointerDownAnimation = () => {\r\n this.scaleX -= 0.05;\r\n this.scaleY -= 0.05;\r\n };\r\n\r\n this.pointerUpAnimation = () => {\r\n this.scaleX += 0.05;\r\n this.scaleY += 0.05;\r\n };\r\n }\r\n\r\n protected _getTypeName(): string {\r\n return \"Button\";\r\n }\r\n\r\n // While being a container, the button behaves like a control.\r\n /**\r\n * @internal\r\n */\r\n public _processPicking(x: number, y: number, pi: PointerInfoBase, type: number, pointerId: number, buttonIndex: number, deltaX?: number, deltaY?: number): boolean {\r\n if (!this._isEnabled || !this.isHitTestVisible || !this.isVisible || this.notRenderable) {\r\n return false;\r\n }\r\n\r\n if (!super.contains(x, y)) {\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 this._processObservables(type, x, y, pi, pointerId, buttonIndex, deltaX, deltaY);\r\n\r\n return true;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _onPointerEnter(target: Control, pi: PointerInfoBase): boolean {\r\n if (!super._onPointerEnter(target, pi)) {\r\n return false;\r\n }\r\n\r\n if (!this.isReadOnly && this.pointerEnterAnimation) {\r\n this.pointerEnterAnimation();\r\n }\r\n\r\n return true;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _onPointerOut(target: Control, pi: PointerInfoBase, force = false): void {\r\n if (!this.isReadOnly && this.pointerOutAnimation) {\r\n this.pointerOutAnimation();\r\n }\r\n\r\n super._onPointerOut(target, pi, force);\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _onPointerDown(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number, pi: PointerInfoBase): boolean {\r\n if (!super._onPointerDown(target, coordinates, pointerId, buttonIndex, pi)) {\r\n return false;\r\n }\r\n\r\n if (!this.isReadOnly && this.pointerDownAnimation) {\r\n this.pointerDownAnimation();\r\n }\r\n\r\n return true;\r\n }\r\n\r\n protected _getRectangleFill(context: ICanvasRenderingContext) {\r\n if (this.isEnabled) {\r\n return this._getBackgroundColor(context);\r\n } else {\r\n return this._disabledColor;\r\n }\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _onPointerUp(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean, pi: PointerInfoBase): void {\r\n if (!this.isReadOnly && this.pointerUpAnimation) {\r\n this.pointerUpAnimation();\r\n }\r\n\r\n super._onPointerUp(target, coordinates, pointerId, buttonIndex, notifyClick, pi);\r\n }\r\n\r\n /**\r\n * Serializes the current button\r\n * @param serializationObject defines the JSON serialized object\r\n * @param force force serialization even if isSerializable === false\r\n */\r\n public serialize(serializationObject: any, force: boolean) {\r\n super.serialize(serializationObject, force);\r\n if (!this.isSerializable && !force) {\r\n return;\r\n }\r\n\r\n if (this._textBlock) {\r\n serializationObject.textBlockName = this._textBlock.name;\r\n }\r\n if (this._image) {\r\n serializationObject.imageName = this._image.name;\r\n }\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\r\n if (serializedObject.textBlockName) {\r\n this._textBlock = this.getChildByName(serializedObject.textBlockName) as Nullable<TextBlock>;\r\n }\r\n\r\n if (serializedObject.imageName) {\r\n this._image = this.getChildByName(serializedObject.imageName) as Nullable<Image>;\r\n }\r\n }\r\n\r\n // Statics\r\n /**\r\n * Creates a new button made with an image and a text\r\n * @param name defines the name of the button\r\n * @param text defines the text of the button\r\n * @param imageUrl defines the url of the image\r\n * @returns a new Button\r\n */\r\n public static CreateImageButton(name: string, text: string, imageUrl: string): Button {\r\n const result = new this(name);\r\n\r\n // Adding text\r\n const textBlock = new TextBlock(name + \"_button\", text);\r\n textBlock.textWrapping = true;\r\n textBlock.textHorizontalAlignment = Control.HORIZONTAL_ALIGNMENT_CENTER;\r\n textBlock.paddingLeft = \"20%\";\r\n result.addControl(textBlock);\r\n\r\n // Adding image\r\n const iconImage = new Image(name + \"_icon\", imageUrl);\r\n iconImage.width = \"20%\";\r\n iconImage.stretch = Image.STRETCH_UNIFORM;\r\n iconImage.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;\r\n result.addControl(iconImage);\r\n\r\n // Store\r\n result._image = iconImage;\r\n result._textBlock = textBlock;\r\n\r\n return result;\r\n }\r\n\r\n /**\r\n * Creates a new button made with an image\r\n * @param name defines the name of the button\r\n * @param imageUrl defines the url of the image\r\n * @returns a new Button\r\n */\r\n public static CreateImageOnlyButton(name: string, imageUrl: string): Button {\r\n const result = new this(name);\r\n\r\n // Adding image\r\n const iconImage = new Image(name + \"_icon\", imageUrl);\r\n iconImage.stretch = Image.STRETCH_FILL;\r\n iconImage.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;\r\n result.addControl(iconImage);\r\n\r\n // Store\r\n result._image = iconImage;\r\n\r\n return result;\r\n }\r\n\r\n /**\r\n * Creates a new button made with a text\r\n * @param name defines the name of the button\r\n * @param text defines the text of the button\r\n * @returns a new Button\r\n */\r\n public static CreateSimpleButton(name: string, text: string): Button {\r\n const result = new this(name);\r\n\r\n // Adding text\r\n const textBlock = new TextBlock(name + \"_button\", text);\r\n textBlock.textWrapping = true;\r\n textBlock.textHorizontalAlignment = Control.HORIZONTAL_ALIGNMENT_CENTER;\r\n result.addControl(textBlock);\r\n\r\n // Store\r\n result._textBlock = textBlock;\r\n\r\n return result;\r\n }\r\n\r\n /**\r\n * Creates a new button made with an image and a centered text\r\n * @param name defines the name of the button\r\n * @param text defines the text of the button\r\n * @param imageUrl defines the url of the image\r\n * @returns a new Button\r\n */\r\n public static CreateImageWithCenterTextButton(name: string, text: string, imageUrl: string): Button {\r\n const result = new this(name);\r\n\r\n // Adding image\r\n const iconImage = new Image(name + \"_icon\", imageUrl);\r\n iconImage.stretch = Image.STRETCH_FILL;\r\n result.addControl(iconImage);\r\n\r\n // Adding text\r\n const textBlock = new TextBlock(name + \"_button\", text);\r\n textBlock.textWrapping = true;\r\n textBlock.textHorizontalAlignment = Control.HORIZONTAL_ALIGNMENT_CENTER;\r\n result.addControl(textBlock);\r\n\r\n // Store\r\n result._image = iconImage;\r\n result._textBlock = textBlock;\r\n\r\n return result;\r\n }\r\n}\r\nRegisterClass(\"BABYLON.GUI.Button\", Button);\r\n"]}
|
@@ -29,6 +29,10 @@ export declare class Container extends Control {
|
|
29
29
|
protected _renderToIntermediateTexture: boolean;
|
30
30
|
/** @internal */
|
31
31
|
protected _intermediateTexture: Nullable<DynamicTexture>;
|
32
|
+
/**
|
33
|
+
* Gets or sets a boolean indicating that the container will let internal controls handle picking instead of doing it directly using its bounding info
|
34
|
+
*/
|
35
|
+
delegatePickingToChildren: boolean;
|
32
36
|
/** Gets or sets boolean indicating if children should be rendered to an intermediate texture rather than directly to host, useful for alpha blending */
|
33
37
|
get renderToIntermediateTexture(): boolean;
|
34
38
|
set renderToIntermediateTexture(value: boolean);
|
@@ -161,8 +165,9 @@ export declare class Container extends Control {
|
|
161
165
|
/**
|
162
166
|
* Serializes the current control
|
163
167
|
* @param serializationObject defined the JSON serialized object
|
168
|
+
* @param force force serialization even if isSerializable === false
|
164
169
|
*/
|
165
|
-
serialize(serializationObject: any): void;
|
170
|
+
serialize(serializationObject: any, force?: boolean): void;
|
166
171
|
/** Releases associated resources */
|
167
172
|
dispose(): void;
|
168
173
|
/**
|
package/2D/controls/container.js
CHANGED
@@ -112,6 +112,10 @@ export class Container extends Control {
|
|
112
112
|
this._renderToIntermediateTexture = false;
|
113
113
|
/** @internal */
|
114
114
|
this._intermediateTexture = null;
|
115
|
+
/**
|
116
|
+
* Gets or sets a boolean indicating that the container will let internal controls handle picking instead of doing it directly using its bounding info
|
117
|
+
*/
|
118
|
+
this.delegatePickingToChildren = false;
|
115
119
|
/**
|
116
120
|
* Gets or sets a boolean indicating that layout cycle errors should be displayed on the console
|
117
121
|
*/
|
@@ -465,6 +469,19 @@ export class Container extends Control {
|
|
465
469
|
if (!contains && this.clipChildren) {
|
466
470
|
return false;
|
467
471
|
}
|
472
|
+
if (this.delegatePickingToChildren) {
|
473
|
+
let contains = false;
|
474
|
+
for (let index = this._children.length - 1; index >= 0; index--) {
|
475
|
+
const child = this._children[index];
|
476
|
+
if (child.isEnabled && child.isHitTestVisible && child.isVisible && !child.notRenderable && child.contains(x, y)) {
|
477
|
+
contains = true;
|
478
|
+
break;
|
479
|
+
}
|
480
|
+
}
|
481
|
+
if (!contains) {
|
482
|
+
return false;
|
483
|
+
}
|
484
|
+
}
|
468
485
|
// Checking backwards to pick closest first
|
469
486
|
for (let index = this._children.length - 1; index >= 0; index--) {
|
470
487
|
const child = this._children[index];
|
@@ -512,9 +529,13 @@ export class Container extends Control {
|
|
512
529
|
/**
|
513
530
|
* Serializes the current control
|
514
531
|
* @param serializationObject defined the JSON serialized object
|
532
|
+
* @param force force serialization even if isSerializable === false
|
515
533
|
*/
|
516
|
-
serialize(serializationObject) {
|
517
|
-
super.serialize(serializationObject);
|
534
|
+
serialize(serializationObject, force = false) {
|
535
|
+
super.serialize(serializationObject, force);
|
536
|
+
if (!this.isSerializable && !force) {
|
537
|
+
return;
|
538
|
+
}
|
518
539
|
if (this.backgroundGradient) {
|
519
540
|
serializationObject.backgroundGradient = {};
|
520
541
|
this.backgroundGradient.serialize(serializationObject.backgroundGradient);
|
@@ -524,9 +545,11 @@ export class Container extends Control {
|
|
524
545
|
}
|
525
546
|
serializationObject.children = [];
|
526
547
|
for (const child of this.children) {
|
527
|
-
|
528
|
-
|
529
|
-
|
548
|
+
if (child.isSerializable || force) {
|
549
|
+
const childSerializationObject = {};
|
550
|
+
child.serialize(childSerializationObject);
|
551
|
+
serializationObject.children.push(childSerializationObject);
|
552
|
+
}
|
530
553
|
}
|
531
554
|
}
|
532
555
|
/** Releases associated resources */
|
@@ -565,6 +588,9 @@ export class Container extends Control {
|
|
565
588
|
return true;
|
566
589
|
}
|
567
590
|
}
|
591
|
+
__decorate([
|
592
|
+
serialize()
|
593
|
+
], Container.prototype, "delegatePickingToChildren", void 0);
|
568
594
|
__decorate([
|
569
595
|
serialize()
|
570
596
|
], Container.prototype, "renderToIntermediateTexture", null);
|
@@ -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,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B,CAAC,gBAAqB,EAAE,IAA4B;QACxE,KAAK,CAAC,iBAAiB,CAAC,gBAAgB,EAAE,IAAI,CAAC,CAAC;QAChD,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAEjB,WAAW;QACX,IAAI,gBAAgB,CAAC,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;IAEM,OAAO;QACV,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;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":"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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;IAEM,OAAO;QACV,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;AAnrBU;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;AA+lBL,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 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 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 _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 * @param force force serialization even if isSerializable === false\r\n */\r\n public serialize(serializationObject: any, force: boolean = false) {\r\n super.serialize(serializationObject, force);\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);\r\n serializationObject.children.push(childSerializationObject);\r\n }\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.d.ts
CHANGED
@@ -211,6 +211,9 @@ export declare class Control implements IAnimatable {
|
|
211
211
|
set accessibilityTag(value: Nullable<IAccessibilityTag>);
|
212
212
|
get accessibilityTag(): Nullable<IAccessibilityTag>;
|
213
213
|
protected _accessibilityTag: Nullable<IAccessibilityTag>;
|
214
|
+
/**
|
215
|
+
* Observable that fires whenever the accessibility event of the control has changed
|
216
|
+
*/
|
214
217
|
onAccessibilityTagChangedObservable: Observable<Nullable<IAccessibilityTag>>;
|
215
218
|
/**
|
216
219
|
* An event triggered when pointer wheel is scrolled
|
@@ -288,6 +291,10 @@ export declare class Control implements IAnimatable {
|
|
288
291
|
*/
|
289
292
|
get isHighlighted(): boolean;
|
290
293
|
set isHighlighted(value: boolean);
|
294
|
+
/**
|
295
|
+
* Indicates if the control should be serialized. Defaults to true.
|
296
|
+
*/
|
297
|
+
isSerializable: boolean;
|
291
298
|
/**
|
292
299
|
* Gets or sets a string defining the color to use for highlighting this control
|
293
300
|
*/
|
@@ -818,8 +825,9 @@ export declare class Control implements IAnimatable {
|
|
818
825
|
/**
|
819
826
|
* Serializes the current control
|
820
827
|
* @param serializationObject defined the JSON serialized object
|
828
|
+
* @param force if the control should be serialized even if the isSerializable flag is set to false (default false)
|
821
829
|
*/
|
822
|
-
serialize(serializationObject: any): void;
|
830
|
+
serialize(serializationObject: any, force?: boolean): void;
|
823
831
|
/**
|
824
832
|
* @internal
|
825
833
|
*/
|
package/2D/controls/control.js
CHANGED
@@ -949,6 +949,9 @@ export class Control {
|
|
949
949
|
/** @internal */
|
950
950
|
this._linkOffsetY = new ValueAndUnit(0);
|
951
951
|
this._accessibilityTag = null;
|
952
|
+
/**
|
953
|
+
* Observable that fires whenever the accessibility event of the control has changed
|
954
|
+
*/
|
952
955
|
this.onAccessibilityTagChangedObservable = new Observable();
|
953
956
|
/**
|
954
957
|
* An event triggered when pointer wheel is scrolled
|
@@ -998,6 +1001,10 @@ export class Control {
|
|
998
1001
|
* An event triggered when the control isVisible is changed
|
999
1002
|
*/
|
1000
1003
|
this.onIsVisibleChangedObservable = new Observable();
|
1004
|
+
/**
|
1005
|
+
* Indicates if the control should be serialized. Defaults to true.
|
1006
|
+
*/
|
1007
|
+
this.isSerializable = true;
|
1001
1008
|
this._fixedRatio = 0;
|
1002
1009
|
this._fixedRatioMasterIsWidth = true;
|
1003
1010
|
/**
|
@@ -1948,7 +1955,7 @@ export class Control {
|
|
1948
1955
|
*/
|
1949
1956
|
clone(host) {
|
1950
1957
|
const serialization = {};
|
1951
|
-
this.serialize(serialization);
|
1958
|
+
this.serialize(serialization, true);
|
1952
1959
|
const controlType = Tools.Instantiate("BABYLON.GUI." + serialization.className);
|
1953
1960
|
const cloned = new controlType();
|
1954
1961
|
cloned.parse(serialization, host);
|
@@ -1969,8 +1976,12 @@ export class Control {
|
|
1969
1976
|
/**
|
1970
1977
|
* Serializes the current control
|
1971
1978
|
* @param serializationObject defined the JSON serialized object
|
1979
|
+
* @param force if the control should be serialized even if the isSerializable flag is set to false (default false)
|
1972
1980
|
*/
|
1973
|
-
serialize(serializationObject) {
|
1981
|
+
serialize(serializationObject, force = false) {
|
1982
|
+
if (!this.isSerializable && !force) {
|
1983
|
+
return;
|
1984
|
+
}
|
1974
1985
|
SerializationHelper.Serialize(this, serializationObject);
|
1975
1986
|
serializationObject.name = this.name;
|
1976
1987
|
serializationObject.className = this.getClassName();
|
@@ -2188,6 +2199,9 @@ __decorate([
|
|
2188
2199
|
__decorate([
|
2189
2200
|
serialize()
|
2190
2201
|
], Control.prototype, "alpha", null);
|
2202
|
+
__decorate([
|
2203
|
+
serialize()
|
2204
|
+
], Control.prototype, "isSerializable", void 0);
|
2191
2205
|
__decorate([
|
2192
2206
|
serialize()
|
2193
2207
|
], Control.prototype, "scaleX", null);
|