@babylonjs/gui 6.45.1 → 6.46.1
Sign up to get free protection for your applications and to get access to all the features.
- package/2D/advancedDynamicTexture.d.ts +3 -2
- package/2D/advancedDynamicTexture.js +15 -3
- package/2D/advancedDynamicTexture.js.map +1 -1
- package/2D/controls/control.js +2 -1
- package/2D/controls/control.js.map +1 -1
- package/3D/materials/fluent/fluentMaterial.js +2 -1
- package/3D/materials/fluent/fluentMaterial.js.map +1 -1
- package/3D/materials/fluentBackplate/fluentBackplateMaterial.js +2 -1
- package/3D/materials/fluentBackplate/fluentBackplateMaterial.js.map +1 -1
- package/3D/materials/fluentButton/fluentButtonMaterial.js +2 -1
- package/3D/materials/fluentButton/fluentButtonMaterial.js.map +1 -1
- package/3D/materials/mrdl/mrdlBackglowMaterial.js +2 -1
- package/3D/materials/mrdl/mrdlBackglowMaterial.js.map +1 -1
- package/3D/materials/mrdl/mrdlBackplateMaterial.js +2 -1
- package/3D/materials/mrdl/mrdlBackplateMaterial.js.map +1 -1
- package/3D/materials/mrdl/mrdlFrontplateMaterial.js +2 -1
- package/3D/materials/mrdl/mrdlFrontplateMaterial.js.map +1 -1
- package/3D/materials/mrdl/mrdlInnerquadMaterial.js +2 -1
- package/3D/materials/mrdl/mrdlInnerquadMaterial.js.map +1 -1
- package/3D/materials/mrdl/mrdlSliderBarMaterial.js +2 -1
- package/3D/materials/mrdl/mrdlSliderBarMaterial.js.map +1 -1
- package/3D/materials/mrdl/mrdlSliderThumbMaterial.js +2 -1
- package/3D/materials/mrdl/mrdlSliderThumbMaterial.js.map +1 -1
- package/package.json +2 -2
@@ -397,11 +397,12 @@ export declare class AdvancedDynamicTexture extends DynamicTexture {
|
|
397
397
|
*/
|
398
398
|
parseSerializedObject(serializedObject: any, scaleToSize?: boolean): void;
|
399
399
|
/**
|
400
|
-
* Clones the ADT
|
400
|
+
* Clones the ADT. If no mesh is defined, the GUI will be considered as a fullscreen GUI
|
401
401
|
* @param newName defines the name of the new ADT
|
402
|
+
* @param attachToMesh defines if the new ADT should be attached to a mesh
|
402
403
|
* @returns the clone of the ADT
|
403
404
|
*/
|
404
|
-
clone(newName?: string): AdvancedDynamicTexture;
|
405
|
+
clone(newName?: string, attachToMesh?: AbstractMesh): AdvancedDynamicTexture;
|
405
406
|
/**
|
406
407
|
* Recreate the content of the ADT from a JSON object
|
407
408
|
* @param serializedObject define the JSON serialized object to restore from
|
@@ -1165,18 +1165,30 @@ export class AdvancedDynamicTexture extends DynamicTexture {
|
|
1165
1165
|
}
|
1166
1166
|
}
|
1167
1167
|
/**
|
1168
|
-
* Clones the ADT
|
1168
|
+
* Clones the ADT. If no mesh is defined, the GUI will be considered as a fullscreen GUI
|
1169
1169
|
* @param newName defines the name of the new ADT
|
1170
|
+
* @param attachToMesh defines if the new ADT should be attached to a mesh
|
1170
1171
|
* @returns the clone of the ADT
|
1171
1172
|
*/
|
1172
|
-
clone(newName) {
|
1173
|
+
clone(newName, attachToMesh) {
|
1173
1174
|
const scene = this.getScene();
|
1174
1175
|
if (!scene) {
|
1175
1176
|
return this;
|
1176
1177
|
}
|
1177
1178
|
const size = this.getSize();
|
1178
1179
|
const data = this.serializeContent();
|
1179
|
-
|
1180
|
+
let clone;
|
1181
|
+
if (!this._isFullscreen) {
|
1182
|
+
if (attachToMesh) {
|
1183
|
+
clone = AdvancedDynamicTexture.CreateForMesh(attachToMesh, size.width, size.height);
|
1184
|
+
}
|
1185
|
+
else {
|
1186
|
+
clone = new AdvancedDynamicTexture(newName ?? "Clone of " + this.name, size.width, size.height, scene, !this.noMipmap, this.samplingMode);
|
1187
|
+
}
|
1188
|
+
}
|
1189
|
+
else {
|
1190
|
+
clone = AdvancedDynamicTexture.CreateFullscreenUI(newName ?? "Clone of " + this.name);
|
1191
|
+
}
|
1180
1192
|
clone.parseSerializedObject(data);
|
1181
1193
|
return clone;
|
1182
1194
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"advancedDynamicTexture.js","sourceRoot":"","sources":["../../../../dev/gui/src/2D/advancedDynamicTexture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AM,QAAQ,GAAG,CAAC,GAAG,WAAW,CAAC,SAAS,EAAE,CAAC,uBAAuB,EAAE,CAAC;YACvE,MAAM,CAAC,cAAc,CAAC,MAAM,GAAG,QAAQ,CAAC;YACxC,MAAM,CAAC,cAAc,CAAC,MAAM,GAAG,QAAQ,CAAC;SAC3C;QAED,SAAS;QACT,MAAM,CAAC,MAAM,EAAE,CAAC;QAChB,OAAO,MAAM,CAAC;IAClB,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,KAAa;QACtB,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QACnB,IAAI,CAAC,WAAW,EAAE,CAAC;IACvB,CAAC;IAED;;;;OAIG;IACI,OAAO,CAAC,KAAa,EAAE,MAAc;QACxC,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;QAC7B,IAAI,CAAC,WAAW,EAAE,CAAC;IACvB,CAAC;IAEO,gBAAgB;QACpB,IAAI,IAAI,CAAC,UAAU,EAAE,EAAE;YACnB,IAAI,CAAC,oBAAoB,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;YAEhD,IAAI,CAAC,oBAAoB,CAAC,KAAK,EAAE,CAAC;SACrC;IACL,CAAC;IAED;;OAEG;IACI,UAAU;QACb,OAAO,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,CAAC;IACzC,CAAC;;AAr+CD,sCAAsC;AACxB,iCAAU,GAAG,SAAS,CAAC,UAAU,AAAvB,CAAwB;AAEhD,yIAAyI;AAC3H,4CAAqB,GAAG,IAAI,AAAP,CAAQ","sourcesContent":["import type { Nullable } from \"core/types\";\r\nimport type { Observer } from \"core/Misc/observable\";\r\nimport { Observable } from \"core/Misc/observable\";\r\nimport type { Matrix } from \"core/Maths/math.vector\";\r\nimport { Vector2, Vector3, TmpVectors } from \"core/Maths/math.vector\";\r\nimport { Tools } from \"core/Misc/tools\";\r\nimport type { PointerInfoPre, PointerInfo, PointerInfoBase } from \"core/Events/pointerEvents\";\r\nimport { PointerEventTypes } from \"core/Events/pointerEvents\";\r\nimport { ClipboardEventTypes, ClipboardInfo } from \"core/Events/clipboardEvents\";\r\nimport type { KeyboardInfoPre } from \"core/Events/keyboardEvents\";\r\nimport { KeyboardEventTypes } from \"core/Events/keyboardEvents\";\r\nimport type { Camera } from \"core/Cameras/camera\";\r\nimport { Texture } from \"core/Materials/Textures/texture\";\r\nimport { DynamicTexture } from \"core/Materials/Textures/dynamicTexture\";\r\nimport type { AbstractMesh } from \"core/Meshes/abstractMesh\";\r\nimport { Layer } from \"core/Layers/layer\";\r\nimport type { Engine } from \"core/Engines/engine\";\r\nimport type { Scene } from \"core/scene\";\r\n\r\nimport { Container } from \"./controls/container\";\r\nimport { Control } from \"./controls/control\";\r\nimport type { IFocusableControl } from \"./controls/focusableControl\";\r\nimport { Style } from \"./style\";\r\nimport { Measure } from \"./measure\";\r\nimport { Constants } from \"core/Engines/constants\";\r\nimport { Viewport } from \"core/Maths/math.viewport\";\r\nimport { Color3 } from \"core/Maths/math.color\";\r\nimport { WebRequest } from \"core/Misc/webRequest\";\r\nimport type { IPointerEvent, IWheelEvent } from \"core/Events/deviceInputEvents\";\r\nimport { RandomGUID } from \"core/Misc/guid\";\r\nimport { GetClass } from \"core/Misc/typeStore\";\r\nimport { DecodeBase64ToBinary } from \"core/Misc/stringTools\";\r\n\r\nimport type { StandardMaterial } from \"core/Materials/standardMaterial\";\r\n\r\n/**\r\n * Class used to create texture to support 2D GUI elements\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/gui/gui\r\n */\r\nexport class AdvancedDynamicTexture extends DynamicTexture {\r\n /** Define the url to load snippets */\r\n public static SnippetUrl = Constants.SnippetUrl;\r\n\r\n /** Indicates if some optimizations can be performed in GUI GPU management (the downside is additional memory/GPU texture memory used) */\r\n public static AllowGPUOptimizations = true;\r\n\r\n /** Snippet ID if the content was created from the snippet server */\r\n public snippetId: string;\r\n\r\n /** Observable that fires when the GUI is ready */\r\n public onGuiReadyObservable = new Observable<AdvancedDynamicTexture>();\r\n\r\n private _isDirty = false;\r\n private _renderObserver: Nullable<Observer<Camera>>;\r\n private _resizeObserver: Nullable<Observer<Engine>>;\r\n private _preKeyboardObserver: Nullable<Observer<KeyboardInfoPre>>;\r\n private _prePointerObserver: Nullable<Observer<PointerInfoPre>>;\r\n private _sceneRenderObserver: Nullable<Observer<Scene>>;\r\n private _pointerObserver: Nullable<Observer<PointerInfo>>;\r\n private _canvasPointerOutObserver: Nullable<Observer<PointerEvent>>;\r\n private _canvasBlurObserver: Nullable<Observer<Engine>>;\r\n private _controlAddedObserver: Nullable<Observer<Nullable<Control>>>;\r\n private _controlRemovedObserver: Nullable<Observer<Nullable<Control>>>;\r\n private _background: string;\r\n /** @internal */\r\n public _rootContainer = new Container(\"root\");\r\n /** @internal */\r\n public _lastPickedControl: Control;\r\n /** @internal */\r\n public _lastControlOver: { [pointerId: number]: Control } = {};\r\n /** @internal */\r\n public _lastControlDown: { [pointerId: number]: Control } = {};\r\n /** @internal */\r\n public _capturingControl: { [pointerId: number]: Control } = {};\r\n /** @internal */\r\n public _shouldBlockPointer: boolean;\r\n /** @internal */\r\n public _layerToDispose: Nullable<Layer>;\r\n /** @internal */\r\n public _linkedControls = new Array<Control>();\r\n /** @internal */\r\n public _isFullscreen = false;\r\n private _fullscreenViewport = new Viewport(0, 0, 1, 1);\r\n private _idealWidth = 0;\r\n private _idealHeight = 0;\r\n private _useSmallestIdeal: boolean = false;\r\n private _renderAtIdealSize = false;\r\n private _focusedControl: Nullable<IFocusableControl>;\r\n private _blockNextFocusCheck = false;\r\n private _renderScale = 1;\r\n private _rootElement: Nullable<HTMLElement>;\r\n private _cursorChanged = false;\r\n private _defaultMousePointerId = 0;\r\n private _rootChildrenHaveChanged: boolean = false;\r\n\r\n /** @internal */\r\n public _capturedPointerIds = new Set<number>();\r\n\r\n /** @internal */\r\n public _numLayoutCalls = 0;\r\n /** Gets the number of layout calls made the last time the ADT has been rendered */\r\n public get numLayoutCalls(): number {\r\n return this._numLayoutCalls;\r\n }\r\n\r\n /** @internal */\r\n public _numRenderCalls = 0;\r\n /** Gets the number of render calls made the last time the ADT has been rendered */\r\n public get numRenderCalls(): number {\r\n return this._numRenderCalls;\r\n }\r\n\r\n /**\r\n * Define type to string to ensure compatibility across browsers\r\n * Safari doesn't support DataTransfer constructor\r\n */\r\n private _clipboardData: string = \"\";\r\n /**\r\n * Observable event triggered each time an clipboard event is received from the rendering canvas\r\n */\r\n public onClipboardObservable = new Observable<ClipboardInfo>();\r\n /**\r\n * Observable event triggered each time a pointer down is intercepted by a control\r\n */\r\n public onControlPickedObservable = new Observable<Control>();\r\n /**\r\n * Observable event triggered before layout is evaluated\r\n */\r\n public onBeginLayoutObservable = new Observable<AdvancedDynamicTexture>();\r\n /**\r\n * Observable event triggered after the layout was evaluated\r\n */\r\n public onEndLayoutObservable = new Observable<AdvancedDynamicTexture>();\r\n /**\r\n * Observable event triggered before the texture is rendered\r\n */\r\n public onBeginRenderObservable = new Observable<AdvancedDynamicTexture>();\r\n /**\r\n * Observable event triggered after the texture was rendered\r\n */\r\n public onEndRenderObservable = new Observable<AdvancedDynamicTexture>();\r\n /**\r\n * Gets or sets a boolean defining if alpha is stored as premultiplied\r\n */\r\n public premulAlpha = false;\r\n /**\r\n * Gets or sets a boolean indicating that the canvas must be reverted on Y when updating the texture\r\n */\r\n public applyYInversionOnUpdate = true;\r\n /**\r\n * Gets or sets a number used to scale rendering size (2 means that the texture will be twice bigger).\r\n * Useful when you want more antialiasing\r\n */\r\n public get renderScale(): number {\r\n return this._renderScale;\r\n }\r\n public set renderScale(value: number) {\r\n if (value === this._renderScale) {\r\n return;\r\n }\r\n this._renderScale = value;\r\n this._onResize();\r\n }\r\n /** Gets or sets the background color */\r\n public get background(): string {\r\n return this._background;\r\n }\r\n public set background(value: string) {\r\n if (this._background === value) {\r\n return;\r\n }\r\n this._background = value;\r\n this.markAsDirty();\r\n }\r\n /**\r\n * Gets or sets the ideal width used to design controls.\r\n * The GUI will then rescale everything accordingly\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/gui/gui#adaptive-scaling\r\n */\r\n public get idealWidth(): number {\r\n return this._idealWidth;\r\n }\r\n public set idealWidth(value: number) {\r\n if (this._idealWidth === value) {\r\n return;\r\n }\r\n this._idealWidth = value;\r\n this.markAsDirty();\r\n this._rootContainer._markAllAsDirty();\r\n }\r\n /**\r\n * Gets or sets the ideal height used to design controls.\r\n * The GUI will then rescale everything accordingly\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/gui/gui#adaptive-scaling\r\n */\r\n public get idealHeight(): number {\r\n return this._idealHeight;\r\n }\r\n public set idealHeight(value: number) {\r\n if (this._idealHeight === value) {\r\n return;\r\n }\r\n this._idealHeight = value;\r\n this.markAsDirty();\r\n this._rootContainer._markAllAsDirty();\r\n }\r\n /**\r\n * Gets or sets a boolean indicating if the smallest ideal value must be used if idealWidth and idealHeight are both set\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/gui/gui#adaptive-scaling\r\n */\r\n public get useSmallestIdeal(): boolean {\r\n return this._useSmallestIdeal;\r\n }\r\n public set useSmallestIdeal(value: boolean) {\r\n if (this._useSmallestIdeal === value) {\r\n return;\r\n }\r\n this._useSmallestIdeal = value;\r\n this.markAsDirty();\r\n this._rootContainer._markAllAsDirty();\r\n }\r\n /**\r\n * Gets or sets a boolean indicating if adaptive scaling must be used\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/gui/gui#adaptive-scaling\r\n */\r\n public get renderAtIdealSize(): boolean {\r\n return this._renderAtIdealSize;\r\n }\r\n public set renderAtIdealSize(value: boolean) {\r\n if (this._renderAtIdealSize === value) {\r\n return;\r\n }\r\n this._renderAtIdealSize = value;\r\n this._onResize();\r\n }\r\n\r\n /**\r\n * Gets the ratio used when in \"ideal mode\"\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/gui/gui#adaptive-scaling\r\n * */\r\n public get idealRatio(): number {\r\n let rwidth: number = 0;\r\n let rheight: number = 0;\r\n\r\n if (this._idealWidth) {\r\n rwidth = this.getSize().width / this._idealWidth;\r\n }\r\n\r\n if (this._idealHeight) {\r\n rheight = this.getSize().height / this._idealHeight;\r\n }\r\n\r\n if (this._useSmallestIdeal && this._idealWidth && this._idealHeight) {\r\n return window.innerWidth < window.innerHeight ? rwidth : rheight;\r\n }\r\n\r\n if (this._idealWidth) {\r\n // horizontal\r\n return rwidth;\r\n }\r\n\r\n if (this._idealHeight) {\r\n // vertical\r\n return rheight;\r\n }\r\n\r\n return 1;\r\n }\r\n\r\n /**\r\n * Gets the underlying layer used to render the texture when in fullscreen mode\r\n */\r\n public get layer(): Nullable<Layer> {\r\n return this._layerToDispose;\r\n }\r\n /**\r\n * Gets the root container control\r\n */\r\n public get rootContainer(): Container {\r\n return this._rootContainer;\r\n }\r\n /**\r\n * Returns an array containing the root container.\r\n * This is mostly used to let the Inspector introspects the ADT\r\n * @returns an array containing the rootContainer\r\n */\r\n public getChildren(): Array<Container> {\r\n return [this._rootContainer];\r\n }\r\n /**\r\n * Will return all controls that are inside this texture\r\n * @param directDescendantsOnly defines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered\r\n * @param predicate defines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored\r\n * @returns all child controls\r\n */\r\n public getDescendants(directDescendantsOnly?: boolean, predicate?: (control: Control) => boolean): Control[] {\r\n return this._rootContainer.getDescendants(directDescendantsOnly, predicate);\r\n }\r\n\r\n /**\r\n * Will return all controls with the given type name\r\n * @param typeName defines the type name to search for\r\n * @returns an array of all controls found\r\n */\r\n public getControlsByType(typeName: string): Control[] {\r\n return this._rootContainer.getDescendants(false, (control) => control.typeName === typeName);\r\n }\r\n\r\n /**\r\n * Will return the first control with the given name\r\n * @param name defines the name to search for\r\n * @returns the first control found or null\r\n */\r\n public getControlByName(name: string): Nullable<Control> {\r\n return this._getControlByKey(\"name\", name);\r\n }\r\n\r\n private _getControlByKey(key: string, value: any): Nullable<Control> {\r\n return this._rootContainer.getDescendants().find((control) => control[key as keyof Control] === value) || null;\r\n }\r\n\r\n /**\r\n * Gets or sets the current focused control\r\n */\r\n public get focusedControl(): Nullable<IFocusableControl> {\r\n return this._focusedControl;\r\n }\r\n public set focusedControl(control: Nullable<IFocusableControl>) {\r\n if (this._focusedControl == control) {\r\n return;\r\n }\r\n if (this._focusedControl) {\r\n this._focusedControl.onBlur();\r\n }\r\n if (control) {\r\n control.onFocus();\r\n }\r\n this._focusedControl = control;\r\n }\r\n /**\r\n * Gets or sets a boolean indicating if the texture must be rendered in background or foreground when in fullscreen mode\r\n */\r\n public get isForeground(): boolean {\r\n if (!this.layer) {\r\n return true;\r\n }\r\n return !this.layer.isBackground;\r\n }\r\n public set isForeground(value: boolean) {\r\n if (!this.layer) {\r\n return;\r\n }\r\n if (this.layer.isBackground === !value) {\r\n return;\r\n }\r\n this.layer.isBackground = !value;\r\n }\r\n /**\r\n * Gets or set information about clipboardData\r\n */\r\n public get clipboardData(): string {\r\n return this._clipboardData;\r\n }\r\n public set clipboardData(value: string) {\r\n this._clipboardData = value;\r\n }\r\n\r\n /**\r\n * If this is set, even when a control is pointer blocker, some events can still be passed through to the scene.\r\n * Options from values are PointerEventTypes\r\n * POINTERDOWN, POINTERUP, POINTERMOVE, POINTERWHEEL, POINTERPICK, POINTERTAP, POINTERDOUBLETAP\r\n */\r\n public skipBlockEvents = 0;\r\n\r\n /**\r\n * If set to true, every scene render will trigger a pointer event for the GUI\r\n * if it is linked to a mesh or has controls linked to a mesh. This will allow\r\n * you to catch the pointer moving around the GUI due to camera or mesh movements,\r\n * but it has a performance cost.\r\n */\r\n public checkPointerEveryFrame = false;\r\n /**\r\n * Creates a new AdvancedDynamicTexture\r\n * @param name defines the name of the texture\r\n * @param width defines the width of the texture\r\n * @param height defines the height of the texture\r\n * @param scene defines the hosting scene\r\n * @param generateMipMaps defines a boolean indicating if mipmaps must be generated (false by default)\r\n * @param samplingMode defines the texture sampling mode (Texture.NEAREST_SAMPLINGMODE by default)\r\n * @param invertY defines if the texture needs to be inverted on the y axis during loading (true by default)\r\n */\r\n constructor(name: string, width = 0, height = 0, scene?: Nullable<Scene>, generateMipMaps = false, samplingMode = Texture.NEAREST_SAMPLINGMODE, invertY = true) {\r\n super(name, { width: width, height: height }, scene, generateMipMaps, samplingMode, Constants.TEXTUREFORMAT_RGBA, invertY);\r\n scene = this.getScene();\r\n if (!scene || !this._texture) {\r\n return;\r\n }\r\n this.applyYInversionOnUpdate = invertY;\r\n this._rootElement = scene.getEngine().getInputElement();\r\n this._renderObserver = scene.onBeforeCameraRenderObservable.add((camera: Camera) => this._checkUpdate(camera));\r\n\r\n /** Whenever a control is added or removed to the root, we have to recheck the camera projection as it can have changed */\r\n this._controlAddedObserver = this._rootContainer.onControlAddedObservable.add((control) => {\r\n if (control) {\r\n this._rootChildrenHaveChanged = true;\r\n }\r\n });\r\n this._controlRemovedObserver = this._rootContainer.onControlRemovedObservable.add((control) => {\r\n if (control) {\r\n this._rootChildrenHaveChanged = true;\r\n }\r\n });\r\n this._preKeyboardObserver = scene.onPreKeyboardObservable.add((info) => {\r\n if (!this._focusedControl) {\r\n return;\r\n }\r\n if (info.type === KeyboardEventTypes.KEYDOWN) {\r\n this._focusedControl.processKeyboard(info.event);\r\n }\r\n info.skipOnPointerObservable = true;\r\n });\r\n this._rootContainer._link(this);\r\n this.hasAlpha = true;\r\n if (!width || !height) {\r\n this._resizeObserver = scene.getEngine().onResizeObservable.add(() => this._onResize());\r\n this._onResize();\r\n }\r\n this._texture.isReady = true;\r\n }\r\n /**\r\n * Get the current class name of the texture useful for serialization or dynamic coding.\r\n * @returns \"AdvancedDynamicTexture\"\r\n */\r\n public getClassName(): string {\r\n return \"AdvancedDynamicTexture\";\r\n }\r\n /**\r\n * Function used to execute a function on all controls\r\n * @param func defines the function to execute\r\n * @param container defines the container where controls belong. If null the root container will be used\r\n */\r\n public executeOnAllControls(func: (control: Control) => void, container?: Container) {\r\n if (!container) {\r\n container = this._rootContainer;\r\n }\r\n func(container);\r\n for (const child of container.children) {\r\n if ((<any>child).children) {\r\n this.executeOnAllControls(func, <Container>child);\r\n continue;\r\n }\r\n func(child);\r\n }\r\n }\r\n\r\n private _useInvalidateRectOptimization = true;\r\n\r\n /**\r\n * Gets or sets a boolean indicating if the InvalidateRect optimization should be turned on\r\n */\r\n public get useInvalidateRectOptimization(): boolean {\r\n return this._useInvalidateRectOptimization;\r\n }\r\n\r\n public set useInvalidateRectOptimization(value: boolean) {\r\n this._useInvalidateRectOptimization = value;\r\n }\r\n\r\n // Invalidated rectangle which is the combination of all invalidated controls after they have been rotated into absolute position\r\n private _invalidatedRectangle: Nullable<Measure> = null;\r\n /**\r\n * Invalidates a rectangle area on the gui texture\r\n * @param invalidMinX left most position of the rectangle to invalidate in the texture\r\n * @param invalidMinY top most position of the rectangle to invalidate in the texture\r\n * @param invalidMaxX right most position of the rectangle to invalidate in the texture\r\n * @param invalidMaxY bottom most position of the rectangle to invalidate in the texture\r\n */\r\n public invalidateRect(invalidMinX: number, invalidMinY: number, invalidMaxX: number, invalidMaxY: number) {\r\n if (!this._useInvalidateRectOptimization) {\r\n return;\r\n }\r\n if (!this._invalidatedRectangle) {\r\n this._invalidatedRectangle = new Measure(invalidMinX, invalidMinY, invalidMaxX - invalidMinX + 1, invalidMaxY - invalidMinY + 1);\r\n } else {\r\n // Compute intersection\r\n const maxX = Math.ceil(Math.max(this._invalidatedRectangle.left + this._invalidatedRectangle.width - 1, invalidMaxX));\r\n const maxY = Math.ceil(Math.max(this._invalidatedRectangle.top + this._invalidatedRectangle.height - 1, invalidMaxY));\r\n this._invalidatedRectangle.left = Math.floor(Math.min(this._invalidatedRectangle.left, invalidMinX));\r\n this._invalidatedRectangle.top = Math.floor(Math.min(this._invalidatedRectangle.top, invalidMinY));\r\n this._invalidatedRectangle.width = maxX - this._invalidatedRectangle.left + 1;\r\n this._invalidatedRectangle.height = maxY - this._invalidatedRectangle.top + 1;\r\n }\r\n }\r\n /**\r\n * Marks the texture as dirty forcing a complete update\r\n */\r\n public markAsDirty() {\r\n this._isDirty = true;\r\n }\r\n /**\r\n * Helper function used to create a new style\r\n * @returns a new style\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/gui/gui#styles\r\n */\r\n public createStyle(): Style {\r\n return new Style(this);\r\n }\r\n /**\r\n * Adds a new control to the root container\r\n * @param control defines the control to add\r\n * @returns the current texture\r\n */\r\n public addControl(control: Control): AdvancedDynamicTexture {\r\n this._rootContainer.addControl(control);\r\n return this;\r\n }\r\n /**\r\n * Removes a control from the root container\r\n * @param control defines the control to remove\r\n * @returns the current texture\r\n */\r\n public removeControl(control: Control): AdvancedDynamicTexture {\r\n this._rootContainer.removeControl(control);\r\n return this;\r\n }\r\n /**\r\n * Moves overlapped controls towards a position where it is not overlapping anymore.\r\n * Please note that this method alters linkOffsetXInPixels and linkOffsetYInPixels.\r\n * @param overlapGroup the overlap group which will be processed or undefined to process all overlap groups\r\n * @param deltaStep the step size (speed) to reach the target non overlapping position (default 0.1)\r\n * @param repelFactor how much is the control repelled by other controls\r\n */\r\n public moveToNonOverlappedPosition(overlapGroup?: number | Control[], deltaStep = 1, repelFactor = 1) {\r\n let controlsForGroup: Control[];\r\n if (Array.isArray(overlapGroup)) {\r\n controlsForGroup = overlapGroup;\r\n } else {\r\n const descendants = this.getDescendants(true);\r\n // get only the controls with an overlapGroup property set\r\n // if the overlapGroup parameter is set, filter the controls and get only the controls belonging to that overlapGroup\r\n controlsForGroup = overlapGroup === undefined ? descendants.filter((c) => c.overlapGroup !== undefined) : descendants.filter((c) => c.overlapGroup === overlapGroup);\r\n }\r\n\r\n controlsForGroup.forEach((control1) => {\r\n let velocity = Vector2.Zero();\r\n const center = new Vector2(control1.centerX, control1.centerY);\r\n\r\n controlsForGroup.forEach((control2) => {\r\n if (control1 !== control2 && AdvancedDynamicTexture._Overlaps(control1, control2)) {\r\n // if the two controls overlaps get a direction vector from one control's center to another control's center\r\n const diff = center.subtract(new Vector2(control2.centerX, control2.centerY));\r\n const diffLength = diff.length();\r\n\r\n if (diffLength > 0) {\r\n // calculate the velocity\r\n velocity = velocity.add(diff.normalize().scale(repelFactor / diffLength));\r\n }\r\n }\r\n });\r\n\r\n if (velocity.length() > 0) {\r\n // move the control along the direction vector away from the overlapping control\r\n velocity = velocity.normalize().scale(deltaStep * (control1.overlapDeltaMultiplier ?? 1));\r\n control1.linkOffsetXInPixels += velocity.x;\r\n control1.linkOffsetYInPixels += velocity.y;\r\n }\r\n });\r\n }\r\n /**\r\n * Release all resources\r\n */\r\n public dispose(): void {\r\n const scene = this.getScene();\r\n if (!scene) {\r\n return;\r\n }\r\n this._rootElement = null;\r\n scene.onBeforeCameraRenderObservable.remove(this._renderObserver);\r\n if (this._resizeObserver) {\r\n scene.getEngine().onResizeObservable.remove(this._resizeObserver);\r\n }\r\n if (this._prePointerObserver) {\r\n scene.onPrePointerObservable.remove(this._prePointerObserver);\r\n }\r\n if (this._sceneRenderObserver) {\r\n scene.onBeforeRenderObservable.remove(this._sceneRenderObserver);\r\n }\r\n if (this._pointerObserver) {\r\n scene.onPointerObservable.remove(this._pointerObserver);\r\n }\r\n if (this._preKeyboardObserver) {\r\n scene.onPreKeyboardObservable.remove(this._preKeyboardObserver);\r\n }\r\n if (this._canvasPointerOutObserver) {\r\n scene.getEngine().onCanvasPointerOutObservable.remove(this._canvasPointerOutObserver);\r\n }\r\n if (this._canvasBlurObserver) {\r\n scene.getEngine().onCanvasBlurObservable.remove(this._canvasBlurObserver);\r\n }\r\n if (this._controlAddedObserver) {\r\n this._rootContainer.onControlAddedObservable.remove(this._controlAddedObserver);\r\n }\r\n if (this._controlRemovedObserver) {\r\n this._rootContainer.onControlRemovedObservable.remove(this._controlRemovedObserver);\r\n }\r\n if (this._layerToDispose) {\r\n this._layerToDispose.texture = null;\r\n this._layerToDispose.dispose();\r\n this._layerToDispose = null;\r\n }\r\n this._rootContainer.dispose();\r\n this.onClipboardObservable.clear();\r\n this.onControlPickedObservable.clear();\r\n this.onBeginRenderObservable.clear();\r\n this.onEndRenderObservable.clear();\r\n this.onBeginLayoutObservable.clear();\r\n this.onEndLayoutObservable.clear();\r\n this.onGuiReadyObservable.clear();\r\n super.dispose();\r\n }\r\n private _onResize(): void {\r\n const scene = this.getScene();\r\n if (!scene) {\r\n return;\r\n }\r\n // Check size\r\n const engine = scene.getEngine();\r\n const textureSize = this.getSize();\r\n let renderWidth = engine.getRenderWidth() * this._renderScale;\r\n let renderHeight = engine.getRenderHeight() * this._renderScale;\r\n\r\n if (this._renderAtIdealSize) {\r\n if (this._idealWidth) {\r\n renderHeight = (renderHeight * this._idealWidth) / renderWidth;\r\n renderWidth = this._idealWidth;\r\n } else if (this._idealHeight) {\r\n renderWidth = (renderWidth * this._idealHeight) / renderHeight;\r\n renderHeight = this._idealHeight;\r\n }\r\n }\r\n if (textureSize.width !== renderWidth || textureSize.height !== renderHeight) {\r\n this.scaleTo(renderWidth, renderHeight);\r\n this.markAsDirty();\r\n if (this._idealWidth || this._idealHeight) {\r\n this._rootContainer._markAllAsDirty();\r\n }\r\n }\r\n this.invalidateRect(0, 0, textureSize.width - 1, textureSize.height - 1);\r\n }\r\n /** @internal */\r\n public _getGlobalViewport(): Viewport {\r\n const size = this.getSize();\r\n const globalViewPort = this._fullscreenViewport.toGlobal(size.width, size.height);\r\n\r\n const targetX = Math.round(globalViewPort.width * (1 / this.rootContainer.scaleX));\r\n const targetY = Math.round(globalViewPort.height * (1 / this.rootContainer.scaleY));\r\n\r\n globalViewPort.x += (globalViewPort.width - targetX) / 2;\r\n globalViewPort.y += (globalViewPort.height - targetY) / 2;\r\n\r\n globalViewPort.width = targetX;\r\n globalViewPort.height = targetY;\r\n\r\n return globalViewPort;\r\n }\r\n /**\r\n * Get screen coordinates for a vector3\r\n * @param position defines the position to project\r\n * @param worldMatrix defines the world matrix to use\r\n * @returns the projected position\r\n */\r\n public getProjectedPosition(position: Vector3, worldMatrix: Matrix): Vector2 {\r\n const result = this.getProjectedPositionWithZ(position, worldMatrix);\r\n return new Vector2(result.x, result.y);\r\n }\r\n\r\n /**\r\n * Get screen coordinates for a vector3\r\n * @param position defines the position to project\r\n * @param worldMatrix defines the world matrix to use\r\n * @returns the projected position with Z\r\n */\r\n public getProjectedPositionWithZ(position: Vector3, worldMatrix: Matrix): Vector3 {\r\n const scene = this.getScene();\r\n if (!scene) {\r\n return Vector3.Zero();\r\n }\r\n const globalViewport = this._getGlobalViewport();\r\n const projectedPosition = Vector3.Project(position, worldMatrix, scene.getTransformMatrix(), globalViewport);\r\n return new Vector3(projectedPosition.x, projectedPosition.y, projectedPosition.z);\r\n }\r\n\r\n private _checkUpdate(camera: Camera, skipUpdate?: boolean): void {\r\n if (this._layerToDispose) {\r\n if ((camera.layerMask & this._layerToDispose.layerMask) === 0) {\r\n return;\r\n }\r\n }\r\n if (this._isFullscreen && this._linkedControls.length) {\r\n const scene = this.getScene();\r\n if (!scene) {\r\n return;\r\n }\r\n const globalViewport = this._getGlobalViewport();\r\n for (const control of this._linkedControls) {\r\n if (!control.isVisible) {\r\n continue;\r\n }\r\n const mesh = control._linkedMesh as AbstractMesh;\r\n if (!mesh || mesh.isDisposed()) {\r\n Tools.SetImmediate(() => {\r\n control.linkWithMesh(null);\r\n });\r\n continue;\r\n }\r\n const position = mesh.getBoundingInfo ? mesh.getBoundingInfo().boundingSphere.center : (Vector3.ZeroReadOnly as Vector3);\r\n const projectedPosition = Vector3.Project(position, mesh.getWorldMatrix(), scene.getTransformMatrix(), globalViewport);\r\n if (projectedPosition.z < 0 || projectedPosition.z > 1) {\r\n control.notRenderable = true;\r\n continue;\r\n }\r\n control.notRenderable = false;\r\n if (this.useInvalidateRectOptimization) {\r\n control.invalidateRect();\r\n }\r\n\r\n control._moveToProjectedPosition(projectedPosition);\r\n }\r\n }\r\n if (!this._isDirty && !this._rootContainer.isDirty) {\r\n return;\r\n }\r\n this._isDirty = false;\r\n this._render(skipUpdate);\r\n if (!skipUpdate) {\r\n this.update(this.applyYInversionOnUpdate, this.premulAlpha, AdvancedDynamicTexture.AllowGPUOptimizations);\r\n }\r\n }\r\n\r\n private _clearMeasure = new Measure(0, 0, 0, 0);\r\n\r\n private _render(skipRender?: boolean): void {\r\n const textureSize = this.getSize();\r\n const renderWidth = textureSize.width;\r\n const renderHeight = textureSize.height;\r\n\r\n const context = this.getContext();\r\n context.font = \"18px Arial\";\r\n context.strokeStyle = \"white\";\r\n\r\n if (this.onGuiReadyObservable.hasObservers()) {\r\n this._checkGuiIsReady();\r\n }\r\n\r\n /** We have to recheck the camera projection in the case the root control's children have changed */\r\n if (this._rootChildrenHaveChanged) {\r\n const camera = this.getScene()?.activeCamera;\r\n if (camera) {\r\n this._rootChildrenHaveChanged = false;\r\n this._checkUpdate(camera, true);\r\n }\r\n }\r\n\r\n // Layout\r\n this.onBeginLayoutObservable.notifyObservers(this);\r\n const measure = new Measure(0, 0, renderWidth, renderHeight);\r\n this._numLayoutCalls = 0;\r\n this._rootContainer._layout(measure, context);\r\n this.onEndLayoutObservable.notifyObservers(this);\r\n this._isDirty = false; // Restoring the dirty state that could have been set by controls during layout processing\r\n\r\n if (skipRender) {\r\n return;\r\n }\r\n\r\n // Clear\r\n if (this._invalidatedRectangle) {\r\n this._clearMeasure.copyFrom(this._invalidatedRectangle);\r\n } else {\r\n this._clearMeasure.copyFromFloats(0, 0, renderWidth, renderHeight);\r\n }\r\n context.clearRect(this._clearMeasure.left, this._clearMeasure.top, this._clearMeasure.width, this._clearMeasure.height);\r\n if (this._background) {\r\n context.save();\r\n context.fillStyle = this._background;\r\n context.fillRect(this._clearMeasure.left, this._clearMeasure.top, this._clearMeasure.width, this._clearMeasure.height);\r\n context.restore();\r\n }\r\n\r\n // Render\r\n this.onBeginRenderObservable.notifyObservers(this);\r\n this._numRenderCalls = 0;\r\n this._rootContainer._render(context, this._invalidatedRectangle);\r\n this.onEndRenderObservable.notifyObservers(this);\r\n this._invalidatedRectangle = null;\r\n }\r\n /**\r\n * @internal\r\n */\r\n public _changeCursor(cursor: string) {\r\n if (this._rootElement) {\r\n this._rootElement.style.cursor = cursor;\r\n this._cursorChanged = true;\r\n }\r\n }\r\n /**\r\n * @internal\r\n */\r\n public _registerLastControlDown(control: Control, pointerId: number) {\r\n this._lastControlDown[pointerId] = control;\r\n this.onControlPickedObservable.notifyObservers(control);\r\n }\r\n private _doPicking(x: number, y: number, pi: Nullable<PointerInfoBase>, type: number, pointerId: number, buttonIndex: number, deltaX?: number, deltaY?: number): void {\r\n const scene = this.getScene();\r\n if (!scene) {\r\n return;\r\n }\r\n const engine = scene.getEngine();\r\n const textureSize = this.getSize();\r\n if (this._isFullscreen) {\r\n const camera = scene.cameraToUseForPointers || scene.activeCamera;\r\n if (!camera) {\r\n return;\r\n }\r\n const viewport = camera.viewport;\r\n x = x * (textureSize.width / (engine.getRenderWidth() * viewport.width));\r\n y = y * (textureSize.height / (engine.getRenderHeight() * viewport.height));\r\n }\r\n if (this._capturingControl[pointerId]) {\r\n if (this._capturingControl[pointerId].isPointerBlocker) {\r\n this._shouldBlockPointer = true;\r\n }\r\n this._capturingControl[pointerId]._processObservables(type, x, y, pi, pointerId, buttonIndex);\r\n return;\r\n }\r\n\r\n this._cursorChanged = false;\r\n if (!this._rootContainer._processPicking(x, y, pi, type, pointerId, buttonIndex, deltaX, deltaY)) {\r\n if (!scene.doNotHandleCursors) {\r\n this._changeCursor(\"\");\r\n }\r\n if (type === PointerEventTypes.POINTERMOVE) {\r\n if (this._lastControlOver[pointerId]) {\r\n this._lastControlOver[pointerId]._onPointerOut(this._lastControlOver[pointerId], pi);\r\n delete this._lastControlOver[pointerId];\r\n }\r\n }\r\n }\r\n\r\n if (!this._cursorChanged && !scene.doNotHandleCursors) {\r\n this._changeCursor(\"\");\r\n }\r\n this._manageFocus();\r\n }\r\n /**\r\n * @internal\r\n */\r\n public _cleanControlAfterRemovalFromList(list: { [pointerId: number]: Control }, control: Control) {\r\n for (const pointerId in list) {\r\n if (!Object.prototype.hasOwnProperty.call(list, pointerId)) {\r\n continue;\r\n }\r\n const lastControlOver = list[pointerId];\r\n if (lastControlOver === control) {\r\n delete list[pointerId];\r\n }\r\n }\r\n }\r\n /**\r\n * @internal\r\n */\r\n public _cleanControlAfterRemoval(control: Control) {\r\n this._cleanControlAfterRemovalFromList(this._lastControlDown, control);\r\n this._cleanControlAfterRemovalFromList(this._lastControlOver, control);\r\n }\r\n\r\n /**\r\n * This function will run a pointer event on this ADT and will trigger any pointer events on any controls\r\n * This will work on a fullscreen ADT only. For mesh based ADT, simulate pointer events using the scene directly.\r\n * @param x pointer X on the canvas for the picking\r\n * @param y pointer Y on the canvas for the picking\r\n * @param pi optional pointer information\r\n */\r\n public pick(x: number, y: number, pi: Nullable<PointerInfoPre> = null) {\r\n if (this._isFullscreen && this._scene) {\r\n this._translateToPicking(this._scene, new Viewport(0, 0, 0, 0), pi, x, y);\r\n }\r\n }\r\n\r\n private _translateToPicking(scene: Scene, tempViewport: Viewport, pi: Nullable<PointerInfoPre>, x: number = scene.pointerX, y: number = scene.pointerY) {\r\n const camera = scene.cameraToUseForPointers || scene.activeCamera;\r\n const engine = scene.getEngine();\r\n const originalCameraToUseForPointers = scene.cameraToUseForPointers;\r\n\r\n if (!camera) {\r\n tempViewport.x = 0;\r\n tempViewport.y = 0;\r\n tempViewport.width = engine.getRenderWidth();\r\n tempViewport.height = engine.getRenderHeight();\r\n } else {\r\n if (camera.rigCameras.length) {\r\n // rig camera - we need to find the camera to use for this event\r\n const rigViewport = new Viewport(0, 0, 1, 1);\r\n camera.rigCameras.forEach((rigCamera) => {\r\n // generate the viewport of this camera\r\n rigCamera.viewport.toGlobalToRef(engine.getRenderWidth(), engine.getRenderHeight(), rigViewport);\r\n const transformedX = x / engine.getHardwareScalingLevel() - rigViewport.x;\r\n const transformedY = y / engine.getHardwareScalingLevel() - (engine.getRenderHeight() - rigViewport.y - rigViewport.height);\r\n // check if the pointer is in the camera's viewport\r\n if (transformedX < 0 || transformedY < 0 || x > rigViewport.width || y > rigViewport.height) {\r\n // out of viewport - don't use this camera\r\n return;\r\n }\r\n // set the camera to use for pointers until this pointer loop is over\r\n scene.cameraToUseForPointers = rigCamera;\r\n // set the viewport\r\n tempViewport.x = rigViewport.x;\r\n tempViewport.y = rigViewport.y;\r\n tempViewport.width = rigViewport.width;\r\n tempViewport.height = rigViewport.height;\r\n });\r\n } else {\r\n camera.viewport.toGlobalToRef(engine.getRenderWidth(), engine.getRenderHeight(), tempViewport);\r\n }\r\n }\r\n\r\n const transformedX = x / engine.getHardwareScalingLevel() - tempViewport.x;\r\n const transformedY = y / engine.getHardwareScalingLevel() - (engine.getRenderHeight() - tempViewport.y - tempViewport.height);\r\n this._shouldBlockPointer = false;\r\n // Do picking modifies _shouldBlockPointer\r\n if (pi) {\r\n const pointerId = (pi.event as IPointerEvent).pointerId || this._defaultMousePointerId;\r\n this._doPicking(transformedX, transformedY, pi, pi.type, pointerId, pi.event.button, (<IWheelEvent>pi.event).deltaX, (<IWheelEvent>pi.event).deltaY);\r\n // Avoid overwriting a true skipOnPointerObservable to false\r\n if ((this._shouldBlockPointer && !(pi.type & this.skipBlockEvents)) || this._capturingControl[pointerId]) {\r\n pi.skipOnPointerObservable = true;\r\n }\r\n } else {\r\n this._doPicking(transformedX, transformedY, null, PointerEventTypes.POINTERMOVE, this._defaultMousePointerId, 0);\r\n }\r\n // if overridden by a rig camera - reset back to the original value\r\n scene.cameraToUseForPointers = originalCameraToUseForPointers;\r\n }\r\n\r\n /** Attach to all scene events required to support pointer events */\r\n public attach(): void {\r\n const scene = this.getScene();\r\n if (!scene) {\r\n return;\r\n }\r\n\r\n const tempViewport = new Viewport(0, 0, 0, 0);\r\n\r\n this._prePointerObserver = scene.onPrePointerObservable.add((pi) => {\r\n if (\r\n scene.isPointerCaptured((<IPointerEvent>pi.event).pointerId) &&\r\n pi.type === PointerEventTypes.POINTERUP &&\r\n !this._capturedPointerIds.has((pi.event as IPointerEvent).pointerId)\r\n ) {\r\n return;\r\n }\r\n if (\r\n pi.type !== PointerEventTypes.POINTERMOVE &&\r\n pi.type !== PointerEventTypes.POINTERUP &&\r\n pi.type !== PointerEventTypes.POINTERDOWN &&\r\n pi.type !== PointerEventTypes.POINTERWHEEL\r\n ) {\r\n return;\r\n }\r\n\r\n if (pi.type === PointerEventTypes.POINTERMOVE) {\r\n // Avoid pointerMove events firing while the pointer is captured by the scene\r\n if (scene.isPointerCaptured((<IPointerEvent>pi.event).pointerId)) {\r\n return;\r\n }\r\n if ((pi.event as IPointerEvent).pointerId) {\r\n this._defaultMousePointerId = (pi.event as IPointerEvent).pointerId; // This is required to make sure we have the correct pointer ID for wheel\r\n }\r\n }\r\n this._translateToPicking(scene, tempViewport, pi);\r\n });\r\n this._attachPickingToSceneRender(scene, () => this._translateToPicking(scene, tempViewport, null), false);\r\n this._attachToOnPointerOut(scene);\r\n this._attachToOnBlur(scene);\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n private _onClipboardCopy = (rawEvt: Event) => {\r\n const evt = rawEvt as ClipboardEvent;\r\n const ev = new ClipboardInfo(ClipboardEventTypes.COPY, evt);\r\n this.onClipboardObservable.notifyObservers(ev);\r\n evt.preventDefault();\r\n };\r\n /**\r\n * @internal\r\n */\r\n private _onClipboardCut = (rawEvt: Event) => {\r\n const evt = rawEvt as ClipboardEvent;\r\n const ev = new ClipboardInfo(ClipboardEventTypes.CUT, evt);\r\n this.onClipboardObservable.notifyObservers(ev);\r\n evt.preventDefault();\r\n };\r\n /**\r\n * @internal\r\n */\r\n private _onClipboardPaste = (rawEvt: Event) => {\r\n const evt = rawEvt as ClipboardEvent;\r\n const ev = new ClipboardInfo(ClipboardEventTypes.PASTE, evt);\r\n this.onClipboardObservable.notifyObservers(ev);\r\n evt.preventDefault();\r\n };\r\n /**\r\n * Register the clipboard Events onto the canvas\r\n */\r\n public registerClipboardEvents(): void {\r\n self.addEventListener(\"copy\", this._onClipboardCopy, false);\r\n self.addEventListener(\"cut\", this._onClipboardCut, false);\r\n self.addEventListener(\"paste\", this._onClipboardPaste, false);\r\n }\r\n /**\r\n * Unregister the clipboard Events from the canvas\r\n */\r\n public unRegisterClipboardEvents(): void {\r\n self.removeEventListener(\"copy\", this._onClipboardCopy);\r\n self.removeEventListener(\"cut\", this._onClipboardCut);\r\n self.removeEventListener(\"paste\", this._onClipboardPaste);\r\n }\r\n\r\n /**\r\n * Transform uvs from mesh space to texture space, taking the texture into account\r\n * @param uv the uvs in mesh space\r\n * @returns the uvs in texture space\r\n */\r\n private _transformUvs(uv: Vector2): Vector2 {\r\n const textureMatrix = this.getTextureMatrix();\r\n let result;\r\n if (textureMatrix.isIdentityAs3x2()) {\r\n result = uv;\r\n } else {\r\n const homogeneousTextureMatrix = TmpVectors.Matrix[0];\r\n\r\n textureMatrix.getRowToRef(0, TmpVectors.Vector4[0]);\r\n textureMatrix.getRowToRef(1, TmpVectors.Vector4[1]);\r\n textureMatrix.getRowToRef(2, TmpVectors.Vector4[2]);\r\n\r\n const r0 = TmpVectors.Vector4[0];\r\n const r1 = TmpVectors.Vector4[1];\r\n const r2 = TmpVectors.Vector4[2];\r\n\r\n homogeneousTextureMatrix.setRowFromFloats(0, r0.x, r0.y, 0, 0);\r\n homogeneousTextureMatrix.setRowFromFloats(1, r1.x, r1.y, 0, 0);\r\n homogeneousTextureMatrix.setRowFromFloats(2, 0, 0, 1, 0);\r\n homogeneousTextureMatrix.setRowFromFloats(3, r2.x, r2.y, 0, 1);\r\n\r\n result = TmpVectors.Vector2[0];\r\n Vector2.TransformToRef(uv, homogeneousTextureMatrix, result);\r\n }\r\n\r\n // In wrap and mirror mode, the texture coordinate for coordinates more than 1 is the fractional part of the coordinate\r\n if (this.wrapU === Texture.WRAP_ADDRESSMODE || this.wrapU === Texture.MIRROR_ADDRESSMODE) {\r\n if (result.x > 1) {\r\n let fX = result.x - Math.trunc(result.x);\r\n // In mirror mode, the sign of the texture coordinate depends on the integer part -\r\n // odd integers means it is mirrored from the original coordinate\r\n if (this.wrapU === Texture.MIRROR_ADDRESSMODE && Math.trunc(result.x) % 2 === 1) {\r\n fX = 1 - fX;\r\n }\r\n result.x = fX;\r\n }\r\n }\r\n if (this.wrapV === Texture.WRAP_ADDRESSMODE || this.wrapV === Texture.MIRROR_ADDRESSMODE) {\r\n if (result.y > 1) {\r\n let fY = result.y - Math.trunc(result.y);\r\n if (this.wrapV === Texture.MIRROR_ADDRESSMODE && Math.trunc(result.x) % 2 === 1) {\r\n fY = 1 - fY;\r\n }\r\n result.y = fY;\r\n }\r\n }\r\n return result;\r\n }\r\n /**\r\n * Connect the texture to a hosting mesh to enable interactions\r\n * @param mesh defines the mesh to attach to\r\n * @param supportPointerMove defines a boolean indicating if pointer move events must be catched as well\r\n */\r\n public attachToMesh(mesh: AbstractMesh, supportPointerMove = true): void {\r\n const scene = this.getScene();\r\n if (!scene) {\r\n return;\r\n }\r\n\r\n if (this._pointerObserver) {\r\n scene.onPointerObservable.remove(this._pointerObserver);\r\n }\r\n\r\n this._pointerObserver = scene.onPointerObservable.add((pi) => {\r\n if (\r\n pi.type !== PointerEventTypes.POINTERMOVE &&\r\n pi.type !== PointerEventTypes.POINTERUP &&\r\n pi.type !== PointerEventTypes.POINTERDOWN &&\r\n pi.type !== PointerEventTypes.POINTERWHEEL\r\n ) {\r\n return;\r\n }\r\n\r\n if (pi.type === PointerEventTypes.POINTERMOVE && (pi.event as IPointerEvent).pointerId) {\r\n this._defaultMousePointerId = (pi.event as IPointerEvent).pointerId; // This is required to make sure we have the correct pointer ID for wheel\r\n }\r\n\r\n const pointerId = (pi.event as IPointerEvent).pointerId || this._defaultMousePointerId;\r\n if (pi.pickInfo && pi.pickInfo.hit && pi.pickInfo.pickedMesh === mesh) {\r\n let uv = pi.pickInfo.getTextureCoordinates();\r\n if (uv) {\r\n uv = this._transformUvs(uv);\r\n const size = this.getSize();\r\n this._doPicking(\r\n uv.x * size.width,\r\n (this.applyYInversionOnUpdate ? 1.0 - uv.y : uv.y) * size.height,\r\n pi,\r\n pi.type,\r\n pointerId,\r\n pi.event.button,\r\n (<IWheelEvent>pi.event).deltaX,\r\n (<IWheelEvent>pi.event).deltaY\r\n );\r\n }\r\n } else if (pi.type === PointerEventTypes.POINTERUP) {\r\n if (this._lastControlDown[pointerId]) {\r\n this._lastControlDown[pointerId]._forcePointerUp(pointerId);\r\n }\r\n delete this._lastControlDown[pointerId];\r\n if (this.focusedControl) {\r\n const friendlyControls = this.focusedControl.keepsFocusWith();\r\n let canMoveFocus = true;\r\n if (friendlyControls) {\r\n for (const control of friendlyControls) {\r\n // Same host, no need to keep the focus\r\n if (this === control._host) {\r\n continue;\r\n }\r\n // Different hosts\r\n const otherHost = control._host;\r\n if (otherHost._lastControlOver[pointerId] && otherHost._lastControlOver[pointerId].isAscendant(control)) {\r\n canMoveFocus = false;\r\n break;\r\n }\r\n }\r\n }\r\n if (canMoveFocus) {\r\n this.focusedControl = null;\r\n }\r\n }\r\n } else if (pi.type === PointerEventTypes.POINTERMOVE) {\r\n if (this._lastControlOver[pointerId]) {\r\n this._lastControlOver[pointerId]._onPointerOut(this._lastControlOver[pointerId], pi, true);\r\n }\r\n delete this._lastControlOver[pointerId];\r\n }\r\n });\r\n mesh.enablePointerMoveEvents = supportPointerMove;\r\n this._attachPickingToSceneRender(\r\n scene,\r\n () => {\r\n const pointerId = this._defaultMousePointerId;\r\n const pick = scene?.pick(scene.pointerX, scene.pointerY);\r\n if (pick && pick.hit && pick.pickedMesh === mesh) {\r\n let uv = pick.getTextureCoordinates();\r\n if (uv) {\r\n uv = this._transformUvs(uv);\r\n const size = this.getSize();\r\n this._doPicking(uv.x * size.width, (this.applyYInversionOnUpdate ? 1.0 - uv.y : uv.y) * size.height, null, PointerEventTypes.POINTERMOVE, pointerId, 0);\r\n }\r\n } else {\r\n if (this._lastControlOver[pointerId]) {\r\n this._lastControlOver[pointerId]._onPointerOut(this._lastControlOver[pointerId], null, true);\r\n }\r\n delete this._lastControlOver[pointerId];\r\n }\r\n },\r\n true\r\n );\r\n this._attachToOnPointerOut(scene);\r\n this._attachToOnBlur(scene);\r\n }\r\n /**\r\n * Move the focus to a specific control\r\n * @param control defines the control which will receive the focus\r\n */\r\n public moveFocusToControl(control: IFocusableControl): void {\r\n this.focusedControl = control;\r\n this._lastPickedControl = <any>control;\r\n this._blockNextFocusCheck = true;\r\n }\r\n private _manageFocus(): void {\r\n if (this._blockNextFocusCheck) {\r\n this._blockNextFocusCheck = false;\r\n this._lastPickedControl = <any>this._focusedControl;\r\n return;\r\n }\r\n // Focus management\r\n if (this._focusedControl) {\r\n if (this._focusedControl !== <any>this._lastPickedControl) {\r\n if (this._lastPickedControl.isFocusInvisible) {\r\n return;\r\n }\r\n this.focusedControl = null;\r\n }\r\n }\r\n }\r\n private _attachPickingToSceneRender(scene: Scene, pickFunction: () => void, forcePicking: boolean) {\r\n this._sceneRenderObserver = scene.onBeforeRenderObservable.add(() => {\r\n if (!this.checkPointerEveryFrame) {\r\n return;\r\n }\r\n if (this._linkedControls.length > 0 || forcePicking) {\r\n pickFunction();\r\n }\r\n });\r\n }\r\n private _attachToOnPointerOut(scene: Scene): void {\r\n this._canvasPointerOutObserver = scene.getEngine().onCanvasPointerOutObservable.add((pointerEvent) => {\r\n if (this._lastControlOver[pointerEvent.pointerId]) {\r\n this._lastControlOver[pointerEvent.pointerId]._onPointerOut(this._lastControlOver[pointerEvent.pointerId], null);\r\n }\r\n delete this._lastControlOver[pointerEvent.pointerId];\r\n if (this._lastControlDown[pointerEvent.pointerId] && this._lastControlDown[pointerEvent.pointerId] !== this._capturingControl[pointerEvent.pointerId]) {\r\n this._lastControlDown[pointerEvent.pointerId]._forcePointerUp(pointerEvent.pointerId);\r\n delete this._lastControlDown[pointerEvent.pointerId];\r\n }\r\n });\r\n }\r\n private _attachToOnBlur(scene: Scene): void {\r\n this._canvasBlurObserver = scene.getEngine().onCanvasBlurObservable.add(() => {\r\n Object.entries(this._lastControlDown).forEach(([, value]) => {\r\n value._onCanvasBlur();\r\n });\r\n this.focusedControl = null;\r\n this._lastControlDown = {};\r\n });\r\n }\r\n\r\n /**\r\n * Serializes the entire GUI system\r\n * @returns an object with the JSON serialized data\r\n */\r\n public serializeContent(): any {\r\n const size = this.getSize();\r\n const serializationObject = {\r\n root: {},\r\n width: size.width,\r\n height: size.height,\r\n };\r\n\r\n this._rootContainer.serialize(serializationObject.root);\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Recreate the content of the ADT from a JSON object\r\n * @param serializedObject define the JSON serialized object to restore from\r\n * @param scaleToSize defines whether to scale to texture to the saved size\r\n */\r\n public parseSerializedObject(serializedObject: any, scaleToSize?: boolean) {\r\n this._rootContainer = Control.Parse(serializedObject.root, this) as Container;\r\n if (scaleToSize) {\r\n const width = serializedObject.width;\r\n const height = serializedObject.height;\r\n if (typeof width === \"number\" && typeof height === \"number\" && width >= 0 && height >= 0) {\r\n this.scaleTo(width, height);\r\n } else {\r\n // scales the GUI to a default size if none was available in the serialized content\r\n this.scaleTo(1920, 1080);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Clones the ADT\r\n * @param newName defines the name of the new ADT\r\n * @returns the clone of the ADT\r\n */\r\n public clone(newName?: string): AdvancedDynamicTexture {\r\n const scene = this.getScene();\r\n\r\n if (!scene) {\r\n return this;\r\n }\r\n const size = this.getSize();\r\n const data = this.serializeContent();\r\n const clone = new AdvancedDynamicTexture(newName ?? \"Clone of \" + this.name, size.width, size.height, scene, !this.noMipmap, this.samplingMode);\r\n clone.parseSerializedObject(data);\r\n\r\n return clone;\r\n }\r\n\r\n /**\r\n * Recreate the content of the ADT from a JSON object\r\n * @param serializedObject define the JSON serialized object to restore from\r\n * @param scaleToSize defines whether to scale to texture to the saved size\r\n * @deprecated Please use parseSerializedObject instead\r\n */\r\n public parseContent = this.parseSerializedObject;\r\n\r\n /**\r\n * Recreate the content of the ADT from a snippet saved by the GUI editor\r\n * @param snippetId defines the snippet to load\r\n * @param scaleToSize defines whether to scale to texture to the saved size\r\n * @param appendToAdt if provided the snippet will be appended to the adt. Otherwise a fullscreen ADT will be created.\r\n * @returns a promise that will resolve on success\r\n */\r\n public static async ParseFromSnippetAsync(snippetId: string, scaleToSize?: boolean, appendToAdt?: AdvancedDynamicTexture): Promise<AdvancedDynamicTexture> {\r\n const adt = appendToAdt ?? AdvancedDynamicTexture.CreateFullscreenUI(\"ADT from snippet\");\r\n if (snippetId === \"_BLANK\") {\r\n return adt;\r\n }\r\n\r\n const serialized = await AdvancedDynamicTexture._LoadURLContentAsync(AdvancedDynamicTexture.SnippetUrl + \"/\" + snippetId.replace(/#/g, \"/\"), true);\r\n adt.parseSerializedObject(serialized, scaleToSize);\r\n return adt;\r\n }\r\n\r\n /**\r\n * Recreate the content of the ADT from a snippet saved by the GUI editor\r\n * @param snippetId defines the snippet to load\r\n * @param scaleToSize defines whether to scale to texture to the saved size\r\n * @returns a promise that will resolve on success\r\n */\r\n public parseFromSnippetAsync(snippetId: string, scaleToSize?: boolean): Promise<AdvancedDynamicTexture> {\r\n return AdvancedDynamicTexture.ParseFromSnippetAsync(snippetId, scaleToSize, this);\r\n }\r\n\r\n /**\r\n * Recreate the content of the ADT from a url json\r\n * @param url defines the url to load\r\n * @param scaleToSize defines whether to scale to texture to the saved size\r\n * @param appendToAdt if provided the snippet will be appended to the adt. Otherwise a fullscreen ADT will be created.\r\n * @returns a promise that will resolve on success\r\n */\r\n public static async ParseFromFileAsync(url: string, scaleToSize?: boolean, appendToAdt?: AdvancedDynamicTexture): Promise<AdvancedDynamicTexture> {\r\n const adt = appendToAdt ?? AdvancedDynamicTexture.CreateFullscreenUI(\"ADT from URL\");\r\n const serialized = await AdvancedDynamicTexture._LoadURLContentAsync(url);\r\n adt.parseSerializedObject(serialized, scaleToSize);\r\n return adt;\r\n }\r\n\r\n /**\r\n * Recreate the content of the ADT from a url json\r\n * @param url defines the url to load\r\n * @param scaleToSize defines whether to scale to texture to the saved size\r\n * @returns a promise that will resolve on success\r\n */\r\n public parseFromURLAsync(url: string, scaleToSize?: boolean): Promise<AdvancedDynamicTexture> {\r\n return AdvancedDynamicTexture.ParseFromFileAsync(url, scaleToSize, this);\r\n }\r\n\r\n private static _LoadURLContentAsync(url: string, snippet: boolean = false): Promise<any> {\r\n if (url === \"\") {\r\n return Promise.reject(\"No URL provided\");\r\n }\r\n\r\n return new Promise((resolve, reject) => {\r\n const request = new WebRequest();\r\n request.addEventListener(\"readystatechange\", () => {\r\n if (request.readyState == 4) {\r\n if (request.status == 200) {\r\n let gui;\r\n if (snippet) {\r\n const payload = JSON.parse(JSON.parse(request.responseText).jsonPayload);\r\n gui = payload.encodedGui ? new TextDecoder(\"utf-8\").decode(DecodeBase64ToBinary(payload.encodedGui)) : payload.gui;\r\n } else {\r\n gui = request.responseText;\r\n }\r\n const serializationObject = JSON.parse(gui);\r\n resolve(serializationObject);\r\n } else {\r\n reject(\"Unable to load\");\r\n }\r\n }\r\n });\r\n request.open(\"GET\", url);\r\n request.send();\r\n });\r\n }\r\n\r\n // Statics\r\n /**\r\n * Compares two rectangle based controls for pixel overlap\r\n * @param control1 The first control to compare\r\n * @param control2 The second control to compare\r\n * @returns true if overlaps, otherwise false\r\n */\r\n private static _Overlaps(control1: Control, control2: Control) {\r\n return !(\r\n control1.centerX > control2.centerX + control2.widthInPixels ||\r\n control1.centerX + control1.widthInPixels < control2.centerX ||\r\n control1.centerY + control1.heightInPixels < control2.centerY ||\r\n control1.centerY > control2.centerY + control2.heightInPixels\r\n );\r\n }\r\n\r\n /**\r\n * Creates a new AdvancedDynamicTexture in projected mode (ie. attached to a mesh)\r\n * @param mesh defines the mesh which will receive the texture\r\n * @param width defines the texture width (1024 by default)\r\n * @param height defines the texture height (1024 by default)\r\n * @param supportPointerMove defines a boolean indicating if the texture must capture move events (true by default)\r\n * @param onlyAlphaTesting defines a boolean indicating that alpha blending will not be used (only alpha testing) (false by default)\r\n * @param invertY defines if the texture needs to be inverted on the y axis during loading (true by default)\r\n * @param materialSetupCallback defines a custom way of creating and setting up the material on the mesh\r\n * @returns a new AdvancedDynamicTexture\r\n */\r\n public static CreateForMesh(\r\n mesh: AbstractMesh,\r\n width = 1024,\r\n height = 1024,\r\n supportPointerMove = true,\r\n onlyAlphaTesting = false,\r\n invertY?: boolean,\r\n materialSetupCallback: (mesh: AbstractMesh, uniqueId: string, texture: AdvancedDynamicTexture, onlyAlphaTesting: boolean) => void = this._CreateMaterial\r\n ): AdvancedDynamicTexture {\r\n // use a unique ID in name so serialization will work even if you create two ADTs for a single mesh\r\n const uniqueId = RandomGUID();\r\n const result = new AdvancedDynamicTexture(\r\n `AdvancedDynamicTexture for ${mesh.name} [${uniqueId}]`,\r\n width,\r\n height,\r\n mesh.getScene(),\r\n true,\r\n Texture.TRILINEAR_SAMPLINGMODE,\r\n invertY\r\n );\r\n\r\n materialSetupCallback(mesh, uniqueId, result, onlyAlphaTesting);\r\n\r\n result.attachToMesh(mesh, supportPointerMove);\r\n return result;\r\n }\r\n\r\n private static _CreateMaterial(mesh: AbstractMesh, uniqueId: string, texture: AdvancedDynamicTexture, onlyAlphaTesting: boolean): void {\r\n const internalClassType = GetClass(\"BABYLON.StandardMaterial\");\r\n if (!internalClassType) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"StandardMaterial needs to be imported before as it contains a side-effect required by your code.\";\r\n }\r\n\r\n const material: StandardMaterial = new internalClassType(`AdvancedDynamicTextureMaterial for ${mesh.name} [${uniqueId}]`, mesh.getScene());\r\n material.backFaceCulling = false;\r\n material.diffuseColor = Color3.Black();\r\n material.specularColor = Color3.Black();\r\n if (onlyAlphaTesting) {\r\n material.diffuseTexture = texture;\r\n material.emissiveTexture = texture;\r\n texture.hasAlpha = true;\r\n } else {\r\n material.emissiveTexture = texture;\r\n material.opacityTexture = texture;\r\n }\r\n mesh.material = material;\r\n }\r\n\r\n /**\r\n * Creates a new AdvancedDynamicTexture in projected mode (ie. attached to a mesh) BUT do not create a new material for the mesh. You will be responsible for connecting the texture\r\n * @param mesh defines the mesh which will receive the texture\r\n * @param width defines the texture width (1024 by default)\r\n * @param height defines the texture height (1024 by default)\r\n * @param supportPointerMove defines a boolean indicating if the texture must capture move events (true by default)\r\n * @param invertY defines if the texture needs to be inverted on the y axis during loading (true by default)\r\n * @returns a new AdvancedDynamicTexture\r\n */\r\n public static CreateForMeshTexture(mesh: AbstractMesh, width = 1024, height = 1024, supportPointerMove = true, invertY?: boolean): AdvancedDynamicTexture {\r\n const result = new AdvancedDynamicTexture(mesh.name + \" AdvancedDynamicTexture\", width, height, mesh.getScene(), true, Texture.TRILINEAR_SAMPLINGMODE, invertY);\r\n result.attachToMesh(mesh, supportPointerMove);\r\n return result;\r\n }\r\n /**\r\n * Creates a new AdvancedDynamicTexture in fullscreen mode.\r\n * In this mode the texture will rely on a layer for its rendering.\r\n * This allows it to be treated like any other layer.\r\n * As such, if you have a multi camera setup, you can set the layerMask on the GUI as well.\r\n * LayerMask is set through advancedTexture.layer.layerMask\r\n * @param name defines name for the texture\r\n * @param foreground defines a boolean indicating if the texture must be rendered in foreground (default is true)\r\n * @param scene defines the hosting scene\r\n * @param sampling defines the texture sampling mode (Texture.BILINEAR_SAMPLINGMODE by default)\r\n * @param adaptiveScaling defines whether to automatically scale root to match hardwarescaling (false by default)\r\n * @returns a new AdvancedDynamicTexture\r\n */\r\n public static CreateFullscreenUI(\r\n name: string,\r\n foreground: boolean = true,\r\n scene: Nullable<Scene> = null,\r\n sampling = Texture.BILINEAR_SAMPLINGMODE,\r\n adaptiveScaling: boolean = false\r\n ): AdvancedDynamicTexture {\r\n const result = new AdvancedDynamicTexture(name, 0, 0, scene, false, sampling);\r\n // Display\r\n const resultScene = result.getScene();\r\n const layer = new Layer(name + \"_layer\", null, resultScene, !foreground);\r\n layer.texture = result;\r\n result._layerToDispose = layer;\r\n result._isFullscreen = true;\r\n\r\n if (adaptiveScaling && resultScene) {\r\n const newScale = 1 / resultScene.getEngine().getHardwareScalingLevel();\r\n result._rootContainer.scaleX = newScale;\r\n result._rootContainer.scaleY = newScale;\r\n }\r\n\r\n // Attach\r\n result.attach();\r\n return result;\r\n }\r\n\r\n /**\r\n * Scales the texture\r\n * @param ratio the scale factor to apply to both width and height\r\n */\r\n public scale(ratio: number): void {\r\n super.scale(ratio);\r\n this.markAsDirty();\r\n }\r\n\r\n /**\r\n * Resizes the texture\r\n * @param width the new width\r\n * @param height the new height\r\n */\r\n public scaleTo(width: number, height: number): void {\r\n super.scaleTo(width, height);\r\n this.markAsDirty();\r\n }\r\n\r\n private _checkGuiIsReady() {\r\n if (this.guiIsReady()) {\r\n this.onGuiReadyObservable.notifyObservers(this);\r\n\r\n this.onGuiReadyObservable.clear();\r\n }\r\n }\r\n\r\n /**\r\n * @returns true if all the GUI components are ready to render\r\n */\r\n public guiIsReady(): boolean {\r\n return this._rootContainer.isReady();\r\n }\r\n}\r\n"]}
|
1
|
+
{"version":3,"file":"advancedDynamicTexture.js","sourceRoot":"","sources":["../../../../dev/gui/src/2D/advancedDynamicTexture.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,2CAA6B;AAElD,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,6CAA+B;AACtE,OAAO,EAAE,KAAK,EAAE,sCAAwB;AAExC,OAAO,EAAE,iBAAiB,EAAE,gDAAkC;AAC9D,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAE,kDAAoC;AAEjF,OAAO,EAAE,kBAAkB,EAAE,iDAAmC;AAEhE,OAAO,EAAE,OAAO,EAAE,sDAAwC;AAC1D,OAAO,EAAE,cAAc,EAAE,6DAA+C;AAExE,OAAO,EAAE,KAAK,EAAE,wCAA0B;AAI1C,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAE7C,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,6CAA+B;AACnD,OAAO,EAAE,QAAQ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KAAK,CAAC,KAAK,CAAC,CAAC;QACnB,IAAI,CAAC,WAAW,EAAE,CAAC;IACvB,CAAC;IAED;;;;OAIG;IACI,OAAO,CAAC,KAAa,EAAE,MAAc;QACxC,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;QAC7B,IAAI,CAAC,WAAW,EAAE,CAAC;IACvB,CAAC;IAEO,gBAAgB;QACpB,IAAI,IAAI,CAAC,UAAU,EAAE,EAAE;YACnB,IAAI,CAAC,oBAAoB,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;YAEhD,IAAI,CAAC,oBAAoB,CAAC,KAAK,EAAE,CAAC;SACrC;IACL,CAAC;IAED;;OAEG;IACI,UAAU;QACb,OAAO,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,CAAC;IACzC,CAAC;;AA/+CD,sCAAsC;AACxB,iCAAU,GAAG,SAAS,CAAC,UAAU,AAAvB,CAAwB;AAEhD,yIAAyI;AAC3H,4CAAqB,GAAG,IAAI,AAAP,CAAQ","sourcesContent":["import type { Nullable } from \"core/types\";\r\nimport type { Observer } from \"core/Misc/observable\";\r\nimport { Observable } from \"core/Misc/observable\";\r\nimport type { Matrix } from \"core/Maths/math.vector\";\r\nimport { Vector2, Vector3, TmpVectors } from \"core/Maths/math.vector\";\r\nimport { Tools } from \"core/Misc/tools\";\r\nimport type { PointerInfoPre, PointerInfo, PointerInfoBase } from \"core/Events/pointerEvents\";\r\nimport { PointerEventTypes } from \"core/Events/pointerEvents\";\r\nimport { ClipboardEventTypes, ClipboardInfo } from \"core/Events/clipboardEvents\";\r\nimport type { KeyboardInfoPre } from \"core/Events/keyboardEvents\";\r\nimport { KeyboardEventTypes } from \"core/Events/keyboardEvents\";\r\nimport type { Camera } from \"core/Cameras/camera\";\r\nimport { Texture } from \"core/Materials/Textures/texture\";\r\nimport { DynamicTexture } from \"core/Materials/Textures/dynamicTexture\";\r\nimport type { AbstractMesh } from \"core/Meshes/abstractMesh\";\r\nimport { Layer } from \"core/Layers/layer\";\r\nimport type { Engine } from \"core/Engines/engine\";\r\nimport type { Scene } from \"core/scene\";\r\n\r\nimport { Container } from \"./controls/container\";\r\nimport { Control } from \"./controls/control\";\r\nimport type { IFocusableControl } from \"./controls/focusableControl\";\r\nimport { Style } from \"./style\";\r\nimport { Measure } from \"./measure\";\r\nimport { Constants } from \"core/Engines/constants\";\r\nimport { Viewport } from \"core/Maths/math.viewport\";\r\nimport { Color3 } from \"core/Maths/math.color\";\r\nimport { WebRequest } from \"core/Misc/webRequest\";\r\nimport type { IPointerEvent, IWheelEvent } from \"core/Events/deviceInputEvents\";\r\nimport { RandomGUID } from \"core/Misc/guid\";\r\nimport { GetClass } from \"core/Misc/typeStore\";\r\nimport { DecodeBase64ToBinary } from \"core/Misc/stringTools\";\r\n\r\nimport type { StandardMaterial } from \"core/Materials/standardMaterial\";\r\n\r\n/**\r\n * Class used to create texture to support 2D GUI elements\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/gui/gui\r\n */\r\nexport class AdvancedDynamicTexture extends DynamicTexture {\r\n /** Define the url to load snippets */\r\n public static SnippetUrl = Constants.SnippetUrl;\r\n\r\n /** Indicates if some optimizations can be performed in GUI GPU management (the downside is additional memory/GPU texture memory used) */\r\n public static AllowGPUOptimizations = true;\r\n\r\n /** Snippet ID if the content was created from the snippet server */\r\n public snippetId: string;\r\n\r\n /** Observable that fires when the GUI is ready */\r\n public onGuiReadyObservable = new Observable<AdvancedDynamicTexture>();\r\n\r\n private _isDirty = false;\r\n private _renderObserver: Nullable<Observer<Camera>>;\r\n private _resizeObserver: Nullable<Observer<Engine>>;\r\n private _preKeyboardObserver: Nullable<Observer<KeyboardInfoPre>>;\r\n private _prePointerObserver: Nullable<Observer<PointerInfoPre>>;\r\n private _sceneRenderObserver: Nullable<Observer<Scene>>;\r\n private _pointerObserver: Nullable<Observer<PointerInfo>>;\r\n private _canvasPointerOutObserver: Nullable<Observer<PointerEvent>>;\r\n private _canvasBlurObserver: Nullable<Observer<Engine>>;\r\n private _controlAddedObserver: Nullable<Observer<Nullable<Control>>>;\r\n private _controlRemovedObserver: Nullable<Observer<Nullable<Control>>>;\r\n private _background: string;\r\n /** @internal */\r\n public _rootContainer = new Container(\"root\");\r\n /** @internal */\r\n public _lastPickedControl: Control;\r\n /** @internal */\r\n public _lastControlOver: { [pointerId: number]: Control } = {};\r\n /** @internal */\r\n public _lastControlDown: { [pointerId: number]: Control } = {};\r\n /** @internal */\r\n public _capturingControl: { [pointerId: number]: Control } = {};\r\n /** @internal */\r\n public _shouldBlockPointer: boolean;\r\n /** @internal */\r\n public _layerToDispose: Nullable<Layer>;\r\n /** @internal */\r\n public _linkedControls = new Array<Control>();\r\n /** @internal */\r\n public _isFullscreen = false;\r\n private _fullscreenViewport = new Viewport(0, 0, 1, 1);\r\n private _idealWidth = 0;\r\n private _idealHeight = 0;\r\n private _useSmallestIdeal: boolean = false;\r\n private _renderAtIdealSize = false;\r\n private _focusedControl: Nullable<IFocusableControl>;\r\n private _blockNextFocusCheck = false;\r\n private _renderScale = 1;\r\n private _rootElement: Nullable<HTMLElement>;\r\n private _cursorChanged = false;\r\n private _defaultMousePointerId = 0;\r\n private _rootChildrenHaveChanged: boolean = false;\r\n\r\n /** @internal */\r\n public _capturedPointerIds = new Set<number>();\r\n\r\n /** @internal */\r\n public _numLayoutCalls = 0;\r\n /** Gets the number of layout calls made the last time the ADT has been rendered */\r\n public get numLayoutCalls(): number {\r\n return this._numLayoutCalls;\r\n }\r\n\r\n /** @internal */\r\n public _numRenderCalls = 0;\r\n /** Gets the number of render calls made the last time the ADT has been rendered */\r\n public get numRenderCalls(): number {\r\n return this._numRenderCalls;\r\n }\r\n\r\n /**\r\n * Define type to string to ensure compatibility across browsers\r\n * Safari doesn't support DataTransfer constructor\r\n */\r\n private _clipboardData: string = \"\";\r\n /**\r\n * Observable event triggered each time an clipboard event is received from the rendering canvas\r\n */\r\n public onClipboardObservable = new Observable<ClipboardInfo>();\r\n /**\r\n * Observable event triggered each time a pointer down is intercepted by a control\r\n */\r\n public onControlPickedObservable = new Observable<Control>();\r\n /**\r\n * Observable event triggered before layout is evaluated\r\n */\r\n public onBeginLayoutObservable = new Observable<AdvancedDynamicTexture>();\r\n /**\r\n * Observable event triggered after the layout was evaluated\r\n */\r\n public onEndLayoutObservable = new Observable<AdvancedDynamicTexture>();\r\n /**\r\n * Observable event triggered before the texture is rendered\r\n */\r\n public onBeginRenderObservable = new Observable<AdvancedDynamicTexture>();\r\n /**\r\n * Observable event triggered after the texture was rendered\r\n */\r\n public onEndRenderObservable = new Observable<AdvancedDynamicTexture>();\r\n /**\r\n * Gets or sets a boolean defining if alpha is stored as premultiplied\r\n */\r\n public premulAlpha = false;\r\n /**\r\n * Gets or sets a boolean indicating that the canvas must be reverted on Y when updating the texture\r\n */\r\n public applyYInversionOnUpdate = true;\r\n /**\r\n * Gets or sets a number used to scale rendering size (2 means that the texture will be twice bigger).\r\n * Useful when you want more antialiasing\r\n */\r\n public get renderScale(): number {\r\n return this._renderScale;\r\n }\r\n public set renderScale(value: number) {\r\n if (value === this._renderScale) {\r\n return;\r\n }\r\n this._renderScale = value;\r\n this._onResize();\r\n }\r\n /** Gets or sets the background color */\r\n public get background(): string {\r\n return this._background;\r\n }\r\n public set background(value: string) {\r\n if (this._background === value) {\r\n return;\r\n }\r\n this._background = value;\r\n this.markAsDirty();\r\n }\r\n /**\r\n * Gets or sets the ideal width used to design controls.\r\n * The GUI will then rescale everything accordingly\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/gui/gui#adaptive-scaling\r\n */\r\n public get idealWidth(): number {\r\n return this._idealWidth;\r\n }\r\n public set idealWidth(value: number) {\r\n if (this._idealWidth === value) {\r\n return;\r\n }\r\n this._idealWidth = value;\r\n this.markAsDirty();\r\n this._rootContainer._markAllAsDirty();\r\n }\r\n /**\r\n * Gets or sets the ideal height used to design controls.\r\n * The GUI will then rescale everything accordingly\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/gui/gui#adaptive-scaling\r\n */\r\n public get idealHeight(): number {\r\n return this._idealHeight;\r\n }\r\n public set idealHeight(value: number) {\r\n if (this._idealHeight === value) {\r\n return;\r\n }\r\n this._idealHeight = value;\r\n this.markAsDirty();\r\n this._rootContainer._markAllAsDirty();\r\n }\r\n /**\r\n * Gets or sets a boolean indicating if the smallest ideal value must be used if idealWidth and idealHeight are both set\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/gui/gui#adaptive-scaling\r\n */\r\n public get useSmallestIdeal(): boolean {\r\n return this._useSmallestIdeal;\r\n }\r\n public set useSmallestIdeal(value: boolean) {\r\n if (this._useSmallestIdeal === value) {\r\n return;\r\n }\r\n this._useSmallestIdeal = value;\r\n this.markAsDirty();\r\n this._rootContainer._markAllAsDirty();\r\n }\r\n /**\r\n * Gets or sets a boolean indicating if adaptive scaling must be used\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/gui/gui#adaptive-scaling\r\n */\r\n public get renderAtIdealSize(): boolean {\r\n return this._renderAtIdealSize;\r\n }\r\n public set renderAtIdealSize(value: boolean) {\r\n if (this._renderAtIdealSize === value) {\r\n return;\r\n }\r\n this._renderAtIdealSize = value;\r\n this._onResize();\r\n }\r\n\r\n /**\r\n * Gets the ratio used when in \"ideal mode\"\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/gui/gui#adaptive-scaling\r\n * */\r\n public get idealRatio(): number {\r\n let rwidth: number = 0;\r\n let rheight: number = 0;\r\n\r\n if (this._idealWidth) {\r\n rwidth = this.getSize().width / this._idealWidth;\r\n }\r\n\r\n if (this._idealHeight) {\r\n rheight = this.getSize().height / this._idealHeight;\r\n }\r\n\r\n if (this._useSmallestIdeal && this._idealWidth && this._idealHeight) {\r\n return window.innerWidth < window.innerHeight ? rwidth : rheight;\r\n }\r\n\r\n if (this._idealWidth) {\r\n // horizontal\r\n return rwidth;\r\n }\r\n\r\n if (this._idealHeight) {\r\n // vertical\r\n return rheight;\r\n }\r\n\r\n return 1;\r\n }\r\n\r\n /**\r\n * Gets the underlying layer used to render the texture when in fullscreen mode\r\n */\r\n public get layer(): Nullable<Layer> {\r\n return this._layerToDispose;\r\n }\r\n /**\r\n * Gets the root container control\r\n */\r\n public get rootContainer(): Container {\r\n return this._rootContainer;\r\n }\r\n /**\r\n * Returns an array containing the root container.\r\n * This is mostly used to let the Inspector introspects the ADT\r\n * @returns an array containing the rootContainer\r\n */\r\n public getChildren(): Array<Container> {\r\n return [this._rootContainer];\r\n }\r\n /**\r\n * Will return all controls that are inside this texture\r\n * @param directDescendantsOnly defines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered\r\n * @param predicate defines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored\r\n * @returns all child controls\r\n */\r\n public getDescendants(directDescendantsOnly?: boolean, predicate?: (control: Control) => boolean): Control[] {\r\n return this._rootContainer.getDescendants(directDescendantsOnly, predicate);\r\n }\r\n\r\n /**\r\n * Will return all controls with the given type name\r\n * @param typeName defines the type name to search for\r\n * @returns an array of all controls found\r\n */\r\n public getControlsByType(typeName: string): Control[] {\r\n return this._rootContainer.getDescendants(false, (control) => control.typeName === typeName);\r\n }\r\n\r\n /**\r\n * Will return the first control with the given name\r\n * @param name defines the name to search for\r\n * @returns the first control found or null\r\n */\r\n public getControlByName(name: string): Nullable<Control> {\r\n return this._getControlByKey(\"name\", name);\r\n }\r\n\r\n private _getControlByKey(key: string, value: any): Nullable<Control> {\r\n return this._rootContainer.getDescendants().find((control) => control[key as keyof Control] === value) || null;\r\n }\r\n\r\n /**\r\n * Gets or sets the current focused control\r\n */\r\n public get focusedControl(): Nullable<IFocusableControl> {\r\n return this._focusedControl;\r\n }\r\n public set focusedControl(control: Nullable<IFocusableControl>) {\r\n if (this._focusedControl == control) {\r\n return;\r\n }\r\n if (this._focusedControl) {\r\n this._focusedControl.onBlur();\r\n }\r\n if (control) {\r\n control.onFocus();\r\n }\r\n this._focusedControl = control;\r\n }\r\n /**\r\n * Gets or sets a boolean indicating if the texture must be rendered in background or foreground when in fullscreen mode\r\n */\r\n public get isForeground(): boolean {\r\n if (!this.layer) {\r\n return true;\r\n }\r\n return !this.layer.isBackground;\r\n }\r\n public set isForeground(value: boolean) {\r\n if (!this.layer) {\r\n return;\r\n }\r\n if (this.layer.isBackground === !value) {\r\n return;\r\n }\r\n this.layer.isBackground = !value;\r\n }\r\n /**\r\n * Gets or set information about clipboardData\r\n */\r\n public get clipboardData(): string {\r\n return this._clipboardData;\r\n }\r\n public set clipboardData(value: string) {\r\n this._clipboardData = value;\r\n }\r\n\r\n /**\r\n * If this is set, even when a control is pointer blocker, some events can still be passed through to the scene.\r\n * Options from values are PointerEventTypes\r\n * POINTERDOWN, POINTERUP, POINTERMOVE, POINTERWHEEL, POINTERPICK, POINTERTAP, POINTERDOUBLETAP\r\n */\r\n public skipBlockEvents = 0;\r\n\r\n /**\r\n * If set to true, every scene render will trigger a pointer event for the GUI\r\n * if it is linked to a mesh or has controls linked to a mesh. This will allow\r\n * you to catch the pointer moving around the GUI due to camera or mesh movements,\r\n * but it has a performance cost.\r\n */\r\n public checkPointerEveryFrame = false;\r\n /**\r\n * Creates a new AdvancedDynamicTexture\r\n * @param name defines the name of the texture\r\n * @param width defines the width of the texture\r\n * @param height defines the height of the texture\r\n * @param scene defines the hosting scene\r\n * @param generateMipMaps defines a boolean indicating if mipmaps must be generated (false by default)\r\n * @param samplingMode defines the texture sampling mode (Texture.NEAREST_SAMPLINGMODE by default)\r\n * @param invertY defines if the texture needs to be inverted on the y axis during loading (true by default)\r\n */\r\n constructor(name: string, width = 0, height = 0, scene?: Nullable<Scene>, generateMipMaps = false, samplingMode = Texture.NEAREST_SAMPLINGMODE, invertY = true) {\r\n super(name, { width: width, height: height }, scene, generateMipMaps, samplingMode, Constants.TEXTUREFORMAT_RGBA, invertY);\r\n scene = this.getScene();\r\n if (!scene || !this._texture) {\r\n return;\r\n }\r\n this.applyYInversionOnUpdate = invertY;\r\n this._rootElement = scene.getEngine().getInputElement();\r\n this._renderObserver = scene.onBeforeCameraRenderObservable.add((camera: Camera) => this._checkUpdate(camera));\r\n\r\n /** Whenever a control is added or removed to the root, we have to recheck the camera projection as it can have changed */\r\n this._controlAddedObserver = this._rootContainer.onControlAddedObservable.add((control) => {\r\n if (control) {\r\n this._rootChildrenHaveChanged = true;\r\n }\r\n });\r\n this._controlRemovedObserver = this._rootContainer.onControlRemovedObservable.add((control) => {\r\n if (control) {\r\n this._rootChildrenHaveChanged = true;\r\n }\r\n });\r\n this._preKeyboardObserver = scene.onPreKeyboardObservable.add((info) => {\r\n if (!this._focusedControl) {\r\n return;\r\n }\r\n if (info.type === KeyboardEventTypes.KEYDOWN) {\r\n this._focusedControl.processKeyboard(info.event);\r\n }\r\n info.skipOnPointerObservable = true;\r\n });\r\n this._rootContainer._link(this);\r\n this.hasAlpha = true;\r\n if (!width || !height) {\r\n this._resizeObserver = scene.getEngine().onResizeObservable.add(() => this._onResize());\r\n this._onResize();\r\n }\r\n this._texture.isReady = true;\r\n }\r\n /**\r\n * Get the current class name of the texture useful for serialization or dynamic coding.\r\n * @returns \"AdvancedDynamicTexture\"\r\n */\r\n public getClassName(): string {\r\n return \"AdvancedDynamicTexture\";\r\n }\r\n /**\r\n * Function used to execute a function on all controls\r\n * @param func defines the function to execute\r\n * @param container defines the container where controls belong. If null the root container will be used\r\n */\r\n public executeOnAllControls(func: (control: Control) => void, container?: Container) {\r\n if (!container) {\r\n container = this._rootContainer;\r\n }\r\n func(container);\r\n for (const child of container.children) {\r\n if ((<any>child).children) {\r\n this.executeOnAllControls(func, <Container>child);\r\n continue;\r\n }\r\n func(child);\r\n }\r\n }\r\n\r\n private _useInvalidateRectOptimization = true;\r\n\r\n /**\r\n * Gets or sets a boolean indicating if the InvalidateRect optimization should be turned on\r\n */\r\n public get useInvalidateRectOptimization(): boolean {\r\n return this._useInvalidateRectOptimization;\r\n }\r\n\r\n public set useInvalidateRectOptimization(value: boolean) {\r\n this._useInvalidateRectOptimization = value;\r\n }\r\n\r\n // Invalidated rectangle which is the combination of all invalidated controls after they have been rotated into absolute position\r\n private _invalidatedRectangle: Nullable<Measure> = null;\r\n /**\r\n * Invalidates a rectangle area on the gui texture\r\n * @param invalidMinX left most position of the rectangle to invalidate in the texture\r\n * @param invalidMinY top most position of the rectangle to invalidate in the texture\r\n * @param invalidMaxX right most position of the rectangle to invalidate in the texture\r\n * @param invalidMaxY bottom most position of the rectangle to invalidate in the texture\r\n */\r\n public invalidateRect(invalidMinX: number, invalidMinY: number, invalidMaxX: number, invalidMaxY: number) {\r\n if (!this._useInvalidateRectOptimization) {\r\n return;\r\n }\r\n if (!this._invalidatedRectangle) {\r\n this._invalidatedRectangle = new Measure(invalidMinX, invalidMinY, invalidMaxX - invalidMinX + 1, invalidMaxY - invalidMinY + 1);\r\n } else {\r\n // Compute intersection\r\n const maxX = Math.ceil(Math.max(this._invalidatedRectangle.left + this._invalidatedRectangle.width - 1, invalidMaxX));\r\n const maxY = Math.ceil(Math.max(this._invalidatedRectangle.top + this._invalidatedRectangle.height - 1, invalidMaxY));\r\n this._invalidatedRectangle.left = Math.floor(Math.min(this._invalidatedRectangle.left, invalidMinX));\r\n this._invalidatedRectangle.top = Math.floor(Math.min(this._invalidatedRectangle.top, invalidMinY));\r\n this._invalidatedRectangle.width = maxX - this._invalidatedRectangle.left + 1;\r\n this._invalidatedRectangle.height = maxY - this._invalidatedRectangle.top + 1;\r\n }\r\n }\r\n /**\r\n * Marks the texture as dirty forcing a complete update\r\n */\r\n public markAsDirty() {\r\n this._isDirty = true;\r\n }\r\n /**\r\n * Helper function used to create a new style\r\n * @returns a new style\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/gui/gui#styles\r\n */\r\n public createStyle(): Style {\r\n return new Style(this);\r\n }\r\n /**\r\n * Adds a new control to the root container\r\n * @param control defines the control to add\r\n * @returns the current texture\r\n */\r\n public addControl(control: Control): AdvancedDynamicTexture {\r\n this._rootContainer.addControl(control);\r\n return this;\r\n }\r\n /**\r\n * Removes a control from the root container\r\n * @param control defines the control to remove\r\n * @returns the current texture\r\n */\r\n public removeControl(control: Control): AdvancedDynamicTexture {\r\n this._rootContainer.removeControl(control);\r\n return this;\r\n }\r\n /**\r\n * Moves overlapped controls towards a position where it is not overlapping anymore.\r\n * Please note that this method alters linkOffsetXInPixels and linkOffsetYInPixels.\r\n * @param overlapGroup the overlap group which will be processed or undefined to process all overlap groups\r\n * @param deltaStep the step size (speed) to reach the target non overlapping position (default 0.1)\r\n * @param repelFactor how much is the control repelled by other controls\r\n */\r\n public moveToNonOverlappedPosition(overlapGroup?: number | Control[], deltaStep = 1, repelFactor = 1) {\r\n let controlsForGroup: Control[];\r\n if (Array.isArray(overlapGroup)) {\r\n controlsForGroup = overlapGroup;\r\n } else {\r\n const descendants = this.getDescendants(true);\r\n // get only the controls with an overlapGroup property set\r\n // if the overlapGroup parameter is set, filter the controls and get only the controls belonging to that overlapGroup\r\n controlsForGroup = overlapGroup === undefined ? descendants.filter((c) => c.overlapGroup !== undefined) : descendants.filter((c) => c.overlapGroup === overlapGroup);\r\n }\r\n\r\n controlsForGroup.forEach((control1) => {\r\n let velocity = Vector2.Zero();\r\n const center = new Vector2(control1.centerX, control1.centerY);\r\n\r\n controlsForGroup.forEach((control2) => {\r\n if (control1 !== control2 && AdvancedDynamicTexture._Overlaps(control1, control2)) {\r\n // if the two controls overlaps get a direction vector from one control's center to another control's center\r\n const diff = center.subtract(new Vector2(control2.centerX, control2.centerY));\r\n const diffLength = diff.length();\r\n\r\n if (diffLength > 0) {\r\n // calculate the velocity\r\n velocity = velocity.add(diff.normalize().scale(repelFactor / diffLength));\r\n }\r\n }\r\n });\r\n\r\n if (velocity.length() > 0) {\r\n // move the control along the direction vector away from the overlapping control\r\n velocity = velocity.normalize().scale(deltaStep * (control1.overlapDeltaMultiplier ?? 1));\r\n control1.linkOffsetXInPixels += velocity.x;\r\n control1.linkOffsetYInPixels += velocity.y;\r\n }\r\n });\r\n }\r\n /**\r\n * Release all resources\r\n */\r\n public dispose(): void {\r\n const scene = this.getScene();\r\n if (!scene) {\r\n return;\r\n }\r\n this._rootElement = null;\r\n scene.onBeforeCameraRenderObservable.remove(this._renderObserver);\r\n if (this._resizeObserver) {\r\n scene.getEngine().onResizeObservable.remove(this._resizeObserver);\r\n }\r\n if (this._prePointerObserver) {\r\n scene.onPrePointerObservable.remove(this._prePointerObserver);\r\n }\r\n if (this._sceneRenderObserver) {\r\n scene.onBeforeRenderObservable.remove(this._sceneRenderObserver);\r\n }\r\n if (this._pointerObserver) {\r\n scene.onPointerObservable.remove(this._pointerObserver);\r\n }\r\n if (this._preKeyboardObserver) {\r\n scene.onPreKeyboardObservable.remove(this._preKeyboardObserver);\r\n }\r\n if (this._canvasPointerOutObserver) {\r\n scene.getEngine().onCanvasPointerOutObservable.remove(this._canvasPointerOutObserver);\r\n }\r\n if (this._canvasBlurObserver) {\r\n scene.getEngine().onCanvasBlurObservable.remove(this._canvasBlurObserver);\r\n }\r\n if (this._controlAddedObserver) {\r\n this._rootContainer.onControlAddedObservable.remove(this._controlAddedObserver);\r\n }\r\n if (this._controlRemovedObserver) {\r\n this._rootContainer.onControlRemovedObservable.remove(this._controlRemovedObserver);\r\n }\r\n if (this._layerToDispose) {\r\n this._layerToDispose.texture = null;\r\n this._layerToDispose.dispose();\r\n this._layerToDispose = null;\r\n }\r\n this._rootContainer.dispose();\r\n this.onClipboardObservable.clear();\r\n this.onControlPickedObservable.clear();\r\n this.onBeginRenderObservable.clear();\r\n this.onEndRenderObservable.clear();\r\n this.onBeginLayoutObservable.clear();\r\n this.onEndLayoutObservable.clear();\r\n this.onGuiReadyObservable.clear();\r\n super.dispose();\r\n }\r\n private _onResize(): void {\r\n const scene = this.getScene();\r\n if (!scene) {\r\n return;\r\n }\r\n // Check size\r\n const engine = scene.getEngine();\r\n const textureSize = this.getSize();\r\n let renderWidth = engine.getRenderWidth() * this._renderScale;\r\n let renderHeight = engine.getRenderHeight() * this._renderScale;\r\n\r\n if (this._renderAtIdealSize) {\r\n if (this._idealWidth) {\r\n renderHeight = (renderHeight * this._idealWidth) / renderWidth;\r\n renderWidth = this._idealWidth;\r\n } else if (this._idealHeight) {\r\n renderWidth = (renderWidth * this._idealHeight) / renderHeight;\r\n renderHeight = this._idealHeight;\r\n }\r\n }\r\n if (textureSize.width !== renderWidth || textureSize.height !== renderHeight) {\r\n this.scaleTo(renderWidth, renderHeight);\r\n this.markAsDirty();\r\n if (this._idealWidth || this._idealHeight) {\r\n this._rootContainer._markAllAsDirty();\r\n }\r\n }\r\n this.invalidateRect(0, 0, textureSize.width - 1, textureSize.height - 1);\r\n }\r\n /** @internal */\r\n public _getGlobalViewport(): Viewport {\r\n const size = this.getSize();\r\n const globalViewPort = this._fullscreenViewport.toGlobal(size.width, size.height);\r\n\r\n const targetX = Math.round(globalViewPort.width * (1 / this.rootContainer.scaleX));\r\n const targetY = Math.round(globalViewPort.height * (1 / this.rootContainer.scaleY));\r\n\r\n globalViewPort.x += (globalViewPort.width - targetX) / 2;\r\n globalViewPort.y += (globalViewPort.height - targetY) / 2;\r\n\r\n globalViewPort.width = targetX;\r\n globalViewPort.height = targetY;\r\n\r\n return globalViewPort;\r\n }\r\n /**\r\n * Get screen coordinates for a vector3\r\n * @param position defines the position to project\r\n * @param worldMatrix defines the world matrix to use\r\n * @returns the projected position\r\n */\r\n public getProjectedPosition(position: Vector3, worldMatrix: Matrix): Vector2 {\r\n const result = this.getProjectedPositionWithZ(position, worldMatrix);\r\n return new Vector2(result.x, result.y);\r\n }\r\n\r\n /**\r\n * Get screen coordinates for a vector3\r\n * @param position defines the position to project\r\n * @param worldMatrix defines the world matrix to use\r\n * @returns the projected position with Z\r\n */\r\n public getProjectedPositionWithZ(position: Vector3, worldMatrix: Matrix): Vector3 {\r\n const scene = this.getScene();\r\n if (!scene) {\r\n return Vector3.Zero();\r\n }\r\n const globalViewport = this._getGlobalViewport();\r\n const projectedPosition = Vector3.Project(position, worldMatrix, scene.getTransformMatrix(), globalViewport);\r\n return new Vector3(projectedPosition.x, projectedPosition.y, projectedPosition.z);\r\n }\r\n\r\n private _checkUpdate(camera: Camera, skipUpdate?: boolean): void {\r\n if (this._layerToDispose) {\r\n if ((camera.layerMask & this._layerToDispose.layerMask) === 0) {\r\n return;\r\n }\r\n }\r\n if (this._isFullscreen && this._linkedControls.length) {\r\n const scene = this.getScene();\r\n if (!scene) {\r\n return;\r\n }\r\n const globalViewport = this._getGlobalViewport();\r\n for (const control of this._linkedControls) {\r\n if (!control.isVisible) {\r\n continue;\r\n }\r\n const mesh = control._linkedMesh as AbstractMesh;\r\n if (!mesh || mesh.isDisposed()) {\r\n Tools.SetImmediate(() => {\r\n control.linkWithMesh(null);\r\n });\r\n continue;\r\n }\r\n const position = mesh.getBoundingInfo ? mesh.getBoundingInfo().boundingSphere.center : (Vector3.ZeroReadOnly as Vector3);\r\n const projectedPosition = Vector3.Project(position, mesh.getWorldMatrix(), scene.getTransformMatrix(), globalViewport);\r\n if (projectedPosition.z < 0 || projectedPosition.z > 1) {\r\n control.notRenderable = true;\r\n continue;\r\n }\r\n control.notRenderable = false;\r\n if (this.useInvalidateRectOptimization) {\r\n control.invalidateRect();\r\n }\r\n\r\n control._moveToProjectedPosition(projectedPosition);\r\n }\r\n }\r\n if (!this._isDirty && !this._rootContainer.isDirty) {\r\n return;\r\n }\r\n this._isDirty = false;\r\n this._render(skipUpdate);\r\n if (!skipUpdate) {\r\n this.update(this.applyYInversionOnUpdate, this.premulAlpha, AdvancedDynamicTexture.AllowGPUOptimizations);\r\n }\r\n }\r\n\r\n private _clearMeasure = new Measure(0, 0, 0, 0);\r\n\r\n private _render(skipRender?: boolean): void {\r\n const textureSize = this.getSize();\r\n const renderWidth = textureSize.width;\r\n const renderHeight = textureSize.height;\r\n\r\n const context = this.getContext();\r\n context.font = \"18px Arial\";\r\n context.strokeStyle = \"white\";\r\n\r\n if (this.onGuiReadyObservable.hasObservers()) {\r\n this._checkGuiIsReady();\r\n }\r\n\r\n /** We have to recheck the camera projection in the case the root control's children have changed */\r\n if (this._rootChildrenHaveChanged) {\r\n const camera = this.getScene()?.activeCamera;\r\n if (camera) {\r\n this._rootChildrenHaveChanged = false;\r\n this._checkUpdate(camera, true);\r\n }\r\n }\r\n\r\n // Layout\r\n this.onBeginLayoutObservable.notifyObservers(this);\r\n const measure = new Measure(0, 0, renderWidth, renderHeight);\r\n this._numLayoutCalls = 0;\r\n this._rootContainer._layout(measure, context);\r\n this.onEndLayoutObservable.notifyObservers(this);\r\n this._isDirty = false; // Restoring the dirty state that could have been set by controls during layout processing\r\n\r\n if (skipRender) {\r\n return;\r\n }\r\n\r\n // Clear\r\n if (this._invalidatedRectangle) {\r\n this._clearMeasure.copyFrom(this._invalidatedRectangle);\r\n } else {\r\n this._clearMeasure.copyFromFloats(0, 0, renderWidth, renderHeight);\r\n }\r\n context.clearRect(this._clearMeasure.left, this._clearMeasure.top, this._clearMeasure.width, this._clearMeasure.height);\r\n if (this._background) {\r\n context.save();\r\n context.fillStyle = this._background;\r\n context.fillRect(this._clearMeasure.left, this._clearMeasure.top, this._clearMeasure.width, this._clearMeasure.height);\r\n context.restore();\r\n }\r\n\r\n // Render\r\n this.onBeginRenderObservable.notifyObservers(this);\r\n this._numRenderCalls = 0;\r\n this._rootContainer._render(context, this._invalidatedRectangle);\r\n this.onEndRenderObservable.notifyObservers(this);\r\n this._invalidatedRectangle = null;\r\n }\r\n /**\r\n * @internal\r\n */\r\n public _changeCursor(cursor: string) {\r\n if (this._rootElement) {\r\n this._rootElement.style.cursor = cursor;\r\n this._cursorChanged = true;\r\n }\r\n }\r\n /**\r\n * @internal\r\n */\r\n public _registerLastControlDown(control: Control, pointerId: number) {\r\n this._lastControlDown[pointerId] = control;\r\n this.onControlPickedObservable.notifyObservers(control);\r\n }\r\n private _doPicking(x: number, y: number, pi: Nullable<PointerInfoBase>, type: number, pointerId: number, buttonIndex: number, deltaX?: number, deltaY?: number): void {\r\n const scene = this.getScene();\r\n if (!scene) {\r\n return;\r\n }\r\n const engine = scene.getEngine();\r\n const textureSize = this.getSize();\r\n if (this._isFullscreen) {\r\n const camera = scene.cameraToUseForPointers || scene.activeCamera;\r\n if (!camera) {\r\n return;\r\n }\r\n const viewport = camera.viewport;\r\n x = x * (textureSize.width / (engine.getRenderWidth() * viewport.width));\r\n y = y * (textureSize.height / (engine.getRenderHeight() * viewport.height));\r\n }\r\n if (this._capturingControl[pointerId]) {\r\n if (this._capturingControl[pointerId].isPointerBlocker) {\r\n this._shouldBlockPointer = true;\r\n }\r\n this._capturingControl[pointerId]._processObservables(type, x, y, pi, pointerId, buttonIndex);\r\n return;\r\n }\r\n\r\n this._cursorChanged = false;\r\n if (!this._rootContainer._processPicking(x, y, pi, type, pointerId, buttonIndex, deltaX, deltaY)) {\r\n if (!scene.doNotHandleCursors) {\r\n this._changeCursor(\"\");\r\n }\r\n if (type === PointerEventTypes.POINTERMOVE) {\r\n if (this._lastControlOver[pointerId]) {\r\n this._lastControlOver[pointerId]._onPointerOut(this._lastControlOver[pointerId], pi);\r\n delete this._lastControlOver[pointerId];\r\n }\r\n }\r\n }\r\n\r\n if (!this._cursorChanged && !scene.doNotHandleCursors) {\r\n this._changeCursor(\"\");\r\n }\r\n this._manageFocus();\r\n }\r\n /**\r\n * @internal\r\n */\r\n public _cleanControlAfterRemovalFromList(list: { [pointerId: number]: Control }, control: Control) {\r\n for (const pointerId in list) {\r\n if (!Object.prototype.hasOwnProperty.call(list, pointerId)) {\r\n continue;\r\n }\r\n const lastControlOver = list[pointerId];\r\n if (lastControlOver === control) {\r\n delete list[pointerId];\r\n }\r\n }\r\n }\r\n /**\r\n * @internal\r\n */\r\n public _cleanControlAfterRemoval(control: Control) {\r\n this._cleanControlAfterRemovalFromList(this._lastControlDown, control);\r\n this._cleanControlAfterRemovalFromList(this._lastControlOver, control);\r\n }\r\n\r\n /**\r\n * This function will run a pointer event on this ADT and will trigger any pointer events on any controls\r\n * This will work on a fullscreen ADT only. For mesh based ADT, simulate pointer events using the scene directly.\r\n * @param x pointer X on the canvas for the picking\r\n * @param y pointer Y on the canvas for the picking\r\n * @param pi optional pointer information\r\n */\r\n public pick(x: number, y: number, pi: Nullable<PointerInfoPre> = null) {\r\n if (this._isFullscreen && this._scene) {\r\n this._translateToPicking(this._scene, new Viewport(0, 0, 0, 0), pi, x, y);\r\n }\r\n }\r\n\r\n private _translateToPicking(scene: Scene, tempViewport: Viewport, pi: Nullable<PointerInfoPre>, x: number = scene.pointerX, y: number = scene.pointerY) {\r\n const camera = scene.cameraToUseForPointers || scene.activeCamera;\r\n const engine = scene.getEngine();\r\n const originalCameraToUseForPointers = scene.cameraToUseForPointers;\r\n\r\n if (!camera) {\r\n tempViewport.x = 0;\r\n tempViewport.y = 0;\r\n tempViewport.width = engine.getRenderWidth();\r\n tempViewport.height = engine.getRenderHeight();\r\n } else {\r\n if (camera.rigCameras.length) {\r\n // rig camera - we need to find the camera to use for this event\r\n const rigViewport = new Viewport(0, 0, 1, 1);\r\n camera.rigCameras.forEach((rigCamera) => {\r\n // generate the viewport of this camera\r\n rigCamera.viewport.toGlobalToRef(engine.getRenderWidth(), engine.getRenderHeight(), rigViewport);\r\n const transformedX = x / engine.getHardwareScalingLevel() - rigViewport.x;\r\n const transformedY = y / engine.getHardwareScalingLevel() - (engine.getRenderHeight() - rigViewport.y - rigViewport.height);\r\n // check if the pointer is in the camera's viewport\r\n if (transformedX < 0 || transformedY < 0 || x > rigViewport.width || y > rigViewport.height) {\r\n // out of viewport - don't use this camera\r\n return;\r\n }\r\n // set the camera to use for pointers until this pointer loop is over\r\n scene.cameraToUseForPointers = rigCamera;\r\n // set the viewport\r\n tempViewport.x = rigViewport.x;\r\n tempViewport.y = rigViewport.y;\r\n tempViewport.width = rigViewport.width;\r\n tempViewport.height = rigViewport.height;\r\n });\r\n } else {\r\n camera.viewport.toGlobalToRef(engine.getRenderWidth(), engine.getRenderHeight(), tempViewport);\r\n }\r\n }\r\n\r\n const transformedX = x / engine.getHardwareScalingLevel() - tempViewport.x;\r\n const transformedY = y / engine.getHardwareScalingLevel() - (engine.getRenderHeight() - tempViewport.y - tempViewport.height);\r\n this._shouldBlockPointer = false;\r\n // Do picking modifies _shouldBlockPointer\r\n if (pi) {\r\n const pointerId = (pi.event as IPointerEvent).pointerId || this._defaultMousePointerId;\r\n this._doPicking(transformedX, transformedY, pi, pi.type, pointerId, pi.event.button, (<IWheelEvent>pi.event).deltaX, (<IWheelEvent>pi.event).deltaY);\r\n // Avoid overwriting a true skipOnPointerObservable to false\r\n if ((this._shouldBlockPointer && !(pi.type & this.skipBlockEvents)) || this._capturingControl[pointerId]) {\r\n pi.skipOnPointerObservable = true;\r\n }\r\n } else {\r\n this._doPicking(transformedX, transformedY, null, PointerEventTypes.POINTERMOVE, this._defaultMousePointerId, 0);\r\n }\r\n // if overridden by a rig camera - reset back to the original value\r\n scene.cameraToUseForPointers = originalCameraToUseForPointers;\r\n }\r\n\r\n /** Attach to all scene events required to support pointer events */\r\n public attach(): void {\r\n const scene = this.getScene();\r\n if (!scene) {\r\n return;\r\n }\r\n\r\n const tempViewport = new Viewport(0, 0, 0, 0);\r\n\r\n this._prePointerObserver = scene.onPrePointerObservable.add((pi) => {\r\n if (\r\n scene.isPointerCaptured((<IPointerEvent>pi.event).pointerId) &&\r\n pi.type === PointerEventTypes.POINTERUP &&\r\n !this._capturedPointerIds.has((pi.event as IPointerEvent).pointerId)\r\n ) {\r\n return;\r\n }\r\n if (\r\n pi.type !== PointerEventTypes.POINTERMOVE &&\r\n pi.type !== PointerEventTypes.POINTERUP &&\r\n pi.type !== PointerEventTypes.POINTERDOWN &&\r\n pi.type !== PointerEventTypes.POINTERWHEEL\r\n ) {\r\n return;\r\n }\r\n\r\n if (pi.type === PointerEventTypes.POINTERMOVE) {\r\n // Avoid pointerMove events firing while the pointer is captured by the scene\r\n if (scene.isPointerCaptured((<IPointerEvent>pi.event).pointerId)) {\r\n return;\r\n }\r\n if ((pi.event as IPointerEvent).pointerId) {\r\n this._defaultMousePointerId = (pi.event as IPointerEvent).pointerId; // This is required to make sure we have the correct pointer ID for wheel\r\n }\r\n }\r\n this._translateToPicking(scene, tempViewport, pi);\r\n });\r\n this._attachPickingToSceneRender(scene, () => this._translateToPicking(scene, tempViewport, null), false);\r\n this._attachToOnPointerOut(scene);\r\n this._attachToOnBlur(scene);\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n private _onClipboardCopy = (rawEvt: Event) => {\r\n const evt = rawEvt as ClipboardEvent;\r\n const ev = new ClipboardInfo(ClipboardEventTypes.COPY, evt);\r\n this.onClipboardObservable.notifyObservers(ev);\r\n evt.preventDefault();\r\n };\r\n /**\r\n * @internal\r\n */\r\n private _onClipboardCut = (rawEvt: Event) => {\r\n const evt = rawEvt as ClipboardEvent;\r\n const ev = new ClipboardInfo(ClipboardEventTypes.CUT, evt);\r\n this.onClipboardObservable.notifyObservers(ev);\r\n evt.preventDefault();\r\n };\r\n /**\r\n * @internal\r\n */\r\n private _onClipboardPaste = (rawEvt: Event) => {\r\n const evt = rawEvt as ClipboardEvent;\r\n const ev = new ClipboardInfo(ClipboardEventTypes.PASTE, evt);\r\n this.onClipboardObservable.notifyObservers(ev);\r\n evt.preventDefault();\r\n };\r\n /**\r\n * Register the clipboard Events onto the canvas\r\n */\r\n public registerClipboardEvents(): void {\r\n self.addEventListener(\"copy\", this._onClipboardCopy, false);\r\n self.addEventListener(\"cut\", this._onClipboardCut, false);\r\n self.addEventListener(\"paste\", this._onClipboardPaste, false);\r\n }\r\n /**\r\n * Unregister the clipboard Events from the canvas\r\n */\r\n public unRegisterClipboardEvents(): void {\r\n self.removeEventListener(\"copy\", this._onClipboardCopy);\r\n self.removeEventListener(\"cut\", this._onClipboardCut);\r\n self.removeEventListener(\"paste\", this._onClipboardPaste);\r\n }\r\n\r\n /**\r\n * Transform uvs from mesh space to texture space, taking the texture into account\r\n * @param uv the uvs in mesh space\r\n * @returns the uvs in texture space\r\n */\r\n private _transformUvs(uv: Vector2): Vector2 {\r\n const textureMatrix = this.getTextureMatrix();\r\n let result;\r\n if (textureMatrix.isIdentityAs3x2()) {\r\n result = uv;\r\n } else {\r\n const homogeneousTextureMatrix = TmpVectors.Matrix[0];\r\n\r\n textureMatrix.getRowToRef(0, TmpVectors.Vector4[0]);\r\n textureMatrix.getRowToRef(1, TmpVectors.Vector4[1]);\r\n textureMatrix.getRowToRef(2, TmpVectors.Vector4[2]);\r\n\r\n const r0 = TmpVectors.Vector4[0];\r\n const r1 = TmpVectors.Vector4[1];\r\n const r2 = TmpVectors.Vector4[2];\r\n\r\n homogeneousTextureMatrix.setRowFromFloats(0, r0.x, r0.y, 0, 0);\r\n homogeneousTextureMatrix.setRowFromFloats(1, r1.x, r1.y, 0, 0);\r\n homogeneousTextureMatrix.setRowFromFloats(2, 0, 0, 1, 0);\r\n homogeneousTextureMatrix.setRowFromFloats(3, r2.x, r2.y, 0, 1);\r\n\r\n result = TmpVectors.Vector2[0];\r\n Vector2.TransformToRef(uv, homogeneousTextureMatrix, result);\r\n }\r\n\r\n // In wrap and mirror mode, the texture coordinate for coordinates more than 1 is the fractional part of the coordinate\r\n if (this.wrapU === Texture.WRAP_ADDRESSMODE || this.wrapU === Texture.MIRROR_ADDRESSMODE) {\r\n if (result.x > 1) {\r\n let fX = result.x - Math.trunc(result.x);\r\n // In mirror mode, the sign of the texture coordinate depends on the integer part -\r\n // odd integers means it is mirrored from the original coordinate\r\n if (this.wrapU === Texture.MIRROR_ADDRESSMODE && Math.trunc(result.x) % 2 === 1) {\r\n fX = 1 - fX;\r\n }\r\n result.x = fX;\r\n }\r\n }\r\n if (this.wrapV === Texture.WRAP_ADDRESSMODE || this.wrapV === Texture.MIRROR_ADDRESSMODE) {\r\n if (result.y > 1) {\r\n let fY = result.y - Math.trunc(result.y);\r\n if (this.wrapV === Texture.MIRROR_ADDRESSMODE && Math.trunc(result.x) % 2 === 1) {\r\n fY = 1 - fY;\r\n }\r\n result.y = fY;\r\n }\r\n }\r\n return result;\r\n }\r\n /**\r\n * Connect the texture to a hosting mesh to enable interactions\r\n * @param mesh defines the mesh to attach to\r\n * @param supportPointerMove defines a boolean indicating if pointer move events must be catched as well\r\n */\r\n public attachToMesh(mesh: AbstractMesh, supportPointerMove = true): void {\r\n const scene = this.getScene();\r\n if (!scene) {\r\n return;\r\n }\r\n\r\n if (this._pointerObserver) {\r\n scene.onPointerObservable.remove(this._pointerObserver);\r\n }\r\n\r\n this._pointerObserver = scene.onPointerObservable.add((pi) => {\r\n if (\r\n pi.type !== PointerEventTypes.POINTERMOVE &&\r\n pi.type !== PointerEventTypes.POINTERUP &&\r\n pi.type !== PointerEventTypes.POINTERDOWN &&\r\n pi.type !== PointerEventTypes.POINTERWHEEL\r\n ) {\r\n return;\r\n }\r\n\r\n if (pi.type === PointerEventTypes.POINTERMOVE && (pi.event as IPointerEvent).pointerId) {\r\n this._defaultMousePointerId = (pi.event as IPointerEvent).pointerId; // This is required to make sure we have the correct pointer ID for wheel\r\n }\r\n\r\n const pointerId = (pi.event as IPointerEvent).pointerId || this._defaultMousePointerId;\r\n if (pi.pickInfo && pi.pickInfo.hit && pi.pickInfo.pickedMesh === mesh) {\r\n let uv = pi.pickInfo.getTextureCoordinates();\r\n if (uv) {\r\n uv = this._transformUvs(uv);\r\n const size = this.getSize();\r\n this._doPicking(\r\n uv.x * size.width,\r\n (this.applyYInversionOnUpdate ? 1.0 - uv.y : uv.y) * size.height,\r\n pi,\r\n pi.type,\r\n pointerId,\r\n pi.event.button,\r\n (<IWheelEvent>pi.event).deltaX,\r\n (<IWheelEvent>pi.event).deltaY\r\n );\r\n }\r\n } else if (pi.type === PointerEventTypes.POINTERUP) {\r\n if (this._lastControlDown[pointerId]) {\r\n this._lastControlDown[pointerId]._forcePointerUp(pointerId);\r\n }\r\n delete this._lastControlDown[pointerId];\r\n if (this.focusedControl) {\r\n const friendlyControls = this.focusedControl.keepsFocusWith();\r\n let canMoveFocus = true;\r\n if (friendlyControls) {\r\n for (const control of friendlyControls) {\r\n // Same host, no need to keep the focus\r\n if (this === control._host) {\r\n continue;\r\n }\r\n // Different hosts\r\n const otherHost = control._host;\r\n if (otherHost._lastControlOver[pointerId] && otherHost._lastControlOver[pointerId].isAscendant(control)) {\r\n canMoveFocus = false;\r\n break;\r\n }\r\n }\r\n }\r\n if (canMoveFocus) {\r\n this.focusedControl = null;\r\n }\r\n }\r\n } else if (pi.type === PointerEventTypes.POINTERMOVE) {\r\n if (this._lastControlOver[pointerId]) {\r\n this._lastControlOver[pointerId]._onPointerOut(this._lastControlOver[pointerId], pi, true);\r\n }\r\n delete this._lastControlOver[pointerId];\r\n }\r\n });\r\n mesh.enablePointerMoveEvents = supportPointerMove;\r\n this._attachPickingToSceneRender(\r\n scene,\r\n () => {\r\n const pointerId = this._defaultMousePointerId;\r\n const pick = scene?.pick(scene.pointerX, scene.pointerY);\r\n if (pick && pick.hit && pick.pickedMesh === mesh) {\r\n let uv = pick.getTextureCoordinates();\r\n if (uv) {\r\n uv = this._transformUvs(uv);\r\n const size = this.getSize();\r\n this._doPicking(uv.x * size.width, (this.applyYInversionOnUpdate ? 1.0 - uv.y : uv.y) * size.height, null, PointerEventTypes.POINTERMOVE, pointerId, 0);\r\n }\r\n } else {\r\n if (this._lastControlOver[pointerId]) {\r\n this._lastControlOver[pointerId]._onPointerOut(this._lastControlOver[pointerId], null, true);\r\n }\r\n delete this._lastControlOver[pointerId];\r\n }\r\n },\r\n true\r\n );\r\n this._attachToOnPointerOut(scene);\r\n this._attachToOnBlur(scene);\r\n }\r\n /**\r\n * Move the focus to a specific control\r\n * @param control defines the control which will receive the focus\r\n */\r\n public moveFocusToControl(control: IFocusableControl): void {\r\n this.focusedControl = control;\r\n this._lastPickedControl = <any>control;\r\n this._blockNextFocusCheck = true;\r\n }\r\n private _manageFocus(): void {\r\n if (this._blockNextFocusCheck) {\r\n this._blockNextFocusCheck = false;\r\n this._lastPickedControl = <any>this._focusedControl;\r\n return;\r\n }\r\n // Focus management\r\n if (this._focusedControl) {\r\n if (this._focusedControl !== <any>this._lastPickedControl) {\r\n if (this._lastPickedControl.isFocusInvisible) {\r\n return;\r\n }\r\n this.focusedControl = null;\r\n }\r\n }\r\n }\r\n private _attachPickingToSceneRender(scene: Scene, pickFunction: () => void, forcePicking: boolean) {\r\n this._sceneRenderObserver = scene.onBeforeRenderObservable.add(() => {\r\n if (!this.checkPointerEveryFrame) {\r\n return;\r\n }\r\n if (this._linkedControls.length > 0 || forcePicking) {\r\n pickFunction();\r\n }\r\n });\r\n }\r\n private _attachToOnPointerOut(scene: Scene): void {\r\n this._canvasPointerOutObserver = scene.getEngine().onCanvasPointerOutObservable.add((pointerEvent) => {\r\n if (this._lastControlOver[pointerEvent.pointerId]) {\r\n this._lastControlOver[pointerEvent.pointerId]._onPointerOut(this._lastControlOver[pointerEvent.pointerId], null);\r\n }\r\n delete this._lastControlOver[pointerEvent.pointerId];\r\n if (this._lastControlDown[pointerEvent.pointerId] && this._lastControlDown[pointerEvent.pointerId] !== this._capturingControl[pointerEvent.pointerId]) {\r\n this._lastControlDown[pointerEvent.pointerId]._forcePointerUp(pointerEvent.pointerId);\r\n delete this._lastControlDown[pointerEvent.pointerId];\r\n }\r\n });\r\n }\r\n private _attachToOnBlur(scene: Scene): void {\r\n this._canvasBlurObserver = scene.getEngine().onCanvasBlurObservable.add(() => {\r\n Object.entries(this._lastControlDown).forEach(([, value]) => {\r\n value._onCanvasBlur();\r\n });\r\n this.focusedControl = null;\r\n this._lastControlDown = {};\r\n });\r\n }\r\n\r\n /**\r\n * Serializes the entire GUI system\r\n * @returns an object with the JSON serialized data\r\n */\r\n public serializeContent(): any {\r\n const size = this.getSize();\r\n const serializationObject = {\r\n root: {},\r\n width: size.width,\r\n height: size.height,\r\n };\r\n\r\n this._rootContainer.serialize(serializationObject.root);\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Recreate the content of the ADT from a JSON object\r\n * @param serializedObject define the JSON serialized object to restore from\r\n * @param scaleToSize defines whether to scale to texture to the saved size\r\n */\r\n public parseSerializedObject(serializedObject: any, scaleToSize?: boolean) {\r\n this._rootContainer = Control.Parse(serializedObject.root, this) as Container;\r\n if (scaleToSize) {\r\n const width = serializedObject.width;\r\n const height = serializedObject.height;\r\n if (typeof width === \"number\" && typeof height === \"number\" && width >= 0 && height >= 0) {\r\n this.scaleTo(width, height);\r\n } else {\r\n // scales the GUI to a default size if none was available in the serialized content\r\n this.scaleTo(1920, 1080);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Clones the ADT. If no mesh is defined, the GUI will be considered as a fullscreen GUI\r\n * @param newName defines the name of the new ADT\r\n * @param attachToMesh defines if the new ADT should be attached to a mesh\r\n * @returns the clone of the ADT\r\n */\r\n public clone(newName?: string, attachToMesh?: AbstractMesh): AdvancedDynamicTexture {\r\n const scene = this.getScene();\r\n\r\n if (!scene) {\r\n return this;\r\n }\r\n const size = this.getSize();\r\n const data = this.serializeContent();\r\n let clone;\r\n if (!this._isFullscreen) {\r\n if (attachToMesh) {\r\n clone = AdvancedDynamicTexture.CreateForMesh(attachToMesh, size.width, size.height);\r\n } else {\r\n clone = new AdvancedDynamicTexture(newName ?? \"Clone of \" + this.name, size.width, size.height, scene, !this.noMipmap, this.samplingMode);\r\n }\r\n } else {\r\n clone = AdvancedDynamicTexture.CreateFullscreenUI(newName ?? \"Clone of \" + this.name);\r\n }\r\n clone.parseSerializedObject(data);\r\n\r\n return clone;\r\n }\r\n\r\n /**\r\n * Recreate the content of the ADT from a JSON object\r\n * @param serializedObject define the JSON serialized object to restore from\r\n * @param scaleToSize defines whether to scale to texture to the saved size\r\n * @deprecated Please use parseSerializedObject instead\r\n */\r\n public parseContent = this.parseSerializedObject;\r\n\r\n /**\r\n * Recreate the content of the ADT from a snippet saved by the GUI editor\r\n * @param snippetId defines the snippet to load\r\n * @param scaleToSize defines whether to scale to texture to the saved size\r\n * @param appendToAdt if provided the snippet will be appended to the adt. Otherwise a fullscreen ADT will be created.\r\n * @returns a promise that will resolve on success\r\n */\r\n public static async ParseFromSnippetAsync(snippetId: string, scaleToSize?: boolean, appendToAdt?: AdvancedDynamicTexture): Promise<AdvancedDynamicTexture> {\r\n const adt = appendToAdt ?? AdvancedDynamicTexture.CreateFullscreenUI(\"ADT from snippet\");\r\n if (snippetId === \"_BLANK\") {\r\n return adt;\r\n }\r\n\r\n const serialized = await AdvancedDynamicTexture._LoadURLContentAsync(AdvancedDynamicTexture.SnippetUrl + \"/\" + snippetId.replace(/#/g, \"/\"), true);\r\n adt.parseSerializedObject(serialized, scaleToSize);\r\n return adt;\r\n }\r\n\r\n /**\r\n * Recreate the content of the ADT from a snippet saved by the GUI editor\r\n * @param snippetId defines the snippet to load\r\n * @param scaleToSize defines whether to scale to texture to the saved size\r\n * @returns a promise that will resolve on success\r\n */\r\n public parseFromSnippetAsync(snippetId: string, scaleToSize?: boolean): Promise<AdvancedDynamicTexture> {\r\n return AdvancedDynamicTexture.ParseFromSnippetAsync(snippetId, scaleToSize, this);\r\n }\r\n\r\n /**\r\n * Recreate the content of the ADT from a url json\r\n * @param url defines the url to load\r\n * @param scaleToSize defines whether to scale to texture to the saved size\r\n * @param appendToAdt if provided the snippet will be appended to the adt. Otherwise a fullscreen ADT will be created.\r\n * @returns a promise that will resolve on success\r\n */\r\n public static async ParseFromFileAsync(url: string, scaleToSize?: boolean, appendToAdt?: AdvancedDynamicTexture): Promise<AdvancedDynamicTexture> {\r\n const adt = appendToAdt ?? AdvancedDynamicTexture.CreateFullscreenUI(\"ADT from URL\");\r\n const serialized = await AdvancedDynamicTexture._LoadURLContentAsync(url);\r\n adt.parseSerializedObject(serialized, scaleToSize);\r\n return adt;\r\n }\r\n\r\n /**\r\n * Recreate the content of the ADT from a url json\r\n * @param url defines the url to load\r\n * @param scaleToSize defines whether to scale to texture to the saved size\r\n * @returns a promise that will resolve on success\r\n */\r\n public parseFromURLAsync(url: string, scaleToSize?: boolean): Promise<AdvancedDynamicTexture> {\r\n return AdvancedDynamicTexture.ParseFromFileAsync(url, scaleToSize, this);\r\n }\r\n\r\n private static _LoadURLContentAsync(url: string, snippet: boolean = false): Promise<any> {\r\n if (url === \"\") {\r\n return Promise.reject(\"No URL provided\");\r\n }\r\n\r\n return new Promise((resolve, reject) => {\r\n const request = new WebRequest();\r\n request.addEventListener(\"readystatechange\", () => {\r\n if (request.readyState == 4) {\r\n if (request.status == 200) {\r\n let gui;\r\n if (snippet) {\r\n const payload = JSON.parse(JSON.parse(request.responseText).jsonPayload);\r\n gui = payload.encodedGui ? new TextDecoder(\"utf-8\").decode(DecodeBase64ToBinary(payload.encodedGui)) : payload.gui;\r\n } else {\r\n gui = request.responseText;\r\n }\r\n const serializationObject = JSON.parse(gui);\r\n resolve(serializationObject);\r\n } else {\r\n reject(\"Unable to load\");\r\n }\r\n }\r\n });\r\n request.open(\"GET\", url);\r\n request.send();\r\n });\r\n }\r\n\r\n // Statics\r\n /**\r\n * Compares two rectangle based controls for pixel overlap\r\n * @param control1 The first control to compare\r\n * @param control2 The second control to compare\r\n * @returns true if overlaps, otherwise false\r\n */\r\n private static _Overlaps(control1: Control, control2: Control) {\r\n return !(\r\n control1.centerX > control2.centerX + control2.widthInPixels ||\r\n control1.centerX + control1.widthInPixels < control2.centerX ||\r\n control1.centerY + control1.heightInPixels < control2.centerY ||\r\n control1.centerY > control2.centerY + control2.heightInPixels\r\n );\r\n }\r\n\r\n /**\r\n * Creates a new AdvancedDynamicTexture in projected mode (ie. attached to a mesh)\r\n * @param mesh defines the mesh which will receive the texture\r\n * @param width defines the texture width (1024 by default)\r\n * @param height defines the texture height (1024 by default)\r\n * @param supportPointerMove defines a boolean indicating if the texture must capture move events (true by default)\r\n * @param onlyAlphaTesting defines a boolean indicating that alpha blending will not be used (only alpha testing) (false by default)\r\n * @param invertY defines if the texture needs to be inverted on the y axis during loading (true by default)\r\n * @param materialSetupCallback defines a custom way of creating and setting up the material on the mesh\r\n * @returns a new AdvancedDynamicTexture\r\n */\r\n public static CreateForMesh(\r\n mesh: AbstractMesh,\r\n width = 1024,\r\n height = 1024,\r\n supportPointerMove = true,\r\n onlyAlphaTesting = false,\r\n invertY?: boolean,\r\n materialSetupCallback: (mesh: AbstractMesh, uniqueId: string, texture: AdvancedDynamicTexture, onlyAlphaTesting: boolean) => void = this._CreateMaterial\r\n ): AdvancedDynamicTexture {\r\n // use a unique ID in name so serialization will work even if you create two ADTs for a single mesh\r\n const uniqueId = RandomGUID();\r\n const result = new AdvancedDynamicTexture(\r\n `AdvancedDynamicTexture for ${mesh.name} [${uniqueId}]`,\r\n width,\r\n height,\r\n mesh.getScene(),\r\n true,\r\n Texture.TRILINEAR_SAMPLINGMODE,\r\n invertY\r\n );\r\n\r\n materialSetupCallback(mesh, uniqueId, result, onlyAlphaTesting);\r\n\r\n result.attachToMesh(mesh, supportPointerMove);\r\n return result;\r\n }\r\n\r\n private static _CreateMaterial(mesh: AbstractMesh, uniqueId: string, texture: AdvancedDynamicTexture, onlyAlphaTesting: boolean): void {\r\n const internalClassType = GetClass(\"BABYLON.StandardMaterial\");\r\n if (!internalClassType) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"StandardMaterial needs to be imported before as it contains a side-effect required by your code.\";\r\n }\r\n\r\n const material: StandardMaterial = new internalClassType(`AdvancedDynamicTextureMaterial for ${mesh.name} [${uniqueId}]`, mesh.getScene());\r\n material.backFaceCulling = false;\r\n material.diffuseColor = Color3.Black();\r\n material.specularColor = Color3.Black();\r\n if (onlyAlphaTesting) {\r\n material.diffuseTexture = texture;\r\n material.emissiveTexture = texture;\r\n texture.hasAlpha = true;\r\n } else {\r\n material.emissiveTexture = texture;\r\n material.opacityTexture = texture;\r\n }\r\n mesh.material = material;\r\n }\r\n\r\n /**\r\n * Creates a new AdvancedDynamicTexture in projected mode (ie. attached to a mesh) BUT do not create a new material for the mesh. You will be responsible for connecting the texture\r\n * @param mesh defines the mesh which will receive the texture\r\n * @param width defines the texture width (1024 by default)\r\n * @param height defines the texture height (1024 by default)\r\n * @param supportPointerMove defines a boolean indicating if the texture must capture move events (true by default)\r\n * @param invertY defines if the texture needs to be inverted on the y axis during loading (true by default)\r\n * @returns a new AdvancedDynamicTexture\r\n */\r\n public static CreateForMeshTexture(mesh: AbstractMesh, width = 1024, height = 1024, supportPointerMove = true, invertY?: boolean): AdvancedDynamicTexture {\r\n const result = new AdvancedDynamicTexture(mesh.name + \" AdvancedDynamicTexture\", width, height, mesh.getScene(), true, Texture.TRILINEAR_SAMPLINGMODE, invertY);\r\n result.attachToMesh(mesh, supportPointerMove);\r\n return result;\r\n }\r\n /**\r\n * Creates a new AdvancedDynamicTexture in fullscreen mode.\r\n * In this mode the texture will rely on a layer for its rendering.\r\n * This allows it to be treated like any other layer.\r\n * As such, if you have a multi camera setup, you can set the layerMask on the GUI as well.\r\n * LayerMask is set through advancedTexture.layer.layerMask\r\n * @param name defines name for the texture\r\n * @param foreground defines a boolean indicating if the texture must be rendered in foreground (default is true)\r\n * @param scene defines the hosting scene\r\n * @param sampling defines the texture sampling mode (Texture.BILINEAR_SAMPLINGMODE by default)\r\n * @param adaptiveScaling defines whether to automatically scale root to match hardwarescaling (false by default)\r\n * @returns a new AdvancedDynamicTexture\r\n */\r\n public static CreateFullscreenUI(\r\n name: string,\r\n foreground: boolean = true,\r\n scene: Nullable<Scene> = null,\r\n sampling = Texture.BILINEAR_SAMPLINGMODE,\r\n adaptiveScaling: boolean = false\r\n ): AdvancedDynamicTexture {\r\n const result = new AdvancedDynamicTexture(name, 0, 0, scene, false, sampling);\r\n // Display\r\n const resultScene = result.getScene();\r\n const layer = new Layer(name + \"_layer\", null, resultScene, !foreground);\r\n layer.texture = result;\r\n result._layerToDispose = layer;\r\n result._isFullscreen = true;\r\n\r\n if (adaptiveScaling && resultScene) {\r\n const newScale = 1 / resultScene.getEngine().getHardwareScalingLevel();\r\n result._rootContainer.scaleX = newScale;\r\n result._rootContainer.scaleY = newScale;\r\n }\r\n\r\n // Attach\r\n result.attach();\r\n return result;\r\n }\r\n\r\n /**\r\n * Scales the texture\r\n * @param ratio the scale factor to apply to both width and height\r\n */\r\n public scale(ratio: number): void {\r\n super.scale(ratio);\r\n this.markAsDirty();\r\n }\r\n\r\n /**\r\n * Resizes the texture\r\n * @param width the new width\r\n * @param height the new height\r\n */\r\n public scaleTo(width: number, height: number): void {\r\n super.scaleTo(width, height);\r\n this.markAsDirty();\r\n }\r\n\r\n private _checkGuiIsReady() {\r\n if (this.guiIsReady()) {\r\n this.onGuiReadyObservable.notifyObservers(this);\r\n\r\n this.onGuiReadyObservable.clear();\r\n }\r\n }\r\n\r\n /**\r\n * @returns true if all the GUI components are ready to render\r\n */\r\n public guiIsReady(): boolean {\r\n return this._rootContainer.isReady();\r\n }\r\n}\r\n"]}
|
package/2D/controls/control.js
CHANGED
@@ -8,7 +8,8 @@ import { ValueAndUnit } from "../valueAndUnit.js";
|
|
8
8
|
import { Measure } from "../measure.js";
|
9
9
|
import { Matrix2D, Vector2WithInfo } from "../math2D.js";
|
10
10
|
import { GetClass, RegisterClass } from "@babylonjs/core/Misc/typeStore.js";
|
11
|
-
import {
|
11
|
+
import { serialize } from "@babylonjs/core/Misc/decorators.js";
|
12
|
+
import { SerializationHelper } from "@babylonjs/core/Misc/decorators.serialization.js";
|
12
13
|
import { EngineStore } from "@babylonjs/core/Engines/engineStore.js";
|
13
14
|
/**
|
14
15
|
* Root class used for all 2D controls
|