@babylonjs/gui 5.0.0-alpha.61 → 5.0.0-alpha.65

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/2D/advancedDynamicTexture.d.ts +4 -1
  2. package/2D/advancedDynamicTexture.js +49 -5
  3. package/2D/advancedDynamicTexture.js.map +1 -1
  4. package/2D/controls/container.js +2 -2
  5. package/2D/controls/container.js.map +1 -1
  6. package/2D/controls/control.d.ts +23 -0
  7. package/2D/controls/control.js +132 -37
  8. package/2D/controls/control.js.map +1 -1
  9. package/2D/controls/grid.d.ts +5 -3
  10. package/2D/controls/grid.js +48 -21
  11. package/2D/controls/grid.js.map +1 -1
  12. package/2D/controls/sliders/imageBasedSlider.js.map +1 -1
  13. package/2D/controls/stackPanel.d.ts +7 -1
  14. package/2D/controls/stackPanel.js +29 -7
  15. package/2D/controls/stackPanel.js.map +1 -1
  16. package/2D/controls/textBlock.js +4 -4
  17. package/2D/controls/textBlock.js.map +1 -1
  18. package/2D/math2D.d.ts +5 -0
  19. package/2D/math2D.js +12 -0
  20. package/2D/math2D.js.map +1 -1
  21. package/2D/valueAndUnit.d.ts +21 -6
  22. package/2D/valueAndUnit.js +57 -13
  23. package/2D/valueAndUnit.js.map +1 -1
  24. package/3D/controls/button3D.js +8 -1
  25. package/3D/controls/button3D.js.map +1 -1
  26. package/3D/controls/control3D.d.ts +2 -0
  27. package/3D/controls/control3D.js +3 -0
  28. package/3D/controls/control3D.js.map +1 -1
  29. package/3D/controls/holographicButton.js +9 -8
  30. package/3D/controls/holographicButton.js.map +1 -1
  31. package/3D/controls/holographicSlate.js +11 -6
  32. package/3D/controls/holographicSlate.js.map +1 -1
  33. package/3D/controls/nearMenu.js +1 -1
  34. package/3D/controls/nearMenu.js.map +1 -1
  35. package/3D/controls/touchHolographicButton.js +12 -12
  36. package/3D/controls/touchHolographicButton.js.map +1 -1
  37. package/3D/controls/touchHolographicMenu.js +13 -11
  38. package/3D/controls/touchHolographicMenu.js.map +1 -1
  39. package/3D/gui3DManager.d.ts +10 -0
  40. package/3D/gui3DManager.js +43 -0
  41. package/3D/gui3DManager.js.map +1 -1
  42. package/package.json +2 -2
