@babylonjs/gui 6.39.0 → 6.41.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. package/2D/advancedDynamicTexture.d.ts +1 -1
  2. package/2D/advancedDynamicTexture.js +2 -1
  3. package/2D/advancedDynamicTexture.js.map +1 -1
  4. package/2D/controls/button.d.ts +2 -5
  5. package/2D/controls/button.js +6 -6
  6. package/2D/controls/button.js.map +1 -1
  7. package/2D/controls/checkbox.js +2 -1
  8. package/2D/controls/checkbox.js.map +1 -1
  9. package/2D/controls/container.d.ts +6 -1
  10. package/2D/controls/container.js +31 -5
  11. package/2D/controls/container.js.map +1 -1
  12. package/2D/controls/control.d.ts +9 -1
  13. package/2D/controls/control.js +16 -2
  14. package/2D/controls/control.js.map +1 -1
  15. package/2D/controls/focusableButton.d.ts +1 -1
  16. package/2D/controls/focusableButton.js +1 -1
  17. package/2D/controls/focusableButton.js.map +1 -1
  18. package/2D/controls/gradient/BaseGradient.d.ts +17 -5
  19. package/2D/controls/gradient/BaseGradient.js +17 -5
  20. package/2D/controls/gradient/BaseGradient.js.map +1 -1
  21. package/2D/controls/grid.d.ts +2 -1
  22. package/2D/controls/grid.js +6 -2
  23. package/2D/controls/grid.js.map +1 -1
  24. package/2D/controls/image.d.ts +2 -1
  25. package/2D/controls/image.js +2 -1
  26. package/2D/controls/image.js.map +1 -1
  27. package/2D/controls/stackPanel.d.ts +2 -1
  28. package/2D/controls/stackPanel.js +6 -2
  29. package/2D/controls/stackPanel.js.map +1 -1
  30. package/2D/xmlLoader.js +9 -0
  31. package/2D/xmlLoader.js.map +1 -1
  32. package/3D/controls/button3D.d.ts +1 -0
  33. package/3D/controls/button3D.js +1 -0
  34. package/3D/controls/button3D.js.map +1 -1
  35. package/3D/controls/control3D.d.ts +1 -1
  36. package/3D/controls/control3D.js +1 -1
  37. package/3D/controls/control3D.js.map +1 -1
  38. package/3D/controls/holographicSlate.d.ts +1 -1
  39. package/3D/controls/holographicSlate.js +1 -1
  40. package/3D/controls/holographicSlate.js.map +1 -1
  41. package/3D/controls/touchHolographicMenu.d.ts +2 -2
  42. package/3D/controls/touchHolographicMenu.js +2 -2
  43. package/3D/controls/touchHolographicMenu.js.map +1 -1
  44. package/3D/materials/fluent/fluentMaterial.js +5 -4
  45. package/3D/materials/fluent/fluentMaterial.js.map +1 -1
  46. package/3D/materials/fluentBackplate/fluentBackplateMaterial.js +4 -3
  47. package/3D/materials/fluentBackplate/fluentBackplateMaterial.js.map +1 -1
  48. package/3D/materials/fluentButton/fluentButtonMaterial.js +4 -3
  49. package/3D/materials/fluentButton/fluentButtonMaterial.js.map +1 -1
  50. package/3D/materials/mrdl/mrdlBackglowMaterial.js +4 -3
  51. package/3D/materials/mrdl/mrdlBackglowMaterial.js.map +1 -1
  52. package/3D/materials/mrdl/mrdlBackplateMaterial.js +4 -3
  53. package/3D/materials/mrdl/mrdlBackplateMaterial.js.map +1 -1
  54. package/3D/materials/mrdl/mrdlFrontplateMaterial.js +4 -3
  55. package/3D/materials/mrdl/mrdlFrontplateMaterial.js.map +1 -1
  56. package/3D/materials/mrdl/mrdlInnerquadMaterial.js +4 -3
  57. package/3D/materials/mrdl/mrdlInnerquadMaterial.js.map +1 -1
  58. package/3D/materials/mrdl/mrdlSliderBarMaterial.js +4 -3
  59. package/3D/materials/mrdl/mrdlSliderBarMaterial.js.map +1 -1
  60. package/3D/materials/mrdl/mrdlSliderThumbMaterial.js +4 -3
  61. package/3D/materials/mrdl/mrdlSliderThumbMaterial.js.map +1 -1
  62. package/package.json +2 -2
@@ -33,6 +33,7 @@ export declare class Button3D extends AbstractButton3D {
33
33
  /**
34
34
  * Creates a new button
35
35
  * @param name defines the control name
36
+ * @param options defines the options used to create the button
36
37
  */
37
38
  constructor(name?: string, options?: IButton3DCreationOptions);
38
39
  /**
@@ -10,6 +10,7 @@ export class Button3D extends AbstractButton3D {
10
10
  /**
11
11
  * Creates a new button
12
12
  * @param name defines the control name
13
+ * @param options defines the options used to create the button
13
14
  */
14
15
  constructor(name, options) {
15
16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KAAM,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAO,CAAC;QACpG,IAAI,CAAC,wBAAwB,EAAE,CAAC;QAEhC,OAAO,IAAI,CAAC;IAChB,CAAC;IAES,eAAe,CAAC,IAAkB;QACxC,MAAM,QAAQ,GAAG,IAAI,gBAAgB,CAAC,IAAI,CAAC,IAAI,GAAG,UAAU,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;QAC/E,QAAQ,CAAC,aAAa,GAAG,MAAM,CAAC,KAAK,EAAE,CAAC;QAExC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,gBAAgB,GAAG,QAAQ,CAAC;QAEjC,IAAI,CAAC,aAAa,EAAE,CAAC;IACzB,CAAC;IAED;;OAEG;IACI,OAAO;QACV,KAAK,CAAC,OAAO,EAAE,CAAC;QAEhB,IAAI,CAAC,qBAAqB,EAAE,CAAC;QAE7B,IAAI,IAAI,CAAC,gBAAgB,EAAE;YACvB,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,CAAC;SACnC;IACL,CAAC;CACJ","sourcesContent":["import { Vector4 } from \"core/Maths/math.vector\";\r\nimport type { TransformNode } from \"core/Meshes/transformNode\";\r\nimport type { AbstractMesh } from \"core/Meshes/abstractMesh\";\r\nimport { CreateBox } from \"core/Meshes/Builders/boxBuilder\";\r\nimport type { Material } from \"core/Materials/material\";\r\nimport { StandardMaterial } from \"core/Materials/standardMaterial\";\r\nimport type { Scene } from \"core/scene\";\r\n\r\nimport { AbstractButton3D } from \"./abstractButton3D\";\r\nimport type { AdvancedDynamicTexture } from \"../../2D/advancedDynamicTexture\";\r\nimport { Color3 } from \"core/Maths/math.color\";\r\n\r\n/**\r\n * Options used to create a button in 3D\r\n */\r\nexport interface IButton3DCreationOptions {\r\n /**\r\n * Width of the button. Default: 1\r\n */\r\n width?: number;\r\n\r\n /**\r\n * Height of the button. Default: 1\r\n */\r\n height?: number;\r\n\r\n /**\r\n * Depth of the button. Default: 0.08\r\n */\r\n depth?: number;\r\n}\r\n\r\n/**\r\n * Class used to create a button in 3D\r\n */\r\nexport class Button3D extends AbstractButton3D {\r\n /** @internal */\r\n protected _currentMaterial: Material;\r\n\r\n protected _options: IButton3DCreationOptions;\r\n protected _height: number;\r\n protected _depth: number;\r\n\r\n /**\r\n * Creates a new button\r\n * @param name defines the control name\r\n */\r\n constructor(name?: string, options?: IButton3DCreationOptions) {\r\n super(name);\r\n\r\n this._options = {\r\n width: 1,\r\n height: 1,\r\n depth: 0.08,\r\n ...options,\r\n };\r\n\r\n // Default animations\r\n\r\n this.pointerEnterAnimation = () => {\r\n if (!this.mesh) {\r\n return;\r\n }\r\n (<StandardMaterial>this._currentMaterial).emissiveColor = Color3.Red();\r\n };\r\n\r\n this.pointerOutAnimation = () => {\r\n (<StandardMaterial>this._currentMaterial).emissiveColor = Color3.Black();\r\n };\r\n\r\n this.pointerDownAnimation = () => {\r\n if (!this.mesh) {\r\n return;\r\n }\r\n\r\n this.mesh.scaling.scaleInPlace(0.95);\r\n };\r\n\r\n this.pointerUpAnimation = () => {\r\n if (!this.mesh) {\r\n return;\r\n }\r\n\r\n this.mesh.scaling.scaleInPlace(1.0 / 0.95);\r\n };\r\n }\r\n\r\n /**\r\n * Apply the facade texture (created from the content property).\r\n * @param facadeTexture defines the AdvancedDynamicTexture to use\r\n */\r\n protected _applyFacade(facadeTexture: AdvancedDynamicTexture) {\r\n (<any>this._currentMaterial).emissiveTexture = facadeTexture;\r\n }\r\n\r\n protected _getTypeName(): string {\r\n return \"Button3D\";\r\n }\r\n\r\n // Mesh association\r\n protected _createNode(scene: Scene): TransformNode {\r\n const faceUV = new Array(6);\r\n\r\n for (let i = 0; i < 6; i++) {\r\n faceUV[i] = new Vector4(0, 0, 0, 0);\r\n }\r\n if (scene.useRightHandedSystem) {\r\n // Flip the u on the texture\r\n faceUV[0].copyFromFloats(1, 0, 0, 1);\r\n } else {\r\n faceUV[1].copyFromFloats(0, 0, 1, 1);\r\n }\r\n\r\n const mesh = CreateBox(\r\n this.name + \"_rootMesh\",\r\n {\r\n width: this._options.width,\r\n height: this._options.height,\r\n depth: this._options.depth,\r\n faceUV: faceUV,\r\n wrap: true,\r\n },\r\n scene\r\n );\r\n\r\n this._contentScaleRatioY = (this._contentScaleRatio * this._options.width!) / this._options.height!;\r\n this._setFacadeTextureScaling();\r\n\r\n return mesh;\r\n }\r\n\r\n protected _affectMaterial(mesh: AbstractMesh) {\r\n const material = new StandardMaterial(this.name + \"Material\", mesh.getScene());\r\n material.specularColor = Color3.Black();\r\n\r\n mesh.material = material;\r\n this._currentMaterial = material;\r\n\r\n this._resetContent();\r\n }\r\n\r\n /**\r\n * Releases all associated resources\r\n */\r\n public dispose() {\r\n super.dispose();\r\n\r\n this._disposeFacadeTexture();\r\n\r\n if (this._currentMaterial) {\r\n this._currentMaterial.dispose();\r\n }\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"button3D.js","sourceRoot":"","sources":["../../../../../dev/gui/src/3D/controls/button3D.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,6CAA+B;AAGjD,OAAO,EAAE,SAAS,EAAE,sDAAwC;AAE5D,OAAO,EAAE,gBAAgB,EAAE,sDAAwC;AAGnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,OAAO,EAAE,MAAM,EAAE,4CAA8B;AAsB/C;;GAEG;AACH,MAAM,OAAO,QAAS,SAAQ,gBAAgB;IAQ1C;;;;OAIG;IACH,YAAY,IAAa,EAAE,OAAkC;QACzD,KAAK,CAAC,IAAI,CAAC,CAAC;QAEZ,IAAI,CAAC,QAAQ,GAAG;YACZ,KAAK,EAAE,CAAC;YACR,MAAM,EAAE,CAAC;YACT,KAAK,EAAE,IAAI;YACX,GAAG,OAAO;SACb,CAAC;QAEF,qBAAqB;QAErB,IAAI,CAAC,qBAAqB,GAAG,GAAG,EAAE;YAC9B,IAAI,CAAC,IAAI,CAAC,IAAI,EA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sourcesContent":["import { Vector4 } from \"core/Maths/math.vector\";\r\nimport type { TransformNode } from \"core/Meshes/transformNode\";\r\nimport type { AbstractMesh } from \"core/Meshes/abstractMesh\";\r\nimport { CreateBox } from \"core/Meshes/Builders/boxBuilder\";\r\nimport type { Material } from \"core/Materials/material\";\r\nimport { StandardMaterial } from \"core/Materials/standardMaterial\";\r\nimport type { Scene } from \"core/scene\";\r\n\r\nimport { AbstractButton3D } from \"./abstractButton3D\";\r\nimport type { AdvancedDynamicTexture } from \"../../2D/advancedDynamicTexture\";\r\nimport { Color3 } from \"core/Maths/math.color\";\r\n\r\n/**\r\n * Options used to create a button in 3D\r\n */\r\nexport interface IButton3DCreationOptions {\r\n /**\r\n * Width of the button. Default: 1\r\n */\r\n width?: number;\r\n\r\n /**\r\n * Height of the button. Default: 1\r\n */\r\n height?: number;\r\n\r\n /**\r\n * Depth of the button. Default: 0.08\r\n */\r\n depth?: number;\r\n}\r\n\r\n/**\r\n * Class used to create a button in 3D\r\n */\r\nexport class Button3D extends AbstractButton3D {\r\n /** @internal */\r\n protected _currentMaterial: Material;\r\n\r\n protected _options: IButton3DCreationOptions;\r\n protected _height: number;\r\n protected _depth: number;\r\n\r\n /**\r\n * Creates a new button\r\n * @param name defines the control name\r\n * @param options defines the options used to create the button\r\n */\r\n constructor(name?: string, options?: IButton3DCreationOptions) {\r\n super(name);\r\n\r\n this._options = {\r\n width: 1,\r\n height: 1,\r\n depth: 0.08,\r\n ...options,\r\n };\r\n\r\n // Default animations\r\n\r\n this.pointerEnterAnimation = () => {\r\n if (!this.mesh) {\r\n return;\r\n }\r\n (<StandardMaterial>this._currentMaterial).emissiveColor = Color3.Red();\r\n };\r\n\r\n this.pointerOutAnimation = () => {\r\n (<StandardMaterial>this._currentMaterial).emissiveColor = Color3.Black();\r\n };\r\n\r\n this.pointerDownAnimation = () => {\r\n if (!this.mesh) {\r\n return;\r\n }\r\n\r\n this.mesh.scaling.scaleInPlace(0.95);\r\n };\r\n\r\n this.pointerUpAnimation = () => {\r\n if (!this.mesh) {\r\n return;\r\n }\r\n\r\n this.mesh.scaling.scaleInPlace(1.0 / 0.95);\r\n };\r\n }\r\n\r\n /**\r\n * Apply the facade texture (created from the content property).\r\n * @param facadeTexture defines the AdvancedDynamicTexture to use\r\n */\r\n protected _applyFacade(facadeTexture: AdvancedDynamicTexture) {\r\n (<any>this._currentMaterial).emissiveTexture = facadeTexture;\r\n }\r\n\r\n protected _getTypeName(): string {\r\n return \"Button3D\";\r\n }\r\n\r\n // Mesh association\r\n protected _createNode(scene: Scene): TransformNode {\r\n const faceUV = new Array(6);\r\n\r\n for (let i = 0; i < 6; i++) {\r\n faceUV[i] = new Vector4(0, 0, 0, 0);\r\n }\r\n if (scene.useRightHandedSystem) {\r\n // Flip the u on the texture\r\n faceUV[0].copyFromFloats(1, 0, 0, 1);\r\n } else {\r\n faceUV[1].copyFromFloats(0, 0, 1, 1);\r\n }\r\n\r\n const mesh = CreateBox(\r\n this.name + \"_rootMesh\",\r\n {\r\n width: this._options.width,\r\n height: this._options.height,\r\n depth: this._options.depth,\r\n faceUV: faceUV,\r\n wrap: true,\r\n },\r\n scene\r\n );\r\n\r\n this._contentScaleRatioY = (this._contentScaleRatio * this._options.width!) / this._options.height!;\r\n this._setFacadeTextureScaling();\r\n\r\n return mesh;\r\n }\r\n\r\n protected _affectMaterial(mesh: AbstractMesh) {\r\n const material = new StandardMaterial(this.name + \"Material\", mesh.getScene());\r\n material.specularColor = Color3.Black();\r\n\r\n mesh.material = material;\r\n this._currentMaterial = material;\r\n\r\n this._resetContent();\r\n }\r\n\r\n /**\r\n * Releases all associated resources\r\n */\r\n public dispose() {\r\n super.dispose();\r\n\r\n this._disposeFacadeTexture();\r\n\r\n if (this._currentMaterial) {\r\n this._currentMaterial.dispose();\r\n }\r\n }\r\n}\r\n"]}
@@ -127,7 +127,7 @@ export declare class Control3D implements IDisposable, IBehaviorAware<Control3D>
127
127
  */