@@ -18,6 +18,8 @@ import { Viewport } from "@babylonjs/core/Maths/math.viewport";
18
18
  export declare class AdvancedDynamicTexture extends DynamicTexture {
19
19
  /** Define the Uurl to load snippets */
20
20
  static SnippetUrl: string;
21
+ /** Indicates if some optimizations can be performed in GUI GPU management (the downside is additional memory/GPU texture memory used) */
22
+ static AllowGPUOptimizations: boolean;
21
23
  /** Snippet ID if the content was created from the snippet server */
22
24
  snippetId: string;
23
25
  private _isDirty;
@@ -392,7 +394,8 @@ export declare class AdvancedDynamicTexture extends DynamicTexture {
392
394
  * @param foreground defines a boolean indicating if the texture must be rendered in foreground (default is true)
393
395
  * @param scene defines the hosting scene
394
396
  * @param sampling defines the texture sampling mode (Texture.BILINEAR_SAMPLINGMODE by default)
397
+ * @param adaptiveScaling defines whether to automatically scale root to match hardwarescaling (false by default)
395
398
  * @returns a new AdvancedDynamicTexture
396
399
  */
397
- static CreateFullscreenUI(name: string, foreground?: boolean, scene?: Nullable<Scene>, sampling?: number): AdvancedDynamicTexture;
400
+ static CreateFullscreenUI(name: string, foreground?: boolean, scene?: Nullable<Scene>, sampling?: number, adaptiveScaling?: boolean): AdvancedDynamicTexture;
398
401
  }
@@ -633,7 +633,14 @@ var AdvancedDynamicTexture = /** @class */ (function (_super) {
633
633
  /** @hidden */
634
634
  AdvancedDynamicTexture.prototype._getGlobalViewport = function () {
635
635
  var size = this.getSize();
636
- return this._fullscreenViewport.toGlobal(size.width, size.height);
636
+ var globalViewPort = this._fullscreenViewport.toGlobal(size.width, size.height);
637
+ var targetX = Math.round(globalViewPort.width * (1 / this.rootContainer.scaleX));
638
+ var targetY = Math.round(globalViewPort.height * (1 / this.rootContainer.scaleY));
639
+ globalViewPort.x += (globalViewPort.width - targetX) / 2;
640
+ globalViewPort.y += (globalViewPort.height - targetY) / 2;
641
+ globalViewPort.width = targetX;
642
+ globalViewPort.height = targetY;
643
+ return globalViewPort;
637
644
  };
638
645
  /**
639
646
  * Get screen coordinates for a vector3
@@ -702,7 +709,7 @@ var AdvancedDynamicTexture = /** @class */ (function (_super) {
702
709
  }
703
710
  this._isDirty = false;
704
711
  this._render();
705
- this.update(this.applyYInversionOnUpdate, this.premulAlpha);
712
+ this.update(this.applyYInversionOnUpdate, this.premulAlpha, AdvancedDynamicTexture.AllowGPUOptimizations);
706
713
  };
707
714
  AdvancedDynamicTexture.prototype._render = function () {
708
715
  var textureSize = this.getSize();
@@ -828,6 +835,7 @@ var AdvancedDynamicTexture = /** @class */ (function (_super) {
828
835
  }
829
836
  var camera = scene.cameraToUseForPointers || scene.activeCamera;
830
837
  var engine = scene.getEngine();
838
+ var originalCameraToUseForPointers = scene.cameraToUseForPointers;
831
839
  if (!camera) {
832
840
  tempViewport.x = 0;
833
841
  tempViewport.y = 0;
@@ -835,7 +843,31 @@ var AdvancedDynamicTexture = /** @class */ (function (_super) {
835
843
  tempViewport.height = engine.getRenderHeight();
836
844
  }
837
845
  else {
838
- camera.viewport.toGlobalToRef(engine.getRenderWidth(), engine.getRenderHeight(), tempViewport);
846
+ if (camera.rigCameras.length) {
847
+ // rig camera - we need to find the camera to use for this event
848
+ var rigViewport_1 = new Viewport(0, 0, 1, 1);
849
+ camera.rigCameras.forEach(function (rigCamera) {
850
+ // generate the viewport of this camera
851
+ rigCamera.viewport.toGlobalToRef(engine.getRenderWidth(), engine.getRenderHeight(), rigViewport_1);
852
+ var x = scene.pointerX / engine.getHardwareScalingLevel() - rigViewport_1.x;
853
+ var y = scene.pointerY / engine.getHardwareScalingLevel() - (engine.getRenderHeight() - rigViewport_1.y - rigViewport_1.height);
854
+ // check if the pointer is in the camera's viewport
855
+ if (x < 0 || y < 0 || x > rigViewport_1.width || y > rigViewport_1.height) {
856
+ // out of viewport - don't use this camera
857
+ return;
858
+ }
859
+ // set the camera to use for pointers until this pointer loop is over
860
+ scene.cameraToUseForPointers = rigCamera;
861
+ // set the viewport
862
+ tempViewport.x = rigViewport_1.x;
863
+ tempViewport.y = rigViewport_1.y;
864
+ tempViewport.width = rigViewport_1.width;
865
+ tempViewport.height = rigViewport_1.height;
866
+ });
867
+ }
868
+ else {
869
+ camera.viewport.toGlobalToRef(engine.getRenderWidth(), engine.getRenderHeight(), tempViewport);
870
+ }
839
871
  }
840
872
  var x = scene.pointerX / engine.getHardwareScalingLevel() - tempViewport.x;
841
873
  var y = scene.pointerY / engine.getHardwareScalingLevel() - (engine.getRenderHeight() - tempViewport.y - tempViewport.height);
@@ -847,6 +879,8 @@ var AdvancedDynamicTexture = /** @class */ (function (_super) {
847
879
  if (_this._shouldBlockPointer) {
848
880
  pi.skipOnPointerObservable = _this._shouldBlockPointer;
849
881
  }
882
+ // if overridden by a rig camera - reset back to the original value
883
+ scene.cameraToUseForPointers = originalCameraToUseForPointers;
850
884
  });
851
885
  this._attachToOnPointerOut(scene);
852
886
  this._attachToOnBlur(scene);
@@ -1148,24 +1182,34 @@ var AdvancedDynamicTexture = /** @class */ (function (_super) {
1148
1182
  * @param foreground defines a boolean indicating if the texture must be rendered in foreground (default is true)
1149
1183
  * @param scene defines the hosting scene
1150
1184
  * @param sampling defines the texture sampling mode (Texture.BILINEAR_SAMPLINGMODE by default)
1185
+ * @param adaptiveScaling defines whether to automatically scale root to match hardwarescaling (false by default)
1151
1186
  * @returns a new AdvancedDynamicTexture
1152
1187
  */
1153
- AdvancedDynamicTexture.CreateFullscreenUI = function (name, foreground, scene, sampling) {
1188
+ AdvancedDynamicTexture.CreateFullscreenUI = function (name, foreground, scene, sampling, adaptiveScaling) {
1154
1189
  if (foreground === void 0) { foreground = true; }
1155
1190
  if (scene === void 0) { scene = null; }
1156
1191
  if (sampling === void 0) { sampling = Texture.BILINEAR_SAMPLINGMODE; }
1192
+ if (adaptiveScaling === void 0) { adaptiveScaling = false; }
1157
1193
  var result = new AdvancedDynamicTexture(name, 0, 0, scene, false, sampling);
1158
1194
  // Display
1159
- var layer = new Layer(name + "_layer", null, scene, !foreground);
1195
+ var resultScene = result.getScene();
1196
+ var layer = new Layer(name + "_layer", null, resultScene, !foreground);
1160
1197
  layer.texture = result;
1161
1198
  result._layerToDispose = layer;
1162
1199
  result._isFullscreen = true;
1200
+ if (adaptiveScaling && resultScene) {
1201
+ var newScale = 1 / resultScene.getEngine().getHardwareScalingLevel();
1202
+ result._rootContainer.scaleX = newScale;
1203
+ result._rootContainer.scaleY = newScale;
1204
+ }
1163
1205
  // Attach
1164
1206
  result.attach();
1165
1207
  return result;
1166
1208
  };
1167
1209
  /** Define the Uurl to load snippets */
1168
1210
  AdvancedDynamicTexture.SnippetUrl = "https://snippet.babylonjs.com";
1211
+ /** Indicates if some optimizations can be performed in GUI GPU management (the downside is additional memory/GPU texture memory used) */
1212
+ AdvancedDynamicTexture.AllowGPUOptimizations = true;
1169
1213
  return AdvancedDynamicTexture;
1170
1214
  }(DynamicTexture));
1171
1215
  export { AdvancedDynamicTexture };
@@ -1 +1 @@
1
- {"version":3,"file":"advancedDynamicTexture.js","sourceRoot":"","sources":["../../../sourceES6/gui/src/2D/advancedDynamicTexture.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,UAAU,EAAY,MAAM,iCAAiC,CAAC;AACvE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAU,MAAM,mCAAmC,CAAC;AAC7E,OAAO,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AACnD,OAAO,EAA+B,iBAAiB,EAAmB,MAAM,sCAAsC,CAAC;AACvH,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAC;AAC5F,OAAO,EAAmB,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAE5F,OAAO,EAAE,gBAAgB,EAAE,MAAM,4CAA4C,CAAC;AAC9E,OAAO,EAAE,OAAO,EAAE,MAAM,4CAA4C,CAAC;AACrE,OAAO,EAAE,cAAc,EA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AI,EAAE,OAAO,CAAC,sBAAsB,EAAE,OAAO,CAAC,CAAC;QAC9J,MAAM,CAAC,YAAY,CAAC,IAAI,EAAE,kBAAkB,CAAC,CAAC;QAC9C,OAAO,MAAM,CAAC;IAClB,CAAC;IACD;;;;;;;;;;;OAWG;IACW,yCAAkB,GAAhC,UAAiC,IAAY,EAAE,UAA0B,EAAE,KAA6B,EAAE,QAAwC;QAAnG,2BAAA,EAAA,iBAA0B;QAAE,sBAAA,EAAA,YAA6B;QAAE,yBAAA,EAAA,WAAW,OAAO,CAAC,qBAAqB;QAC9I,IAAI,MAAM,GAAG,IAAI,sBAAsB,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;QAC5E,UAAU;QACV,IAAI,KAAK,GAAG,IAAI,KAAK,CAAC,IAAI,GAAG,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,UAAU,CAAC,CAAC;QACjE,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC;QACvB,MAAM,CAAC,eAAe,GAAG,KAAK,CAAC;QAC/B,MAAM,CAAC,aAAa,GAAG,IAAI,CAAC;QAC5B,SAAS;QACT,MAAM,CAAC,MAAM,EAAE,CAAC;QAChB,OAAO,MAAM,CAAC;IAClB,CAAC;IA7mCD,uCAAuC;IACzB,iCAAU,GAAG,+BAA+B,CAAC;IA6mC/D,6BAAC;CAAA,AA/mCD,CAA4C,cAAc,GA+mCzD;SA/mCY,sBAAsB","sourcesContent":["import { Nullable } from \"@babylonjs/core/types\";\nimport { Observable, Observer } from \"@babylonjs/core/Misc/observable\";\nimport { Vector2, Vector3, Matrix } from \"@babylonjs/core/Maths/math.vector\";\nimport { Tools } from \"@babylonjs/core/Misc/tools\";\nimport { PointerInfoPre, PointerInfo, PointerEventTypes, PointerInfoBase } from \"@babylonjs/core/Events/pointerEvents\";\nimport { ClipboardEventTypes, ClipboardInfo } from \"@babylonjs/core/Events/clipboardEvents\";\nimport { KeyboardInfoPre, KeyboardEventTypes } from \"@babylonjs/core/Events/keyboardEvents\";\nimport { Camera } from \"@babylonjs/core/Cameras/camera\";\nimport { StandardMaterial } from \"@babylonjs/core/Materials/standardMaterial\";\nimport { Texture } from \"@babylonjs/core/Materials/Textures/texture\";\nimport { DynamicTexture } from \"@babylonjs/core/Materials/Textures/dynamicTexture\";\nimport { AbstractMesh } from \"@babylonjs/core/Meshes/abstractMesh\";\nimport { Layer } from \"@babylonjs/core/Layers/layer\";\nimport { Engine } from \"@babylonjs/core/Engines/engine\";\nimport { Scene } from \"@babylonjs/core/scene\";\n\nimport { Container } from \"./controls/container\";\nimport { Control } from \"./controls/control\";\nimport { IFocusableControl } from \"./controls/focusableControl\";\nimport { Style } from \"./style\";\nimport { Measure } from \"./measure\";\nimport { Constants } from \"@babylonjs/core/Engines/constants\";\nimport { Viewport } from \"@babylonjs/core/Maths/math.viewport\";\nimport { Color3 } from \"@babylonjs/core/Maths/math.color\";\nimport { WebRequest } from \"@babylonjs/core/Misc/webRequest\";\nimport { IPointerEvent, IWheelEvent } from \"@babylonjs/core/Events/deviceInputEvents\";\n\n/**\n * Class used to create texture to support 2D GUI elements\n * @see https://doc.babylonjs.com/how_to/gui\n */\nexport class AdvancedDynamicTexture extends DynamicTexture {\n /** Define the Uurl to load snippets */\n public static SnippetUrl = \"https://snippet.babylonjs.com\";\n\n /** Snippet ID if the content was created from the snippet server */\n public snippetId: string;\n\n private _isDirty = false;\n private _renderObserver: Nullable<Observer<Camera>>;\n private _resizeObserver: Nullable<Observer<Engine>>;\n private _preKeyboardObserver: Nullable<Observer<KeyboardInfoPre>>;\n private _pointerMoveObserver: Nullable<Observer<PointerInfoPre>>;\n private _pointerObserver: Nullable<Observer<PointerInfo>>;\n private _canvasPointerOutObserver: Nullable<Observer<IPointerEvent>>;\n private _canvasBlurObserver: Nullable<Observer<Engine>>;\n private _background: string;\n /** @hidden */\n public _rootContainer = new Container(\"root\");\n /** @hidden */\n public _lastPickedControl: Control;\n /** @hidden */\n public _lastControlOver: { [pointerId: number]: Control } = {};\n /** @hidden */\n public _lastControlDown: { [pointerId: number]: Control } = {};\n /** @hidden */\n public _capturingControl: { [pointerId: number]: Control } = {};\n /** @hidden */\n public _shouldBlockPointer: boolean;\n /** @hidden */\n public _layerToDispose: Nullable<Layer>;\n /** @hidden */\n public _linkedControls = new Array<Control>();\n private _isFullscreen = false;\n private _fullscreenViewport = new Viewport(0, 0, 1, 1);\n private _idealWidth = 0;\n private _idealHeight = 0;\n private _useSmallestIdeal: boolean = false;\n private _renderAtIdealSize = false;\n private _focusedControl: Nullable<IFocusableControl>;\n private _blockNextFocusCheck = false;\n private _renderScale = 1;\n private _rootElement: Nullable<HTMLElement>;\n private _cursorChanged = false;\n private _defaultMousePointerId = 0;\n\n /** @hidden */\n public _numLayoutCalls = 0;\n /** Gets the number of layout calls made the last time the ADT has been rendered */\n public get numLayoutCalls(): number {\n return this._numLayoutCalls;\n }\n\n /** @hidden */\n public _numRenderCalls = 0;\n /** Gets the number of render calls made the last time the ADT has been rendered */\n public get numRenderCalls(): number {\n return this._numRenderCalls;\n }\n\n /**\n * Define type to string to ensure compatibility across browsers\n * Safari doesn't support DataTransfer constructor\n */\n private _clipboardData: string = \"\";\n /**\n * Observable event triggered each time an clipboard event is received from the rendering canvas\n */\n public onClipboardObservable = new Observable<ClipboardInfo>();\n /**\n * Observable event triggered each time a pointer down is intercepted by a control\n */\n public onControlPickedObservable = new Observable<Control>();\n /**\n * Observable event triggered before layout is evaluated\n */\n public onBeginLayoutObservable = new Observable<AdvancedDynamicTexture>();\n /**\n * Observable event triggered after the layout was evaluated\n */\n public onEndLayoutObservable = new Observable<AdvancedDynamicTexture>();\n /**\n * Observable event triggered before the texture is rendered\n */\n public onBeginRenderObservable = new Observable<AdvancedDynamicTexture>();\n /**\n * Observable event triggered after the texture was rendered\n */\n public onEndRenderObservable = new Observable<AdvancedDynamicTexture>();\n /**\n * Gets or sets a boolean defining if alpha is stored as premultiplied\n */\n public premulAlpha = false;\n /**\n * Gets or sets a boolean indicating that the canvas must be reverted on Y when updating the texture\n */\n public applyYInversionOnUpdate = true;\n /**\n * Gets or sets a number used to scale rendering size (2 means that the texture will be twice bigger).\n * Useful when you want more antialiasing\n */\n public get renderScale(): number {\n return this._renderScale;\n }\n public set renderScale(value: number) {\n if (value === this._renderScale) {\n return;\n }\n this._renderScale = value;\n this._onResize();\n }\n /** Gets or sets the background color */\n public get background(): string {\n return this._background;\n }\n public set background(value: string) {\n if (this._background === value) {\n return;\n }\n this._background = value;\n this.markAsDirty();\n }\n /**\n * Gets or sets the ideal width used to design controls.\n * The GUI will then rescale everything accordingly\n * @see https://doc.babylonjs.com/how_to/gui#adaptive-scaling\n */\n public get idealWidth(): number {\n return this._idealWidth;\n }\n public set idealWidth(value: number) {\n if (this._idealWidth === value) {\n return;\n }\n this._idealWidth = value;\n this.markAsDirty();\n this._rootContainer._markAllAsDirty();\n }\n /**\n * Gets or sets the ideal height used to design controls.\n * The GUI will then rescale everything accordingly\n * @see https://doc.babylonjs.com/how_to/gui#adaptive-scaling\n */\n public get idealHeight(): number {\n return this._idealHeight;\n }\n public set idealHeight(value: number) {\n if (this._idealHeight === value) {\n return;\n }\n this._idealHeight = value;\n this.markAsDirty();\n this._rootContainer._markAllAsDirty();\n }\n /**\n * Gets or sets a boolean indicating if the smallest ideal value must be used if idealWidth and idealHeight are both set\n * @see https://doc.babylonjs.com/how_to/gui#adaptive-scaling\n */\n public get useSmallestIdeal(): boolean {\n return this._useSmallestIdeal;\n }\n public set useSmallestIdeal(value: boolean) {\n if (this._useSmallestIdeal === value) {\n return;\n }\n this._useSmallestIdeal = value;\n this.markAsDirty();\n this._rootContainer._markAllAsDirty();\n }\n /**\n * Gets or sets a boolean indicating if adaptive scaling must be used\n * @see https://doc.babylonjs.com/how_to/gui#adaptive-scaling\n */\n public get renderAtIdealSize(): boolean {\n return this._renderAtIdealSize;\n }\n public set renderAtIdealSize(value: boolean) {\n if (this._renderAtIdealSize === value) {\n return;\n }\n this._renderAtIdealSize = value;\n this._onResize();\n }\n\n /**\n * Gets the ratio used when in \"ideal mode\"\n * @see https://doc.babylonjs.com/how_to/gui#adaptive-scaling\n * */\n public get idealRatio(): number {\n var rwidth: number = 0;\n var rheight: number = 0;\n\n if (this._idealWidth) {\n rwidth = this.getSize().width / this._idealWidth;\n }\n\n if (this._idealHeight) {\n rheight = this.getSize().height / this._idealHeight;\n }\n\n if (this._useSmallestIdeal && this._idealWidth && this._idealHeight) {\n return window.innerWidth < window.innerHeight ? rwidth : rheight;\n }\n\n if (this._idealWidth) {\n // horizontal\n return rwidth;\n }\n\n if (this._idealHeight) {\n // vertical\n return rheight;\n }\n\n return 1;\n }\n\n /**\n * Gets the underlying layer used to render the texture when in fullscreen mode\n */\n public get layer(): Nullable<Layer> {\n return this._layerToDispose;\n }\n /**\n * Gets the root container control\n */\n public get rootContainer(): Container {\n return this._rootContainer;\n }\n /**\n * Returns an array containing the root container.\n * This is mostly used to let the Inspector introspects the ADT\n * @returns an array containing the rootContainer\n */\n public getChildren(): Array<Container> {\n return [this._rootContainer];\n }\n /**\n * Will return all controls that are inside this texture\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\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\n * @return all child controls\n */\n public getDescendants(directDescendantsOnly?: boolean, predicate?: (control: Control) => boolean): Control[] {\n return this._rootContainer.getDescendants(directDescendantsOnly, predicate);\n }\n\n /**\n * Will return all controls with the given type name\n * @param typeName defines the type name to search for\n * @returns an array of all controls found\n */\n public getControlsByType(typeName: string): Control[] {\n return this._rootContainer.getDescendants(false, (control) => control.typeName === typeName);\n }\n\n /**\n * Will return the first control with the given name\n * @param name defines the name to search for\n * @return the first control found or null\n */\n public getControlByName(name: string): Nullable<Control> {\n return this._getControlByKey(\"name\", name);\n }\n\n private _getControlByKey(key: string, value: any): Nullable<Control> {\n return this._rootContainer.getDescendants().find((control) => control[key as keyof Control] === value) || null;\n }\n\n /**\n * Gets or sets the current focused control\n */\n public get focusedControl(): Nullable<IFocusableControl> {\n return this._focusedControl;\n }\n public set focusedControl(control: Nullable<IFocusableControl>) {\n if (this._focusedControl == control) {\n return;\n }\n if (this._focusedControl) {\n this._focusedControl.onBlur();\n }\n if (control) {\n control.onFocus();\n }\n this._focusedControl = control;\n }\n /**\n * Gets or sets a boolean indicating if the texture must be rendered in background or foreground when in fullscreen mode\n */\n public get isForeground(): boolean {\n if (!this.layer) {\n return true;\n }\n return !this.layer.isBackground;\n }\n public set isForeground(value: boolean) {\n if (!this.layer) {\n return;\n }\n if (this.layer.isBackground === !value) {\n return;\n }\n this.layer.isBackground = !value;\n }\n /**\n * Gets or set information about clipboardData\n */\n public get clipboardData(): string {\n return this._clipboardData;\n }\n public set clipboardData(value: string) {\n this._clipboardData = value;\n }\n /**\n * Creates a new AdvancedDynamicTexture\n * @param name defines the name of the texture\n * @param width defines the width of the texture\n * @param height defines the height of the texture\n * @param scene defines the hosting scene\n * @param generateMipMaps defines a boolean indicating if mipmaps must be generated (false by default)\n * @param samplingMode defines the texture sampling mode (Texture.NEAREST_SAMPLINGMODE by default)\n * @param invertY defines if the texture needs to be inverted on the y axis during loading (true by default)\n */\n constructor(name: string, width = 0, height = 0, scene: Nullable<Scene>, generateMipMaps = false, samplingMode = Texture.NEAREST_SAMPLINGMODE, invertY = true) {\n super(name, { width: width, height: height }, scene, generateMipMaps, samplingMode, Constants.TEXTUREFORMAT_RGBA, invertY);\n scene = this.getScene();\n if (!scene || !this._texture) {\n return;\n }\n this.applyYInversionOnUpdate = invertY;\n this._rootElement = scene.getEngine().getInputElement();\n this._renderObserver = scene.onBeforeCameraRenderObservable.add((camera: Camera) => this._checkUpdate(camera));\n this._preKeyboardObserver = scene.onPreKeyboardObservable.add((info) => {\n if (!this._focusedControl) {\n return;\n }\n if (info.type === KeyboardEventTypes.KEYDOWN) {\n this._focusedControl.processKeyboard(info.event);\n }\n info.skipOnPointerObservable = true;\n });\n this._rootContainer._link(this);\n this.hasAlpha = true;\n if (!width || !height) {\n this._resizeObserver = scene.getEngine().onResizeObservable.add(() => this._onResize());\n this._onResize();\n }\n this._texture.isReady = true;\n }\n /**\n * Get the current class name of the texture useful for serialization or dynamic coding.\n * @returns \"AdvancedDynamicTexture\"\n */\n public getClassName(): string {\n return \"AdvancedDynamicTexture\";\n }\n /**\n * Function used to execute a function on all controls\n * @param func defines the function to execute\n * @param container defines the container where controls belong. If null the root container will be used\n */\n public executeOnAllControls(func: (control: Control) => void, container?: Container) {\n if (!container) {\n container = this._rootContainer;\n }\n func(container);\n for (var child of container.children) {\n if ((<any>child).children) {\n this.executeOnAllControls(func, <Container>child);\n continue;\n }\n func(child);\n }\n }\n\n private _useInvalidateRectOptimization = true;\n\n /**\n * Gets or sets a boolean indicating if the InvalidateRect optimization should be turned on\n */\n public get useInvalidateRectOptimization(): boolean {\n return this._useInvalidateRectOptimization;\n }\n\n public set useInvalidateRectOptimization(value: boolean) {\n this._useInvalidateRectOptimization = value;\n }\n\n // Invalidated rectangle which is the combination of all invalidated controls after they have been rotated into absolute position\n private _invalidatedRectangle: Nullable<Measure> = null;\n /**\n * Invalidates a rectangle area on the gui texture\n * @param invalidMinX left most position of the rectangle to invalidate in the texture\n * @param invalidMinY top most position of the rectangle to invalidate in the texture\n * @param invalidMaxX right most position of the rectangle to invalidate in the texture\n * @param invalidMaxY bottom most position of the rectangle to invalidate in the texture\n */\n public invalidateRect(invalidMinX: number, invalidMinY: number, invalidMaxX: number, invalidMaxY: number) {\n if (!this._useInvalidateRectOptimization) {\n return;\n }\n if (!this._invalidatedRectangle) {\n this._invalidatedRectangle = new Measure(invalidMinX, invalidMinY, invalidMaxX - invalidMinX + 1, invalidMaxY - invalidMinY + 1);\n } else {\n // Compute intersection\n var maxX = Math.ceil(Math.max(this._invalidatedRectangle.left + this._invalidatedRectangle.width - 1, invalidMaxX));\n var maxY = Math.ceil(Math.max(this._invalidatedRectangle.top + this._invalidatedRectangle.height - 1, invalidMaxY));\n this._invalidatedRectangle.left = Math.floor(Math.min(this._invalidatedRectangle.left, invalidMinX));\n this._invalidatedRectangle.top = Math.floor(Math.min(this._invalidatedRectangle.top, invalidMinY));\n this._invalidatedRectangle.width = maxX - this._invalidatedRectangle.left + 1;\n this._invalidatedRectangle.height = maxY - this._invalidatedRectangle.top + 1;\n }\n }\n /**\n * Marks the texture as dirty forcing a complete update\n */\n public markAsDirty() {\n this._isDirty = true;\n }\n /**\n * Helper function used to create a new style\n * @returns a new style\n * @see https://doc.babylonjs.com/how_to/gui#styles\n */\n public createStyle(): Style {\n return new Style(this);\n }\n /**\n * Adds a new control to the root container\n * @param control defines the control to add\n * @returns the current texture\n */\n public addControl(control: Control): AdvancedDynamicTexture {\n this._rootContainer.addControl(control);\n return this;\n }\n /**\n * Removes a control from the root container\n * @param control defines the control to remove\n * @returns the current texture\n */\n public removeControl(control: Control): AdvancedDynamicTexture {\n this._rootContainer.removeControl(control);\n return this;\n }\n /**\n * Moves overlapped controls towards a position where it is not overlapping anymore.\n * Please note that this method alters linkOffsetXInPixels and linkOffsetYInPixels.\n * @param overlapGroup the overlap group which will be processed or undefined to process all overlap groups\n * @param deltaStep the step size (speed) to reach the target non overlapping position (default 0.1)\n * @param repelFactor how much is the control repelled by other controls\n */\n public moveToNonOverlappedPosition(overlapGroup?: number | Control[], deltaStep = 1, repelFactor = 1) {\n let controlsForGroup: Control[];\n if (Array.isArray(overlapGroup)) {\n controlsForGroup = overlapGroup;\n } else {\n const descendants = this.getDescendants(true);\n // get only the controls with an overlapGroup property set\n // if the overlapGroup parameter is set, filter the controls and get only the controls belonging to that overlapGroup\n controlsForGroup = overlapGroup === undefined ? descendants.filter((c) => c.overlapGroup !== undefined) : descendants.filter((c) => c.overlapGroup === overlapGroup);\n }\n\n controlsForGroup.forEach((control1) => {\n let velocity = Vector2.Zero();\n const center = new Vector2(control1.centerX, control1.centerY);\n\n controlsForGroup.forEach((control2) => {\n if (control1 !== control2 && AdvancedDynamicTexture._Overlaps(control1, control2)) {\n // if the two controls overlaps get a direction vector from one control's center to another control's center\n const diff = center.subtract(new Vector2(control2.centerX, control2.centerY));\n const diffLength = diff.length();\n\n if (diffLength > 0) {\n // calculate the velocity\n velocity = velocity.add(diff.normalize().scale(repelFactor / diffLength));\n }\n }\n });\n\n if (velocity.length() > 0) {\n // move the control along the direction vector away from the overlapping control\n velocity = velocity.normalize().scale(deltaStep * (control1.overlapDeltaMultiplier ?? 1));\n control1.linkOffsetXInPixels += velocity.x;\n control1.linkOffsetYInPixels += velocity.y;\n }\n });\n }\n /**\n * Release all resources\n */\n public dispose(): void {\n let scene = this.getScene();\n if (!scene) {\n return;\n }\n this._rootElement = null;\n scene.onBeforeCameraRenderObservable.remove(this._renderObserver);\n if (this._resizeObserver) {\n scene.getEngine().onResizeObservable.remove(this._resizeObserver);\n }\n if (this._pointerMoveObserver) {\n scene.onPrePointerObservable.remove(this._pointerMoveObserver);\n }\n if (this._pointerObserver) {\n scene.onPointerObservable.remove(this._pointerObserver);\n }\n if (this._preKeyboardObserver) {\n scene.onPreKeyboardObservable.remove(this._preKeyboardObserver);\n }\n if (this._canvasPointerOutObserver) {\n scene.getEngine().onCanvasPointerOutObservable.remove(this._canvasPointerOutObserver);\n }\n if (this._canvasBlurObserver) {\n scene.getEngine().onCanvasBlurObservable.remove(this._canvasBlurObserver);\n }\n if (this._layerToDispose) {\n this._layerToDispose.texture = null;\n this._layerToDispose.dispose();\n this._layerToDispose = null;\n }\n this._rootContainer.dispose();\n this.onClipboardObservable.clear();\n this.onControlPickedObservable.clear();\n this.onBeginRenderObservable.clear();\n this.onEndRenderObservable.clear();\n this.onBeginLayoutObservable.clear();\n this.onEndLayoutObservable.clear();\n super.dispose();\n }\n private _onResize(): void {\n let scene = this.getScene();\n if (!scene) {\n return;\n }\n // Check size\n var engine = scene.getEngine();\n var textureSize = this.getSize();\n var renderWidth = engine.getRenderWidth() * this._renderScale;\n var renderHeight = engine.getRenderHeight() * this._renderScale;\n\n if (this._renderAtIdealSize) {\n if (this._idealWidth) {\n renderHeight = (renderHeight * this._idealWidth) / renderWidth;\n renderWidth = this._idealWidth;\n } else if (this._idealHeight) {\n renderWidth = (renderWidth * this._idealHeight) / renderHeight;\n renderHeight = this._idealHeight;\n }\n }\n if (textureSize.width !== renderWidth || textureSize.height !== renderHeight) {\n this.scaleTo(renderWidth, renderHeight);\n this.markAsDirty();\n if (this._idealWidth || this._idealHeight) {\n this._rootContainer._markAllAsDirty();\n }\n }\n this.invalidateRect(0, 0, textureSize.width - 1, textureSize.height - 1);\n }\n /** @hidden */\n public _getGlobalViewport(): Viewport {\n var size = this.getSize();\n return this._fullscreenViewport.toGlobal(size.width, size.height);\n }\n /**\n * Get screen coordinates for a vector3\n * @param position defines the position to project\n * @param worldMatrix defines the world matrix to use\n * @returns the projected position\n */\n public getProjectedPosition(position: Vector3, worldMatrix: Matrix): Vector2 {\n const result = this.getProjectedPositionWithZ(position, worldMatrix);\n return new Vector2(result.x, result.y);\n }\n\n /**\n * Get screen coordinates for a vector3\n * @param position defines the position to project\n * @param worldMatrix defines the world matrix to use\n * @returns the projected position with Z\n */\n public getProjectedPositionWithZ(position: Vector3, worldMatrix: Matrix): Vector3 {\n var scene = this.getScene();\n if (!scene) {\n return Vector3.Zero();\n }\n var globalViewport = this._getGlobalViewport();\n var projectedPosition = Vector3.Project(position, worldMatrix, scene.getTransformMatrix(), globalViewport);\n return new Vector3(projectedPosition.x, projectedPosition.y, projectedPosition.z);\n }\n\n private _checkUpdate(camera: Camera): void {\n if (this._layerToDispose) {\n if ((camera.layerMask & this._layerToDispose.layerMask) === 0) {\n return;\n }\n }\n if (this._isFullscreen && this._linkedControls.length) {\n var scene = this.getScene();\n if (!scene) {\n return;\n }\n var globalViewport = this._getGlobalViewport();\n for (let control of this._linkedControls) {\n if (!control.isVisible) {\n continue;\n }\n let mesh = control._linkedMesh as AbstractMesh;\n if (!mesh || mesh.isDisposed()) {\n Tools.SetImmediate(() => {\n control.linkWithMesh(null);\n });\n continue;\n }\n let position = mesh.getBoundingInfo ? mesh.getBoundingInfo().boundingSphere.center : (Vector3.ZeroReadOnly as Vector3);\n let projectedPosition = Vector3.Project(position, mesh.getWorldMatrix(), scene.getTransformMatrix(), globalViewport);\n if (projectedPosition.z < 0 || projectedPosition.z > 1) {\n control.notRenderable = true;\n continue;\n }\n control.notRenderable = false;\n\n control._moveToProjectedPosition(projectedPosition);\n }\n }\n if (!this._isDirty && !this._rootContainer.isDirty) {\n return;\n }\n this._isDirty = false;\n this._render();\n this.update(this.applyYInversionOnUpdate, this.premulAlpha);\n }\n\n private _clearMeasure = new Measure(0, 0, 0, 0);\n\n private _render(): void {\n var textureSize = this.getSize();\n var renderWidth = textureSize.width;\n var renderHeight = textureSize.height;\n\n var context = this.getContext();\n context.font = \"18px Arial\";\n context.strokeStyle = \"white\";\n\n // Layout\n this.onBeginLayoutObservable.notifyObservers(this);\n var measure = new Measure(0, 0, renderWidth, renderHeight);\n this._numLayoutCalls = 0;\n this._rootContainer._layout(measure, context);\n this.onEndLayoutObservable.notifyObservers(this);\n this._isDirty = false; // Restoring the dirty state that could have been set by controls during layout processing\n\n // Clear\n if (this._invalidatedRectangle) {\n this._clearMeasure.copyFrom(this._invalidatedRectangle);\n } else {\n this._clearMeasure.copyFromFloats(0, 0, renderWidth, renderHeight);\n }\n context.clearRect(this._clearMeasure.left, this._clearMeasure.top, this._clearMeasure.width, this._clearMeasure.height);\n if (this._background) {\n context.save();\n context.fillStyle = this._background;\n context.fillRect(this._clearMeasure.left, this._clearMeasure.top, this._clearMeasure.width, this._clearMeasure.height);\n context.restore();\n }\n\n // Render\n this.onBeginRenderObservable.notifyObservers(this);\n this._numRenderCalls = 0;\n this._rootContainer._render(context, this._invalidatedRectangle);\n this.onEndRenderObservable.notifyObservers(this);\n this._invalidatedRectangle = null;\n }\n /** @hidden */\n public _changeCursor(cursor: string) {\n if (this._rootElement) {\n this._rootElement.style.cursor = cursor;\n this._cursorChanged = true;\n }\n }\n /** @hidden */\n public _registerLastControlDown(control: Control, pointerId: number) {\n this._lastControlDown[pointerId] = control;\n this.onControlPickedObservable.notifyObservers(control);\n }\n private _doPicking(x: number, y: number, pi: PointerInfoBase, type: number, pointerId: number, buttonIndex: number, deltaX?: number, deltaY?: number): void {\n var scene = this.getScene();\n if (!scene) {\n return;\n }\n var engine = scene.getEngine();\n var textureSize = this.getSize();\n if (this._isFullscreen) {\n let camera = scene.cameraToUseForPointers || scene.activeCamera;\n if (!camera) {\n return;\n }\n let viewport = camera.viewport;\n x = x * (textureSize.width / (engine.getRenderWidth() * viewport.width));\n y = y * (textureSize.height / (engine.getRenderHeight() * viewport.height));\n }\n if (this._capturingControl[pointerId]) {\n this._capturingControl[pointerId]._processObservables(type, x, y, pi, pointerId, buttonIndex);\n return;\n }\n\n this._cursorChanged = false;\n if (!this._rootContainer._processPicking(x, y, pi, type, pointerId, buttonIndex, deltaX, deltaY)) {\n if (!scene.doNotHandleCursors) {\n this._changeCursor(\"\");\n }\n if (type === PointerEventTypes.POINTERMOVE) {\n if (this._lastControlOver[pointerId]) {\n this._lastControlOver[pointerId]._onPointerOut(this._lastControlOver[pointerId], pi);\n delete this._lastControlOver[pointerId];\n }\n }\n }\n\n if (!this._cursorChanged && !scene.doNotHandleCursors) {\n this._changeCursor(\"\");\n }\n this._manageFocus();\n }\n /** @hidden */\n public _cleanControlAfterRemovalFromList(list: { [pointerId: number]: Control }, control: Control) {\n for (var pointerId in list) {\n if (!list.hasOwnProperty(pointerId)) {\n continue;\n }\n var lastControlOver = list[pointerId];\n if (lastControlOver === control) {\n delete list[pointerId];\n }\n }\n }\n /** @hidden */\n public _cleanControlAfterRemoval(control: Control) {\n this._cleanControlAfterRemovalFromList(this._lastControlDown, control);\n this._cleanControlAfterRemovalFromList(this._lastControlOver, control);\n }\n /** Attach to all scene events required to support pointer events */\n public attach(): void {\n const scene = this.getScene();\n if (!scene) {\n return;\n }\n\n let tempViewport = new Viewport(0, 0, 0, 0);\n\n this._pointerMoveObserver = scene.onPrePointerObservable.add((pi, state) => {\n if (scene.isPointerCaptured((<IPointerEvent>pi.event).pointerId)) {\n return;\n }\n if (\n pi.type !== PointerEventTypes.POINTERMOVE &&\n pi.type !== PointerEventTypes.POINTERUP &&\n pi.type !== PointerEventTypes.POINTERDOWN &&\n pi.type !== PointerEventTypes.POINTERWHEEL\n ) {\n return;\n }\n\n if (pi.type === PointerEventTypes.POINTERMOVE && (pi.event as IPointerEvent).pointerId) {\n this._defaultMousePointerId = (pi.event as IPointerEvent).pointerId; // This is required to make sure we have the correct pointer ID for wheel\n }\n\n let camera = scene.cameraToUseForPointers || scene.activeCamera;\n let engine = scene.getEngine();\n\n if (!camera) {\n tempViewport.x = 0;\n tempViewport.y = 0;\n tempViewport.width = engine.getRenderWidth();\n tempViewport.height = engine.getRenderHeight();\n } else {\n camera.viewport.toGlobalToRef(engine.getRenderWidth(), engine.getRenderHeight(), tempViewport);\n }\n\n let x = scene.pointerX / engine.getHardwareScalingLevel() - tempViewport.x;\n let y = scene.pointerY / engine.getHardwareScalingLevel() - (engine.getRenderHeight() - tempViewport.y - tempViewport.height);\n this._shouldBlockPointer = false;\n // Do picking modifies _shouldBlockPointer\n let pointerId = (pi.event as IPointerEvent).pointerId || this._defaultMousePointerId;\n this._doPicking(x, y, pi, pi.type, pointerId, pi.event.button, (<IWheelEvent>pi.event).deltaX, (<IWheelEvent>pi.event).deltaY);\n // Avoid overwriting a true skipOnPointerObservable to false\n if (this._shouldBlockPointer) {\n pi.skipOnPointerObservable = this._shouldBlockPointer;\n }\n });\n this._attachToOnPointerOut(scene);\n this._attachToOnBlur(scene);\n }\n\n /** @hidden */\n private onClipboardCopy = (rawEvt: Event) => {\n const evt = rawEvt as ClipboardEvent;\n let ev = new ClipboardInfo(ClipboardEventTypes.COPY, evt);\n this.onClipboardObservable.notifyObservers(ev);\n evt.preventDefault();\n };\n /** @hidden */\n private onClipboardCut = (rawEvt: Event) => {\n const evt = rawEvt as ClipboardEvent;\n let ev = new ClipboardInfo(ClipboardEventTypes.CUT, evt);\n this.onClipboardObservable.notifyObservers(ev);\n evt.preventDefault();\n };\n /** @hidden */\n private onClipboardPaste = (rawEvt: Event) => {\n const evt = rawEvt as ClipboardEvent;\n let ev = new ClipboardInfo(ClipboardEventTypes.PASTE, evt);\n this.onClipboardObservable.notifyObservers(ev);\n evt.preventDefault();\n };\n /**\n * Register the clipboard Events onto the canvas\n */\n public registerClipboardEvents(): void {\n self.addEventListener(\"copy\", this.onClipboardCopy, false);\n self.addEventListener(\"cut\", this.onClipboardCut, false);\n self.addEventListener(\"paste\", this.onClipboardPaste, false);\n }\n /**\n * Unregister the clipboard Events from the canvas\n */\n public unRegisterClipboardEvents(): void {\n self.removeEventListener(\"copy\", this.onClipboardCopy);\n self.removeEventListener(\"cut\", this.onClipboardCut);\n self.removeEventListener(\"paste\", this.onClipboardPaste);\n }\n /**\n * Connect the texture to a hosting mesh to enable interactions\n * @param mesh defines the mesh to attach to\n * @param supportPointerMove defines a boolean indicating if pointer move events must be catched as well\n */\n public attachToMesh(mesh: AbstractMesh, supportPointerMove = true): void {\n var scene = this.getScene();\n if (!scene) {\n return;\n }\n this._pointerObserver = scene.onPointerObservable.add((pi, state) => {\n if (\n pi.type !== PointerEventTypes.POINTERMOVE &&\n pi.type !== PointerEventTypes.POINTERUP &&\n pi.type !== PointerEventTypes.POINTERDOWN &&\n pi.type !== PointerEventTypes.POINTERWHEEL\n ) {\n return;\n }\n\n if (pi.type === PointerEventTypes.POINTERMOVE && (pi.event as IPointerEvent).pointerId) {\n this._defaultMousePointerId = (pi.event as IPointerEvent).pointerId; // This is required to make sure we have the correct pointer ID for wheel\n }\n\n var pointerId = (pi.event as IPointerEvent).pointerId || this._defaultMousePointerId;\n if (pi.pickInfo && pi.pickInfo.hit && pi.pickInfo.pickedMesh === mesh) {\n var uv = pi.pickInfo.getTextureCoordinates();\n if (uv) {\n let size = this.getSize();\n this._doPicking(\n uv.x * size.width,\n (this.applyYInversionOnUpdate ? 1.0 - uv.y : uv.y) * size.height,\n pi,\n pi.type,\n pointerId,\n pi.event.button,\n (<IWheelEvent>pi.event).deltaX,\n (<IWheelEvent>pi.event).deltaY\n );\n }\n } else if (pi.type === PointerEventTypes.POINTERUP) {\n if (this._lastControlDown[pointerId]) {\n this._lastControlDown[pointerId]._forcePointerUp(pointerId);\n }\n delete this._lastControlDown[pointerId];\n if (this.focusedControl) {\n const friendlyControls = this.focusedControl.keepsFocusWith();\n let canMoveFocus = true;\n if (friendlyControls) {\n for (var control of friendlyControls) {\n // Same host, no need to keep the focus\n if (this === control._host) {\n continue;\n }\n // Different hosts\n const otherHost = control._host;\n if (otherHost._lastControlOver[pointerId] && otherHost._lastControlOver[pointerId].isAscendant(control)) {\n canMoveFocus = false;\n break;\n }\n }\n }\n if (canMoveFocus) {\n this.focusedControl = null;\n }\n }\n } else if (pi.type === PointerEventTypes.POINTERMOVE) {\n if (this._lastControlOver[pointerId]) {\n this._lastControlOver[pointerId]._onPointerOut(this._lastControlOver[pointerId], pi, true);\n }\n delete this._lastControlOver[pointerId];\n }\n });\n mesh.enablePointerMoveEvents = supportPointerMove;\n this._attachToOnPointerOut(scene);\n this._attachToOnBlur(scene);\n }\n /**\n * Move the focus to a specific control\n * @param control defines the control which will receive the focus\n */\n public moveFocusToControl(control: IFocusableControl): void {\n this.focusedControl = control;\n this._lastPickedControl = <any>control;\n this._blockNextFocusCheck = true;\n }\n private _manageFocus(): void {\n if (this._blockNextFocusCheck) {\n this._blockNextFocusCheck = false;\n this._lastPickedControl = <any>this._focusedControl;\n return;\n }\n // Focus management\n if (this._focusedControl) {\n if (this._focusedControl !== <any>this._lastPickedControl) {\n if (this._lastPickedControl.isFocusInvisible) {\n return;\n }\n this.focusedControl = null;\n }\n }\n }\n private _attachToOnPointerOut(scene: Scene): void {\n this._canvasPointerOutObserver = scene.getEngine().onCanvasPointerOutObservable.add((pointerEvent) => {\n if (this._lastControlOver[pointerEvent.pointerId]) {\n this._lastControlOver[pointerEvent.pointerId]._onPointerOut(this._lastControlOver[pointerEvent.pointerId], null);\n }\n delete this._lastControlOver[pointerEvent.pointerId];\n if (this._lastControlDown[pointerEvent.pointerId] && this._lastControlDown[pointerEvent.pointerId] !== this._capturingControl[pointerEvent.pointerId]) {\n this._lastControlDown[pointerEvent.pointerId]._forcePointerUp();\n delete this._lastControlDown[pointerEvent.pointerId];\n }\n });\n }\n private _attachToOnBlur(scene: Scene): void {\n this._canvasBlurObserver = scene.getEngine().onCanvasBlurObservable.add((pointerEvent) => {\n Object.entries(this._lastControlDown).forEach(([key, value]) => {\n value._onCanvasBlur();\n });\n this.focusedControl = null;\n this._lastControlDown = {};\n });\n }\n\n /**\n * Serializes the entire GUI system\n * @returns an object with the JSON serialized data\n */\n public serializeContent(): any {\n const size = this.getSize();\n let serializationObject = {\n root: {},\n width: size.width,\n height: size.height,\n };\n\n this._rootContainer.serialize(serializationObject.root);\n\n return serializationObject;\n }\n\n /**\n * Recreate the content of the ADT from a JSON object\n * @param serializedObject define the JSON serialized object to restore from\n * @param scaleToSize defines whether to scale to texture to the saved size\n */\n public parseContent(serializedObject: any, scaleToSize?: boolean) {\n this._rootContainer = Control.Parse(serializedObject.root, this) as Container;\n if (scaleToSize) {\n const width = serializedObject.width;\n const height = serializedObject.height;\n if (typeof width === \"number\" && typeof height === \"number\" && width >= 0 && height >= 0) {\n this.scaleTo(width, height);\n }\n }\n }\n\n /**\n * Recreate the content of the ADT from a snippet saved by the GUI editor\n * @param snippetId defines the snippet to load\n * @param scaleToSize defines whether to scale to texture to the saved size\n * @returns a promise that will resolve on success\n */\n public parseFromSnippetAsync(snippetId: string, scaleToSize?: boolean): Promise<void> {\n if (snippetId === \"_BLANK\") {\n return Promise.resolve();\n }\n\n return new Promise((resolve, reject) => {\n var request = new WebRequest();\n request.addEventListener(\"readystatechange\", () => {\n if (request.readyState == 4) {\n if (request.status == 200) {\n var snippet = JSON.parse(JSON.parse(request.responseText).jsonPayload);\n let serializationObject = JSON.parse(snippet.gui);\n\n this.parseContent(serializationObject, scaleToSize);\n this.snippetId = snippetId;\n\n resolve();\n } else {\n reject(\"Unable to load the snippet \" + snippetId);\n }\n }\n });\n\n request.open(\"GET\", AdvancedDynamicTexture.SnippetUrl + \"/\" + snippetId.replace(/#/g, \"/\"));\n request.send();\n });\n }\n\n /**\n * Recreate the content of the ADT from a url json\n * @param url defines the url to load\n * @param scaleToSize defines whether to scale to texture to the saved size\n * @returns a promise that will resolve on success\n */\n public parseFromURLAsync(url: string, scaleToSize?: boolean): Promise<void> {\n if (url === \"\") {\n return Promise.resolve();\n }\n\n return new Promise((resolve, reject) => {\n var request = new WebRequest();\n request.addEventListener(\"readystatechange\", () => {\n if (request.readyState == 4) {\n if (request.status == 200) {\n var gui = request.responseText;\n let serializationObject = JSON.parse(gui);\n this.parseContent(serializationObject, scaleToSize);\n\n resolve();\n } else {\n reject(\"Unable to load\");\n }\n }\n });\n request.open(\"GET\", url);\n request.send();\n });\n }\n\n // Statics\n /**\n * Compares two rectangle based controls for pixel overlap\n * @param control1 The first control to compare\n * @param control2 The second control to compare\n * @returns true if overlaps, otherwise false\n */\n private static _Overlaps(control1: Control, control2: Control) {\n return !(\n control1.centerX > control2.centerX + control2.widthInPixels ||\n control1.centerX + control1.widthInPixels < control2.centerX ||\n control1.centerY + control1.heightInPixels < control2.centerY ||\n control1.centerY > control2.centerY + control2.heightInPixels\n );\n }\n\n /**\n * Creates a new AdvancedDynamicTexture in projected mode (ie. attached to a mesh)\n * @param mesh defines the mesh which will receive the texture\n * @param width defines the texture width (1024 by default)\n * @param height defines the texture height (1024 by default)\n * @param supportPointerMove defines a boolean indicating if the texture must capture move events (true by default)\n * @param onlyAlphaTesting defines a boolean indicating that alpha blending will not be used (only alpha testing) (false by default)\n * @param invertY defines if the texture needs to be inverted on the y axis during loading (true by default)\n * @returns a new AdvancedDynamicTexture\n */\n public static CreateForMesh(mesh: AbstractMesh, width = 1024, height = 1024, supportPointerMove = true, onlyAlphaTesting = false, invertY?: boolean): AdvancedDynamicTexture {\n var result = new AdvancedDynamicTexture(mesh.name + \" AdvancedDynamicTexture\", width, height, mesh.getScene(), true, Texture.TRILINEAR_SAMPLINGMODE, invertY);\n var material = new StandardMaterial(\"AdvancedDynamicTextureMaterial\", mesh.getScene());\n material.backFaceCulling = false;\n material.diffuseColor = Color3.Black();\n material.specularColor = Color3.Black();\n if (onlyAlphaTesting) {\n material.diffuseTexture = result;\n material.emissiveTexture = result;\n result.hasAlpha = true;\n } else {\n material.emissiveTexture = result;\n material.opacityTexture = result;\n }\n mesh.material = material;\n result.attachToMesh(mesh, supportPointerMove);\n return result;\n }\n\n /**\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\n * @param mesh defines the mesh which will receive the texture\n * @param width defines the texture width (1024 by default)\n * @param height defines the texture height (1024 by default)\n * @param supportPointerMove defines a boolean indicating if the texture must capture move events (true by default)\n * @param invertY defines if the texture needs to be inverted on the y axis during loading (true by default)\n * @returns a new AdvancedDynamicTexture\n */\n public static CreateForMeshTexture(mesh: AbstractMesh, width = 1024, height = 1024, supportPointerMove = true, invertY?: boolean): AdvancedDynamicTexture {\n var result = new AdvancedDynamicTexture(mesh.name + \" AdvancedDynamicTexture\", width, height, mesh.getScene(), true, Texture.TRILINEAR_SAMPLINGMODE, invertY);\n result.attachToMesh(mesh, supportPointerMove);\n return result;\n }\n /**\n * Creates a new AdvancedDynamicTexture in fullscreen mode.\n * In this mode the texture will rely on a layer for its rendering.\n * This allows it to be treated like any other layer.\n * As such, if you have a multi camera setup, you can set the layerMask on the GUI as well.\n * LayerMask is set through advancedTexture.layer.layerMask\n * @param name defines name for the texture\n * @param foreground defines a boolean indicating if the texture must be rendered in foreground (default is true)\n * @param scene defines the hosting scene\n * @param sampling defines the texture sampling mode (Texture.BILINEAR_SAMPLINGMODE by default)\n * @returns a new AdvancedDynamicTexture\n */\n public static CreateFullscreenUI(name: string, foreground: boolean = true, scene: Nullable<Scene> = null, sampling = Texture.BILINEAR_SAMPLINGMODE): AdvancedDynamicTexture {\n var result = new AdvancedDynamicTexture(name, 0, 0, scene, false, sampling);\n // Display\n var layer = new Layer(name + \"_layer\", null, scene, !foreground);\n layer.texture = result;\n result._layerToDispose = layer;\n result._isFullscreen = true;\n // Attach\n result.attach();\n return result;\n }\n}\n"]}
1
+ {"version":3,"file":"advancedDynamicTexture.js","sourceRoot":"","sources":["../../../sourceES6/gui/src/2D/advancedDynamicTexture.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,UAAU,EAAY,MAAM,iCAAiC,CAAC;AACvE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAU,MAAM,mCAAmC,CAAC;AAC7E,OAAO,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AACnD,OAAO,EAA+B,iBAAiB,EAAmB,MAAM,sCAAsC,CAAC;AACvH,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAC;AAC5F,OAAO,EAAmB,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAE5F,OAAO,EAAE,gBAAgB,EAAE,MAAM,4CAA4C,CAAC;AAC9E,OAAO,EAAE,OAAO,EAAE,MAAM,4CAA4C,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,mDAAmD,CAAC;AAEnF,OAAO,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AAIrD,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,MAAM,mCAAmC,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,MAAM,qCAAqC,C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AuB,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;IA9pCD,uCAAuC;IACzB,iCAAU,GAAG,+BAA+B,CAAC;IAE3D,yIAAyI;IAC3H,4CAAqB,GAAG,IAAI,CAAC;IA2pC/C,6BAAC;CAAA,AAhqCD,CAA4C,cAAc,GAgqCzD;SAhqCY,sBAAsB","sourcesContent":["import { Nullable } from \"@babylonjs/core/types\";\nimport { Observable, Observer } from \"@babylonjs/core/Misc/observable\";\nimport { Vector2, Vector3, Matrix } from \"@babylonjs/core/Maths/math.vector\";\nimport { Tools } from \"@babylonjs/core/Misc/tools\";\nimport { PointerInfoPre, PointerInfo, PointerEventTypes, PointerInfoBase } from \"@babylonjs/core/Events/pointerEvents\";\nimport { ClipboardEventTypes, ClipboardInfo } from \"@babylonjs/core/Events/clipboardEvents\";\nimport { KeyboardInfoPre, KeyboardEventTypes } from \"@babylonjs/core/Events/keyboardEvents\";\nimport { Camera } from \"@babylonjs/core/Cameras/camera\";\nimport { StandardMaterial } from \"@babylonjs/core/Materials/standardMaterial\";\nimport { Texture } from \"@babylonjs/core/Materials/Textures/texture\";\nimport { DynamicTexture } from \"@babylonjs/core/Materials/Textures/dynamicTexture\";\nimport { AbstractMesh } from \"@babylonjs/core/Meshes/abstractMesh\";\nimport { Layer } from \"@babylonjs/core/Layers/layer\";\nimport { Engine } from \"@babylonjs/core/Engines/engine\";\nimport { Scene } from \"@babylonjs/core/scene\";\n\nimport { Container } from \"./controls/container\";\nimport { Control } from \"./controls/control\";\nimport { IFocusableControl } from \"./controls/focusableControl\";\nimport { Style } from \"./style\";\nimport { Measure } from \"./measure\";\nimport { Constants } from \"@babylonjs/core/Engines/constants\";\nimport { Viewport } from \"@babylonjs/core/Maths/math.viewport\";\nimport { Color3 } from \"@babylonjs/core/Maths/math.color\";\nimport { WebRequest } from \"@babylonjs/core/Misc/webRequest\";\nimport { IPointerEvent, IWheelEvent } from \"@babylonjs/core/Events/deviceInputEvents\";\n\n/**\n * Class used to create texture to support 2D GUI elements\n * @see https://doc.babylonjs.com/how_to/gui\n */\nexport class AdvancedDynamicTexture extends DynamicTexture {\n /** Define the Uurl to load snippets */\n public static SnippetUrl = \"https://snippet.babylonjs.com\";\n\n /** Indicates if some optimizations can be performed in GUI GPU management (the downside is additional memory/GPU texture memory used) */\n public static AllowGPUOptimizations = true;\n\n /** Snippet ID if the content was created from the snippet server */\n public snippetId: string;\n\n private _isDirty = false;\n private _renderObserver: Nullable<Observer<Camera>>;\n private _resizeObserver: Nullable<Observer<Engine>>;\n private _preKeyboardObserver: Nullable<Observer<KeyboardInfoPre>>;\n private _pointerMoveObserver: Nullable<Observer<PointerInfoPre>>;\n private _pointerObserver: Nullable<Observer<PointerInfo>>;\n private _canvasPointerOutObserver: Nullable<Observer<IPointerEvent>>;\n private _canvasBlurObserver: Nullable<Observer<Engine>>;\n private _background: string;\n /** @hidden */\n public _rootContainer = new Container(\"root\");\n /** @hidden */\n public _lastPickedControl: Control;\n /** @hidden */\n public _lastControlOver: { [pointerId: number]: Control } = {};\n /** @hidden */\n public _lastControlDown: { [pointerId: number]: Control } = {};\n /** @hidden */\n public _capturingControl: { [pointerId: number]: Control } = {};\n /** @hidden */\n public _shouldBlockPointer: boolean;\n /** @hidden */\n public _layerToDispose: Nullable<Layer>;\n /** @hidden */\n public _linkedControls = new Array<Control>();\n private _isFullscreen = false;\n private _fullscreenViewport = new Viewport(0, 0, 1, 1);\n private _idealWidth = 0;\n private _idealHeight = 0;\n private _useSmallestIdeal: boolean = false;\n private _renderAtIdealSize = false;\n private _focusedControl: Nullable<IFocusableControl>;\n private _blockNextFocusCheck = false;\n private _renderScale = 1;\n private _rootElement: Nullable<HTMLElement>;\n private _cursorChanged = false;\n private _defaultMousePointerId = 0;\n\n /** @hidden */\n public _numLayoutCalls = 0;\n /** Gets the number of layout calls made the last time the ADT has been rendered */\n public get numLayoutCalls(): number {\n return this._numLayoutCalls;\n }\n\n /** @hidden */\n public _numRenderCalls = 0;\n /** Gets the number of render calls made the last time the ADT has been rendered */\n public get numRenderCalls(): number {\n return this._numRenderCalls;\n }\n\n /**\n * Define type to string to ensure compatibility across browsers\n * Safari doesn't support DataTransfer constructor\n */\n private _clipboardData: string = \"\";\n /**\n * Observable event triggered each time an clipboard event is received from the rendering canvas\n */\n public onClipboardObservable = new Observable<ClipboardInfo>();\n /**\n * Observable event triggered each time a pointer down is intercepted by a control\n */\n public onControlPickedObservable = new Observable<Control>();\n /**\n * Observable event triggered before layout is evaluated\n */\n public onBeginLayoutObservable = new Observable<AdvancedDynamicTexture>();\n /**\n * Observable event triggered after the layout was evaluated\n */\n public onEndLayoutObservable = new Observable<AdvancedDynamicTexture>();\n /**\n * Observable event triggered before the texture is rendered\n */\n public onBeginRenderObservable = new Observable<AdvancedDynamicTexture>();\n /**\n * Observable event triggered after the texture was rendered\n */\n public onEndRenderObservable = new Observable<AdvancedDynamicTexture>();\n /**\n * Gets or sets a boolean defining if alpha is stored as premultiplied\n */\n public premulAlpha = false;\n /**\n * Gets or sets a boolean indicating that the canvas must be reverted on Y when updating the texture\n */\n public applyYInversionOnUpdate = true;\n /**\n * Gets or sets a number used to scale rendering size (2 means that the texture will be twice bigger).\n * Useful when you want more antialiasing\n */\n public get renderScale(): number {\n return this._renderScale;\n }\n public set renderScale(value: number) {\n if (value === this._renderScale) {\n return;\n }\n this._renderScale = value;\n this._onResize();\n }\n /** Gets or sets the background color */\n public get background(): string {\n return this._background;\n }\n public set background(value: string) {\n if (this._background === value) {\n return;\n }\n this._background = value;\n this.markAsDirty();\n }\n /**\n * Gets or sets the ideal width used to design controls.\n * The GUI will then rescale everything accordingly\n * @see https://doc.babylonjs.com/how_to/gui#adaptive-scaling\n */\n public get idealWidth(): number {\n return this._idealWidth;\n }\n public set idealWidth(value: number) {\n if (this._idealWidth === value) {\n return;\n }\n this._idealWidth = value;\n this.markAsDirty();\n this._rootContainer._markAllAsDirty();\n }\n /**\n * Gets or sets the ideal height used to design controls.\n * The GUI will then rescale everything accordingly\n * @see https://doc.babylonjs.com/how_to/gui#adaptive-scaling\n */\n public get idealHeight(): number {\n return this._idealHeight;\n }\n public set idealHeight(value: number) {\n if (this._idealHeight === value) {\n return;\n }\n this._idealHeight = value;\n this.markAsDirty();\n this._rootContainer._markAllAsDirty();\n }\n /**\n * Gets or sets a boolean indicating if the smallest ideal value must be used if idealWidth and idealHeight are both set\n * @see https://doc.babylonjs.com/how_to/gui#adaptive-scaling\n */\n public get useSmallestIdeal(): boolean {\n return this._useSmallestIdeal;\n }\n public set useSmallestIdeal(value: boolean) {\n if (this._useSmallestIdeal === value) {\n return;\n }\n this._useSmallestIdeal = value;\n this.markAsDirty();\n this._rootContainer._markAllAsDirty();\n }\n /**\n * Gets or sets a boolean indicating if adaptive scaling must be used\n * @see https://doc.babylonjs.com/how_to/gui#adaptive-scaling\n */\n public get renderAtIdealSize(): boolean {\n return this._renderAtIdealSize;\n }\n public set renderAtIdealSize(value: boolean) {\n if (this._renderAtIdealSize === value) {\n return;\n }\n this._renderAtIdealSize = value;\n this._onResize();\n }\n\n /**\n * Gets the ratio used when in \"ideal mode\"\n * @see https://doc.babylonjs.com/how_to/gui#adaptive-scaling\n * */\n public get idealRatio(): number {\n var rwidth: number = 0;\n var rheight: number = 0;\n\n if (this._idealWidth) {\n rwidth = this.getSize().width / this._idealWidth;\n }\n\n if (this._idealHeight) {\n rheight = this.getSize().height / this._idealHeight;\n }\n\n if (this._useSmallestIdeal && this._idealWidth && this._idealHeight) {\n return window.innerWidth < window.innerHeight ? rwidth : rheight;\n }\n\n if (this._idealWidth) {\n // horizontal\n return rwidth;\n }\n\n if (this._idealHeight) {\n // vertical\n return rheight;\n }\n\n return 1;\n }\n\n /**\n * Gets the underlying layer used to render the texture when in fullscreen mode\n */\n public get layer(): Nullable<Layer> {\n return this._layerToDispose;\n }\n /**\n * Gets the root container control\n */\n public get rootContainer(): Container {\n return this._rootContainer;\n }\n /**\n * Returns an array containing the root container.\n * This is mostly used to let the Inspector introspects the ADT\n * @returns an array containing the rootContainer\n */\n public getChildren(): Array<Container> {\n return [this._rootContainer];\n }\n /**\n * Will return all controls that are inside this texture\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\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\n * @return all child controls\n */\n public getDescendants(directDescendantsOnly?: boolean, predicate?: (control: Control) => boolean): Control[] {\n return this._rootContainer.getDescendants(directDescendantsOnly, predicate);\n }\n\n /**\n * Will return all controls with the given type name\n * @param typeName defines the type name to search for\n * @returns an array of all controls found\n */\n public getControlsByType(typeName: string): Control[] {\n return this._rootContainer.getDescendants(false, (control) => control.typeName === typeName);\n }\n\n /**\n * Will return the first control with the given name\n * @param name defines the name to search for\n * @return the first control found or null\n */\n public getControlByName(name: string): Nullable<Control> {\n return this._getControlByKey(\"name\", name);\n }\n\n private _getControlByKey(key: string, value: any): Nullable<Control> {\n return this._rootContainer.getDescendants().find((control) => control[key as keyof Control] === value) || null;\n }\n\n /**\n * Gets or sets the current focused control\n */\n public get focusedControl(): Nullable<IFocusableControl> {\n return this._focusedControl;\n }\n public set focusedControl(control: Nullable<IFocusableControl>) {\n if (this._focusedControl == control) {\n return;\n }\n if (this._focusedControl) {\n this._focusedControl.onBlur();\n }\n if (control) {\n control.onFocus();\n }\n this._focusedControl = control;\n }\n /**\n * Gets or sets a boolean indicating if the texture must be rendered in background or foreground when in fullscreen mode\n */\n public get isForeground(): boolean {\n if (!this.layer) {\n return true;\n }\n return !this.layer.isBackground;\n }\n public set isForeground(value: boolean) {\n if (!this.layer) {\n return;\n }\n if (this.layer.isBackground === !value) {\n return;\n }\n this.layer.isBackground = !value;\n }\n /**\n * Gets or set information about clipboardData\n */\n public get clipboardData(): string {\n return this._clipboardData;\n }\n public set clipboardData(value: string) {\n this._clipboardData = value;\n }\n /**\n * Creates a new AdvancedDynamicTexture\n * @param name defines the name of the texture\n * @param width defines the width of the texture\n * @param height defines the height of the texture\n * @param scene defines the hosting scene\n * @param generateMipMaps defines a boolean indicating if mipmaps must be generated (false by default)\n * @param samplingMode defines the texture sampling mode (Texture.NEAREST_SAMPLINGMODE by default)\n * @param invertY defines if the texture needs to be inverted on the y axis during loading (true by default)\n */\n constructor(name: string, width = 0, height = 0, scene: Nullable<Scene>, generateMipMaps = false, samplingMode = Texture.NEAREST_SAMPLINGMODE, invertY = true) {\n super(name, { width: width, height: height }, scene, generateMipMaps, samplingMode, Constants.TEXTUREFORMAT_RGBA, invertY);\n scene = this.getScene();\n if (!scene || !this._texture) {\n return;\n }\n this.applyYInversionOnUpdate = invertY;\n this._rootElement = scene.getEngine().getInputElement();\n this._renderObserver = scene.onBeforeCameraRenderObservable.add((camera: Camera) => this._checkUpdate(camera));\n this._preKeyboardObserver = scene.onPreKeyboardObservable.add((info) => {\n if (!this._focusedControl) {\n return;\n }\n if (info.type === KeyboardEventTypes.KEYDOWN) {\n this._focusedControl.processKeyboard(info.event);\n }\n info.skipOnPointerObservable = true;\n });\n this._rootContainer._link(this);\n this.hasAlpha = true;\n if (!width || !height) {\n this._resizeObserver = scene.getEngine().onResizeObservable.add(() => this._onResize());\n this._onResize();\n }\n this._texture.isReady = true;\n }\n /**\n * Get the current class name of the texture useful for serialization or dynamic coding.\n * @returns \"AdvancedDynamicTexture\"\n */\n public getClassName(): string {\n return \"AdvancedDynamicTexture\";\n }\n /**\n * Function used to execute a function on all controls\n * @param func defines the function to execute\n * @param container defines the container where controls belong. If null the root container will be used\n */\n public executeOnAllControls(func: (control: Control) => void, container?: Container) {\n if (!container) {\n container = this._rootContainer;\n }\n func(container);\n for (var child of container.children) {\n if ((<any>child).children) {\n this.executeOnAllControls(func, <Container>child);\n continue;\n }\n func(child);\n }\n }\n\n private _useInvalidateRectOptimization = true;\n\n /**\n * Gets or sets a boolean indicating if the InvalidateRect optimization should be turned on\n */\n public get useInvalidateRectOptimization(): boolean {\n return this._useInvalidateRectOptimization;\n }\n\n public set useInvalidateRectOptimization(value: boolean) {\n this._useInvalidateRectOptimization = value;\n }\n\n // Invalidated rectangle which is the combination of all invalidated controls after they have been rotated into absolute position\n private _invalidatedRectangle: Nullable<Measure> = null;\n /**\n * Invalidates a rectangle area on the gui texture\n * @param invalidMinX left most position of the rectangle to invalidate in the texture\n * @param invalidMinY top most position of the rectangle to invalidate in the texture\n * @param invalidMaxX right most position of the rectangle to invalidate in the texture\n * @param invalidMaxY bottom most position of the rectangle to invalidate in the texture\n */\n public invalidateRect(invalidMinX: number, invalidMinY: number, invalidMaxX: number, invalidMaxY: number) {\n if (!this._useInvalidateRectOptimization) {\n return;\n }\n if (!this._invalidatedRectangle) {\n this._invalidatedRectangle = new Measure(invalidMinX, invalidMinY, invalidMaxX - invalidMinX + 1, invalidMaxY - invalidMinY + 1);\n } else {\n // Compute intersection\n var maxX = Math.ceil(Math.max(this._invalidatedRectangle.left + this._invalidatedRectangle.width - 1, invalidMaxX));\n var maxY = Math.ceil(Math.max(this._invalidatedRectangle.top + this._invalidatedRectangle.height - 1, invalidMaxY));\n this._invalidatedRectangle.left = Math.floor(Math.min(this._invalidatedRectangle.left, invalidMinX));\n this._invalidatedRectangle.top = Math.floor(Math.min(this._invalidatedRectangle.top, invalidMinY));\n this._invalidatedRectangle.width = maxX - this._invalidatedRectangle.left + 1;\n this._invalidatedRectangle.height = maxY - this._invalidatedRectangle.top + 1;\n }\n }\n /**\n * Marks the texture as dirty forcing a complete update\n */\n public markAsDirty() {\n this._isDirty = true;\n }\n /**\n * Helper function used to create a new style\n * @returns a new style\n * @see https://doc.babylonjs.com/how_to/gui#styles\n */\n public createStyle(): Style {\n return new Style(this);\n }\n /**\n * Adds a new control to the root container\n * @param control defines the control to add\n * @returns the current texture\n */\n public addControl(control: Control): AdvancedDynamicTexture {\n this._rootContainer.addControl(control);\n return this;\n }\n /**\n * Removes a control from the root container\n * @param control defines the control to remove\n * @returns the current texture\n */\n public removeControl(control: Control): AdvancedDynamicTexture {\n this._rootContainer.removeControl(control);\n return this;\n }\n /**\n * Moves overlapped controls towards a position where it is not overlapping anymore.\n * Please note that this method alters linkOffsetXInPixels and linkOffsetYInPixels.\n * @param overlapGroup the overlap group which will be processed or undefined to process all overlap groups\n * @param deltaStep the step size (speed) to reach the target non overlapping position (default 0.1)\n * @param repelFactor how much is the control repelled by other controls\n */\n public moveToNonOverlappedPosition(overlapGroup?: number | Control[], deltaStep = 1, repelFactor = 1) {\n let controlsForGroup: Control[];\n if (Array.isArray(overlapGroup)) {\n controlsForGroup = overlapGroup;\n } else {\n const descendants = this.getDescendants(true);\n // get only the controls with an overlapGroup property set\n // if the overlapGroup parameter is set, filter the controls and get only the controls belonging to that overlapGroup\n controlsForGroup = overlapGroup === undefined ? descendants.filter((c) => c.overlapGroup !== undefined) : descendants.filter((c) => c.overlapGroup === overlapGroup);\n }\n\n controlsForGroup.forEach((control1) => {\n let velocity = Vector2.Zero();\n const center = new Vector2(control1.centerX, control1.centerY);\n\n controlsForGroup.forEach((control2) => {\n if (control1 !== control2 && AdvancedDynamicTexture._Overlaps(control1, control2)) {\n // if the two controls overlaps get a direction vector from one control's center to another control's center\n const diff = center.subtract(new Vector2(control2.centerX, control2.centerY));\n const diffLength = diff.length();\n\n if (diffLength > 0) {\n // calculate the velocity\n velocity = velocity.add(diff.normalize().scale(repelFactor / diffLength));\n }\n }\n });\n\n if (velocity.length() > 0) {\n // move the control along the direction vector away from the overlapping control\n velocity = velocity.normalize().scale(deltaStep * (control1.overlapDeltaMultiplier ?? 1));\n control1.linkOffsetXInPixels += velocity.x;\n control1.linkOffsetYInPixels += velocity.y;\n }\n });\n }\n /**\n * Release all resources\n */\n public dispose(): void {\n let scene = this.getScene();\n if (!scene) {\n return;\n }\n this._rootElement = null;\n scene.onBeforeCameraRenderObservable.remove(this._renderObserver);\n if (this._resizeObserver) {\n scene.getEngine().onResizeObservable.remove(this._resizeObserver);\n }\n if (this._pointerMoveObserver) {\n scene.onPrePointerObservable.remove(this._pointerMoveObserver);\n }\n if (this._pointerObserver) {\n scene.onPointerObservable.remove(this._pointerObserver);\n }\n if (this._preKeyboardObserver) {\n scene.onPreKeyboardObservable.remove(this._preKeyboardObserver);\n }\n if (this._canvasPointerOutObserver) {\n scene.getEngine().onCanvasPointerOutObservable.remove(this._canvasPointerOutObserver);\n }\n if (this._canvasBlurObserver) {\n scene.getEngine().onCanvasBlurObservable.remove(this._canvasBlurObserver);\n }\n if (this._layerToDispose) {\n this._layerToDispose.texture = null;\n this._layerToDispose.dispose();\n this._layerToDispose = null;\n }\n this._rootContainer.dispose();\n this.onClipboardObservable.clear();\n this.onControlPickedObservable.clear();\n this.onBeginRenderObservable.clear();\n this.onEndRenderObservable.clear();\n this.onBeginLayoutObservable.clear();\n this.onEndLayoutObservable.clear();\n super.dispose();\n }\n private _onResize(): void {\n let scene = this.getScene();\n if (!scene) {\n return;\n }\n // Check size\n var engine = scene.getEngine();\n var textureSize = this.getSize();\n var renderWidth = engine.getRenderWidth() * this._renderScale;\n var renderHeight = engine.getRenderHeight() * this._renderScale;\n\n if (this._renderAtIdealSize) {\n if (this._idealWidth) {\n renderHeight = (renderHeight * this._idealWidth) / renderWidth;\n renderWidth = this._idealWidth;\n } else if (this._idealHeight) {\n renderWidth = (renderWidth * this._idealHeight) / renderHeight;\n renderHeight = this._idealHeight;\n }\n }\n if (textureSize.width !== renderWidth || textureSize.height !== renderHeight) {\n this.scaleTo(renderWidth, renderHeight);\n this.markAsDirty();\n if (this._idealWidth || this._idealHeight) {\n this._rootContainer._markAllAsDirty();\n }\n }\n this.invalidateRect(0, 0, textureSize.width - 1, textureSize.height - 1);\n }\n /** @hidden */\n public _getGlobalViewport(): Viewport {\n var size = this.getSize();\n const globalViewPort = this._fullscreenViewport.toGlobal(size.width, size.height);\n\n const targetX = Math.round(globalViewPort.width * (1 / this.rootContainer.scaleX));\n const targetY = Math.round(globalViewPort.height * (1 / this.rootContainer.scaleY));\n\n globalViewPort.x += (globalViewPort.width - targetX) / 2;\n globalViewPort.y += (globalViewPort.height - targetY) / 2;\n\n globalViewPort.width = targetX;\n globalViewPort.height = targetY;\n\n return globalViewPort;\n }\n /**\n * Get screen coordinates for a vector3\n * @param position defines the position to project\n * @param worldMatrix defines the world matrix to use\n * @returns the projected position\n */\n public getProjectedPosition(position: Vector3, worldMatrix: Matrix): Vector2 {\n const result = this.getProjectedPositionWithZ(position, worldMatrix);\n return new Vector2(result.x, result.y);\n }\n\n /**\n * Get screen coordinates for a vector3\n * @param position defines the position to project\n * @param worldMatrix defines the world matrix to use\n * @returns the projected position with Z\n */\n public getProjectedPositionWithZ(position: Vector3, worldMatrix: Matrix): Vector3 {\n var scene = this.getScene();\n if (!scene) {\n return Vector3.Zero();\n }\n var globalViewport = this._getGlobalViewport();\n var projectedPosition = Vector3.Project(position, worldMatrix, scene.getTransformMatrix(), globalViewport);\n return new Vector3(projectedPosition.x, projectedPosition.y, projectedPosition.z);\n }\n\n private _checkUpdate(camera: Camera): void {\n if (this._layerToDispose) {\n if ((camera.layerMask & this._layerToDispose.layerMask) === 0) {\n return;\n }\n }\n if (this._isFullscreen && this._linkedControls.length) {\n var scene = this.getScene();\n if (!scene) {\n return;\n }\n var globalViewport = this._getGlobalViewport();\n for (let control of this._linkedControls) {\n if (!control.isVisible) {\n continue;\n }\n let mesh = control._linkedMesh as AbstractMesh;\n if (!mesh || mesh.isDisposed()) {\n Tools.SetImmediate(() => {\n control.linkWithMesh(null);\n });\n continue;\n }\n let position = mesh.getBoundingInfo ? mesh.getBoundingInfo().boundingSphere.center : (Vector3.ZeroReadOnly as Vector3);\n let projectedPosition = Vector3.Project(position, mesh.getWorldMatrix(), scene.getTransformMatrix(), globalViewport);\n if (projectedPosition.z < 0 || projectedPosition.z > 1) {\n control.notRenderable = true;\n continue;\n }\n control.notRenderable = false;\n\n control._moveToProjectedPosition(projectedPosition);\n }\n }\n if (!this._isDirty && !this._rootContainer.isDirty) {\n return;\n }\n this._isDirty = false;\n this._render();\n this.update(this.applyYInversionOnUpdate, this.premulAlpha, AdvancedDynamicTexture.AllowGPUOptimizations);\n }\n\n private _clearMeasure = new Measure(0, 0, 0, 0);\n\n private _render(): void {\n var textureSize = this.getSize();\n var renderWidth = textureSize.width;\n var renderHeight = textureSize.height;\n\n var context = this.getContext();\n context.font = \"18px Arial\";\n context.strokeStyle = \"white\";\n\n // Layout\n this.onBeginLayoutObservable.notifyObservers(this);\n var measure = new Measure(0, 0, renderWidth, renderHeight);\n this._numLayoutCalls = 0;\n this._rootContainer._layout(measure, context);\n this.onEndLayoutObservable.notifyObservers(this);\n this._isDirty = false; // Restoring the dirty state that could have been set by controls during layout processing\n\n // Clear\n if (this._invalidatedRectangle) {\n this._clearMeasure.copyFrom(this._invalidatedRectangle);\n } else {\n this._clearMeasure.copyFromFloats(0, 0, renderWidth, renderHeight);\n }\n context.clearRect(this._clearMeasure.left, this._clearMeasure.top, this._clearMeasure.width, this._clearMeasure.height);\n if (this._background) {\n context.save();\n context.fillStyle = this._background;\n context.fillRect(this._clearMeasure.left, this._clearMeasure.top, this._clearMeasure.width, this._clearMeasure.height);\n context.restore();\n }\n\n // Render\n this.onBeginRenderObservable.notifyObservers(this);\n this._numRenderCalls = 0;\n this._rootContainer._render(context, this._invalidatedRectangle);\n this.onEndRenderObservable.notifyObservers(this);\n this._invalidatedRectangle = null;\n }\n /** @hidden */\n public _changeCursor(cursor: string) {\n if (this._rootElement) {\n this._rootElement.style.cursor = cursor;\n this._cursorChanged = true;\n }\n }\n /** @hidden */\n public _registerLastControlDown(control: Control, pointerId: number) {\n this._lastControlDown[pointerId] = control;\n this.onControlPickedObservable.notifyObservers(control);\n }\n private _doPicking(x: number, y: number, pi: PointerInfoBase, type: number, pointerId: number, buttonIndex: number, deltaX?: number, deltaY?: number): void {\n var scene = this.getScene();\n if (!scene) {\n return;\n }\n var engine = scene.getEngine();\n var textureSize = this.getSize();\n if (this._isFullscreen) {\n let camera = scene.cameraToUseForPointers || scene.activeCamera;\n if (!camera) {\n return;\n }\n let viewport = camera.viewport;\n x = x * (textureSize.width / (engine.getRenderWidth() * viewport.width));\n y = y * (textureSize.height / (engine.getRenderHeight() * viewport.height));\n }\n if (this._capturingControl[pointerId]) {\n this._capturingControl[pointerId]._processObservables(type, x, y, pi, pointerId, buttonIndex);\n return;\n }\n\n this._cursorChanged = false;\n if (!this._rootContainer._processPicking(x, y, pi, type, pointerId, buttonIndex, deltaX, deltaY)) {\n if (!scene.doNotHandleCursors) {\n this._changeCursor(\"\");\n }\n if (type === PointerEventTypes.POINTERMOVE) {\n if (this._lastControlOver[pointerId]) {\n this._lastControlOver[pointerId]._onPointerOut(this._lastControlOver[pointerId], pi);\n delete this._lastControlOver[pointerId];\n }\n }\n }\n\n if (!this._cursorChanged && !scene.doNotHandleCursors) {\n this._changeCursor(\"\");\n }\n this._manageFocus();\n }\n /** @hidden */\n public _cleanControlAfterRemovalFromList(list: { [pointerId: number]: Control }, control: Control) {\n for (var pointerId in list) {\n if (!list.hasOwnProperty(pointerId)) {\n continue;\n }\n var lastControlOver = list[pointerId];\n if (lastControlOver === control) {\n delete list[pointerId];\n }\n }\n }\n /** @hidden */\n public _cleanControlAfterRemoval(control: Control) {\n this._cleanControlAfterRemovalFromList(this._lastControlDown, control);\n this._cleanControlAfterRemovalFromList(this._lastControlOver, control);\n }\n /** Attach to all scene events required to support pointer events */\n public attach(): void {\n const scene = this.getScene();\n if (!scene) {\n return;\n }\n\n let tempViewport = new Viewport(0, 0, 0, 0);\n\n this._pointerMoveObserver = scene.onPrePointerObservable.add((pi, state) => {\n if (scene.isPointerCaptured((<IPointerEvent>pi.event).pointerId)) {\n return;\n }\n if (\n pi.type !== PointerEventTypes.POINTERMOVE &&\n pi.type !== PointerEventTypes.POINTERUP &&\n pi.type !== PointerEventTypes.POINTERDOWN &&\n pi.type !== PointerEventTypes.POINTERWHEEL\n ) {\n return;\n }\n\n if (pi.type === PointerEventTypes.POINTERMOVE && (pi.event as IPointerEvent).pointerId) {\n this._defaultMousePointerId = (pi.event as IPointerEvent).pointerId; // This is required to make sure we have the correct pointer ID for wheel\n }\n\n const camera = scene.cameraToUseForPointers || scene.activeCamera;\n const engine = scene.getEngine();\n const originalCameraToUseForPointers = scene.cameraToUseForPointers;\n\n if (!camera) {\n tempViewport.x = 0;\n tempViewport.y = 0;\n tempViewport.width = engine.getRenderWidth();\n tempViewport.height = engine.getRenderHeight();\n } else {\n if (camera.rigCameras.length) {\n // rig camera - we need to find the camera to use for this event\n let rigViewport = new Viewport(0, 0, 1, 1);\n camera.rigCameras.forEach((rigCamera) => {\n // generate the viewport of this camera\n rigCamera.viewport.toGlobalToRef(engine.getRenderWidth(), engine.getRenderHeight(), rigViewport);\n let x = scene.pointerX / engine.getHardwareScalingLevel() - rigViewport.x;\n let y = scene.pointerY / engine.getHardwareScalingLevel() - (engine.getRenderHeight() - rigViewport.y - rigViewport.height);\n // check if the pointer is in the camera's viewport\n if (x < 0 || y < 0 || x > rigViewport.width || y > rigViewport.height) {\n // out of viewport - don't use this camera\n return;\n }\n // set the camera to use for pointers until this pointer loop is over\n scene.cameraToUseForPointers = rigCamera;\n // set the viewport\n tempViewport.x = rigViewport.x;\n tempViewport.y = rigViewport.y;\n tempViewport.width = rigViewport.width;\n tempViewport.height = rigViewport.height;\n });\n } else {\n camera.viewport.toGlobalToRef(engine.getRenderWidth(), engine.getRenderHeight(), tempViewport);\n }\n }\n\n let x = scene.pointerX / engine.getHardwareScalingLevel() - tempViewport.x;\n let y = scene.pointerY / engine.getHardwareScalingLevel() - (engine.getRenderHeight() - tempViewport.y - tempViewport.height);\n this._shouldBlockPointer = false;\n // Do picking modifies _shouldBlockPointer\n let pointerId = (pi.event as IPointerEvent).pointerId || this._defaultMousePointerId;\n this._doPicking(x, y, pi, pi.type, pointerId, pi.event.button, (<IWheelEvent>pi.event).deltaX, (<IWheelEvent>pi.event).deltaY);\n // Avoid overwriting a true skipOnPointerObservable to false\n if (this._shouldBlockPointer) {\n pi.skipOnPointerObservable = this._shouldBlockPointer;\n }\n // if overridden by a rig camera - reset back to the original value\n scene.cameraToUseForPointers = originalCameraToUseForPointers;\n });\n this._attachToOnPointerOut(scene);\n this._attachToOnBlur(scene);\n }\n\n /** @hidden */\n private onClipboardCopy = (rawEvt: Event) => {\n const evt = rawEvt as ClipboardEvent;\n let ev = new ClipboardInfo(ClipboardEventTypes.COPY, evt);\n this.onClipboardObservable.notifyObservers(ev);\n evt.preventDefault();\n };\n /** @hidden */\n private onClipboardCut = (rawEvt: Event) => {\n const evt = rawEvt as ClipboardEvent;\n let ev = new ClipboardInfo(ClipboardEventTypes.CUT, evt);\n this.onClipboardObservable.notifyObservers(ev);\n evt.preventDefault();\n };\n /** @hidden */\n private onClipboardPaste = (rawEvt: Event) => {\n const evt = rawEvt as ClipboardEvent;\n let ev = new ClipboardInfo(ClipboardEventTypes.PASTE, evt);\n this.onClipboardObservable.notifyObservers(ev);\n evt.preventDefault();\n };\n /**\n * Register the clipboard Events onto the canvas\n */\n public registerClipboardEvents(): void {\n self.addEventListener(\"copy\", this.onClipboardCopy, false);\n self.addEventListener(\"cut\", this.onClipboardCut, false);\n self.addEventListener(\"paste\", this.onClipboardPaste, false);\n }\n /**\n * Unregister the clipboard Events from the canvas\n */\n public unRegisterClipboardEvents(): void {\n self.removeEventListener(\"copy\", this.onClipboardCopy);\n self.removeEventListener(\"cut\", this.onClipboardCut);\n self.removeEventListener(\"paste\", this.onClipboardPaste);\n }\n /**\n * Connect the texture to a hosting mesh to enable interactions\n * @param mesh defines the mesh to attach to\n * @param supportPointerMove defines a boolean indicating if pointer move events must be catched as well\n */\n public attachToMesh(mesh: AbstractMesh, supportPointerMove = true): void {\n var scene = this.getScene();\n if (!scene) {\n return;\n }\n this._pointerObserver = scene.onPointerObservable.add((pi, state) => {\n if (\n pi.type !== PointerEventTypes.POINTERMOVE &&\n pi.type !== PointerEventTypes.POINTERUP &&\n pi.type !== PointerEventTypes.POINTERDOWN &&\n pi.type !== PointerEventTypes.POINTERWHEEL\n ) {\n return;\n }\n\n if (pi.type === PointerEventTypes.POINTERMOVE && (pi.event as IPointerEvent).pointerId) {\n this._defaultMousePointerId = (pi.event as IPointerEvent).pointerId; // This is required to make sure we have the correct pointer ID for wheel\n }\n\n var pointerId = (pi.event as IPointerEvent).pointerId || this._defaultMousePointerId;\n if (pi.pickInfo && pi.pickInfo.hit && pi.pickInfo.pickedMesh === mesh) {\n var uv = pi.pickInfo.getTextureCoordinates();\n if (uv) {\n let size = this.getSize();\n this._doPicking(\n uv.x * size.width,\n (this.applyYInversionOnUpdate ? 1.0 - uv.y : uv.y) * size.height,\n pi,\n pi.type,\n pointerId,\n pi.event.button,\n (<IWheelEvent>pi.event).deltaX,\n (<IWheelEvent>pi.event).deltaY\n );\n }\n } else if (pi.type === PointerEventTypes.POINTERUP) {\n if (this._lastControlDown[pointerId]) {\n this._lastControlDown[pointerId]._forcePointerUp(pointerId);\n }\n delete this._lastControlDown[pointerId];\n if (this.focusedControl) {\n const friendlyControls = this.focusedControl.keepsFocusWith();\n let canMoveFocus = true;\n if (friendlyControls) {\n for (var control of friendlyControls) {\n // Same host, no need to keep the focus\n if (this === control._host) {\n continue;\n }\n // Different hosts\n const otherHost = control._host;\n if (otherHost._lastControlOver[pointerId] && otherHost._lastControlOver[pointerId].isAscendant(control)) {\n canMoveFocus = false;\n break;\n }\n }\n }\n if (canMoveFocus) {\n this.focusedControl = null;\n }\n }\n } else if (pi.type === PointerEventTypes.POINTERMOVE) {\n if (this._lastControlOver[pointerId]) {\n this._lastControlOver[pointerId]._onPointerOut(this._lastControlOver[pointerId], pi, true);\n }\n delete this._lastControlOver[pointerId];\n }\n });\n mesh.enablePointerMoveEvents = supportPointerMove;\n this._attachToOnPointerOut(scene);\n this._attachToOnBlur(scene);\n }\n /**\n * Move the focus to a specific control\n * @param control defines the control which will receive the focus\n */\n public moveFocusToControl(control: IFocusableControl): void {\n this.focusedControl = control;\n this._lastPickedControl = <any>control;\n this._blockNextFocusCheck = true;\n }\n private _manageFocus(): void {\n if (this._blockNextFocusCheck) {\n this._blockNextFocusCheck = false;\n this._lastPickedControl = <any>this._focusedControl;\n return;\n }\n // Focus management\n if (this._focusedControl) {\n if (this._focusedControl !== <any>this._lastPickedControl) {\n if (this._lastPickedControl.isFocusInvisible) {\n return;\n }\n this.focusedControl = null;\n }\n }\n }\n private _attachToOnPointerOut(scene: Scene): void {\n this._canvasPointerOutObserver = scene.getEngine().onCanvasPointerOutObservable.add((pointerEvent) => {\n if (this._lastControlOver[pointerEvent.pointerId]) {\n this._lastControlOver[pointerEvent.pointerId]._onPointerOut(this._lastControlOver[pointerEvent.pointerId], null);\n }\n delete this._lastControlOver[pointerEvent.pointerId];\n if (this._lastControlDown[pointerEvent.pointerId] && this._lastControlDown[pointerEvent.pointerId] !== this._capturingControl[pointerEvent.pointerId]) {\n this._lastControlDown[pointerEvent.pointerId]._forcePointerUp();\n delete this._lastControlDown[pointerEvent.pointerId];\n }\n });\n }\n private _attachToOnBlur(scene: Scene): void {\n this._canvasBlurObserver = scene.getEngine().onCanvasBlurObservable.add((pointerEvent) => {\n Object.entries(this._lastControlDown).forEach(([key, value]) => {\n value._onCanvasBlur();\n });\n this.focusedControl = null;\n this._lastControlDown = {};\n });\n }\n\n /**\n * Serializes the entire GUI system\n * @returns an object with the JSON serialized data\n */\n public serializeContent(): any {\n const size = this.getSize();\n let serializationObject = {\n root: {},\n width: size.width,\n height: size.height,\n };\n\n this._rootContainer.serialize(serializationObject.root);\n\n return serializationObject;\n }\n\n /**\n * Recreate the content of the ADT from a JSON object\n * @param serializedObject define the JSON serialized object to restore from\n * @param scaleToSize defines whether to scale to texture to the saved size\n */\n public parseContent(serializedObject: any, scaleToSize?: boolean) {\n this._rootContainer = Control.Parse(serializedObject.root, this) as Container;\n if (scaleToSize) {\n const width = serializedObject.width;\n const height = serializedObject.height;\n if (typeof width === \"number\" && typeof height === \"number\" && width >= 0 && height >= 0) {\n this.scaleTo(width, height);\n }\n }\n }\n\n /**\n * Recreate the content of the ADT from a snippet saved by the GUI editor\n * @param snippetId defines the snippet to load\n * @param scaleToSize defines whether to scale to texture to the saved size\n * @returns a promise that will resolve on success\n */\n public parseFromSnippetAsync(snippetId: string, scaleToSize?: boolean): Promise<void> {\n if (snippetId === \"_BLANK\") {\n return Promise.resolve();\n }\n\n return new Promise((resolve, reject) => {\n var request = new WebRequest();\n request.addEventListener(\"readystatechange\", () => {\n if (request.readyState == 4) {\n if (request.status == 200) {\n var snippet = JSON.parse(JSON.parse(request.responseText).jsonPayload);\n let serializationObject = JSON.parse(snippet.gui);\n\n this.parseContent(serializationObject, scaleToSize);\n this.snippetId = snippetId;\n\n resolve();\n } else {\n reject(\"Unable to load the snippet \" + snippetId);\n }\n }\n });\n\n request.open(\"GET\", AdvancedDynamicTexture.SnippetUrl + \"/\" + snippetId.replace(/#/g, \"/\"));\n request.send();\n });\n }\n\n /**\n * Recreate the content of the ADT from a url json\n * @param url defines the url to load\n * @param scaleToSize defines whether to scale to texture to the saved size\n * @returns a promise that will resolve on success\n */\n public parseFromURLAsync(url: string, scaleToSize?: boolean): Promise<void> {\n if (url === \"\") {\n return Promise.resolve();\n }\n\n return new Promise((resolve, reject) => {\n var request = new WebRequest();\n request.addEventListener(\"readystatechange\", () => {\n if (request.readyState == 4) {\n if (request.status == 200) {\n var gui = request.responseText;\n let serializationObject = JSON.parse(gui);\n this.parseContent(serializationObject, scaleToSize);\n\n resolve();\n } else {\n reject(\"Unable to load\");\n }\n }\n });\n request.open(\"GET\", url);\n request.send();\n });\n }\n\n // Statics\n /**\n * Compares two rectangle based controls for pixel overlap\n * @param control1 The first control to compare\n * @param control2 The second control to compare\n * @returns true if overlaps, otherwise false\n */\n private static _Overlaps(control1: Control, control2: Control) {\n return !(\n control1.centerX > control2.centerX + control2.widthInPixels ||\n control1.centerX + control1.widthInPixels < control2.centerX ||\n control1.centerY + control1.heightInPixels < control2.centerY ||\n control1.centerY > control2.centerY + control2.heightInPixels\n );\n }\n\n /**\n * Creates a new AdvancedDynamicTexture in projected mode (ie. attached to a mesh)\n * @param mesh defines the mesh which will receive the texture\n * @param width defines the texture width (1024 by default)\n * @param height defines the texture height (1024 by default)\n * @param supportPointerMove defines a boolean indicating if the texture must capture move events (true by default)\n * @param onlyAlphaTesting defines a boolean indicating that alpha blending will not be used (only alpha testing) (false by default)\n * @param invertY defines if the texture needs to be inverted on the y axis during loading (true by default)\n * @returns a new AdvancedDynamicTexture\n */\n public static CreateForMesh(mesh: AbstractMesh, width = 1024, height = 1024, supportPointerMove = true, onlyAlphaTesting = false, invertY?: boolean): AdvancedDynamicTexture {\n var result = new AdvancedDynamicTexture(mesh.name + \" AdvancedDynamicTexture\", width, height, mesh.getScene(), true, Texture.TRILINEAR_SAMPLINGMODE, invertY);\n var material = new StandardMaterial(\"AdvancedDynamicTextureMaterial\", mesh.getScene());\n material.backFaceCulling = false;\n material.diffuseColor = Color3.Black();\n material.specularColor = Color3.Black();\n if (onlyAlphaTesting) {\n material.diffuseTexture = result;\n material.emissiveTexture = result;\n result.hasAlpha = true;\n } else {\n material.emissiveTexture = result;\n material.opacityTexture = result;\n }\n mesh.material = material;\n result.attachToMesh(mesh, supportPointerMove);\n return result;\n }\n\n /**\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\n * @param mesh defines the mesh which will receive the texture\n * @param width defines the texture width (1024 by default)\n * @param height defines the texture height (1024 by default)\n * @param supportPointerMove defines a boolean indicating if the texture must capture move events (true by default)\n * @param invertY defines if the texture needs to be inverted on the y axis during loading (true by default)\n * @returns a new AdvancedDynamicTexture\n */\n public static CreateForMeshTexture(mesh: AbstractMesh, width = 1024, height = 1024, supportPointerMove = true, invertY?: boolean): AdvancedDynamicTexture {\n var result = new AdvancedDynamicTexture(mesh.name + \" AdvancedDynamicTexture\", width, height, mesh.getScene(), true, Texture.TRILINEAR_SAMPLINGMODE, invertY);\n result.attachToMesh(mesh, supportPointerMove);\n return result;\n }\n /**\n * Creates a new AdvancedDynamicTexture in fullscreen mode.\n * In this mode the texture will rely on a layer for its rendering.\n * This allows it to be treated like any other layer.\n * As such, if you have a multi camera setup, you can set the layerMask on the GUI as well.\n * LayerMask is set through advancedTexture.layer.layerMask\n * @param name defines name for the texture\n * @param foreground defines a boolean indicating if the texture must be rendered in foreground (default is true)\n * @param scene defines the hosting scene\n * @param sampling defines the texture sampling mode (Texture.BILINEAR_SAMPLINGMODE by default)\n * @param adaptiveScaling defines whether to automatically scale root to match hardwarescaling (false by default)\n * @returns a new AdvancedDynamicTexture\n */\n public static CreateFullscreenUI(name: string, foreground: boolean = true, scene: Nullable<Scene> = null, sampling = Texture.BILINEAR_SAMPLINGMODE, adaptiveScaling: boolean = false): AdvancedDynamicTexture {\n var result = new AdvancedDynamicTexture(name, 0, 0, scene, false, sampling);\n // Display\n const resultScene = result.getScene();\n var layer = new Layer(name + \"_layer\", null, resultScene, !foreground);\n layer.texture = result;\n result._layerToDispose = layer;\n result._isFullscreen = true;\n\n if (adaptiveScaling && resultScene) {\n const newScale = 1 / resultScene.getEngine().getHardwareScalingLevel();\n result._rootContainer.scaleX = newScale;\n result._rootContainer.scaleY = newScale;\n }\n\n // Attach\n result.attach();\n return result;\n }\n}\n"]}
@@ -339,10 +339,10 @@ var Container = /** @class */ (function (_super) {
339
339
  child._tempParentMeasure.copyFrom(this._measureForChildren);
340
340
  if (child._layout(this._measureForChildren, context)) {
341
341
  if (this.adaptWidthToChildren && child._width.isPixel) {
342
- computedWidth = Math.max(computedWidth, child._currentMeasure.width + child.paddingLeftInPixels + child.paddingRightInPixels);
342
+ computedWidth = Math.max(computedWidth, child._currentMeasure.width + child._paddingLeftInPixels + child._paddingRightInPixels);
343
343
  }
344
344
  if (this.adaptHeightToChildren && child._height.isPixel) {
345
- computedHeight = Math.max(computedHeight, child._currentMeasure.height + child.paddingTopInPixels + child.paddingBottomInPixels);
345
+ computedHeight = Math.max(computedHeight, child._currentMeasure.height + child._paddingTopInPixels + child._paddingBottomInPixels);
346
346
  }
347
347
  }
348
348
  }