128
128
  linkToTransformNode(node: Nullable<TransformNode>): Control3D;
129
129
  /**
130
- * @internal*
130
+ * @internal
131
131
  */
132
132
  _prepareNode(scene: Scene): void;
133
133
  protected _injectGUI3DReservedDataStore(node: TransformNode): any;
@@ -193,7 +193,7 @@ export class Control3D {
193
193
  return this;
194
194
  }
195
195
  /**
196
- * @internal*
196
+ * @internal
197
197
  */
198
198
  _prepareNode(scene) {
199
199
  if (!this._node) {
@@ -1 +1 @@
1
- {"version":3,"file":"control3D.js","sourceRoot":"","sources":["../../../../../dev/gui/src/3D/controls/control3D.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,2CAA6B;AAClD,OAAO,EAAE,OAAO,EAAE,6CAA+B;AACjD,OAAO,EAAE,iBAAiB,EAAE,gDAAkC;AAE9D,OAAO,EAAE,YAAY,EAAE,+CAAiC;AAKxD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAKrD;;GAEG;AACH,MAAM,OAAO,SAAS;IAalB,uDAAuD;IACvD,IAAW,QAAQ;QACf,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE;YACb,OAAO,OAAO,CAAC,IAAI,EAAE,CAAC;SACzB;QAED,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC;IAC/B,CAAC;IAED,IAAW,QAAQ,CAAC,KAAc;QAC9B,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE;YACb,OAAO;SACV;QAED,IAAI,CAAC,KAAK,CAAC,QAAQ,GAAG,KAAK,CAAC;IAChC,CAAC;IAED,sDAAsD;IACtD,IAAW,OAAO;QACd,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE;YACb,OAAO,IAAI,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;SAC/B;QAED,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC;IAC9B,CAAC;IAED,IAAW,OAAO,CAAC,KAAc;QAC7B,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE;YACb,OAAO;SACV;QAED,IAAI,CAA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EAAE,WAAW,EAAE,SAAS,EAAE,WAAW,EAAE,IAAI,CAAC,CAAC;aACxG;YACD,OAAO,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC;YAC9C,OAAO,IAAI,CAAC;SACf;QAED,OAAO,KAAK,CAAC;IACjB,CAAC;IAED,gBAAgB;IACT,YAAY;QACf,IAAI,IAAI,CAAC,KAAK,EAAE;YACZ,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;YACrB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;SACrB;IACL,CAAC;IAED;;OAEG;IACI,OAAO;QACV,IAAI,CAAC,uBAAuB,CAAC,KAAK,EAAE,CAAC;QACrC,IAAI,CAAC,wBAAwB,CAAC,KAAK,EAAE,CAAC;QACtC,IAAI,CAAC,uBAAuB,CAAC,KAAK,EAAE,CAAC;QACrC,IAAI,CAAC,sBAAsB,CAAC,KAAK,EAAE,CAAC;QACpC,IAAI,CAAC,qBAAqB,CAAC,KAAK,EAAE,CAAC;QACnC,IAAI,CAAC,wBAAwB,CAAC,KAAK,EAAE,CAAC;QAEtC,IAAI,CAAC,YAAY,EAAE,CAAC;QAEpB,YAAY;QACZ,KAAK,MAAM,QAAQ,IAAI,IAAI,CAAC,UAAU,EAAE;YACpC,QAAQ,CAAC,MAAM,EAAE,CAAC;SACrB;IACL,CAAC;CACJ","sourcesContent":["import type { Nullable } from \"core/types\";\r\nimport { Observable } from \"core/Misc/observable\";\r\nimport { Vector3 } from \"core/Maths/math.vector\";\r\nimport { PointerEventTypes } from \"core/Events/pointerEvents\";\r\nimport type { TransformNode } from \"core/Meshes/transformNode\";\r\nimport { AbstractMesh } from \"core/Meshes/abstractMesh\";\r\nimport type { IBehaviorAware, Behavior } from \"core/Behaviors/behavior\";\r\nimport type { IDisposable, Scene } from \"core/scene\";\r\n\r\nimport type { GUI3DManager } from \"../gui3DManager\";\r\nimport { Vector3WithInfo } from \"../vector3WithInfo\";\r\nimport type { Container3D } from \"./container3D\";\r\n\r\nimport type { TouchButton3D } from \"./touchButton3D\";\r\n\r\n/**\r\n * Class used as base class for controls\r\n */\r\nexport class Control3D implements IDisposable, IBehaviorAware<Control3D> {\r\n private _node: Nullable<TransformNode>;\r\n private _downCount = 0;\r\n private _enterCount = -1;\r\n private _downPointerIds: { [id: number]: number } = {}; // Store number of pointer downs per ID, from near and far interactions\r\n\r\n protected _isVisible = true;\r\n\r\n /** @internal */\r\n public _host: GUI3DManager;\r\n /** @internal */\r\n public _isScaledByManager = false;\r\n\r\n /** Gets or sets the control position in world space */\r\n public get position(): Vector3 {\r\n if (!this._node) {\r\n return Vector3.Zero();\r\n }\r\n\r\n return this._node.position;\r\n }\r\n\r\n public set position(value: Vector3) {\r\n if (!this._node) {\r\n return;\r\n }\r\n\r\n this._node.position = value;\r\n }\r\n\r\n /** Gets or sets the control scaling in world space */\r\n public get scaling(): Vector3 {\r\n if (!this._node) {\r\n return new Vector3(1, 1, 1);\r\n }\r\n\r\n return this._node.scaling;\r\n }\r\n\r\n public set scaling(value: Vector3) {\r\n if (!this._node) {\r\n return;\r\n }\r\n\r\n this._isScaledByManager = false;\r\n this._node.scaling = value;\r\n }\r\n\r\n /** Callback used to start pointer enter animation */\r\n public pointerEnterAnimation: () => void;\r\n /** Callback used to start pointer out animation */\r\n public pointerOutAnimation: () => void;\r\n /** Callback used to start pointer down animation */\r\n public pointerDownAnimation: () => void;\r\n /** Callback used to start pointer up animation */\r\n public pointerUpAnimation: () => void;\r\n\r\n /**\r\n * An event triggered when the pointer moves over the control\r\n */\r\n public onPointerMoveObservable = new Observable<Vector3>();\r\n\r\n /**\r\n * An event triggered when the pointer moves out of the control\r\n */\r\n public onPointerOutObservable = new Observable<Control3D>();\r\n\r\n /**\r\n * An event triggered when the pointer taps the control\r\n */\r\n public onPointerDownObservable = new Observable<Vector3WithInfo>();\r\n\r\n /**\r\n * An event triggered when pointer is up\r\n */\r\n public onPointerUpObservable = new Observable<Vector3WithInfo>();\r\n\r\n /**\r\n * An event triggered when a control is clicked on (with a mouse)\r\n */\r\n public onPointerClickObservable = new Observable<Vector3WithInfo>();\r\n\r\n /**\r\n * An event triggered when pointer enters the control\r\n */\r\n public onPointerEnterObservable = new Observable<Control3D>();\r\n\r\n /**\r\n * Gets or sets the parent container\r\n */\r\n public parent: Nullable<Container3D>;\r\n\r\n // Behaviors\r\n private _behaviors = new Array<Behavior<Control3D>>();\r\n\r\n /**\r\n * Gets the list of attached behaviors\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/behaviors\r\n */\r\n public get behaviors(): Behavior<Control3D>[] {\r\n return this._behaviors;\r\n }\r\n\r\n /**\r\n * Attach a behavior to the control\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/behaviors\r\n * @param behavior defines the behavior to attach\r\n * @returns the current control\r\n */\r\n public addBehavior(behavior: Behavior<Control3D>): Control3D {\r\n const index = this._behaviors.indexOf(behavior);\r\n\r\n if (index !== -1) {\r\n return this;\r\n }\r\n\r\n behavior.init();\r\n const scene = this._host.scene;\r\n if (scene.isLoading) {\r\n // We defer the attach when the scene will be loaded\r\n scene.onDataLoadedObservable.addOnce(() => {\r\n behavior.attach(this);\r\n });\r\n } else {\r\n behavior.attach(this);\r\n }\r\n this._behaviors.push(behavior);\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Remove an attached behavior\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/behaviors\r\n * @param behavior defines the behavior to attach\r\n * @returns the current control\r\n */\r\n public removeBehavior(behavior: Behavior<Control3D>): Control3D {\r\n const index = this._behaviors.indexOf(behavior);\r\n\r\n if (index === -1) {\r\n return this;\r\n }\r\n\r\n this._behaviors[index].detach();\r\n this._behaviors.splice(index, 1);\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Gets an attached behavior by name\r\n * @param name defines the name of the behavior to look for\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/behaviors\r\n * @returns null if behavior was not found else the requested behavior\r\n */\r\n public getBehaviorByName(name: string): Nullable<Behavior<Control3D>> {\r\n for (const behavior of this._behaviors) {\r\n if (behavior.name === name) {\r\n return behavior;\r\n }\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /** Gets or sets a boolean indicating if the control is visible */\r\n public get isVisible(): boolean {\r\n return this._isVisible;\r\n }\r\n\r\n public set isVisible(value: boolean) {\r\n if (this._isVisible === value) {\r\n return;\r\n }\r\n\r\n this._isVisible = value;\r\n\r\n const mesh = this.mesh;\r\n if (mesh) {\r\n mesh.setEnabled(value);\r\n }\r\n }\r\n\r\n /**\r\n * Creates a new control\r\n * @param name defines the control name\r\n */\r\n constructor(\r\n /** Defines the control name */\r\n public name?: string\r\n ) {}\r\n\r\n /**\r\n * Gets a string representing the class name\r\n */\r\n public get typeName(): string {\r\n return this._getTypeName();\r\n }\r\n\r\n /**\r\n * Get the current class name of the control.\r\n * @returns current class name\r\n */\r\n public getClassName(): string {\r\n return this._getTypeName();\r\n }\r\n\r\n protected _getTypeName(): string {\r\n return \"Control3D\";\r\n }\r\n\r\n /**\r\n * Gets the transform node used by this control\r\n */\r\n public get node(): Nullable<TransformNode> {\r\n return this._node;\r\n }\r\n\r\n /**\r\n * Gets the mesh used to render this control\r\n */\r\n public get mesh(): Nullable<AbstractMesh> {\r\n if (this._node instanceof AbstractMesh) {\r\n return this._node as AbstractMesh;\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /**\r\n * Link the control as child of the given node\r\n * @param node defines the node to link to. Use null to unlink the control\r\n * @returns the current control\r\n */\r\n public linkToTransformNode(node: Nullable<TransformNode>): Control3D {\r\n if (this._node) {\r\n this._node.parent = node;\r\n }\r\n return this;\r\n }\r\n\r\n /**\r\n * @internal*\r\n */\r\n public _prepareNode(scene: Scene): void {\r\n if (!this._node) {\r\n this._node = this._createNode(scene);\r\n\r\n if (!this.node) {\r\n return;\r\n }\r\n this._injectGUI3DReservedDataStore(this.node).control = this; // Store the control on the reservedDataStore field in order to get it when picking\r\n\r\n const mesh = this.mesh;\r\n if (mesh) {\r\n mesh.isPickable = true;\r\n\r\n this._affectMaterial(mesh);\r\n }\r\n }\r\n }\r\n\r\n protected _injectGUI3DReservedDataStore(node: TransformNode): any {\r\n node.reservedDataStore = node.reservedDataStore ?? {};\r\n node.reservedDataStore.GUI3D = node.reservedDataStore.GUI3D ?? {};\r\n return node.reservedDataStore.GUI3D;\r\n }\r\n\r\n /**\r\n * Node creation.\r\n * Can be overriden by children\r\n * @param scene defines the scene where the node must be attached\r\n * @returns the attached node or null if none. Must return a Mesh or AbstractMesh if there is an attached visible object\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n protected _createNode(scene: Scene): Nullable<TransformNode> {\r\n // Do nothing by default\r\n return null;\r\n }\r\n\r\n /**\r\n * Affect a material to the given mesh\r\n * @param mesh defines the mesh which will represent the control\r\n */\r\n protected _affectMaterial(mesh: AbstractMesh) {\r\n mesh.material = null;\r\n }\r\n\r\n private _isTouchButton3D(control: Control3D): control is TouchButton3D {\r\n return (control as TouchButton3D)._generatePointerEventType !== undefined;\r\n }\r\n\r\n // Pointers\r\n\r\n /**\r\n * @internal\r\n */\r\n public _onPointerMove(target: Control3D, coordinates: Vector3): void {\r\n this.onPointerMoveObservable.notifyObservers(coordinates, -1, target, this);\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _onPointerEnter(target: Control3D): boolean {\r\n if (this._enterCount === -1) {\r\n // -1 is for touch input, we are now sure we are with a mouse or pencil\r\n this._enterCount = 0;\r\n }\r\n\r\n this._enterCount++;\r\n\r\n if (this._enterCount > 1) {\r\n return false;\r\n }\r\n\r\n this.onPointerEnterObservable.notifyObservers(this, -1, target, this);\r\n\r\n if (this.pointerEnterAnimation) {\r\n this.pointerEnterAnimation();\r\n }\r\n\r\n return true;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _onPointerOut(target: Control3D): void {\r\n this._enterCount--;\r\n\r\n if (this._enterCount > 0) {\r\n return;\r\n }\r\n\r\n this._enterCount = 0;\r\n\r\n this.onPointerOutObservable.notifyObservers(this, -1, target, this);\r\n\r\n if (this.pointerOutAnimation) {\r\n this.pointerOutAnimation();\r\n }\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _onPointerDown(target: Control3D, coordinates: Vector3, pointerId: number, buttonIndex: number): boolean {\r\n this._downCount++;\r\n this._downPointerIds[pointerId] = this._downPointerIds[pointerId] + 1 || 1;\r\n\r\n if (this._downCount !== 1) {\r\n return false;\r\n }\r\n\r\n this.onPointerDownObservable.notifyObservers(new Vector3WithInfo(coordinates, buttonIndex), -1, target, this);\r\n\r\n if (this.pointerDownAnimation) {\r\n this.pointerDownAnimation();\r\n }\r\n\r\n return true;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _onPointerUp(target: Control3D, coordinates: Vector3, pointerId: number, buttonIndex: number, notifyClick: boolean): void {\r\n this._downCount--;\r\n this._downPointerIds[pointerId]--;\r\n\r\n if (this._downPointerIds[pointerId] <= 0) {\r\n delete this._downPointerIds[pointerId];\r\n }\r\n\r\n if (this._downCount < 0) {\r\n // Handle if forcePointerUp was called prior to this\r\n this._downCount = 0;\r\n return;\r\n }\r\n\r\n if (this._downCount == 0) {\r\n if (notifyClick && (this._enterCount > 0 || this._enterCount === -1)) {\r\n this.onPointerClickObservable.notifyObservers(new Vector3WithInfo(coordinates, buttonIndex), -1, target, this);\r\n }\r\n this.onPointerUpObservable.notifyObservers(new Vector3WithInfo(coordinates, buttonIndex), -1, target, this);\r\n\r\n if (this.pointerUpAnimation) {\r\n this.pointerUpAnimation();\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public forcePointerUp(pointerId: Nullable<number> = null) {\r\n if (pointerId !== null) {\r\n this._onPointerUp(this, Vector3.Zero(), pointerId, 0, true);\r\n } else {\r\n for (const key in this._downPointerIds) {\r\n this._onPointerUp(this, Vector3.Zero(), +key as number, 0, true);\r\n }\r\n if (this._downCount > 0) {\r\n this._downCount = 1;\r\n this._onPointerUp(this, Vector3.Zero(), 0, 0, true);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _processObservables(type: number, pickedPoint: Vector3, originMeshPosition: Nullable<Vector3>, pointerId: number, buttonIndex: number): boolean {\r\n if (this._isTouchButton3D(this) && originMeshPosition) {\r\n type = this._generatePointerEventType(type, originMeshPosition, this._downCount);\r\n }\r\n\r\n if (type === PointerEventTypes.POINTERMOVE) {\r\n this._onPointerMove(this, pickedPoint);\r\n\r\n const previousControlOver = this._host._lastControlOver[pointerId];\r\n if (previousControlOver && previousControlOver !== this) {\r\n previousControlOver._onPointerOut(this);\r\n }\r\n\r\n if (previousControlOver !== this) {\r\n this._onPointerEnter(this);\r\n }\r\n\r\n this._host._lastControlOver[pointerId] = this;\r\n return true;\r\n }\r\n\r\n if (type === PointerEventTypes.POINTERDOWN) {\r\n this._onPointerDown(this, pickedPoint, pointerId, buttonIndex);\r\n this._host._lastControlDown[pointerId] = this;\r\n this._host._lastPickedControl = this;\r\n return true;\r\n }\r\n\r\n if (type === PointerEventTypes.POINTERUP || type === PointerEventTypes.POINTERDOUBLETAP) {\r\n if (this._host._lastControlDown[pointerId]) {\r\n this._host._lastControlDown[pointerId]._onPointerUp(this, pickedPoint, pointerId, buttonIndex, true);\r\n }\r\n delete this._host._lastControlDown[pointerId];\r\n return true;\r\n }\r\n\r\n return false;\r\n }\r\n\r\n /** @internal */\r\n public _disposeNode(): void {\r\n if (this._node) {\r\n this._node.dispose();\r\n this._node = null;\r\n }\r\n }\r\n\r\n /**\r\n * Releases all associated resources\r\n */\r\n public dispose() {\r\n this.onPointerDownObservable.clear();\r\n this.onPointerEnterObservable.clear();\r\n this.onPointerMoveObservable.clear();\r\n this.onPointerOutObservable.clear();\r\n this.onPointerUpObservable.clear();\r\n this.onPointerClickObservable.clear();\r\n\r\n this._disposeNode();\r\n\r\n // Behaviors\r\n for (const behavior of this._behaviors) {\r\n behavior.detach();\r\n }\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"control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,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;YACrB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;SACrB;IACL,CAAC;IAED;;OAEG;IACI,OAAO;QACV,IAAI,CAAC,uBAAuB,CAAC,KAAK,EAAE,CAAC;QACrC,IAAI,CAAC,wBAAwB,CAAC,KAAK,EAAE,CAAC;QACtC,IAAI,CAAC,uBAAuB,CAAC,KAAK,EAAE,CAAC;QACrC,IAAI,CAAC,sBAAsB,CAAC,KAAK,EAAE,CAAC;QACpC,IAAI,CAAC,qBAAqB,CAAC,KAAK,EAAE,CAAC;QACnC,IAAI,CAAC,wBAAwB,CAAC,KAAK,EAAE,CAAC;QAEtC,IAAI,CAAC,YAAY,EAAE,CAAC;QAEpB,YAAY;QACZ,KAAK,MAAM,QAAQ,IAAI,IAAI,CAAC,UAAU,EAAE;YACpC,QAAQ,CAAC,MAAM,EAAE,CAAC;SACrB;IACL,CAAC;CACJ","sourcesContent":["import type { Nullable } from \"core/types\";\r\nimport { Observable } from \"core/Misc/observable\";\r\nimport { Vector3 } from \"core/Maths/math.vector\";\r\nimport { PointerEventTypes } from \"core/Events/pointerEvents\";\r\nimport type { TransformNode } from \"core/Meshes/transformNode\";\r\nimport { AbstractMesh } from \"core/Meshes/abstractMesh\";\r\nimport type { IBehaviorAware, Behavior } from \"core/Behaviors/behavior\";\r\nimport type { IDisposable, Scene } from \"core/scene\";\r\n\r\nimport type { GUI3DManager } from \"../gui3DManager\";\r\nimport { Vector3WithInfo } from \"../vector3WithInfo\";\r\nimport type { Container3D } from \"./container3D\";\r\n\r\nimport type { TouchButton3D } from \"./touchButton3D\";\r\n\r\n/**\r\n * Class used as base class for controls\r\n */\r\nexport class Control3D implements IDisposable, IBehaviorAware<Control3D> {\r\n private _node: Nullable<TransformNode>;\r\n private _downCount = 0;\r\n private _enterCount = -1;\r\n private _downPointerIds: { [id: number]: number } = {}; // Store number of pointer downs per ID, from near and far interactions\r\n\r\n protected _isVisible = true;\r\n\r\n /** @internal */\r\n public _host: GUI3DManager;\r\n /** @internal */\r\n public _isScaledByManager = false;\r\n\r\n /** Gets or sets the control position in world space */\r\n public get position(): Vector3 {\r\n if (!this._node) {\r\n return Vector3.Zero();\r\n }\r\n\r\n return this._node.position;\r\n }\r\n\r\n public set position(value: Vector3) {\r\n if (!this._node) {\r\n return;\r\n }\r\n\r\n this._node.position = value;\r\n }\r\n\r\n /** Gets or sets the control scaling in world space */\r\n public get scaling(): Vector3 {\r\n if (!this._node) {\r\n return new Vector3(1, 1, 1);\r\n }\r\n\r\n return this._node.scaling;\r\n }\r\n\r\n public set scaling(value: Vector3) {\r\n if (!this._node) {\r\n return;\r\n }\r\n\r\n this._isScaledByManager = false;\r\n this._node.scaling = value;\r\n }\r\n\r\n /** Callback used to start pointer enter animation */\r\n public pointerEnterAnimation: () => void;\r\n /** Callback used to start pointer out animation */\r\n public pointerOutAnimation: () => void;\r\n /** Callback used to start pointer down animation */\r\n public pointerDownAnimation: () => void;\r\n /** Callback used to start pointer up animation */\r\n public pointerUpAnimation: () => void;\r\n\r\n /**\r\n * An event triggered when the pointer moves over the control\r\n */\r\n public onPointerMoveObservable = new Observable<Vector3>();\r\n\r\n /**\r\n * An event triggered when the pointer moves out of the control\r\n */\r\n public onPointerOutObservable = new Observable<Control3D>();\r\n\r\n /**\r\n * An event triggered when the pointer taps the control\r\n */\r\n public onPointerDownObservable = new Observable<Vector3WithInfo>();\r\n\r\n /**\r\n * An event triggered when pointer is up\r\n */\r\n public onPointerUpObservable = new Observable<Vector3WithInfo>();\r\n\r\n /**\r\n * An event triggered when a control is clicked on (with a mouse)\r\n */\r\n public onPointerClickObservable = new Observable<Vector3WithInfo>();\r\n\r\n /**\r\n * An event triggered when pointer enters the control\r\n */\r\n public onPointerEnterObservable = new Observable<Control3D>();\r\n\r\n /**\r\n * Gets or sets the parent container\r\n */\r\n public parent: Nullable<Container3D>;\r\n\r\n // Behaviors\r\n private _behaviors = new Array<Behavior<Control3D>>();\r\n\r\n /**\r\n * Gets the list of attached behaviors\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/behaviors\r\n */\r\n public get behaviors(): Behavior<Control3D>[] {\r\n return this._behaviors;\r\n }\r\n\r\n /**\r\n * Attach a behavior to the control\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/behaviors\r\n * @param behavior defines the behavior to attach\r\n * @returns the current control\r\n */\r\n public addBehavior(behavior: Behavior<Control3D>): Control3D {\r\n const index = this._behaviors.indexOf(behavior);\r\n\r\n if (index !== -1) {\r\n return this;\r\n }\r\n\r\n behavior.init();\r\n const scene = this._host.scene;\r\n if (scene.isLoading) {\r\n // We defer the attach when the scene will be loaded\r\n scene.onDataLoadedObservable.addOnce(() => {\r\n behavior.attach(this);\r\n });\r\n } else {\r\n behavior.attach(this);\r\n }\r\n this._behaviors.push(behavior);\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Remove an attached behavior\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/behaviors\r\n * @param behavior defines the behavior to attach\r\n * @returns the current control\r\n */\r\n public removeBehavior(behavior: Behavior<Control3D>): Control3D {\r\n const index = this._behaviors.indexOf(behavior);\r\n\r\n if (index === -1) {\r\n return this;\r\n }\r\n\r\n this._behaviors[index].detach();\r\n this._behaviors.splice(index, 1);\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Gets an attached behavior by name\r\n * @param name defines the name of the behavior to look for\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/behaviors\r\n * @returns null if behavior was not found else the requested behavior\r\n */\r\n public getBehaviorByName(name: string): Nullable<Behavior<Control3D>> {\r\n for (const behavior of this._behaviors) {\r\n if (behavior.name === name) {\r\n return behavior;\r\n }\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /** Gets or sets a boolean indicating if the control is visible */\r\n public get isVisible(): boolean {\r\n return this._isVisible;\r\n }\r\n\r\n public set isVisible(value: boolean) {\r\n if (this._isVisible === value) {\r\n return;\r\n }\r\n\r\n this._isVisible = value;\r\n\r\n const mesh = this.mesh;\r\n if (mesh) {\r\n mesh.setEnabled(value);\r\n }\r\n }\r\n\r\n /**\r\n * Creates a new control\r\n * @param name defines the control name\r\n */\r\n constructor(\r\n /** Defines the control name */\r\n public name?: string\r\n ) {}\r\n\r\n /**\r\n * Gets a string representing the class name\r\n */\r\n public get typeName(): string {\r\n return this._getTypeName();\r\n }\r\n\r\n /**\r\n * Get the current class name of the control.\r\n * @returns current class name\r\n */\r\n public getClassName(): string {\r\n return this._getTypeName();\r\n }\r\n\r\n protected _getTypeName(): string {\r\n return \"Control3D\";\r\n }\r\n\r\n /**\r\n * Gets the transform node used by this control\r\n */\r\n public get node(): Nullable<TransformNode> {\r\n return this._node;\r\n }\r\n\r\n /**\r\n * Gets the mesh used to render this control\r\n */\r\n public get mesh(): Nullable<AbstractMesh> {\r\n if (this._node instanceof AbstractMesh) {\r\n return this._node as AbstractMesh;\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /**\r\n * Link the control as child of the given node\r\n * @param node defines the node to link to. Use null to unlink the control\r\n * @returns the current control\r\n */\r\n public linkToTransformNode(node: Nullable<TransformNode>): Control3D {\r\n if (this._node) {\r\n this._node.parent = node;\r\n }\r\n return this;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _prepareNode(scene: Scene): void {\r\n if (!this._node) {\r\n this._node = this._createNode(scene);\r\n\r\n if (!this.node) {\r\n return;\r\n }\r\n this._injectGUI3DReservedDataStore(this.node).control = this; // Store the control on the reservedDataStore field in order to get it when picking\r\n\r\n const mesh = this.mesh;\r\n if (mesh) {\r\n mesh.isPickable = true;\r\n\r\n this._affectMaterial(mesh);\r\n }\r\n }\r\n }\r\n\r\n protected _injectGUI3DReservedDataStore(node: TransformNode): any {\r\n node.reservedDataStore = node.reservedDataStore ?? {};\r\n node.reservedDataStore.GUI3D = node.reservedDataStore.GUI3D ?? {};\r\n return node.reservedDataStore.GUI3D;\r\n }\r\n\r\n /**\r\n * Node creation.\r\n * Can be overriden by children\r\n * @param scene defines the scene where the node must be attached\r\n * @returns the attached node or null if none. Must return a Mesh or AbstractMesh if there is an attached visible object\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n protected _createNode(scene: Scene): Nullable<TransformNode> {\r\n // Do nothing by default\r\n return null;\r\n }\r\n\r\n /**\r\n * Affect a material to the given mesh\r\n * @param mesh defines the mesh which will represent the control\r\n */\r\n protected _affectMaterial(mesh: AbstractMesh) {\r\n mesh.material = null;\r\n }\r\n\r\n private _isTouchButton3D(control: Control3D): control is TouchButton3D {\r\n return (control as TouchButton3D)._generatePointerEventType !== undefined;\r\n }\r\n\r\n // Pointers\r\n\r\n /**\r\n * @internal\r\n */\r\n public _onPointerMove(target: Control3D, coordinates: Vector3): void {\r\n this.onPointerMoveObservable.notifyObservers(coordinates, -1, target, this);\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _onPointerEnter(target: Control3D): boolean {\r\n if (this._enterCount === -1) {\r\n // -1 is for touch input, we are now sure we are with a mouse or pencil\r\n this._enterCount = 0;\r\n }\r\n\r\n this._enterCount++;\r\n\r\n if (this._enterCount > 1) {\r\n return false;\r\n }\r\n\r\n this.onPointerEnterObservable.notifyObservers(this, -1, target, this);\r\n\r\n if (this.pointerEnterAnimation) {\r\n this.pointerEnterAnimation();\r\n }\r\n\r\n return true;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _onPointerOut(target: Control3D): void {\r\n this._enterCount--;\r\n\r\n if (this._enterCount > 0) {\r\n return;\r\n }\r\n\r\n this._enterCount = 0;\r\n\r\n this.onPointerOutObservable.notifyObservers(this, -1, target, this);\r\n\r\n if (this.pointerOutAnimation) {\r\n this.pointerOutAnimation();\r\n }\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _onPointerDown(target: Control3D, coordinates: Vector3, pointerId: number, buttonIndex: number): boolean {\r\n this._downCount++;\r\n this._downPointerIds[pointerId] = this._downPointerIds[pointerId] + 1 || 1;\r\n\r\n if (this._downCount !== 1) {\r\n return false;\r\n }\r\n\r\n this.onPointerDownObservable.notifyObservers(new Vector3WithInfo(coordinates, buttonIndex), -1, target, this);\r\n\r\n if (this.pointerDownAnimation) {\r\n this.pointerDownAnimation();\r\n }\r\n\r\n return true;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _onPointerUp(target: Control3D, coordinates: Vector3, pointerId: number, buttonIndex: number, notifyClick: boolean): void {\r\n this._downCount--;\r\n this._downPointerIds[pointerId]--;\r\n\r\n if (this._downPointerIds[pointerId] <= 0) {\r\n delete this._downPointerIds[pointerId];\r\n }\r\n\r\n if (this._downCount < 0) {\r\n // Handle if forcePointerUp was called prior to this\r\n this._downCount = 0;\r\n return;\r\n }\r\n\r\n if (this._downCount == 0) {\r\n if (notifyClick && (this._enterCount > 0 || this._enterCount === -1)) {\r\n this.onPointerClickObservable.notifyObservers(new Vector3WithInfo(coordinates, buttonIndex), -1, target, this);\r\n }\r\n this.onPointerUpObservable.notifyObservers(new Vector3WithInfo(coordinates, buttonIndex), -1, target, this);\r\n\r\n if (this.pointerUpAnimation) {\r\n this.pointerUpAnimation();\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public forcePointerUp(pointerId: Nullable<number> = null) {\r\n if (pointerId !== null) {\r\n this._onPointerUp(this, Vector3.Zero(), pointerId, 0, true);\r\n } else {\r\n for (const key in this._downPointerIds) {\r\n this._onPointerUp(this, Vector3.Zero(), +key as number, 0, true);\r\n }\r\n if (this._downCount > 0) {\r\n this._downCount = 1;\r\n this._onPointerUp(this, Vector3.Zero(), 0, 0, true);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _processObservables(type: number, pickedPoint: Vector3, originMeshPosition: Nullable<Vector3>, pointerId: number, buttonIndex: number): boolean {\r\n if (this._isTouchButton3D(this) && originMeshPosition) {\r\n type = this._generatePointerEventType(type, originMeshPosition, this._downCount);\r\n }\r\n\r\n if (type === PointerEventTypes.POINTERMOVE) {\r\n this._onPointerMove(this, pickedPoint);\r\n\r\n const previousControlOver = this._host._lastControlOver[pointerId];\r\n if (previousControlOver && previousControlOver !== this) {\r\n previousControlOver._onPointerOut(this);\r\n }\r\n\r\n if (previousControlOver !== this) {\r\n this._onPointerEnter(this);\r\n }\r\n\r\n this._host._lastControlOver[pointerId] = this;\r\n return true;\r\n }\r\n\r\n if (type === PointerEventTypes.POINTERDOWN) {\r\n this._onPointerDown(this, pickedPoint, pointerId, buttonIndex);\r\n this._host._lastControlDown[pointerId] = this;\r\n this._host._lastPickedControl = this;\r\n return true;\r\n }\r\n\r\n if (type === PointerEventTypes.POINTERUP || type === PointerEventTypes.POINTERDOUBLETAP) {\r\n if (this._host._lastControlDown[pointerId]) {\r\n this._host._lastControlDown[pointerId]._onPointerUp(this, pickedPoint, pointerId, buttonIndex, true);\r\n }\r\n delete this._host._lastControlDown[pointerId];\r\n return true;\r\n }\r\n\r\n return false;\r\n }\r\n\r\n /** @internal */\r\n public _disposeNode(): void {\r\n if (this._node) {\r\n this._node.dispose();\r\n this._node = null;\r\n }\r\n }\r\n\r\n /**\r\n * Releases all associated resources\r\n */\r\n public dispose() {\r\n this.onPointerDownObservable.clear();\r\n this.onPointerEnterObservable.clear();\r\n this.onPointerMoveObservable.clear();\r\n this.onPointerOutObservable.clear();\r\n this.onPointerUpObservable.clear();\r\n this.onPointerClickObservable.clear();\r\n\r\n this._disposeNode();\r\n\r\n // Behaviors\r\n for (const behavior of this._behaviors) {\r\n behavior.detach();\r\n }\r\n }\r\n}\r\n"]}
@@ -115,7 +115,7 @@ export declare class HolographicSlate extends ContentDisplay3D {
115
115
  private _attachContentPlateBehavior;
116
116
  protected _affectMaterial(mesh: AbstractMesh): void;
117
117
  /**
118
- * @internal*
118
+ * @internal
119
119
  */
120
120
  _prepareNode(scene: Scene): void;
121
121
  /**
@@ -325,7 +325,7 @@ export class HolographicSlate extends ContentDisplay3D {
325
325
  this._applyContentViewport();
326
326
  }
327
327
  /**
328
- * @internal*
328
+ * @internal
329
329
  */
330
330
  _prepareNode(scene) {
331
331
  super._prepareNode(scene);
@@ -1 +1 @@
1
- {"version":3,"file":"holographicSlate.js","sourceRoot":"","sources":["../../../../../dev/gui/src/3D/controls/holographicSlate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AACzE,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AACtE,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAE,uBAAuB,EAAE,MAAM,sDAAsD,CAAC;AAC/F,OAAO,EAAE,mBAAmB,EAAE,gEAAkD;AAEhF,OAAO,EAAE,OAAO,EAAE,sCAAwB;AAC1C,OAAO,EAAE,OAAO,EAAE,gDAAkC;AACpD,OAAO,EAAE,MAAM,EAAE,6CAA+B;AAEhD,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,6CAA+B;AACtE,OAAO,EAAE,QAAQ,EAAE,+CAAiC;AAEpD,OAAO,EAAE,SAAS,EAAE,sDAAwC;AAC5D,OAAO,EAAE,WAAW,EAAE,wDAA0C;AAEhE,OAAO,EAAE,IAAI,EAAE,uCAAyB;AACxC,OAAO,EAAE,UAAU,EAAE,kDAAoC;AAKzD;;;GAGG;AACH,MAAM,OAAO,gBAAiB,SAAQ,gBAAgB;IA0ClD;;OAEG;IACH,IAAW,eAAe;QACtB,OAAO,IAAI,CAAC,gBAAgB,CAAC;IACjC,CAAC;IAcD;;OAEG;IACH,IAAW,UAAU;QACjB,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AS","sourcesContent":["import { ContentDisplay3D } from \"./contentDisplay3D\";\r\nimport type { Control3D } from \"./control3D\";\r\nimport { TouchHolographicButton } from \"./touchHolographicButton\";\r\nimport { AdvancedDynamicTexture } from \"../../2D/advancedDynamicTexture\";\r\nimport { Control } from \"../../2D/controls/control\";\r\nimport { TextBlock, TextWrapping } from \"../../2D/controls/textBlock\";\r\nimport { DefaultBehavior } from \"../behaviors/defaultBehavior\";\r\nimport { SlateGizmo } from \"../gizmos/slateGizmo\";\r\nimport { FluentMaterial } from \"../materials/fluent/fluentMaterial\";\r\nimport { FluentBackplateMaterial } from \"../materials/fluentBackplate/fluentBackplateMaterial\";\r\nimport { PointerDragBehavior } from \"core/Behaviors/Meshes/pointerDragBehavior\";\r\nimport type { Texture } from \"core/Materials/Textures/texture\";\r\nimport { Vector4 } from \"core/Maths/math\";\r\nimport { Epsilon } from \"core/Maths/math.constants\";\r\nimport { Scalar } from \"core/Maths/math.scalar\";\r\nimport type { Matrix } from \"core/Maths/math.vector\";\r\nimport { Quaternion, Vector2, Vector3 } from \"core/Maths/math.vector\";\r\nimport { Viewport } from \"core/Maths/math.viewport\";\r\nimport type { AbstractMesh } from \"core/Meshes/abstractMesh\";\r\nimport { CreateBox } from \"core/Meshes/Builders/boxBuilder\";\r\nimport { CreatePlane } from \"core/Meshes/Builders/planeBuilder\";\r\nimport type { TransformNode } from \"core/Meshes/transformNode\";\r\nimport { Mesh } from \"core/Meshes/mesh\";\r\nimport { VertexData } from \"core/Meshes/mesh.vertexData\";\r\nimport type { Observer } from \"core/Misc/observable\";\r\nimport type { Scene } from \"core/scene\";\r\nimport type { Nullable } from \"core/types\";\r\n\r\n/**\r\n * Class used to create a holographic slate\r\n * @since 5.0.0\r\n */\r\nexport class HolographicSlate extends ContentDisplay3D {\r\n /**\r\n * Base Url for the assets.\r\n */\r\n public static ASSETS_BASE_URL: string = \"https://assets.babylonjs.com/meshes/MRTK/\";\r\n /**\r\n * File name for the close icon.\r\n */\r\n public static CLOSE_ICON_FILENAME: string = \"IconClose.png\";\r\n /**\r\n * File name for the close icon.\r\n */\r\n public static FOLLOW_ICON_FILENAME: string = \"IconFollowMe.png\";\r\n\r\n private static _DEFAULT_TEXT_RESOLUTION_Y = 102.4;\r\n\r\n /**\r\n * Margin between title bar and contentplate\r\n */\r\n public titleBarMargin = 0.005;\r\n\r\n /**\r\n * Origin in local coordinates (top left corner)\r\n */\r\n public origin = new Vector3(0, 0, 0);\r\n\r\n private _dimensions = new Vector2(21.875, 12.5);\r\n private _titleBarHeight = 0.625;\r\n\r\n private _titleBarMaterial: FluentBackplateMaterial;\r\n private _backMaterial: FluentBackplateMaterial;\r\n private _contentMaterial: FluentMaterial;\r\n private _pickedPointObserver: Nullable<Observer<Nullable<Vector3>>>;\r\n private _positionChangedObserver: Nullable<Observer<{ position: Vector3 }>>;\r\n\r\n private _titleText = \"\";\r\n private _titleTextComponent: TextBlock;\r\n\r\n private _contentViewport: Viewport;\r\n private _contentDragBehavior: PointerDragBehavior;\r\n\r\n private _defaultBehavior: DefaultBehavior;\r\n /**\r\n * Regroups all mesh behaviors for the slate\r\n */\r\n public get defaultBehavior(): DefaultBehavior {\r\n return this._defaultBehavior;\r\n }\r\n\r\n /** @internal */\r\n public _gizmo: SlateGizmo;\r\n\r\n protected _titleBar: Mesh;\r\n protected _titleBarTitle: Mesh;\r\n protected _contentPlate: Mesh;\r\n protected _backPlate: Mesh;\r\n /** @internal */\r\n public _followButton: TouchHolographicButton;\r\n protected _closeButton: TouchHolographicButton;\r\n protected _contentScaleRatio = 1;\r\n\r\n /**\r\n * 2D dimensions of the slate\r\n */\r\n public get dimensions() {\r\n return this._dimensions;\r\n }\r\n public set dimensions(value) {\r\n //clamp, respecting ratios\r\n let scale = 1.0;\r\n if (value.x < this.minDimensions.x || value.y < this.minDimensions.y) {\r\n const newRatio = value.x / value.y;\r\n const minRatio = this.minDimensions.x / this.minDimensions.y;\r\n if (minRatio > newRatio) {\r\n // We just need to make sure the x-val is greater than the min\r\n scale = this.minDimensions.x / value.x;\r\n } else {\r\n // We just need to make sure the y-val is greater than the min\r\n scale = this.minDimensions.y / value.y;\r\n }\r\n }\r\n\r\n this._dimensions.copyFrom(value).scaleInPlace(scale);\r\n this._updatePivot();\r\n this._positionElements();\r\n }\r\n\r\n /**\r\n * Minimum dimensions of the slate\r\n */\r\n public minDimensions = new Vector2(15.625, 6.25);\r\n\r\n /**\r\n * Default dimensions of the slate\r\n */\r\n public readonly defaultDimensions = this._dimensions.clone();\r\n\r\n /**\r\n * Height of the title bar component\r\n */\r\n public get titleBarHeight() {\r\n return this._titleBarHeight;\r\n }\r\n public set titleBarHeight(value) {\r\n this._titleBarHeight = value;\r\n }\r\n\r\n /**\r\n * Rendering ground id of all the meshes\r\n */\r\n public set renderingGroupId(id: number) {\r\n this._titleBar.renderingGroupId = id;\r\n this._titleBarTitle.renderingGroupId = id;\r\n this._contentPlate.renderingGroupId = id;\r\n this._backPlate.renderingGroupId = id;\r\n }\r\n public get renderingGroupId(): number {\r\n return this._titleBar.renderingGroupId;\r\n }\r\n\r\n /**\r\n * The title text displayed at the top of the slate\r\n */\r\n public set title(title: string) {\r\n this._titleText = title;\r\n if (this._titleTextComponent) {\r\n this._titleTextComponent.text = title;\r\n }\r\n }\r\n public get title() {\r\n return this._titleText;\r\n }\r\n\r\n /**\r\n * Creates a new slate\r\n * @param name defines the control name\r\n */\r\n constructor(name?: string) {\r\n super(name);\r\n\r\n this._followButton = new TouchHolographicButton(\"followButton\" + this.name);\r\n this._followButton.isToggleButton = true;\r\n this._closeButton = new TouchHolographicButton(\"closeButton\" + this.name);\r\n\r\n this._contentViewport = new Viewport(0, 0, 1, 1);\r\n this._contentDragBehavior = new PointerDragBehavior({\r\n dragPlaneNormal: new Vector3(0, 0, -1),\r\n });\r\n }\r\n\r\n /**\r\n * Apply the facade texture (created from the content property).\r\n * This function can be overloaded by child classes\r\n * @param facadeTexture defines the AdvancedDynamicTexture to use\r\n */\r\n protected _applyFacade(facadeTexture: AdvancedDynamicTexture) {\r\n this._contentMaterial.albedoTexture = facadeTexture;\r\n this._resetContentPositionAndZoom();\r\n this._applyContentViewport();\r\n\r\n facadeTexture.attachToMesh(this._contentPlate, true);\r\n }\r\n\r\n private _addControl(control: Control3D): void {\r\n control._host = this._host;\r\n if (this._host.utilityLayer) {\r\n control._prepareNode(this._host.utilityLayer.utilityLayerScene);\r\n }\r\n }\r\n\r\n protected _getTypeName(): string {\r\n return \"HolographicSlate\";\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _positionElements() {\r\n const followButton = this._followButton;\r\n const closeButton = this._closeButton;\r\n const titleBar = this._titleBar;\r\n const titleBarTitle = this._titleBarTitle;\r\n const contentPlate = this._contentPlate;\r\n const backPlate = this._backPlate;\r\n\r\n if (followButton && closeButton && titleBar) {\r\n closeButton.scaling.setAll(this.titleBarHeight);\r\n followButton.scaling.setAll(this.titleBarHeight);\r\n closeButton.position.copyFromFloats(this.dimensions.x - this.titleBarHeight / 2, -this.titleBarHeight / 2, 0).addInPlace(this.origin);\r\n followButton.position.copyFromFloats(this.dimensions.x - (3 * this.titleBarHeight) / 2, -this.titleBarHeight / 2, 0).addInPlace(this.origin);\r\n\r\n const contentPlateHeight = this.dimensions.y - this.titleBarHeight - this.titleBarMargin;\r\n const rightHandScene = contentPlate.getScene().useRightHandedSystem;\r\n\r\n titleBar.scaling.set(this.dimensions.x, this.titleBarHeight, Epsilon);\r\n titleBarTitle.scaling.set(this.dimensions.x - 2 * this.titleBarHeight, this.titleBarHeight, Epsilon);\r\n contentPlate.scaling.copyFromFloats(this.dimensions.x, contentPlateHeight, Epsilon);\r\n backPlate.scaling.copyFromFloats(this.dimensions.x, contentPlateHeight, Epsilon);\r\n\r\n titleBar.position.copyFromFloats(this.dimensions.x / 2, -(this.titleBarHeight / 2), 0).addInPlace(this.origin);\r\n titleBarTitle.position\r\n .copyFromFloats(this.dimensions.x / 2 - this.titleBarHeight, -(this.titleBarHeight / 2), rightHandScene ? Epsilon : -Epsilon)\r\n .addInPlace(this.origin);\r\n contentPlate.position.copyFromFloats(this.dimensions.x / 2, -(this.titleBarHeight + this.titleBarMargin + contentPlateHeight / 2), 0).addInPlace(this.origin);\r\n backPlate.position\r\n .copyFromFloats(this.dimensions.x / 2, -(this.titleBarHeight + this.titleBarMargin + contentPlateHeight / 2), rightHandScene ? -Epsilon : Epsilon)\r\n .addInPlace(this.origin);\r\n\r\n // Update the title's AdvancedDynamicTexture scale to avoid visual stretching\r\n this._titleTextComponent.host.scaleTo(\r\n (HolographicSlate._DEFAULT_TEXT_RESOLUTION_Y * titleBarTitle.scaling.x) / titleBarTitle.scaling.y,\r\n HolographicSlate._DEFAULT_TEXT_RESOLUTION_Y\r\n );\r\n\r\n const aspectRatio = this.dimensions.x / contentPlateHeight;\r\n this._contentViewport.width = this._contentScaleRatio;\r\n this._contentViewport.height = this._contentScaleRatio / aspectRatio;\r\n\r\n this._applyContentViewport();\r\n if (this._gizmo) {\r\n this._gizmo.updateBoundingBox();\r\n }\r\n }\r\n }\r\n\r\n private _applyContentViewport() {\r\n if (this._contentPlate?.material && (this._contentPlate.material as FluentMaterial).albedoTexture) {\r\n const tex = (this._contentPlate.material as FluentMaterial).albedoTexture as Texture;\r\n tex.uScale = this._contentScaleRatio;\r\n tex.vScale = (this._contentScaleRatio / this._contentViewport.width) * this._contentViewport.height;\r\n tex.uOffset = this._contentViewport.x;\r\n tex.vOffset = this._contentViewport.y;\r\n }\r\n }\r\n\r\n private _resetContentPositionAndZoom() {\r\n this._contentViewport.x = 0;\r\n this._contentViewport.y = 1 - this._contentViewport.height / this._contentViewport.width;\r\n this._contentScaleRatio = 1;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _updatePivot() {\r\n if (!this.mesh) {\r\n return;\r\n }\r\n\r\n // Update pivot point so it is at the center of geometry\r\n // As origin is topleft corner in 2D, dimensions are calculated towards bottom right corner, thus y axis is downwards\r\n const center = new Vector3(this.dimensions.x * 0.5, -this.dimensions.y * 0.5, Epsilon);\r\n center.addInPlace(this.origin);\r\n center.z = 0;\r\n\r\n const origin = new Vector3(0, 0, 0);\r\n Vector3.TransformCoordinatesToRef(origin, this.mesh.computeWorldMatrix(true), origin);\r\n this.mesh.setPivotPoint(center);\r\n const origin2 = new Vector3(0, 0, 0);\r\n Vector3.TransformCoordinatesToRef(origin2, this.mesh.computeWorldMatrix(true), origin2);\r\n this.mesh.position.addInPlace(origin).subtractInPlace(origin2);\r\n }\r\n\r\n // Mesh association\r\n protected _createNode(scene: Scene): TransformNode {\r\n const node = new Mesh(\"slate_\" + this.name, scene);\r\n\r\n this._titleBar = CreateBox(\"titleBar_\" + this.name, { size: 1 }, scene);\r\n this._titleBarTitle = CreatePlane(\"titleText_\" + this.name, { size: 1 }, scene);\r\n this._titleBarTitle.parent = node;\r\n this._titleBarTitle.isPickable = false;\r\n\r\n const adt = AdvancedDynamicTexture.CreateForMesh(this._titleBarTitle);\r\n this._titleTextComponent = new TextBlock(\"titleText_\" + this.name, this._titleText);\r\n this._titleTextComponent.textWrapping = TextWrapping.Ellipsis;\r\n this._titleTextComponent.textHorizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;\r\n this._titleTextComponent.color = \"white\";\r\n this._titleTextComponent.fontSize = HolographicSlate._DEFAULT_TEXT_RESOLUTION_Y / 2;\r\n this._titleTextComponent.paddingLeft = HolographicSlate._DEFAULT_TEXT_RESOLUTION_Y / 4;\r\n adt.addControl(this._titleTextComponent);\r\n\r\n if (scene.useRightHandedSystem) {\r\n const faceUV = new Vector4(0, 0, 1, 1);\r\n this._contentPlate = CreatePlane(\"contentPlate_\" + this.name, { size: 1, sideOrientation: VertexData.BACKSIDE, frontUVs: faceUV }, scene);\r\n this._backPlate = CreatePlane(\"backPlate_\" + this.name, { size: 1, sideOrientation: VertexData.FRONTSIDE }, scene);\r\n } else {\r\n const faceUV = new Vector4(0, 0, 1, 1);\r\n this._contentPlate = CreatePlane(\"contentPlate_\" + this.name, { size: 1, sideOrientation: VertexData.FRONTSIDE, frontUVs: faceUV }, scene);\r\n this._backPlate = CreatePlane(\"backPlate_\" + this.name, { size: 1, sideOrientation: VertexData.BACKSIDE }, scene);\r\n }\r\n\r\n this._titleBar.parent = node;\r\n this._titleBar.isNearGrabbable = true;\r\n this._contentPlate.parent = node;\r\n this._backPlate.parent = node;\r\n this._attachContentPlateBehavior();\r\n\r\n this._addControl(this._followButton);\r\n this._addControl(this._closeButton);\r\n\r\n const followButton = this._followButton;\r\n const closeButton = this._closeButton;\r\n\r\n followButton.node!.parent = node;\r\n closeButton.node!.parent = node;\r\n\r\n this._positionElements();\r\n\r\n this._followButton.imageUrl = HolographicSlate.ASSETS_BASE_URL + HolographicSlate.FOLLOW_ICON_FILENAME;\r\n this._closeButton.imageUrl = HolographicSlate.ASSETS_BASE_URL + HolographicSlate.CLOSE_ICON_FILENAME;\r\n\r\n this._followButton.isBackplateVisible = false;\r\n this._closeButton.isBackplateVisible = false;\r\n\r\n this._followButton.onToggleObservable.add((isToggled) => {\r\n this._defaultBehavior.followBehaviorEnabled = isToggled;\r\n if (this._defaultBehavior.followBehaviorEnabled) {\r\n this._defaultBehavior.followBehavior.recenter();\r\n }\r\n });\r\n\r\n this._closeButton.onPointerClickObservable.add(() => {\r\n this.dispose();\r\n });\r\n\r\n node.rotationQuaternion = Quaternion.Identity();\r\n node.isVisible = false;\r\n\r\n return node;\r\n }\r\n\r\n private _attachContentPlateBehavior() {\r\n this._contentDragBehavior.attach(this._contentPlate);\r\n this._contentDragBehavior.moveAttached = false;\r\n this._contentDragBehavior.useObjectOrientationForDragging = true;\r\n this._contentDragBehavior.updateDragPlane = false;\r\n\r\n const origin = new Vector3();\r\n const worldDimensions = new Vector3();\r\n const upWorld = new Vector3();\r\n const rightWorld = new Vector3();\r\n const projectedOffset = new Vector2();\r\n let startViewport: Viewport;\r\n let worldMatrix: Matrix;\r\n\r\n this._contentDragBehavior.onDragStartObservable.add((event) => {\r\n if (!this.node) {\r\n return;\r\n }\r\n startViewport = this._contentViewport.clone();\r\n worldMatrix = this.node.computeWorldMatrix(true);\r\n\r\n origin.copyFrom(event.dragPlanePoint);\r\n worldDimensions.set(this.dimensions.x, this.dimensions.y, Epsilon);\r\n worldDimensions.y -= this.titleBarHeight + this.titleBarMargin;\r\n Vector3.TransformNormalToRef(worldDimensions, worldMatrix, worldDimensions);\r\n upWorld.copyFromFloats(0, 1, 0);\r\n Vector3.TransformNormalToRef(upWorld, worldMatrix, upWorld);\r\n rightWorld.copyFromFloats(1, 0, 0);\r\n Vector3.TransformNormalToRef(rightWorld, worldMatrix, rightWorld);\r\n upWorld.normalize();\r\n upWorld.scaleInPlace(1 / Vector3.Dot(upWorld, worldDimensions));\r\n rightWorld.normalize();\r\n rightWorld.scaleInPlace(1 / Vector3.Dot(rightWorld, worldDimensions));\r\n });\r\n\r\n const offset = new Vector3();\r\n this._contentDragBehavior.onDragObservable.add((event) => {\r\n offset.copyFrom(event.dragPlanePoint);\r\n offset.subtractInPlace(origin);\r\n projectedOffset.copyFromFloats(Vector3.Dot(offset, rightWorld), Vector3.Dot(offset, upWorld));\r\n\r\n // By default, content takes full width available and height is cropped to keep aspect ratio\r\n this._contentViewport.x = Scalar.Clamp(startViewport.x - offset.x, 0, 1 - this._contentViewport.width * this._contentScaleRatio);\r\n this._contentViewport.y = Scalar.Clamp(startViewport.y - offset.y, 0, 1 - this._contentViewport.height * this._contentScaleRatio);\r\n this._applyContentViewport();\r\n });\r\n }\r\n\r\n protected _affectMaterial(mesh: AbstractMesh) {\r\n // TODO share materials\r\n this._titleBarMaterial = new FluentBackplateMaterial(`${this.name} plateMaterial`, mesh.getScene());\r\n\r\n this._contentMaterial = new FluentMaterial(`${this.name} contentMaterial`, mesh.getScene());\r\n this._contentMaterial.renderBorders = true;\r\n\r\n this._backMaterial = new FluentBackplateMaterial(`${this.name} backPlate`, mesh.getScene());\r\n this._backMaterial.lineWidth = Epsilon;\r\n this._backMaterial.radius = 0.005;\r\n this._backMaterial.backFaceCulling = true;\r\n\r\n this._titleBar.material = this._titleBarMaterial;\r\n this._contentPlate.material = this._contentMaterial;\r\n this._backPlate.material = this._backMaterial;\r\n\r\n this._resetContent();\r\n this._applyContentViewport();\r\n }\r\n\r\n /**\r\n * @internal*\r\n */\r\n public _prepareNode(scene: Scene): void {\r\n super._prepareNode(scene);\r\n this._gizmo = new SlateGizmo(this._host.utilityLayer!);\r\n this._gizmo.attachedSlate = this;\r\n this._defaultBehavior = new DefaultBehavior();\r\n this._defaultBehavior.attach(this.node as Mesh, [this._titleBar]);\r\n this._defaultBehavior.sixDofDragBehavior.onDragStartObservable.add(() => {\r\n this._followButton.isToggled = false;\r\n });\r\n\r\n this._positionChangedObserver = this._defaultBehavior.sixDofDragBehavior.onPositionChangedObservable.add(() => {\r\n this._gizmo.updateBoundingBox();\r\n });\r\n\r\n this._updatePivot();\r\n this.resetDefaultAspectAndPose(false);\r\n }\r\n\r\n /**\r\n * Resets the aspect and pose of the slate so it is right in front of the active camera, facing towards it.\r\n * @param resetAspect Should the slate's dimensions/aspect ratio be reset as well\r\n */\r\n public resetDefaultAspectAndPose(resetAspect: boolean = true) {\r\n if (!this._host || !this._host.utilityLayer || !this.node) {\r\n return;\r\n }\r\n const scene = this._host.utilityLayer.utilityLayerScene;\r\n const camera = scene.activeCamera;\r\n if (camera) {\r\n const worldMatrix = camera.getWorldMatrix();\r\n const backward = Vector3.TransformNormal(Vector3.Backward(scene.useRightHandedSystem), worldMatrix);\r\n this.origin.setAll(0);\r\n this._gizmo.updateBoundingBox();\r\n const pivot = this.node.getAbsolutePivotPoint();\r\n this.node.position.copyFrom(camera.position).subtractInPlace(backward).subtractInPlace(pivot);\r\n this.node.rotationQuaternion = Quaternion.FromLookDirectionLH(backward, new Vector3(0, 1, 0));\r\n\r\n if (resetAspect) {\r\n this.dimensions = this.defaultDimensions;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Releases all associated resources\r\n */\r\n public dispose() {\r\n super.dispose();\r\n this._titleBarMaterial.dispose();\r\n this._contentMaterial.dispose();\r\n\r\n this._titleBar.dispose();\r\n this._titleBarTitle.dispose();\r\n this._contentPlate.dispose();\r\n this._backPlate.dispose();\r\n\r\n this._followButton.dispose();\r\n this._closeButton.dispose();\r\n\r\n this._host.onPickedPointChangedObservable.remove(this._pickedPointObserver);\r\n this._defaultBehavior.sixDofDragBehavior.onPositionChangedObservable.remove(this._positionChangedObserver);\r\n\r\n this._defaultBehavior.detach();\r\n this._gizmo.dispose();\r\n this._contentDragBehavior.detach();\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"holographicSlate.js","sourceRoot":"","sources":["../../../../../dev/gui/src/3D/controls/holographicSlate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AACzE,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AACtE,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAE,uBAAuB,EAAE,MAAM,sDAAsD,CAAC;AAC/F,OAAO,EAAE,mBAAmB,EAAE,gEAAkD;AAEhF,OAAO,EAAE,OAAO,EAAE,sCAAwB;AAC1C,OAAO,EAAE,OAAO,EAAE,gDAAkC;AACpD,OAAO,EAAE,MAAM,EAAE,6CAA+B;AAEhD,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,6CAA+B;AACtE,OAAO,EAAE,QAAQ,EAAE,+CAAiC;AAEpD,OAAO,EAAE,SAAS,EAAE,sDAAwC;AAC5D,OAAO,EAAE,WAAW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CAAC;QACtB,IAAI,CAAC,oBAAoB,CAAC,MAAM,EAAE,CAAC;IACvC,CAAC;;AAldD;;GAEG;AACW,gCAAe,GAAW,2CAA2C,AAAtD,CAAuD;AACpF;;GAEG;AACW,oCAAmB,GAAW,eAAe,AAA1B,CAA2B;AAC5D;;GAEG;AACW,qCAAoB,GAAW,kBAAkB,AAA7B,CAA8B;AAEjD,2CAA0B,GAAG,KAAK,AAAR,CAAS","sourcesContent":["import { ContentDisplay3D } from \"./contentDisplay3D\";\r\nimport type { Control3D } from \"./control3D\";\r\nimport { TouchHolographicButton } from \"./touchHolographicButton\";\r\nimport { AdvancedDynamicTexture } from \"../../2D/advancedDynamicTexture\";\r\nimport { Control } from \"../../2D/controls/control\";\r\nimport { TextBlock, TextWrapping } from \"../../2D/controls/textBlock\";\r\nimport { DefaultBehavior } from \"../behaviors/defaultBehavior\";\r\nimport { SlateGizmo } from \"../gizmos/slateGizmo\";\r\nimport { FluentMaterial } from \"../materials/fluent/fluentMaterial\";\r\nimport { FluentBackplateMaterial } from \"../materials/fluentBackplate/fluentBackplateMaterial\";\r\nimport { PointerDragBehavior } from \"core/Behaviors/Meshes/pointerDragBehavior\";\r\nimport type { Texture } from \"core/Materials/Textures/texture\";\r\nimport { Vector4 } from \"core/Maths/math\";\r\nimport { Epsilon } from \"core/Maths/math.constants\";\r\nimport { Scalar } from \"core/Maths/math.scalar\";\r\nimport type { Matrix } from \"core/Maths/math.vector\";\r\nimport { Quaternion, Vector2, Vector3 } from \"core/Maths/math.vector\";\r\nimport { Viewport } from \"core/Maths/math.viewport\";\r\nimport type { AbstractMesh } from \"core/Meshes/abstractMesh\";\r\nimport { CreateBox } from \"core/Meshes/Builders/boxBuilder\";\r\nimport { CreatePlane } from \"core/Meshes/Builders/planeBuilder\";\r\nimport type { TransformNode } from \"core/Meshes/transformNode\";\r\nimport { Mesh } from \"core/Meshes/mesh\";\r\nimport { VertexData } from \"core/Meshes/mesh.vertexData\";\r\nimport type { Observer } from \"core/Misc/observable\";\r\nimport type { Scene } from \"core/scene\";\r\nimport type { Nullable } from \"core/types\";\r\n\r\n/**\r\n * Class used to create a holographic slate\r\n * @since 5.0.0\r\n */\r\nexport class HolographicSlate extends ContentDisplay3D {\r\n /**\r\n * Base Url for the assets.\r\n */\r\n public static ASSETS_BASE_URL: string = \"https://assets.babylonjs.com/meshes/MRTK/\";\r\n /**\r\n * File name for the close icon.\r\n */\r\n public static CLOSE_ICON_FILENAME: string = \"IconClose.png\";\r\n /**\r\n * File name for the close icon.\r\n */\r\n public static FOLLOW_ICON_FILENAME: string = \"IconFollowMe.png\";\r\n\r\n private static _DEFAULT_TEXT_RESOLUTION_Y = 102.4;\r\n\r\n /**\r\n * Margin between title bar and contentplate\r\n */\r\n public titleBarMargin = 0.005;\r\n\r\n /**\r\n * Origin in local coordinates (top left corner)\r\n */\r\n public origin = new Vector3(0, 0, 0);\r\n\r\n private _dimensions = new Vector2(21.875, 12.5);\r\n private _titleBarHeight = 0.625;\r\n\r\n private _titleBarMaterial: FluentBackplateMaterial;\r\n private _backMaterial: FluentBackplateMaterial;\r\n private _contentMaterial: FluentMaterial;\r\n private _pickedPointObserver: Nullable<Observer<Nullable<Vector3>>>;\r\n private _positionChangedObserver: Nullable<Observer<{ position: Vector3 }>>;\r\n\r\n private _titleText = \"\";\r\n private _titleTextComponent: TextBlock;\r\n\r\n private _contentViewport: Viewport;\r\n private _contentDragBehavior: PointerDragBehavior;\r\n\r\n private _defaultBehavior: DefaultBehavior;\r\n /**\r\n * Regroups all mesh behaviors for the slate\r\n */\r\n public get defaultBehavior(): DefaultBehavior {\r\n return this._defaultBehavior;\r\n }\r\n\r\n /** @internal */\r\n public _gizmo: SlateGizmo;\r\n\r\n protected _titleBar: Mesh;\r\n protected _titleBarTitle: Mesh;\r\n protected _contentPlate: Mesh;\r\n protected _backPlate: Mesh;\r\n /** @internal */\r\n public _followButton: TouchHolographicButton;\r\n protected _closeButton: TouchHolographicButton;\r\n protected _contentScaleRatio = 1;\r\n\r\n /**\r\n * 2D dimensions of the slate\r\n */\r\n public get dimensions() {\r\n return this._dimensions;\r\n }\r\n public set dimensions(value) {\r\n //clamp, respecting ratios\r\n let scale = 1.0;\r\n if (value.x < this.minDimensions.x || value.y < this.minDimensions.y) {\r\n const newRatio = value.x / value.y;\r\n const minRatio = this.minDimensions.x / this.minDimensions.y;\r\n if (minRatio > newRatio) {\r\n // We just need to make sure the x-val is greater than the min\r\n scale = this.minDimensions.x / value.x;\r\n } else {\r\n // We just need to make sure the y-val is greater than the min\r\n scale = this.minDimensions.y / value.y;\r\n }\r\n }\r\n\r\n this._dimensions.copyFrom(value).scaleInPlace(scale);\r\n this._updatePivot();\r\n this._positionElements();\r\n }\r\n\r\n /**\r\n * Minimum dimensions of the slate\r\n */\r\n public minDimensions = new Vector2(15.625, 6.25);\r\n\r\n /**\r\n * Default dimensions of the slate\r\n */\r\n public readonly defaultDimensions = this._dimensions.clone();\r\n\r\n /**\r\n * Height of the title bar component\r\n */\r\n public get titleBarHeight() {\r\n return this._titleBarHeight;\r\n }\r\n public set titleBarHeight(value) {\r\n this._titleBarHeight = value;\r\n }\r\n\r\n /**\r\n * Rendering ground id of all the meshes\r\n */\r\n public set renderingGroupId(id: number) {\r\n this._titleBar.renderingGroupId = id;\r\n this._titleBarTitle.renderingGroupId = id;\r\n this._contentPlate.renderingGroupId = id;\r\n this._backPlate.renderingGroupId = id;\r\n }\r\n public get renderingGroupId(): number {\r\n return this._titleBar.renderingGroupId;\r\n }\r\n\r\n /**\r\n * The title text displayed at the top of the slate\r\n */\r\n public set title(title: string) {\r\n this._titleText = title;\r\n if (this._titleTextComponent) {\r\n this._titleTextComponent.text = title;\r\n }\r\n }\r\n public get title() {\r\n return this._titleText;\r\n }\r\n\r\n /**\r\n * Creates a new slate\r\n * @param name defines the control name\r\n */\r\n constructor(name?: string) {\r\n super(name);\r\n\r\n this._followButton = new TouchHolographicButton(\"followButton\" + this.name);\r\n this._followButton.isToggleButton = true;\r\n this._closeButton = new TouchHolographicButton(\"closeButton\" + this.name);\r\n\r\n this._contentViewport = new Viewport(0, 0, 1, 1);\r\n this._contentDragBehavior = new PointerDragBehavior({\r\n dragPlaneNormal: new Vector3(0, 0, -1),\r\n });\r\n }\r\n\r\n /**\r\n * Apply the facade texture (created from the content property).\r\n * This function can be overloaded by child classes\r\n * @param facadeTexture defines the AdvancedDynamicTexture to use\r\n */\r\n protected _applyFacade(facadeTexture: AdvancedDynamicTexture) {\r\n this._contentMaterial.albedoTexture = facadeTexture;\r\n this._resetContentPositionAndZoom();\r\n this._applyContentViewport();\r\n\r\n facadeTexture.attachToMesh(this._contentPlate, true);\r\n }\r\n\r\n private _addControl(control: Control3D): void {\r\n control._host = this._host;\r\n if (this._host.utilityLayer) {\r\n control._prepareNode(this._host.utilityLayer.utilityLayerScene);\r\n }\r\n }\r\n\r\n protected _getTypeName(): string {\r\n return \"HolographicSlate\";\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _positionElements() {\r\n const followButton = this._followButton;\r\n const closeButton = this._closeButton;\r\n const titleBar = this._titleBar;\r\n const titleBarTitle = this._titleBarTitle;\r\n const contentPlate = this._contentPlate;\r\n const backPlate = this._backPlate;\r\n\r\n if (followButton && closeButton && titleBar) {\r\n closeButton.scaling.setAll(this.titleBarHeight);\r\n followButton.scaling.setAll(this.titleBarHeight);\r\n closeButton.position.copyFromFloats(this.dimensions.x - this.titleBarHeight / 2, -this.titleBarHeight / 2, 0).addInPlace(this.origin);\r\n followButton.position.copyFromFloats(this.dimensions.x - (3 * this.titleBarHeight) / 2, -this.titleBarHeight / 2, 0).addInPlace(this.origin);\r\n\r\n const contentPlateHeight = this.dimensions.y - this.titleBarHeight - this.titleBarMargin;\r\n const rightHandScene = contentPlate.getScene().useRightHandedSystem;\r\n\r\n titleBar.scaling.set(this.dimensions.x, this.titleBarHeight, Epsilon);\r\n titleBarTitle.scaling.set(this.dimensions.x - 2 * this.titleBarHeight, this.titleBarHeight, Epsilon);\r\n contentPlate.scaling.copyFromFloats(this.dimensions.x, contentPlateHeight, Epsilon);\r\n backPlate.scaling.copyFromFloats(this.dimensions.x, contentPlateHeight, Epsilon);\r\n\r\n titleBar.position.copyFromFloats(this.dimensions.x / 2, -(this.titleBarHeight / 2), 0).addInPlace(this.origin);\r\n titleBarTitle.position\r\n .copyFromFloats(this.dimensions.x / 2 - this.titleBarHeight, -(this.titleBarHeight / 2), rightHandScene ? Epsilon : -Epsilon)\r\n .addInPlace(this.origin);\r\n contentPlate.position.copyFromFloats(this.dimensions.x / 2, -(this.titleBarHeight + this.titleBarMargin + contentPlateHeight / 2), 0).addInPlace(this.origin);\r\n backPlate.position\r\n .copyFromFloats(this.dimensions.x / 2, -(this.titleBarHeight + this.titleBarMargin + contentPlateHeight / 2), rightHandScene ? -Epsilon : Epsilon)\r\n .addInPlace(this.origin);\r\n\r\n // Update the title's AdvancedDynamicTexture scale to avoid visual stretching\r\n this._titleTextComponent.host.scaleTo(\r\n (HolographicSlate._DEFAULT_TEXT_RESOLUTION_Y * titleBarTitle.scaling.x) / titleBarTitle.scaling.y,\r\n HolographicSlate._DEFAULT_TEXT_RESOLUTION_Y\r\n );\r\n\r\n const aspectRatio = this.dimensions.x / contentPlateHeight;\r\n this._contentViewport.width = this._contentScaleRatio;\r\n this._contentViewport.height = this._contentScaleRatio / aspectRatio;\r\n\r\n this._applyContentViewport();\r\n if (this._gizmo) {\r\n this._gizmo.updateBoundingBox();\r\n }\r\n }\r\n }\r\n\r\n private _applyContentViewport() {\r\n if (this._contentPlate?.material && (this._contentPlate.material as FluentMaterial).albedoTexture) {\r\n const tex = (this._contentPlate.material as FluentMaterial).albedoTexture as Texture;\r\n tex.uScale = this._contentScaleRatio;\r\n tex.vScale = (this._contentScaleRatio / this._contentViewport.width) * this._contentViewport.height;\r\n tex.uOffset = this._contentViewport.x;\r\n tex.vOffset = this._contentViewport.y;\r\n }\r\n }\r\n\r\n private _resetContentPositionAndZoom() {\r\n this._contentViewport.x = 0;\r\n this._contentViewport.y = 1 - this._contentViewport.height / this._contentViewport.width;\r\n this._contentScaleRatio = 1;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _updatePivot() {\r\n if (!this.mesh) {\r\n return;\r\n }\r\n\r\n // Update pivot point so it is at the center of geometry\r\n // As origin is topleft corner in 2D, dimensions are calculated towards bottom right corner, thus y axis is downwards\r\n const center = new Vector3(this.dimensions.x * 0.5, -this.dimensions.y * 0.5, Epsilon);\r\n center.addInPlace(this.origin);\r\n center.z = 0;\r\n\r\n const origin = new Vector3(0, 0, 0);\r\n Vector3.TransformCoordinatesToRef(origin, this.mesh.computeWorldMatrix(true), origin);\r\n this.mesh.setPivotPoint(center);\r\n const origin2 = new Vector3(0, 0, 0);\r\n Vector3.TransformCoordinatesToRef(origin2, this.mesh.computeWorldMatrix(true), origin2);\r\n this.mesh.position.addInPlace(origin).subtractInPlace(origin2);\r\n }\r\n\r\n // Mesh association\r\n protected _createNode(scene: Scene): TransformNode {\r\n const node = new Mesh(\"slate_\" + this.name, scene);\r\n\r\n this._titleBar = CreateBox(\"titleBar_\" + this.name, { size: 1 }, scene);\r\n this._titleBarTitle = CreatePlane(\"titleText_\" + this.name, { size: 1 }, scene);\r\n this._titleBarTitle.parent = node;\r\n this._titleBarTitle.isPickable = false;\r\n\r\n const adt = AdvancedDynamicTexture.CreateForMesh(this._titleBarTitle);\r\n this._titleTextComponent = new TextBlock(\"titleText_\" + this.name, this._titleText);\r\n this._titleTextComponent.textWrapping = TextWrapping.Ellipsis;\r\n this._titleTextComponent.textHorizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;\r\n this._titleTextComponent.color = \"white\";\r\n this._titleTextComponent.fontSize = HolographicSlate._DEFAULT_TEXT_RESOLUTION_Y / 2;\r\n this._titleTextComponent.paddingLeft = HolographicSlate._DEFAULT_TEXT_RESOLUTION_Y / 4;\r\n adt.addControl(this._titleTextComponent);\r\n\r\n if (scene.useRightHandedSystem) {\r\n const faceUV = new Vector4(0, 0, 1, 1);\r\n this._contentPlate = CreatePlane(\"contentPlate_\" + this.name, { size: 1, sideOrientation: VertexData.BACKSIDE, frontUVs: faceUV }, scene);\r\n this._backPlate = CreatePlane(\"backPlate_\" + this.name, { size: 1, sideOrientation: VertexData.FRONTSIDE }, scene);\r\n } else {\r\n const faceUV = new Vector4(0, 0, 1, 1);\r\n this._contentPlate = CreatePlane(\"contentPlate_\" + this.name, { size: 1, sideOrientation: VertexData.FRONTSIDE, frontUVs: faceUV }, scene);\r\n this._backPlate = CreatePlane(\"backPlate_\" + this.name, { size: 1, sideOrientation: VertexData.BACKSIDE }, scene);\r\n }\r\n\r\n this._titleBar.parent = node;\r\n this._titleBar.isNearGrabbable = true;\r\n this._contentPlate.parent = node;\r\n this._backPlate.parent = node;\r\n this._attachContentPlateBehavior();\r\n\r\n this._addControl(this._followButton);\r\n this._addControl(this._closeButton);\r\n\r\n const followButton = this._followButton;\r\n const closeButton = this._closeButton;\r\n\r\n followButton.node!.parent = node;\r\n closeButton.node!.parent = node;\r\n\r\n this._positionElements();\r\n\r\n this._followButton.imageUrl = HolographicSlate.ASSETS_BASE_URL + HolographicSlate.FOLLOW_ICON_FILENAME;\r\n this._closeButton.imageUrl = HolographicSlate.ASSETS_BASE_URL + HolographicSlate.CLOSE_ICON_FILENAME;\r\n\r\n this._followButton.isBackplateVisible = false;\r\n this._closeButton.isBackplateVisible = false;\r\n\r\n this._followButton.onToggleObservable.add((isToggled) => {\r\n this._defaultBehavior.followBehaviorEnabled = isToggled;\r\n if (this._defaultBehavior.followBehaviorEnabled) {\r\n this._defaultBehavior.followBehavior.recenter();\r\n }\r\n });\r\n\r\n this._closeButton.onPointerClickObservable.add(() => {\r\n this.dispose();\r\n });\r\n\r\n node.rotationQuaternion = Quaternion.Identity();\r\n node.isVisible = false;\r\n\r\n return node;\r\n }\r\n\r\n private _attachContentPlateBehavior() {\r\n this._contentDragBehavior.attach(this._contentPlate);\r\n this._contentDragBehavior.moveAttached = false;\r\n this._contentDragBehavior.useObjectOrientationForDragging = true;\r\n this._contentDragBehavior.updateDragPlane = false;\r\n\r\n const origin = new Vector3();\r\n const worldDimensions = new Vector3();\r\n const upWorld = new Vector3();\r\n const rightWorld = new Vector3();\r\n const projectedOffset = new Vector2();\r\n let startViewport: Viewport;\r\n let worldMatrix: Matrix;\r\n\r\n this._contentDragBehavior.onDragStartObservable.add((event) => {\r\n if (!this.node) {\r\n return;\r\n }\r\n startViewport = this._contentViewport.clone();\r\n worldMatrix = this.node.computeWorldMatrix(true);\r\n\r\n origin.copyFrom(event.dragPlanePoint);\r\n worldDimensions.set(this.dimensions.x, this.dimensions.y, Epsilon);\r\n worldDimensions.y -= this.titleBarHeight + this.titleBarMargin;\r\n Vector3.TransformNormalToRef(worldDimensions, worldMatrix, worldDimensions);\r\n upWorld.copyFromFloats(0, 1, 0);\r\n Vector3.TransformNormalToRef(upWorld, worldMatrix, upWorld);\r\n rightWorld.copyFromFloats(1, 0, 0);\r\n Vector3.TransformNormalToRef(rightWorld, worldMatrix, rightWorld);\r\n upWorld.normalize();\r\n upWorld.scaleInPlace(1 / Vector3.Dot(upWorld, worldDimensions));\r\n rightWorld.normalize();\r\n rightWorld.scaleInPlace(1 / Vector3.Dot(rightWorld, worldDimensions));\r\n });\r\n\r\n const offset = new Vector3();\r\n this._contentDragBehavior.onDragObservable.add((event) => {\r\n offset.copyFrom(event.dragPlanePoint);\r\n offset.subtractInPlace(origin);\r\n projectedOffset.copyFromFloats(Vector3.Dot(offset, rightWorld), Vector3.Dot(offset, upWorld));\r\n\r\n // By default, content takes full width available and height is cropped to keep aspect ratio\r\n this._contentViewport.x = Scalar.Clamp(startViewport.x - offset.x, 0, 1 - this._contentViewport.width * this._contentScaleRatio);\r\n this._contentViewport.y = Scalar.Clamp(startViewport.y - offset.y, 0, 1 - this._contentViewport.height * this._contentScaleRatio);\r\n this._applyContentViewport();\r\n });\r\n }\r\n\r\n protected _affectMaterial(mesh: AbstractMesh) {\r\n // TODO share materials\r\n this._titleBarMaterial = new FluentBackplateMaterial(`${this.name} plateMaterial`, mesh.getScene());\r\n\r\n this._contentMaterial = new FluentMaterial(`${this.name} contentMaterial`, mesh.getScene());\r\n this._contentMaterial.renderBorders = true;\r\n\r\n this._backMaterial = new FluentBackplateMaterial(`${this.name} backPlate`, mesh.getScene());\r\n this._backMaterial.lineWidth = Epsilon;\r\n this._backMaterial.radius = 0.005;\r\n this._backMaterial.backFaceCulling = true;\r\n\r\n this._titleBar.material = this._titleBarMaterial;\r\n this._contentPlate.material = this._contentMaterial;\r\n this._backPlate.material = this._backMaterial;\r\n\r\n this._resetContent();\r\n this._applyContentViewport();\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _prepareNode(scene: Scene): void {\r\n super._prepareNode(scene);\r\n this._gizmo = new SlateGizmo(this._host.utilityLayer!);\r\n this._gizmo.attachedSlate = this;\r\n this._defaultBehavior = new DefaultBehavior();\r\n this._defaultBehavior.attach(this.node as Mesh, [this._titleBar]);\r\n this._defaultBehavior.sixDofDragBehavior.onDragStartObservable.add(() => {\r\n this._followButton.isToggled = false;\r\n });\r\n\r\n this._positionChangedObserver = this._defaultBehavior.sixDofDragBehavior.onPositionChangedObservable.add(() => {\r\n this._gizmo.updateBoundingBox();\r\n });\r\n\r\n this._updatePivot();\r\n this.resetDefaultAspectAndPose(false);\r\n }\r\n\r\n /**\r\n * Resets the aspect and pose of the slate so it is right in front of the active camera, facing towards it.\r\n * @param resetAspect Should the slate's dimensions/aspect ratio be reset as well\r\n */\r\n public resetDefaultAspectAndPose(resetAspect: boolean = true) {\r\n if (!this._host || !this._host.utilityLayer || !this.node) {\r\n return;\r\n }\r\n const scene = this._host.utilityLayer.utilityLayerScene;\r\n const camera = scene.activeCamera;\r\n if (camera) {\r\n const worldMatrix = camera.getWorldMatrix();\r\n const backward = Vector3.TransformNormal(Vector3.Backward(scene.useRightHandedSystem), worldMatrix);\r\n this.origin.setAll(0);\r\n this._gizmo.updateBoundingBox();\r\n const pivot = this.node.getAbsolutePivotPoint();\r\n this.node.position.copyFrom(camera.position).subtractInPlace(backward).subtractInPlace(pivot);\r\n this.node.rotationQuaternion = Quaternion.FromLookDirectionLH(backward, new Vector3(0, 1, 0));\r\n\r\n if (resetAspect) {\r\n this.dimensions = this.defaultDimensions;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Releases all associated resources\r\n */\r\n public dispose() {\r\n super.dispose();\r\n this._titleBarMaterial.dispose();\r\n this._contentMaterial.dispose();\r\n\r\n this._titleBar.dispose();\r\n this._titleBarTitle.dispose();\r\n this._contentPlate.dispose();\r\n this._backPlate.dispose();\r\n\r\n this._followButton.dispose();\r\n this._closeButton.dispose();\r\n\r\n this._host.onPickedPointChangedObservable.remove(this._pickedPointObserver);\r\n this._defaultBehavior.sixDofDragBehavior.onPositionChangedObservable.remove(this._positionChangedObserver);\r\n\r\n this._defaultBehavior.detach();\r\n this._gizmo.dispose();\r\n this._contentDragBehavior.detach();\r\n }\r\n}\r\n"]}
@@ -50,8 +50,8 @@ export declare class TouchHolographicMenu extends VolumeBasedPanel {
50
50
  /**
51
51
  * This method should not be used directly. It is inherited from `Container3D`.
52
52
  * Please use `addButton` instead.
53
- * @param _control
54
- * @returns
53
+ * @param _control the control to add
54
+ * @returns the current container
55
55
  */
56
56
  addControl(_control: Control3D): Container3D;
57
57
  /**
@@ -116,8 +116,8 @@ export class TouchHolographicMenu extends VolumeBasedPanel {
116
116
  /**
117
117
  * This method should not be used directly. It is inherited from `Container3D`.
118
118
  * Please use `addButton` instead.
119
- * @param _control
120
- * @returns
119
+ * @param _control the control to add
120
+ * @returns the current container
121
121
  */
122
122
  addControl(_control) {
123
123
  Logger.Warn("TouchHolographicMenu can only contain buttons. Please use the method `addButton` instead.");
@@ -1 +1 @@
1
- {"version":3,"file":"touchHolographicMenu.js","sourceRoot":"","sources":["../../../../../dev/gui/src/3D/controls/touchHolographicMenu.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC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CAAC,WAAW,GAAG,IAAI,CAAC;QACxB,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;IAC5B,CAAC;IAED;;;OAGG;IACH,YAAY,IAAa;QACrB,KAAK,CAAC,IAAI,CAAC,CAAC;QA5GR,qBAAgB,GAAG,IAAI,CAAC;IA6GhC,CAAC;IAED;;;;;;OAMG;IACI,SAAS,CAAC,MAA8B;QAC3C,kGAAkG;QAClG,MAAM,gBAAgB,GAAG,IAAI,CAAC,WAAW,CAAC;QAC1C,IAAI,CAAC,gBAAgB,EAAE;YACnB,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;SAC3B;QAED,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;QAEzB,MAAM,CAAC,kBAAkB,GAAG,KAAK,CAAC;QAClC,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,CAAC;QAEpE,uIAAuI;QACvI,IAAI,CAAC,gBAAgB,EAAE;YACnB,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC;SAC5B;QACD,OAAO,IAAI,CAAC;IAChB,CAAC;IAED;;;;;OAKG;IACI,UAAU,CAAC,QAAmB;QACjC,MAAM,CAAC,IAAI,CAAC,2FAA2F,CAAC,CAAC;QAEzG,OAAO,IAAI,CAAC;IAChB,CAAC;IAED;;OAEG;IACI,OAAO;QACV,KAAK,CAAC,OAAO,EAAE,CAAC;QAEhB,IAAI,CAAC,KAAK,CAAC,8BAA8B,CAAC,MAAM,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;IAChF,CAAC;;AA1JD;;GAEG;AACH,gEAAgE;AAC/C,sCAAiB,GAAW,CAAC,AAAZ,CAAa","sourcesContent":["import type { Scene } from \"core/scene\";\r\nimport type { Vector3 } from \"core/Maths/math.vector\";\r\nimport type { TransformNode } from \"core/Meshes/transformNode\";\r\nimport type { Nullable } from \"core/types\";\r\nimport type { Control3D } from \"./control3D\";\r\nimport { VolumeBasedPanel } from \"./volumeBasedPanel\";\r\nimport { Mesh } from \"core/Meshes/mesh\";\r\nimport { CreateBox } from \"core/Meshes/Builders/boxBuilder\";\r\nimport type { AbstractMesh } from \"core/Meshes/abstractMesh\";\r\nimport { FluentMaterial } from \"../materials/fluent/fluentMaterial\";\r\nimport { Color3 } from \"core/Maths/math.color\";\r\nimport type { Observer } from \"core/Misc/observable\";\r\nimport { Logger } from \"core/Misc/logger\";\r\nimport type { Container3D } from \"./container3D\";\r\nimport type { TouchHolographicButton } from \"./touchHolographicButton\";\r\n\r\n/**\r\n * Simple menu that can contain holographic buttons\r\n */\r\nexport class TouchHolographicMenu extends VolumeBasedPanel {\r\n protected _backPlate: Mesh;\r\n private _backPlateMaterial: FluentMaterial;\r\n private _pickedPointObserver: Nullable<Observer<Nullable<Vector3>>>;\r\n\r\n private _currentMin: Nullable<Vector3>;\r\n private _currentMax: Nullable<Vector3>;\r\n\r\n private _backPlateMargin = 1.25;\r\n\r\n /**\r\n * Scale for the buttons added to the menu\r\n */\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n protected static MENU_BUTTON_SCALE: number = 1;\r\n\r\n /**\r\n * Gets or sets the margin size of the backplate in button size units.\r\n * Setting this to 1, will make the backPlate margin the size of 1 button\r\n */\r\n public get backPlateMargin(): number {\r\n return this._backPlateMargin;\r\n }\r\n\r\n public set backPlateMargin(value: number) {\r\n this._backPlateMargin = value;\r\n\r\n if (this._children.length >= 1) {\r\n this.children.forEach((control) => {\r\n this._updateCurrentMinMax(control.position);\r\n });\r\n\r\n this._updateMargins();\r\n }\r\n }\r\n\r\n protected _createNode(scene: Scene): Nullable<TransformNode> {\r\n const node = new Mesh(`menu_${this.name}`, scene);\r\n\r\n this._backPlate = CreateBox(\"backPlate\" + this.name, { size: 1 }, scene);\r\n this._backPlate.parent = node;\r\n\r\n return node;\r\n }\r\n\r\n protected _affectMaterial(mesh: AbstractMesh) {\r\n this._backPlateMaterial = new FluentMaterial(this.name + \"backPlateMaterial\", mesh.getScene());\r\n this._backPlateMaterial.albedoColor = new Color3(0.08, 0.15, 0.55);\r\n this._backPlateMaterial.renderBorders = true;\r\n this._backPlateMaterial.renderHoverLight = true;\r\n\r\n this._pickedPointObserver = this._host.onPickedPointChangedObservable.add((pickedPoint) => {\r\n if (pickedPoint) {\r\n this._backPlateMaterial.hoverPosition = pickedPoint;\r\n this._backPlateMaterial.hoverColor.a = 1.0;\r\n } else {\r\n this._backPlateMaterial.hoverColor.a = 0;\r\n }\r\n });\r\n\r\n this._backPlate.material = this._backPlateMaterial;\r\n }\r\n\r\n protected _mapGridNode(control: Control3D, nodePosition: Vector3) {\r\n // Simple plane mapping for the menu\r\n const mesh = control.mesh;\r\n\r\n if (!mesh) {\r\n return;\r\n }\r\n\r\n control.position = nodePosition.clone();\r\n\r\n this._updateCurrentMinMax(nodePosition);\r\n }\r\n\r\n protected _finalProcessing() {\r\n this._updateMargins();\r\n }\r\n\r\n private _updateCurrentMinMax(nodePosition: Vector3) {\r\n if (!this._currentMin) {\r\n this._currentMin = nodePosition.clone();\r\n this._currentMax = nodePosition.clone();\r\n }\r\n\r\n this._currentMin.minimizeInPlace(nodePosition);\r\n this._currentMax!.maximizeInPlace(nodePosition);\r\n }\r\n\r\n private _updateMargins() {\r\n if (this._children.length > 0) {\r\n this._currentMin!.addInPlaceFromFloats(-this._cellWidth / 2, -this._cellHeight / 2, 0);\r\n this._currentMax!.addInPlaceFromFloats(this._cellWidth / 2, this._cellHeight / 2, 0);\r\n const extendSize = this._currentMax!.subtract(this._currentMin!);\r\n\r\n // Also add a % margin\r\n this._backPlate.scaling.x = extendSize.x + this._cellWidth * this.backPlateMargin;\r\n this._backPlate.scaling.y = extendSize.y + this._cellHeight * this.backPlateMargin;\r\n this._backPlate.scaling.z = 0.001;\r\n\r\n for (let i = 0; i < this._children.length; i++) {\r\n this._children[i].position.subtractInPlace(this._currentMin!).subtractInPlace(extendSize.scale(0.5));\r\n this._children[i].position.z -= 0.01;\r\n }\r\n }\r\n\r\n this._currentMin = null;\r\n this._currentMax = null;\r\n }\r\n\r\n /**\r\n * Creates a holographic menu GUI 3D control\r\n * @param name name of the menu\r\n */\r\n constructor(name?: string) {\r\n super(name);\r\n }\r\n\r\n /**\r\n * Adds a button to the menu.\r\n * Please note that the back material of the button will be set to transparent as it is attached to the menu.\r\n *\r\n * @param button Button to add\r\n * @returns This menu\r\n */\r\n public addButton(button: TouchHolographicButton): TouchHolographicMenu {\r\n // Block updating the layout until the button is resized (which has to happen after node creation)\r\n const wasLayoutBlocked = this.blockLayout;\r\n if (!wasLayoutBlocked) {\r\n this.blockLayout = true;\r\n }\r\n\r\n super.addControl(button);\r\n\r\n button.isBackplateVisible = false;\r\n button.scaling.scaleInPlace(TouchHolographicMenu.MENU_BUTTON_SCALE);\r\n\r\n // Unblocking the layout triggers the pending layout update that uses the size of the buttons to determine the size of the backing mesh\r\n if (!wasLayoutBlocked) {\r\n this.blockLayout = false;\r\n }\r\n return this;\r\n }\r\n\r\n /**\r\n * This method should not be used directly. It is inherited from `Container3D`.\r\n * Please use `addButton` instead.\r\n * @param _control\r\n * @returns\r\n */\r\n public addControl(_control: Control3D): Container3D {\r\n Logger.Warn(\"TouchHolographicMenu can only contain buttons. Please use the method `addButton` instead.\");\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Disposes the menu\r\n */\r\n public dispose() {\r\n super.dispose();\r\n\r\n this._host.onPickedPointChangedObservable.remove(this._pickedPointObserver);\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"touchHolographicMenu.js","sourceRoot":"","sources":["../../../../../dev/gui/src/3D/controls/touchHolographicMenu.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,IAAI,EAAE,uCAAyB;AACxC,OAAO,EAAE,SAAS,EAAE,sDAAwC;AAE5D,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAE,MAAM,EAAE,4CAA8B;AAE/C,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AI,CAAC;IA6GhC,CAAC;IAED;;;;;;OAMG;IACI,SAAS,CAAC,MAA8B;QAC3C,kGAAkG;QAClG,MAAM,gBAAgB,GAAG,IAAI,CAAC,WAAW,CAAC;QAC1C,IAAI,CAAC,gBAAgB,EAAE;YACnB,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;SAC3B;QAED,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;QAEzB,MAAM,CAAC,kBAAkB,GAAG,KAAK,CAAC;QAClC,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,CAAC;QAEpE,uIAAuI;QACvI,IAAI,CAAC,gBAAgB,EAAE;YACnB,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC;SAC5B;QACD,OAAO,IAAI,CAAC;IAChB,CAAC;IAED;;;;;OAKG;IACI,UAAU,CAAC,QAAmB;QACjC,MAAM,CAAC,IAAI,CAAC,2FAA2F,CAAC,CAAC;QAEzG,OAAO,IAAI,CAAC;IAChB,CAAC;IAED;;OAEG;IACI,OAAO;QACV,KAAK,CAAC,OAAO,EAAE,CAAC;QAEhB,IAAI,CAAC,KAAK,CAAC,8BAA8B,CAAC,MAAM,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;IAChF,CAAC;;AA1JD;;GAEG;AACH,gEAAgE;AAC/C,sCAAiB,GAAW,CAAC,AAAZ,CAAa","sourcesContent":["import type { Scene } from \"core/scene\";\r\nimport type { Vector3 } from \"core/Maths/math.vector\";\r\nimport type { TransformNode } from \"core/Meshes/transformNode\";\r\nimport type { Nullable } from \"core/types\";\r\nimport type { Control3D } from \"./control3D\";\r\nimport { VolumeBasedPanel } from \"./volumeBasedPanel\";\r\nimport { Mesh } from \"core/Meshes/mesh\";\r\nimport { CreateBox } from \"core/Meshes/Builders/boxBuilder\";\r\nimport type { AbstractMesh } from \"core/Meshes/abstractMesh\";\r\nimport { FluentMaterial } from \"../materials/fluent/fluentMaterial\";\r\nimport { Color3 } from \"core/Maths/math.color\";\r\nimport type { Observer } from \"core/Misc/observable\";\r\nimport { Logger } from \"core/Misc/logger\";\r\nimport type { Container3D } from \"./container3D\";\r\nimport type { TouchHolographicButton } from \"./touchHolographicButton\";\r\n\r\n/**\r\n * Simple menu that can contain holographic buttons\r\n */\r\nexport class TouchHolographicMenu extends VolumeBasedPanel {\r\n protected _backPlate: Mesh;\r\n private _backPlateMaterial: FluentMaterial;\r\n private _pickedPointObserver: Nullable<Observer<Nullable<Vector3>>>;\r\n\r\n private _currentMin: Nullable<Vector3>;\r\n private _currentMax: Nullable<Vector3>;\r\n\r\n private _backPlateMargin = 1.25;\r\n\r\n /**\r\n * Scale for the buttons added to the menu\r\n */\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n protected static MENU_BUTTON_SCALE: number = 1;\r\n\r\n /**\r\n * Gets or sets the margin size of the backplate in button size units.\r\n * Setting this to 1, will make the backPlate margin the size of 1 button\r\n */\r\n public get backPlateMargin(): number {\r\n return this._backPlateMargin;\r\n }\r\n\r\n public set backPlateMargin(value: number) {\r\n this._backPlateMargin = value;\r\n\r\n if (this._children.length >= 1) {\r\n this.children.forEach((control) => {\r\n this._updateCurrentMinMax(control.position);\r\n });\r\n\r\n this._updateMargins();\r\n }\r\n }\r\n\r\n protected _createNode(scene: Scene): Nullable<TransformNode> {\r\n const node = new Mesh(`menu_${this.name}`, scene);\r\n\r\n this._backPlate = CreateBox(\"backPlate\" + this.name, { size: 1 }, scene);\r\n this._backPlate.parent = node;\r\n\r\n return node;\r\n }\r\n\r\n protected _affectMaterial(mesh: AbstractMesh) {\r\n this._backPlateMaterial = new FluentMaterial(this.name + \"backPlateMaterial\", mesh.getScene());\r\n this._backPlateMaterial.albedoColor = new Color3(0.08, 0.15, 0.55);\r\n this._backPlateMaterial.renderBorders = true;\r\n this._backPlateMaterial.renderHoverLight = true;\r\n\r\n this._pickedPointObserver = this._host.onPickedPointChangedObservable.add((pickedPoint) => {\r\n if (pickedPoint) {\r\n this._backPlateMaterial.hoverPosition = pickedPoint;\r\n this._backPlateMaterial.hoverColor.a = 1.0;\r\n } else {\r\n this._backPlateMaterial.hoverColor.a = 0;\r\n }\r\n });\r\n\r\n this._backPlate.material = this._backPlateMaterial;\r\n }\r\n\r\n protected _mapGridNode(control: Control3D, nodePosition: Vector3) {\r\n // Simple plane mapping for the menu\r\n const mesh = control.mesh;\r\n\r\n if (!mesh) {\r\n return;\r\n }\r\n\r\n control.position = nodePosition.clone();\r\n\r\n this._updateCurrentMinMax(nodePosition);\r\n }\r\n\r\n protected _finalProcessing() {\r\n this._updateMargins();\r\n }\r\n\r\n private _updateCurrentMinMax(nodePosition: Vector3) {\r\n if (!this._currentMin) {\r\n this._currentMin = nodePosition.clone();\r\n this._currentMax = nodePosition.clone();\r\n }\r\n\r\n this._currentMin.minimizeInPlace(nodePosition);\r\n this._currentMax!.maximizeInPlace(nodePosition);\r\n }\r\n\r\n private _updateMargins() {\r\n if (this._children.length > 0) {\r\n this._currentMin!.addInPlaceFromFloats(-this._cellWidth / 2, -this._cellHeight / 2, 0);\r\n this._currentMax!.addInPlaceFromFloats(this._cellWidth / 2, this._cellHeight / 2, 0);\r\n const extendSize = this._currentMax!.subtract(this._currentMin!);\r\n\r\n // Also add a % margin\r\n this._backPlate.scaling.x = extendSize.x + this._cellWidth * this.backPlateMargin;\r\n this._backPlate.scaling.y = extendSize.y + this._cellHeight * this.backPlateMargin;\r\n this._backPlate.scaling.z = 0.001;\r\n\r\n for (let i = 0; i < this._children.length; i++) {\r\n this._children[i].position.subtractInPlace(this._currentMin!).subtractInPlace(extendSize.scale(0.5));\r\n this._children[i].position.z -= 0.01;\r\n }\r\n }\r\n\r\n this._currentMin = null;\r\n this._currentMax = null;\r\n }\r\n\r\n /**\r\n * Creates a holographic menu GUI 3D control\r\n * @param name name of the menu\r\n */\r\n constructor(name?: string) {\r\n super(name);\r\n }\r\n\r\n /**\r\n * Adds a button to the menu.\r\n * Please note that the back material of the button will be set to transparent as it is attached to the menu.\r\n *\r\n * @param button Button to add\r\n * @returns This menu\r\n */\r\n public addButton(button: TouchHolographicButton): TouchHolographicMenu {\r\n // Block updating the layout until the button is resized (which has to happen after node creation)\r\n const wasLayoutBlocked = this.blockLayout;\r\n if (!wasLayoutBlocked) {\r\n this.blockLayout = true;\r\n }\r\n\r\n super.addControl(button);\r\n\r\n button.isBackplateVisible = false;\r\n button.scaling.scaleInPlace(TouchHolographicMenu.MENU_BUTTON_SCALE);\r\n\r\n // Unblocking the layout triggers the pending layout update that uses the size of the buttons to determine the size of the backing mesh\r\n if (!wasLayoutBlocked) {\r\n this.blockLayout = false;\r\n }\r\n return this;\r\n }\r\n\r\n /**\r\n * This method should not be used directly. It is inherited from `Container3D`.\r\n * Please use `addButton` instead.\r\n * @param _control the control to add\r\n * @returns the current container\r\n */\r\n public addControl(_control: Control3D): Container3D {\r\n Logger.Warn(\"TouchHolographicMenu can only contain buttons. Please use the method `addButton` instead.\");\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Disposes the menu\r\n */\r\n public dispose() {\r\n super.dispose();\r\n\r\n this._host.onPickedPointChangedObservable.remove(this._pickedPointObserver);\r\n }\r\n}\r\n"]}
@@ -86,8 +86,9 @@ export class FluentMaterial extends PushMaterial {
86
86
  return null;
87
87
  }
88
88
  isReadyForSubMesh(mesh, subMesh) {
89
+ const drawWrapper = subMesh._drawWrapper;
89
90
  if (this.isFrozen) {
90
- if (subMesh.effect && subMesh.effect._wasPreviouslyReady) {
91
+ if (drawWrapper.effect && drawWrapper._wasPreviouslyReady) {
91
92
  return true;
92
93
  }
93
94
  }
@@ -167,7 +168,7 @@ export class FluentMaterial extends PushMaterial {
167
168
  return false;
168
169
  }
169
170
  defines._renderId = scene.getRenderId();
170
- subMesh.effect._wasPreviouslyReady = true;
171
+ drawWrapper._wasPreviouslyReady = true;
171
172
  return true;
172
173
  }
173
174
  bindForSubMesh(world, mesh, subMesh) {
@@ -184,7 +185,7 @@ export class FluentMaterial extends PushMaterial {
184
185
  // Matrices
185
186
  this.bindOnlyWorldMatrix(world);
186
187
  this._activeEffect.setMatrix("viewProjection", scene.getTransformMatrix());
187
- if (this._mustRebind(scene, effect)) {
188
+ if (this._mustRebind(scene, effect, subMesh)) {
188
189
  this._activeEffect.setColor4("albedoColor", this.albedoColor, this.alpha);
189
190
  if (defines.INNERGLOW) {
190
191
  this._activeEffect.setColor4("innerGlowColor", this.innerGlowColor, this.innerGlowColorIntensity);
@@ -207,7 +208,7 @@ export class FluentMaterial extends PushMaterial {
207
208
  this._activeEffect.setMatrix("textureMatrix", matrix);
208
209
  }
209
210
  }
210
- this._afterBind(mesh, this._activeEffect);
211
+ this._afterBind(mesh, this._activeEffect, subMesh);
211
212
  }
212
213
  getActiveTextures() {
213
214
  const activeTextures = super.getActiveTextures();