@babylonjs/gui 7.34.4 → 7.35.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (80) hide show
  1. package/2D/FrameGraph/guiTask.js.map +1 -1
  2. package/2D/FrameGraph/renderGraphGUIBlock.js.map +1 -1
  3. package/2D/adtInstrumentation.js.map +1 -1
  4. package/2D/advancedDynamicTexture.d.ts +1 -1
  5. package/2D/advancedDynamicTexture.js.map +1 -1
  6. package/2D/controls/button.js.map +1 -1
  7. package/2D/controls/checkbox.js.map +1 -1
  8. package/2D/controls/colorpicker.js.map +1 -1
  9. package/2D/controls/container.js.map +1 -1
  10. package/2D/controls/control.js.map +1 -1
  11. package/2D/controls/displayGrid.js.map +1 -1
  12. package/2D/controls/ellipse.js.map +1 -1
  13. package/2D/controls/focusableButton.js.map +1 -1
  14. package/2D/controls/gradient/BaseGradient.js.map +1 -1
  15. package/2D/controls/grid.js.map +1 -1
  16. package/2D/controls/image.js.map +1 -1
  17. package/2D/controls/inputPassword.js.map +1 -1
  18. package/2D/controls/inputText.js.map +1 -1
  19. package/2D/controls/inputTextArea.js.map +1 -1
  20. package/2D/controls/line.js.map +1 -1
  21. package/2D/controls/multiLine.js.map +1 -1
  22. package/2D/controls/radioButton.js.map +1 -1
  23. package/2D/controls/rectangle.js.map +1 -1
  24. package/2D/controls/scrollViewers/scrollViewer.js.map +1 -1
  25. package/2D/controls/scrollViewers/scrollViewerWindow.js.map +1 -1
  26. package/2D/controls/selector.js.map +1 -1
  27. package/2D/controls/sliders/baseSlider.js.map +1 -1
  28. package/2D/controls/sliders/imageBasedSlider.js.map +1 -1
  29. package/2D/controls/sliders/imageScrollBar.js.map +1 -1
  30. package/2D/controls/sliders/scrollBar.js.map +1 -1
  31. package/2D/controls/sliders/slider.js.map +1 -1
  32. package/2D/controls/stackPanel.js.map +1 -1
  33. package/2D/controls/statics.js.map +1 -1
  34. package/2D/controls/textBlock.js.map +1 -1
  35. package/2D/controls/textWrapper.js.map +1 -1
  36. package/2D/controls/toggleButton.js.map +1 -1
  37. package/2D/controls/virtualKeyboard.js.map +1 -1
  38. package/2D/math2D.js.map +1 -1
  39. package/2D/measure.js.map +1 -1
  40. package/2D/multiLinePoint.js.map +1 -1
  41. package/2D/style.js.map +1 -1
  42. package/2D/valueAndUnit.js.map +1 -1
  43. package/2D/xmlLoader.js.map +1 -1
  44. package/3D/behaviors/defaultBehavior.js.map +1 -1
  45. package/3D/controls/MRTK3/touchHolographicButton.js.map +1 -1
  46. package/3D/controls/button3D.js.map +1 -1
  47. package/3D/controls/container3D.js.map +1 -1
  48. package/3D/controls/contentDisplay3D.js.map +1 -1
  49. package/3D/controls/control3D.js.map +1 -1
  50. package/3D/controls/cylinderPanel.js.map +1 -1
  51. package/3D/controls/holographicBackplate.js.map +1 -1
  52. package/3D/controls/holographicButton.js.map +1 -1
  53. package/3D/controls/holographicSlate.js.map +1 -1
  54. package/3D/controls/meshButton3D.js.map +1 -1
  55. package/3D/controls/nearMenu.js.map +1 -1
  56. package/3D/controls/planePanel.js.map +1 -1
  57. package/3D/controls/scatterPanel.js.map +1 -1
  58. package/3D/controls/slider3D.js.map +1 -1
  59. package/3D/controls/spherePanel.js.map +1 -1
  60. package/3D/controls/stackPanel3D.js.map +1 -1
  61. package/3D/controls/touchButton3D.js.map +1 -1
  62. package/3D/controls/touchHolographicButton.js.map +1 -1
  63. package/3D/controls/touchHolographicMenu.js.map +1 -1
  64. package/3D/controls/touchMeshButton3D.js.map +1 -1
  65. package/3D/controls/volumeBasedPanel.js.map +1 -1
  66. package/3D/gizmos/gizmoHandle.js.map +1 -1
  67. package/3D/gizmos/slateGizmo.js.map +1 -1
  68. package/3D/gui3DManager.js.map +1 -1
  69. package/3D/materials/fluent/fluentMaterial.js.map +1 -1
  70. package/3D/materials/fluentBackplate/fluentBackplateMaterial.js.map +1 -1
  71. package/3D/materials/fluentButton/fluentButtonMaterial.js.map +1 -1
  72. package/3D/materials/handle/handleMaterial.js.map +1 -1
  73. package/3D/materials/mrdl/mrdlBackglowMaterial.js.map +1 -1
  74. package/3D/materials/mrdl/mrdlBackplateMaterial.js.map +1 -1
  75. package/3D/materials/mrdl/mrdlFrontplateMaterial.js.map +1 -1
  76. package/3D/materials/mrdl/mrdlInnerquadMaterial.js.map +1 -1
  77. package/3D/materials/mrdl/mrdlSliderBarMaterial.js.map +1 -1
  78. package/3D/materials/mrdl/mrdlSliderThumbMaterial.js.map +1 -1
  79. package/legacy/legacy.js.map +1 -1
  80. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"spherePanel.js","sourceRoot":"","sources":["../../../../../dev/gui/src/3D/controls/spherePanel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,sCAAwB;AACxC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,6CAA+B;AAGrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAS,2CAA6B;AAEnD;;GAEG;AACH,MAAM,OAAO,WAAY,SAAQ,gBAAgB;IAAjD;;QACY,YAAO,GAAG,GAAG,CAAC;IAwD1B,CAAC;IAtDG;;OAEG;IACH,IAAW,MAAM;QACb,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;IAED,IAAW,MAAM,CAAC,KAAY;QAC1B,IAAI,IAAI,CAAC,OAAO,KAAK,KAAK,EAAE;YACxB,OAAO;SACV;QAED,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;QAErB,KAAK,CAAC,YAAY,CAAC,GAAG,EAAE;YACpB,IAAI,CAAC,gBAAgB,EAAE,CAAC;QAC5B,CAAC,CAAC,CAAC;IACP,CAAC;IAES,YAAY,CAAC,OAAkB,EAAE,YAAqB;QAC5D,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;QAE1B,IAAI,CAAC,IAAI,EAAE;YACP,OAAO;SACV;QAED,MAAM,MAAM,GAAG,IAAI,CAAC,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AC;CACJ","sourcesContent":["import { Tools } from \"core/Misc/tools\";\r\nimport { Matrix, TmpVectors, Vector3 } from \"core/Maths/math.vector\";\r\nimport type { float } from \"core/types\";\r\n\r\nimport { VolumeBasedPanel } from \"./volumeBasedPanel\";\r\nimport type { Control3D } from \"./control3D\";\r\nimport { Container3D } from \"./container3D\";\r\nimport { Axis, Space } from \"core/Maths/math.axis\";\r\n\r\n/**\r\n * Class used to create a container panel deployed on the surface of a sphere\r\n */\r\nexport class SpherePanel extends VolumeBasedPanel {\r\n private _radius = 5.0;\r\n\r\n /**\r\n * Gets or sets the radius of the sphere where to project controls (5 by default)\r\n */\r\n public get radius(): float {\r\n return this._radius;\r\n }\r\n\r\n public set radius(value: float) {\r\n if (this._radius === value) {\r\n return;\r\n }\r\n\r\n this._radius = value;\r\n\r\n Tools.SetImmediate(() => {\r\n this._arrangeChildren();\r\n });\r\n }\r\n\r\n protected _mapGridNode(control: Control3D, nodePosition: Vector3) {\r\n const mesh = control.mesh;\r\n\r\n if (!mesh) {\r\n return;\r\n }\r\n\r\n const newPos = this._sphericalMapping(nodePosition);\r\n control.position = newPos;\r\n\r\n switch (this.orientation) {\r\n case Container3D.FACEORIGIN_ORIENTATION:\r\n mesh.lookAt(new Vector3(2 * newPos.x, 2 * newPos.y, 2 * newPos.z));\r\n break;\r\n case Container3D.FACEORIGINREVERSED_ORIENTATION:\r\n mesh.lookAt(new Vector3(-newPos.x, -newPos.y, -newPos.z));\r\n break;\r\n case Container3D.FACEFORWARD_ORIENTATION:\r\n break;\r\n case Container3D.FACEFORWARDREVERSED_ORIENTATION:\r\n mesh.rotate(Axis.Y, Math.PI, Space.LOCAL);\r\n break;\r\n }\r\n }\r\n\r\n private _sphericalMapping(source: Vector3) {\r\n const newPos = new Vector3(0, 0, this._radius);\r\n\r\n const xAngle = source.y / this._radius;\r\n const yAngle = -(source.x / this._radius);\r\n\r\n Matrix.RotationYawPitchRollToRef(yAngle, xAngle, 0, TmpVectors.Matrix[0]);\r\n\r\n return Vector3.TransformNormal(newPos, TmpVectors.Matrix[0]);\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"spherePanel.js","sourceRoot":"","sources":["../../../../../dev/gui/src/3D/controls/spherePanel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,sCAAwB;AACxC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,6CAA+B;AAGrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAS,2CAA6B;AAEnD;;GAEG;AACH,MAAM,OAAO,WAAY,SAAQ,gBAAgB;IAAjD;;QACY,YAAO,GAAG,GAAG,CAAC;IAwD1B,CAAC;IAtDG;;OAEG;IACH,IAAW,MAAM;QACb,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;IAED,IAAW,MAAM,CAAC,KAAY;QAC1B,IAAI,IAAI,CAAC,OAAO,KAAK,KAAK,EAAE,CAAC;YACzB,OAAO;QACX,CAAC;QAED,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;QAErB,KAAK,CAAC,YAAY,CAAC,GAAG,EAAE;YACpB,IAAI,CAAC,gBAAgB,EAAE,CAAC;QAC5B,CAAC,CAAC,CAAC;IACP,CAAC;IAES,YAAY,CAAC,OAAkB,EAAE,YAAqB;QAC5D,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;QAE1B,IAAI,CAAC,IAAI,EAAE,CAAC;YACR,OAAO;QACX,CAAC;QAED,MAAM,MAAM,GAAG,IAAI,CAAC,iBAAiB,CAAC,YAAY,CAAC,CAAC;QACpD,OAAO,CAAC,QAAQ,GAAG,MAAM,CAAC;QAE1B,QAAQ,IAAI,CAAC,WAAW,EAAE,CAAC;YACvB,KAAK,WAAW,CAAC,sBAAsB;gBACnC,IAAI,CAAC,MAAM,CAAC,IAAI,OAAO,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;gBACnE,MAAM;YACV,KAAK,WAAW,CAAC,8BAA8B;gBAC3C,IAAI,CAAC,MAAM,CAAC,IAAI,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;gBAC1D,MAAM;YACV,KAAK,WAAW,CAAC,uBAAuB;gBACpC,MAAM;YACV,KAAK,WAAW,CAAC,+BAA+B;gBAC5C,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC,EAAE,sBAAc,CAAC;gBAC1C,MAAM;QACd,CAAC;IACL,CAAC;IAEO,iBAAiB,CAAC,MAAe;QACrC,MAAM,MAAM,GAAG,IAAI,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QAE/C,MAAM,MAAM,GAAG,MAAM,CAAC,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC;QACvC,MAAM,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC;QAE1C,MAAM,CAAC,yBAAyB,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;QAE1E,OAAO,OAAO,CAAC,eAAe,CAAC,MAAM,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IACjE,CAAC;CACJ","sourcesContent":["import { Tools } from \"core/Misc/tools\";\r\nimport { Matrix, TmpVectors, Vector3 } from \"core/Maths/math.vector\";\r\nimport type { float } from \"core/types\";\r\n\r\nimport { VolumeBasedPanel } from \"./volumeBasedPanel\";\r\nimport type { Control3D } from \"./control3D\";\r\nimport { Container3D } from \"./container3D\";\r\nimport { Axis, Space } from \"core/Maths/math.axis\";\r\n\r\n/**\r\n * Class used to create a container panel deployed on the surface of a sphere\r\n */\r\nexport class SpherePanel extends VolumeBasedPanel {\r\n private _radius = 5.0;\r\n\r\n /**\r\n * Gets or sets the radius of the sphere where to project controls (5 by default)\r\n */\r\n public get radius(): float {\r\n return this._radius;\r\n }\r\n\r\n public set radius(value: float) {\r\n if (this._radius === value) {\r\n return;\r\n }\r\n\r\n this._radius = value;\r\n\r\n Tools.SetImmediate(() => {\r\n this._arrangeChildren();\r\n });\r\n }\r\n\r\n protected _mapGridNode(control: Control3D, nodePosition: Vector3) {\r\n const mesh = control.mesh;\r\n\r\n if (!mesh) {\r\n return;\r\n }\r\n\r\n const newPos = this._sphericalMapping(nodePosition);\r\n control.position = newPos;\r\n\r\n switch (this.orientation) {\r\n case Container3D.FACEORIGIN_ORIENTATION:\r\n mesh.lookAt(new Vector3(2 * newPos.x, 2 * newPos.y, 2 * newPos.z));\r\n break;\r\n case Container3D.FACEORIGINREVERSED_ORIENTATION:\r\n mesh.lookAt(new Vector3(-newPos.x, -newPos.y, -newPos.z));\r\n break;\r\n case Container3D.FACEFORWARD_ORIENTATION:\r\n break;\r\n case Container3D.FACEFORWARDREVERSED_ORIENTATION:\r\n mesh.rotate(Axis.Y, Math.PI, Space.LOCAL);\r\n break;\r\n }\r\n }\r\n\r\n private _sphericalMapping(source: Vector3) {\r\n const newPos = new Vector3(0, 0, this._radius);\r\n\r\n const xAngle = source.y / this._radius;\r\n const yAngle = -(source.x / this._radius);\r\n\r\n Matrix.RotationYawPitchRollToRef(yAngle, xAngle, 0, TmpVectors.Matrix[0]);\r\n\r\n return Vector3.TransformNormal(newPos, TmpVectors.Matrix[0]);\r\n }\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"stackPanel3D.js","sourceRoot":"","sources":["../../../../../dev/gui/src/3D/controls/stackPanel3D.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,K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AAC,CAAC,CAAC;gBACzC,KAAK,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC;gBACrB,MAAM,IAAI,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC;aAC9B;iBAAM;gBACH,KAAK,CAAC,QAAQ,CAAC,CAAC,GAAG,MAAM,GAAG,UAAU,CAAC,CAAC,CAAC;gBACzC,KAAK,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC;gBACrB,MAAM,IAAI,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC;aAC9B;YAED,MAAM,IAAI,YAAY,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;SAChD;IACL,CAAC;CACJ","sourcesContent":["import { Tools } from \"core/Misc/tools\";\r\nimport { Matrix, TmpVectors, Vector3 } from \"core/Maths/math.vector\";\r\n\r\nimport { Container3D } from \"./container3D\";\r\n\r\n/**\r\n * Class used to create a stack panel in 3D on XY plane\r\n */\r\nexport class StackPanel3D extends Container3D {\r\n private _isVertical = false;\r\n\r\n /**\r\n * Gets or sets a boolean indicating if the stack panel is vertical or horizontal (horizontal by default)\r\n */\r\n public get isVertical(): boolean {\r\n return this._isVertical;\r\n }\r\n\r\n public set isVertical(value: boolean) {\r\n if (this._isVertical === value) {\r\n return;\r\n }\r\n\r\n this._isVertical = value;\r\n\r\n Tools.SetImmediate(() => {\r\n this._arrangeChildren();\r\n });\r\n }\r\n\r\n /**\r\n * Gets or sets the distance between elements\r\n */\r\n public margin = 0.1;\r\n\r\n /**\r\n * Creates new StackPanel\r\n * @param isVertical\r\n */\r\n public constructor(isVertical = false) {\r\n super();\r\n\r\n this._isVertical = isVertical;\r\n }\r\n\r\n protected override _arrangeChildren() {\r\n let width = 0;\r\n let height = 0;\r\n let controlCount = 0;\r\n const extendSizes = [];\r\n\r\n const currentInverseWorld = Matrix.Invert(this.node!.computeWorldMatrix(true));\r\n\r\n // Measure\r\n for (const child of this._children) {\r\n if (!child.mesh) {\r\n continue;\r\n }\r\n\r\n controlCount++;\r\n child.mesh.computeWorldMatrix(true);\r\n child.mesh.getWorldMatrix().multiplyToRef(currentInverseWorld, TmpVectors.Matrix[0]);\r\n\r\n const boundingBox = child.mesh.getBoundingInfo().boundingBox;\r\n const extendSize = Vector3.TransformNormal(boundingBox.extendSize, TmpVectors.Matrix[0]);\r\n extendSizes.push(extendSize);\r\n\r\n if (this._isVertical) {\r\n height += extendSize.y;\r\n } else {\r\n width += extendSize.x;\r\n }\r\n }\r\n\r\n if (this._isVertical) {\r\n height += ((controlCount - 1) * this.margin) / 2;\r\n } else {\r\n width += ((controlCount - 1) * this.margin) / 2;\r\n }\r\n\r\n // Arrange\r\n let offset: number;\r\n if (this._isVertical) {\r\n offset = -height;\r\n } else {\r\n offset = -width;\r\n }\r\n\r\n let index = 0;\r\n for (const child of this._children) {\r\n if (!child.mesh) {\r\n continue;\r\n }\r\n controlCount--;\r\n const extendSize = extendSizes[index++];\r\n\r\n if (this._isVertical) {\r\n child.position.y = offset + extendSize.y;\r\n child.position.x = 0;\r\n offset += extendSize.y * 2;\r\n } else {\r\n child.position.x = offset + extendSize.x;\r\n child.position.y = 0;\r\n offset += extendSize.x * 2;\r\n }\r\n\r\n offset += controlCount > 0 ? this.margin : 0;\r\n }\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"stackPanel3D.js","sourceRoot":"","sources":["../../../../../dev/gui/src/3D/controls/stackPanel3D.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,sCAAwB;AACxC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,6CAA+B;AAErE,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C;;GAEG;AACH,MAAM,OAAO,YAAa,SAAQ,WAAW;IAGzC;;OAEG;IACH,IAAW,UAAU;QACjB,OAAO,IAAI,CAAC,WAAW,CAAC;IAC5B,CAAC;IAED,IAAW,UAAU,CAAC,KAA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;gBACJ,KAAK,CAAC,QAAQ,CAAC,CAAC,GAAG,MAAM,GAAG,UAAU,CAAC,CAAC,CAAC;gBACzC,KAAK,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC;gBACrB,MAAM,IAAI,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC;YAC/B,CAAC;YAED,MAAM,IAAI,YAAY,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;QACjD,CAAC;IACL,CAAC;CACJ","sourcesContent":["import { Tools } from \"core/Misc/tools\";\r\nimport { Matrix, TmpVectors, Vector3 } from \"core/Maths/math.vector\";\r\n\r\nimport { Container3D } from \"./container3D\";\r\n\r\n/**\r\n * Class used to create a stack panel in 3D on XY plane\r\n */\r\nexport class StackPanel3D extends Container3D {\r\n private _isVertical = false;\r\n\r\n /**\r\n * Gets or sets a boolean indicating if the stack panel is vertical or horizontal (horizontal by default)\r\n */\r\n public get isVertical(): boolean {\r\n return this._isVertical;\r\n }\r\n\r\n public set isVertical(value: boolean) {\r\n if (this._isVertical === value) {\r\n return;\r\n }\r\n\r\n this._isVertical = value;\r\n\r\n Tools.SetImmediate(() => {\r\n this._arrangeChildren();\r\n });\r\n }\r\n\r\n /**\r\n * Gets or sets the distance between elements\r\n */\r\n public margin = 0.1;\r\n\r\n /**\r\n * Creates new StackPanel\r\n * @param isVertical\r\n */\r\n public constructor(isVertical = false) {\r\n super();\r\n\r\n this._isVertical = isVertical;\r\n }\r\n\r\n protected override _arrangeChildren() {\r\n let width = 0;\r\n let height = 0;\r\n let controlCount = 0;\r\n const extendSizes = [];\r\n\r\n const currentInverseWorld = Matrix.Invert(this.node!.computeWorldMatrix(true));\r\n\r\n // Measure\r\n for (const child of this._children) {\r\n if (!child.mesh) {\r\n continue;\r\n }\r\n\r\n controlCount++;\r\n child.mesh.computeWorldMatrix(true);\r\n child.mesh.getWorldMatrix().multiplyToRef(currentInverseWorld, TmpVectors.Matrix[0]);\r\n\r\n const boundingBox = child.mesh.getBoundingInfo().boundingBox;\r\n const extendSize = Vector3.TransformNormal(boundingBox.extendSize, TmpVectors.Matrix[0]);\r\n extendSizes.push(extendSize);\r\n\r\n if (this._isVertical) {\r\n height += extendSize.y;\r\n } else {\r\n width += extendSize.x;\r\n }\r\n }\r\n\r\n if (this._isVertical) {\r\n height += ((controlCount - 1) * this.margin) / 2;\r\n } else {\r\n width += ((controlCount - 1) * this.margin) / 2;\r\n }\r\n\r\n // Arrange\r\n let offset: number;\r\n if (this._isVertical) {\r\n offset = -height;\r\n } else {\r\n offset = -width;\r\n }\r\n\r\n let index = 0;\r\n for (const child of this._children) {\r\n if (!child.mesh) {\r\n continue;\r\n }\r\n controlCount--;\r\n const extendSize = extendSizes[index++];\r\n\r\n if (this._isVertical) {\r\n child.position.y = offset + extendSize.y;\r\n child.position.x = 0;\r\n offset += extendSize.y * 2;\r\n } else {\r\n child.position.x = offset + extendSize.x;\r\n child.position.y = 0;\r\n offset += extendSize.x * 2;\r\n }\r\n\r\n offset += controlCount > 0 ? this.margin : 0;\r\n }\r\n }\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"touchButton3D.js","sourceRoot":"","sources":["../../../../../dev/gui/src/3D/controls/touchButton3D.ts"],"names":[],"mappings":"AAAA,mEAAmE;AAEnE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,6CAA+B;AAE7D,OAAO,EAAE,iBAAiB,EAAE,gDAAkC;AAI9D,OAAO,EAAE,UAAU,EAAE,2CAA6B;AAElD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC;;GAEG;AACH,MAAM,OAAO,aAAc,SAAQ,QAAQ;IAmBvC;;;;OAIG;IACH,YAAY,IAAa,EAAE,aAAoB;QAC3C,KAAK,CAAC,IAAI,CAAC,CAAC;QApBR,mBAAc,GAAG,KAAK,CAAC;QACvB,8BAAyB,GAAG,CAAC,CAAC;QAE9B,oBAAe,GAAG,KAAK,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Y;QAC3B,OAAO,eAAe,CAAC;IAC3B,CAAC;IAED,mBAAmB;IACA,WAAW,CAAC,KAAY;QACvC,OAAO,KAAK,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;IAED;;OAEG;IACa,OAAO;QACnB,KAAK,CAAC,OAAO,EAAE,CAAC;QAEhB,8BAA8B;QAC9B,IAAI,CAAC,qBAAqB,CAAC,cAAc,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;QACtE,IAAI,CAAC,kBAAkB,CAAC,KAAK,EAAE,CAAC;QAEhC,IAAI,IAAI,CAAC,cAAc,EAAE;YACrB,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,CAAC;SACjC;IACL,CAAC;CACJ","sourcesContent":["// Assumptions: absolute position of button mesh is inside the mesh\r\n\r\nimport { Vector3, TmpVectors } from \"core/Maths/math.vector\";\r\nimport type { Mesh } from \"core/Meshes/mesh\";\r\nimport { PointerEventTypes } from \"core/Events/pointerEvents\";\r\nimport type { TransformNode } from \"core/Meshes/transformNode\";\r\nimport type { Scene } from \"core/scene\";\r\n\r\nimport { Observable } from \"core/Misc/observable\";\r\n\r\nimport { Button3D } from \"./button3D\";\r\n\r\n/**\r\n * Class used to create a touchable button in 3D\r\n */\r\nexport class TouchButton3D extends Button3D {\r\n private _collisionMesh: Mesh;\r\n\r\n // 'front' direction. If Vector3.Zero, there is no front and all directions of interaction are accepted\r\n private _collidableFrontDirection: Vector3;\r\n private _isNearPressed = false;\r\n private _interactionSurfaceHeight = 0;\r\n\r\n private _isToggleButton = false;\r\n private _toggleState = false;\r\n private _toggleButtonCallback = () => {\r\n this._onToggle(!this._toggleState);\r\n };\r\n\r\n /**\r\n * An event triggered when the button is toggled. Only fired if 'isToggleButton' is true\r\n */\r\n public onToggleObservable = new Observable<boolean>();\r\n\r\n /**\r\n * Creates a new touchable button\r\n * @param name defines the control name\r\n * @param collisionMesh mesh to track collisions with\r\n */\r\n constructor(name?: string, collisionMesh?: Mesh) {\r\n super(name);\r\n\r\n this.collidableFrontDirection = Vector3.Zero();\r\n\r\n if (collisionMesh) {\r\n this.collisionMesh = collisionMesh;\r\n }\r\n }\r\n\r\n /**\r\n * Whether the current interaction is caused by near interaction or not\r\n */\r\n public get isActiveNearInteraction() {\r\n return this._isNearPressed;\r\n }\r\n\r\n /**\r\n * Sets the front-facing direction of the button. Pass in Vector3.Zero to allow interactions from any direction\r\n * @param frontWorldDir the forward direction of the button\r\n */\r\n public set collidableFrontDirection(frontWorldDir: Vector3) {\r\n this._collidableFrontDirection = frontWorldDir.normalize();\r\n\r\n if (this._collisionMesh) {\r\n const invert = TmpVectors.Matrix[0];\r\n\r\n invert.copyFrom(this._collisionMesh.getWorldMatrix());\r\n invert.invert();\r\n Vector3.TransformNormalToRef(this._collidableFrontDirection, invert, this._collidableFrontDirection);\r\n this._collidableFrontDirection.normalize();\r\n }\r\n }\r\n\r\n /**\r\n * Returns the front-facing direction of the button, or Vector3.Zero if there is no 'front'\r\n */\r\n public get collidableFrontDirection() {\r\n if (this._collisionMesh) {\r\n // Update the front direction to reflect any rotations of the collision mesh\r\n const transformedDirection = TmpVectors.Vector3[0];\r\n Vector3.TransformNormalToRef(this._collidableFrontDirection, this._collisionMesh.getWorldMatrix(), transformedDirection);\r\n\r\n return transformedDirection.normalize();\r\n }\r\n\r\n return this._collidableFrontDirection;\r\n }\r\n\r\n /**\r\n * Sets the mesh used for testing input collision\r\n * @param collisionMesh the new collision mesh for the button\r\n */\r\n public set collisionMesh(collisionMesh: Mesh) {\r\n // Remove the GUI3DManager's data from the previous collision mesh's reserved data store, and reset interactability\r\n if (this._collisionMesh) {\r\n this._collisionMesh.isNearPickable = false;\r\n if (this._collisionMesh.reservedDataStore?.GUI3D) {\r\n this._collisionMesh.reservedDataStore.GUI3D = {};\r\n }\r\n\r\n this._collisionMesh.getChildMeshes().forEach((mesh) => {\r\n mesh.isNearPickable = false;\r\n if (mesh.reservedDataStore?.GUI3D) {\r\n mesh.reservedDataStore.GUI3D = {};\r\n }\r\n });\r\n }\r\n\r\n this._collisionMesh = collisionMesh;\r\n this._injectGUI3DReservedDataStore(this._collisionMesh).control = this;\r\n this._collisionMesh.isNearPickable = true;\r\n\r\n this._collisionMesh.getChildMeshes().forEach((mesh) => {\r\n this._injectGUI3DReservedDataStore(mesh).control = this;\r\n mesh.isNearPickable = true;\r\n });\r\n this.collidableFrontDirection = collisionMesh.forward;\r\n }\r\n\r\n /**\r\n * Setter for if this TouchButton3D should be treated as a toggle button\r\n * @param value If this TouchHolographicButton should act like a toggle button\r\n */\r\n public set isToggleButton(value: boolean) {\r\n if (value === this._isToggleButton) {\r\n return;\r\n }\r\n\r\n this._isToggleButton = value;\r\n\r\n if (value) {\r\n this.onPointerUpObservable.add(this._toggleButtonCallback);\r\n } else {\r\n this.onPointerUpObservable.removeCallback(this._toggleButtonCallback);\r\n\r\n // Safety check, reset the button if it's toggled on but no longer a toggle button\r\n if (this._toggleState) {\r\n this._onToggle(false);\r\n }\r\n }\r\n }\r\n public get isToggleButton() {\r\n return this._isToggleButton;\r\n }\r\n\r\n /**\r\n * A public entrypoint to set the toggle state of the TouchHolographicButton. Only works if 'isToggleButton' is true\r\n * @param newState The new state to set the TouchHolographicButton's toggle state to\r\n */\r\n public set isToggled(newState: boolean) {\r\n if (this._isToggleButton && this._toggleState !== newState) {\r\n this._onToggle(newState);\r\n }\r\n }\r\n public get isToggled() {\r\n return this._toggleState;\r\n }\r\n\r\n protected _onToggle(newState: boolean) {\r\n this._toggleState = newState;\r\n this.onToggleObservable.notifyObservers(newState);\r\n }\r\n\r\n // Returns true if the collidable is in front of the button, or if the button has no front direction\r\n private _isInteractionInFrontOfButton(collidablePos: Vector3) {\r\n return this._getInteractionHeight(collidablePos, this._collisionMesh.getAbsolutePosition()) > 0;\r\n }\r\n\r\n /**\r\n * Get the height of the touchPoint from the collidable part of the button\r\n * @param touchPoint the point to compare to the button, in absolute position\r\n * @returns the depth of the touch point into the front of the button\r\n */\r\n public getPressDepth(touchPoint: Vector3) {\r\n if (!this._isNearPressed) {\r\n return 0;\r\n }\r\n const interactionHeight = this._getInteractionHeight(touchPoint, this._collisionMesh.getAbsolutePosition());\r\n return this._interactionSurfaceHeight - interactionHeight;\r\n }\r\n\r\n // Returns true if the collidable is in front of the button, or if the button has no front direction\r\n protected _getInteractionHeight(interactionPos: Vector3, basePos: Vector3) {\r\n const frontDir = this.collidableFrontDirection;\r\n if (frontDir.length() === 0) {\r\n // The button has no front, just return the distance to the base\r\n return Vector3.Distance(interactionPos, basePos);\r\n }\r\n const d = Vector3.Dot(basePos, frontDir);\r\n const abc = Vector3.Dot(interactionPos, frontDir);\r\n\r\n return abc - d;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _generatePointerEventType(providedType: number, nearMeshPosition: Vector3, activeInteractionCount: number): number {\r\n if (providedType === PointerEventTypes.POINTERDOWN || providedType === PointerEventTypes.POINTERMOVE) {\r\n if (!this._isInteractionInFrontOfButton(nearMeshPosition)) {\r\n // Near interaction mesh is behind the button, don't send a pointer down\r\n return PointerEventTypes.POINTERMOVE;\r\n } else {\r\n this._isNearPressed = true;\r\n this._interactionSurfaceHeight = this._getInteractionHeight(nearMeshPosition, this._collisionMesh.getAbsolutePosition());\r\n }\r\n }\r\n if (providedType === PointerEventTypes.POINTERUP) {\r\n if (activeInteractionCount == 0) {\r\n // We get the release for the down we swallowed earlier, swallow as well\r\n return PointerEventTypes.POINTERMOVE;\r\n } else {\r\n this._isNearPressed = false;\r\n }\r\n }\r\n\r\n return providedType;\r\n }\r\n\r\n protected override _getTypeName(): string {\r\n return \"TouchButton3D\";\r\n }\r\n\r\n // Mesh association\r\n protected override _createNode(scene: Scene): TransformNode {\r\n return super._createNode(scene);\r\n }\r\n\r\n /**\r\n * Releases all associated resources\r\n */\r\n public override dispose() {\r\n super.dispose();\r\n\r\n // Clean up toggle observables\r\n this.onPointerUpObservable.removeCallback(this._toggleButtonCallback);\r\n this.onToggleObservable.clear();\r\n\r\n if (this._collisionMesh) {\r\n this._collisionMesh.dispose();\r\n }\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"touchButton3D.js","sourceRoot":"","sources":["../../../../../dev/gui/src/3D/controls/touchButton3D.ts"],"names":[],"mappings":"AAAA,mEAAmE;AAEnE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,6CAA+B;AAE7D,OAAO,EAAE,iBAAiB,EAAE,gDAAkC;AAI9D,OAAO,EAAE,UAAU,EAAE,2CAA6B;AAElD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC;;GAEG;AACH,MAAM,OAAO,aAAc,SAAQ,QAAQ;IAmBvC;;;;OAIG;IACH,YAAY,IAAa,EAAE,aAAoB;QAC3C,KAAK,CAAC,IAAI,CAAC,CAAC;QApBR,mBAAc,GAAG,KAAK,CAAC;QACvB,8BAAyB,GAAG,CAAC,CAAC;QAE9B,oBAAe,GAAG,KAAK,CAAC;QACxB,iBAAY,GAAG,KAAK,CAAC;QACrB,0BAAqB,GAAG,GAAG,EAAE;YACjC,IAAI,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QACvC,CAAC,CAAC;QAEF;;WAEG;QACI,uBAAkB,GAAG,IAAI,UAAU,EAAW,CAAC;QAUlD,IAAI,CAAC,wBAAwB,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;QAE/C,IAAI,aAAa,EAAE,CAAC;YAChB,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACvC,CAAC;IACL,CAAC;IAED;;OAEG;IACH,IAAW,uBAAuB;QAC9B,OAAO,IAAI,CAAC,cAAc,CAAC;IAC/B,CAAC;IAED;;;OAGG;IACH,IAAW,wBAAwB,CAAC,aAAsB;QACtD,IAAI,CAAC,yBAAyB,GAAG,aAAa,CAAC,SAAS,EAAE,CAAC;QAE3D,IAAI,IAAI,CAAC,cAAc,EAAE,CAAC;YACtB,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC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AC;QAClC,CAAC;IACL,CAAC;CACJ","sourcesContent":["// Assumptions: absolute position of button mesh is inside the mesh\r\n\r\nimport { Vector3, TmpVectors } from \"core/Maths/math.vector\";\r\nimport type { Mesh } from \"core/Meshes/mesh\";\r\nimport { PointerEventTypes } from \"core/Events/pointerEvents\";\r\nimport type { TransformNode } from \"core/Meshes/transformNode\";\r\nimport type { Scene } from \"core/scene\";\r\n\r\nimport { Observable } from \"core/Misc/observable\";\r\n\r\nimport { Button3D } from \"./button3D\";\r\n\r\n/**\r\n * Class used to create a touchable button in 3D\r\n */\r\nexport class TouchButton3D extends Button3D {\r\n private _collisionMesh: Mesh;\r\n\r\n // 'front' direction. If Vector3.Zero, there is no front and all directions of interaction are accepted\r\n private _collidableFrontDirection: Vector3;\r\n private _isNearPressed = false;\r\n private _interactionSurfaceHeight = 0;\r\n\r\n private _isToggleButton = false;\r\n private _toggleState = false;\r\n private _toggleButtonCallback = () => {\r\n this._onToggle(!this._toggleState);\r\n };\r\n\r\n /**\r\n * An event triggered when the button is toggled. Only fired if 'isToggleButton' is true\r\n */\r\n public onToggleObservable = new Observable<boolean>();\r\n\r\n /**\r\n * Creates a new touchable button\r\n * @param name defines the control name\r\n * @param collisionMesh mesh to track collisions with\r\n */\r\n constructor(name?: string, collisionMesh?: Mesh) {\r\n super(name);\r\n\r\n this.collidableFrontDirection = Vector3.Zero();\r\n\r\n if (collisionMesh) {\r\n this.collisionMesh = collisionMesh;\r\n }\r\n }\r\n\r\n /**\r\n * Whether the current interaction is caused by near interaction or not\r\n */\r\n public get isActiveNearInteraction() {\r\n return this._isNearPressed;\r\n }\r\n\r\n /**\r\n * Sets the front-facing direction of the button. Pass in Vector3.Zero to allow interactions from any direction\r\n * @param frontWorldDir the forward direction of the button\r\n */\r\n public set collidableFrontDirection(frontWorldDir: Vector3) {\r\n this._collidableFrontDirection = frontWorldDir.normalize();\r\n\r\n if (this._collisionMesh) {\r\n const invert = TmpVectors.Matrix[0];\r\n\r\n invert.copyFrom(this._collisionMesh.getWorldMatrix());\r\n invert.invert();\r\n Vector3.TransformNormalToRef(this._collidableFrontDirection, invert, this._collidableFrontDirection);\r\n this._collidableFrontDirection.normalize();\r\n }\r\n }\r\n\r\n /**\r\n * Returns the front-facing direction of the button, or Vector3.Zero if there is no 'front'\r\n */\r\n public get collidableFrontDirection() {\r\n if (this._collisionMesh) {\r\n // Update the front direction to reflect any rotations of the collision mesh\r\n const transformedDirection = TmpVectors.Vector3[0];\r\n Vector3.TransformNormalToRef(this._collidableFrontDirection, this._collisionMesh.getWorldMatrix(), transformedDirection);\r\n\r\n return transformedDirection.normalize();\r\n }\r\n\r\n return this._collidableFrontDirection;\r\n }\r\n\r\n /**\r\n * Sets the mesh used for testing input collision\r\n * @param collisionMesh the new collision mesh for the button\r\n */\r\n public set collisionMesh(collisionMesh: Mesh) {\r\n // Remove the GUI3DManager's data from the previous collision mesh's reserved data store, and reset interactability\r\n if (this._collisionMesh) {\r\n this._collisionMesh.isNearPickable = false;\r\n if (this._collisionMesh.reservedDataStore?.GUI3D) {\r\n this._collisionMesh.reservedDataStore.GUI3D = {};\r\n }\r\n\r\n this._collisionMesh.getChildMeshes().forEach((mesh) => {\r\n mesh.isNearPickable = false;\r\n if (mesh.reservedDataStore?.GUI3D) {\r\n mesh.reservedDataStore.GUI3D = {};\r\n }\r\n });\r\n }\r\n\r\n this._collisionMesh = collisionMesh;\r\n this._injectGUI3DReservedDataStore(this._collisionMesh).control = this;\r\n this._collisionMesh.isNearPickable = true;\r\n\r\n this._collisionMesh.getChildMeshes().forEach((mesh) => {\r\n this._injectGUI3DReservedDataStore(mesh).control = this;\r\n mesh.isNearPickable = true;\r\n });\r\n this.collidableFrontDirection = collisionMesh.forward;\r\n }\r\n\r\n /**\r\n * Setter for if this TouchButton3D should be treated as a toggle button\r\n * @param value If this TouchHolographicButton should act like a toggle button\r\n */\r\n public set isToggleButton(value: boolean) {\r\n if (value === this._isToggleButton) {\r\n return;\r\n }\r\n\r\n this._isToggleButton = value;\r\n\r\n if (value) {\r\n this.onPointerUpObservable.add(this._toggleButtonCallback);\r\n } else {\r\n this.onPointerUpObservable.removeCallback(this._toggleButtonCallback);\r\n\r\n // Safety check, reset the button if it's toggled on but no longer a toggle button\r\n if (this._toggleState) {\r\n this._onToggle(false);\r\n }\r\n }\r\n }\r\n public get isToggleButton() {\r\n return this._isToggleButton;\r\n }\r\n\r\n /**\r\n * A public entrypoint to set the toggle state of the TouchHolographicButton. Only works if 'isToggleButton' is true\r\n * @param newState The new state to set the TouchHolographicButton's toggle state to\r\n */\r\n public set isToggled(newState: boolean) {\r\n if (this._isToggleButton && this._toggleState !== newState) {\r\n this._onToggle(newState);\r\n }\r\n }\r\n public get isToggled() {\r\n return this._toggleState;\r\n }\r\n\r\n protected _onToggle(newState: boolean) {\r\n this._toggleState = newState;\r\n this.onToggleObservable.notifyObservers(newState);\r\n }\r\n\r\n // Returns true if the collidable is in front of the button, or if the button has no front direction\r\n private _isInteractionInFrontOfButton(collidablePos: Vector3) {\r\n return this._getInteractionHeight(collidablePos, this._collisionMesh.getAbsolutePosition()) > 0;\r\n }\r\n\r\n /**\r\n * Get the height of the touchPoint from the collidable part of the button\r\n * @param touchPoint the point to compare to the button, in absolute position\r\n * @returns the depth of the touch point into the front of the button\r\n */\r\n public getPressDepth(touchPoint: Vector3) {\r\n if (!this._isNearPressed) {\r\n return 0;\r\n }\r\n const interactionHeight = this._getInteractionHeight(touchPoint, this._collisionMesh.getAbsolutePosition());\r\n return this._interactionSurfaceHeight - interactionHeight;\r\n }\r\n\r\n // Returns true if the collidable is in front of the button, or if the button has no front direction\r\n protected _getInteractionHeight(interactionPos: Vector3, basePos: Vector3) {\r\n const frontDir = this.collidableFrontDirection;\r\n if (frontDir.length() === 0) {\r\n // The button has no front, just return the distance to the base\r\n return Vector3.Distance(interactionPos, basePos);\r\n }\r\n const d = Vector3.Dot(basePos, frontDir);\r\n const abc = Vector3.Dot(interactionPos, frontDir);\r\n\r\n return abc - d;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _generatePointerEventType(providedType: number, nearMeshPosition: Vector3, activeInteractionCount: number): number {\r\n if (providedType === PointerEventTypes.POINTERDOWN || providedType === PointerEventTypes.POINTERMOVE) {\r\n if (!this._isInteractionInFrontOfButton(nearMeshPosition)) {\r\n // Near interaction mesh is behind the button, don't send a pointer down\r\n return PointerEventTypes.POINTERMOVE;\r\n } else {\r\n this._isNearPressed = true;\r\n this._interactionSurfaceHeight = this._getInteractionHeight(nearMeshPosition, this._collisionMesh.getAbsolutePosition());\r\n }\r\n }\r\n if (providedType === PointerEventTypes.POINTERUP) {\r\n if (activeInteractionCount == 0) {\r\n // We get the release for the down we swallowed earlier, swallow as well\r\n return PointerEventTypes.POINTERMOVE;\r\n } else {\r\n this._isNearPressed = false;\r\n }\r\n }\r\n\r\n return providedType;\r\n }\r\n\r\n protected override _getTypeName(): string {\r\n return \"TouchButton3D\";\r\n }\r\n\r\n // Mesh association\r\n protected override _createNode(scene: Scene): TransformNode {\r\n return super._createNode(scene);\r\n }\r\n\r\n /**\r\n * Releases all associated resources\r\n */\r\n public override dispose() {\r\n super.dispose();\r\n\r\n // Clean up toggle observables\r\n this.onPointerUpObservable.removeCallback(this._toggleButtonCallback);\r\n this.onToggleObservable.clear();\r\n\r\n if (this._collisionMesh) {\r\n this._collisionMesh.dispose();\r\n }\r\n }\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"touchHolographicButton.js","sourceRoot":"","sources":["../../../../../dev/gui/src/3D/controls/touchHolographicButton.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,6CAA+B;AACjD,OAAO,EAAE,gBAAgB,EAAE,sDAAwC;AACnE,OAAO,EAAE,aAAa,EAAE,gDAAkC;AAC1D,OAAO,EAAE,IAAI,EAAE,uCAAyB;AACxC,OAAO,EAAE,WAAW,EAAE,wDAA0C;AAChE,OAAO,EAAE,SAAS,EAAE,sDAAwC;AAC5D,OAAO,EAAE,iBAAi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AEG;AACW,qCAAc,GAAW,wBAAwB,AAAnC,CAAoC","sourcesContent":["import type { Nullable } from \"core/types\";\r\nimport type { Observer } from \"core/Misc/observable\";\r\nimport { Vector3 } from \"core/Maths/math.vector\";\r\nimport { StandardMaterial } from \"core/Materials/standardMaterial\";\r\nimport { TransformNode } from \"core/Meshes/transformNode\";\r\nimport { Mesh } from \"core/Meshes/mesh\";\r\nimport { CreatePlane } from \"core/Meshes/Builders/planeBuilder\";\r\nimport { CreateBox } from \"core/Meshes/Builders/boxBuilder\";\r\nimport { FadeInOutBehavior } from \"core/Behaviors/Meshes/fadeInOutBehavior\";\r\nimport type { Scene } from \"core/scene\";\r\nimport { FluentMaterial } from \"../materials/fluent/fluentMaterial\";\r\nimport { FluentButtonMaterial } from \"../materials/fluentButton/fluentButtonMaterial\";\r\nimport { StackPanel } from \"../../2D/controls/stackPanel\";\r\nimport { Image } from \"../../2D/controls/image\";\r\nimport { TextBlock } from \"../../2D/controls/textBlock\";\r\nimport { AdvancedDynamicTexture } from \"../../2D/advancedDynamicTexture\";\r\nimport type { Control3D } from \"./control3D\";\r\nimport { Color3 } from \"core/Maths/math.color\";\r\nimport { TouchButton3D } from \"./touchButton3D\";\r\nimport type { AbstractMesh } from \"core/Meshes/abstractMesh\";\r\nimport { SceneLoader } from \"core/Loading/sceneLoader\";\r\nimport { IsDocumentAvailable } from \"core/Misc/domManagement\";\r\nimport { Scalar } from \"core/Maths/math.scalar\";\r\n\r\n/**\r\n * Class used to create a holographic button in 3D\r\n * @since 5.0.0\r\n */\r\nexport class TouchHolographicButton extends TouchButton3D {\r\n /**\r\n * Base Url for the button model.\r\n */\r\n public static MODEL_BASE_URL: string = \"https://assets.babylonjs.com/meshes/MRTK/\";\r\n /**\r\n * File name for the button model.\r\n */\r\n public static MODEL_FILENAME: string = \"mrtk-fluent-button.glb\";\r\n\r\n private _backPlate: Mesh;\r\n private _textPlate: Mesh;\r\n private _frontPlate: AbstractMesh;\r\n private _text: string;\r\n private _imageUrl: string;\r\n private _shareMaterials = true;\r\n private _isBackplateVisible = true;\r\n private _frontMaterial: FluentButtonMaterial;\r\n private _backMaterial: FluentMaterial;\r\n private _plateMaterial: StandardMaterial;\r\n private _pickedPointObserver: Nullable<Observer<Nullable<Vector3>>>;\r\n private _pointerHoverObserver: Nullable<Observer<Vector3>>;\r\n private _frontPlateDepth = 0.5;\r\n private _backPlateDepth = 0.04;\r\n private _backplateColor = new Color3(0.08, 0.15, 0.55);\r\n private _backplateToggledColor = new Color3(0.25, 0.4, 0.95);\r\n\r\n // Tooltip\r\n private _tooltipFade: Nullable<FadeInOutBehavior>;\r\n private _tooltipTextBlock: Nullable<TextBlock>;\r\n private _tooltipTexture: Nullable<AdvancedDynamicTexture>;\r\n private _tooltipMesh: Nullable<Mesh>;\r\n private _tooltipHoverObserver: Nullable<Observer<Control3D>>;\r\n private _tooltipOutObserver: Nullable<Observer<Control3D>>;\r\n\r\n private _disposeTooltip() {\r\n this._tooltipFade = null;\r\n if (this._tooltipTextBlock) {\r\n this._tooltipTextBlock.dispose();\r\n }\r\n if (this._tooltipTexture) {\r\n this._tooltipTexture.dispose();\r\n }\r\n if (this._tooltipMesh) {\r\n this._tooltipMesh.dispose();\r\n }\r\n this.onPointerEnterObservable.remove(this._tooltipHoverObserver);\r\n this.onPointerOutObservable.remove(this._tooltipOutObserver);\r\n }\r\n\r\n /**\r\n * Rendering ground id of all the mesh in the button\r\n */\r\n public set renderingGroupId(id: number) {\r\n this._backPlate.renderingGroupId = id;\r\n this._textPlate.renderingGroupId = id;\r\n this._frontPlate.renderingGroupId = id;\r\n\r\n if (this._tooltipMesh) {\r\n this._tooltipMesh.renderingGroupId = id;\r\n }\r\n }\r\n public get renderingGroupId(): number {\r\n return this._backPlate.renderingGroupId;\r\n }\r\n\r\n /**\r\n * Gets the mesh used to render this control\r\n */\r\n public override get mesh(): Nullable<AbstractMesh> {\r\n return this._backPlate as AbstractMesh;\r\n }\r\n\r\n /**\r\n * Text to be displayed on the tooltip shown when hovering on the button. When set to null tooltip is disabled. (Default: null)\r\n */\r\n public set tooltipText(text: Nullable<string>) {\r\n if (!text) {\r\n this._disposeTooltip();\r\n return;\r\n }\r\n if (!this._tooltipFade) {\r\n const rightHandedScene = this._backPlate._scene.useRightHandedSystem;\r\n // Create tooltip with mesh and text\r\n this._tooltipMesh = CreatePlane(\"\", { size: 1 }, this._backPlate._scene);\r\n const tooltipBackground = CreatePlane(\"\", { size: 1, sideOrientation: Mesh.DOUBLESIDE }, this._backPlate._scene);\r\n const mat = new StandardMaterial(\"\", this._backPlate._scene);\r\n mat.diffuseColor = Color3.FromHexString(\"#212121\");\r\n tooltipBackground.material = mat;\r\n tooltipBackground.isPickable = false;\r\n this._tooltipMesh.addChild(tooltipBackground);\r\n tooltipBackground.position = Vector3.Forward(rightHandedScene).scale(0.05);\r\n this._tooltipMesh.scaling.y = 1 / 3;\r\n this._tooltipMesh.position = Vector3.Up().scale(0.7).add(Vector3.Forward(rightHandedScene).scale(-0.15));\r\n this._tooltipMesh.isPickable = false;\r\n this._tooltipMesh.parent = this._backPlate;\r\n\r\n // Create text texture for the tooltip\r\n this._tooltipTexture = AdvancedDynamicTexture.CreateForMesh(this._tooltipMesh);\r\n this._tooltipTextBlock = new TextBlock();\r\n this._tooltipTextBlock.scaleY = 3;\r\n this._tooltipTextBlock.color = \"white\";\r\n this._tooltipTextBlock.fontSize = 130;\r\n this._tooltipTexture.addControl(this._tooltipTextBlock);\r\n\r\n // Add hover action to tooltip\r\n this._tooltipFade = new FadeInOutBehavior();\r\n this._tooltipFade.delay = 500;\r\n this._tooltipMesh.addBehavior(this._tooltipFade);\r\n this._tooltipHoverObserver = this.onPointerEnterObservable.add(() => {\r\n if (this._tooltipFade) {\r\n this._tooltipFade.fadeIn(true);\r\n }\r\n });\r\n this._tooltipOutObserver = this.onPointerOutObservable.add(() => {\r\n if (this._tooltipFade) {\r\n this._tooltipFade.fadeIn(false);\r\n }\r\n });\r\n }\r\n if (this._tooltipTextBlock) {\r\n this._tooltipTextBlock.text = text;\r\n }\r\n }\r\n\r\n public get tooltipText() {\r\n if (this._tooltipTextBlock) {\r\n return this._tooltipTextBlock.text;\r\n }\r\n return null;\r\n }\r\n\r\n /**\r\n * Gets or sets text for the button\r\n */\r\n public get text(): string {\r\n return this._text;\r\n }\r\n\r\n public set text(value: string) {\r\n if (this._text === value) {\r\n return;\r\n }\r\n\r\n this._text = value;\r\n this._rebuildContent();\r\n }\r\n\r\n /**\r\n * Gets or sets the image url for the button\r\n */\r\n public get imageUrl(): string {\r\n return this._imageUrl;\r\n }\r\n\r\n public set imageUrl(value: string) {\r\n if (this._imageUrl === value) {\r\n return;\r\n }\r\n\r\n this._imageUrl = value;\r\n this._rebuildContent();\r\n }\r\n\r\n /**\r\n * Gets the back material used by this button\r\n */\r\n public get backMaterial(): FluentMaterial {\r\n return this._backMaterial;\r\n }\r\n\r\n /**\r\n * Gets the front material used by this button\r\n */\r\n public get frontMaterial(): FluentButtonMaterial {\r\n return this._frontMaterial;\r\n }\r\n\r\n /**\r\n * Gets the plate material used by this button\r\n */\r\n public get plateMaterial(): StandardMaterial {\r\n return this._plateMaterial;\r\n }\r\n\r\n /**\r\n * Gets a boolean indicating if this button shares its material with other HolographicButtons\r\n */\r\n public get shareMaterials(): boolean {\r\n return this._shareMaterials;\r\n }\r\n\r\n /**\r\n * Sets whether the backplate is visible or hidden. Hiding the backplate is not recommended without some sort of replacement\r\n */\r\n public set isBackplateVisible(isVisible: boolean) {\r\n if (this.mesh && !!this._backMaterial) {\r\n if (isVisible && !this._isBackplateVisible) {\r\n this._backPlate.visibility = 1;\r\n } else if (!isVisible && this._isBackplateVisible) {\r\n this._backPlate.visibility = 0;\r\n }\r\n }\r\n\r\n this._isBackplateVisible = isVisible;\r\n }\r\n\r\n /**\r\n * Creates a new button\r\n * @param name defines the control name\r\n * @param shareMaterials\r\n */\r\n constructor(name?: string, shareMaterials = true) {\r\n super(name);\r\n\r\n this._shareMaterials = shareMaterials;\r\n\r\n this.pointerEnterAnimation = () => {\r\n this._frontMaterial.leftBlobEnable = true;\r\n this._frontMaterial.rightBlobEnable = true;\r\n };\r\n\r\n this.pointerOutAnimation = () => {\r\n this._frontMaterial.leftBlobEnable = false;\r\n this._frontMaterial.rightBlobEnable = false;\r\n };\r\n\r\n this.pointerDownAnimation = () => {\r\n if (this._frontPlate && !this.isActiveNearInteraction) {\r\n this._frontPlate.scaling.z = this._frontPlateDepth * 0.2;\r\n this._frontPlate.position = Vector3.Forward(this._frontPlate._scene.useRightHandedSystem).scale((this._frontPlateDepth - 0.2 * this._frontPlateDepth) / 2);\r\n this._textPlate.position = Vector3.Forward(this._textPlate._scene.useRightHandedSystem).scale(-(this._backPlateDepth + 0.2 * this._frontPlateDepth) / 2);\r\n }\r\n };\r\n this.pointerUpAnimation = () => {\r\n if (this._frontPlate) {\r\n this._frontPlate.scaling.z = this._frontPlateDepth;\r\n this._frontPlate.position = Vector3.Forward(this._frontPlate._scene.useRightHandedSystem).scale((this._frontPlateDepth - this._frontPlateDepth) / 2);\r\n this._textPlate.position = Vector3.Forward(this._textPlate._scene.useRightHandedSystem).scale(-(this._backPlateDepth + this._frontPlateDepth) / 2);\r\n }\r\n };\r\n\r\n this.onPointerMoveObservable.add((position) => {\r\n if (this._frontPlate && this.isActiveNearInteraction) {\r\n const scale = Vector3.Zero();\r\n if (this._backPlate.getWorldMatrix().decompose(scale, undefined, undefined)) {\r\n let interactionHeight = this._getInteractionHeight(position, this._backPlate.getAbsolutePosition()) / scale.z;\r\n interactionHeight = Scalar.Clamp(interactionHeight - this._backPlateDepth / 2, 0.2 * this._frontPlateDepth, this._frontPlateDepth);\r\n\r\n this._frontPlate.scaling.z = interactionHeight;\r\n this._frontPlate.position = Vector3.Forward(this._frontPlate._scene.useRightHandedSystem).scale((this._frontPlateDepth - interactionHeight) / 2);\r\n this._textPlate.position = Vector3.Forward(this._textPlate._scene.useRightHandedSystem).scale(-(this._backPlateDepth + interactionHeight) / 2);\r\n }\r\n }\r\n });\r\n\r\n this._pointerHoverObserver = this.onPointerMoveObservable.add((hoverPosition: Vector3) => {\r\n this._frontMaterial.globalLeftIndexTipPosition = hoverPosition;\r\n });\r\n }\r\n\r\n protected override _getTypeName(): string {\r\n return \"TouchHolographicButton\";\r\n }\r\n\r\n private _rebuildContent(): void {\r\n this._disposeFacadeTexture();\r\n\r\n const panel = new StackPanel();\r\n panel.isVertical = true;\r\n\r\n if (IsDocumentAvailable() && !!document.createElement) {\r\n if (this._imageUrl) {\r\n const image = new Image();\r\n image.source = this._imageUrl;\r\n image.paddingTop = \"40px\";\r\n image.height = \"180px\";\r\n image.width = \"100px\";\r\n image.paddingBottom = \"40px\";\r\n panel.addControl(image);\r\n }\r\n }\r\n\r\n if (this._text) {\r\n const text = new TextBlock();\r\n text.text = this._text;\r\n text.color = \"white\";\r\n text.height = \"30px\";\r\n text.fontSize = 24;\r\n panel.addControl(text);\r\n }\r\n\r\n this.content = panel;\r\n }\r\n\r\n // Mesh association\r\n protected override _createNode(scene: Scene): TransformNode {\r\n this.name = this.name ?? \"TouchHolographicButton\";\r\n const collisionMesh = CreateBox(\r\n `${this.name}_collisionMesh`,\r\n {\r\n width: 1.0,\r\n height: 1.0,\r\n depth: this._frontPlateDepth,\r\n },\r\n scene\r\n );\r\n collisionMesh.isPickable = true;\r\n collisionMesh.isNearPickable = true;\r\n collisionMesh.visibility = 0;\r\n collisionMesh.position = Vector3.Forward(scene.useRightHandedSystem).scale(-this._frontPlateDepth / 2);\r\n\r\n SceneLoader.ImportMeshAsync(undefined, TouchHolographicButton.MODEL_BASE_URL, TouchHolographicButton.MODEL_FILENAME, scene).then((result) => {\r\n const alphaMesh = CreateBox(\r\n \"${this.name}_alphaMesh\",\r\n {\r\n width: 1.0,\r\n height: 1.0,\r\n depth: 1.0,\r\n },\r\n scene\r\n );\r\n alphaMesh.isPickable = false;\r\n alphaMesh.material = new StandardMaterial(\"${this.name}_alphaMesh_material\", scene);\r\n alphaMesh.material.alpha = 0.15;\r\n\r\n const importedFrontPlate = result.meshes[1];\r\n importedFrontPlate.name = `${this.name}_frontPlate`;\r\n importedFrontPlate.isPickable = false;\r\n importedFrontPlate.scaling.z = this._frontPlateDepth;\r\n alphaMesh.parent = importedFrontPlate;\r\n importedFrontPlate.parent = collisionMesh;\r\n if (this._frontMaterial) {\r\n importedFrontPlate.material = this._frontMaterial;\r\n }\r\n this._frontPlate = importedFrontPlate;\r\n });\r\n\r\n this._backPlate = CreateBox(\r\n `${this.name}_backPlate`,\r\n {\r\n width: 1.0,\r\n height: 1.0,\r\n depth: this._backPlateDepth,\r\n },\r\n scene\r\n );\r\n\r\n this._backPlate.position = Vector3.Forward(scene.useRightHandedSystem).scale(this._backPlateDepth / 2);\r\n this._backPlate.isPickable = false;\r\n\r\n this._textPlate = <Mesh>super._createNode(scene);\r\n this._textPlate.name = `${this.name}_textPlate`;\r\n this._textPlate.isPickable = false;\r\n this._textPlate.position = Vector3.Forward(scene.useRightHandedSystem).scale(-this._frontPlateDepth / 2);\r\n\r\n this._backPlate.addChild(collisionMesh);\r\n this._backPlate.addChild(this._textPlate);\r\n\r\n const tn = new TransformNode(`{this.name}_root`, scene);\r\n this._backPlate.setParent(tn);\r\n\r\n this.collisionMesh = collisionMesh;\r\n this.collidableFrontDirection = this._backPlate.forward.negate(); // Mesh is facing the wrong way\r\n\r\n return tn;\r\n }\r\n\r\n protected override _applyFacade(facadeTexture: AdvancedDynamicTexture) {\r\n this._plateMaterial.emissiveTexture = facadeTexture;\r\n this._plateMaterial.opacityTexture = facadeTexture;\r\n this._plateMaterial.diffuseColor = new Color3(0.4, 0.4, 0.4);\r\n }\r\n\r\n private _createBackMaterial(mesh: Mesh) {\r\n this._backMaterial = new FluentMaterial(this.name + \"backPlateMaterial\", mesh.getScene());\r\n this._backMaterial.albedoColor = this._backplateColor;\r\n this._backMaterial.renderBorders = true;\r\n this._backMaterial.renderHoverLight = false;\r\n }\r\n\r\n private _createFrontMaterial(mesh: Mesh) {\r\n this._frontMaterial = new FluentButtonMaterial(this.name + \"Front Material\", mesh.getScene());\r\n }\r\n\r\n private _createPlateMaterial(mesh: Mesh) {\r\n this._plateMaterial = new StandardMaterial(this.name + \"Plate Material\", mesh.getScene());\r\n this._plateMaterial.specularColor = Color3.Black();\r\n }\r\n\r\n protected override _onToggle(newState: boolean) {\r\n if (this._backMaterial) {\r\n if (newState) {\r\n this._backMaterial.albedoColor = this._backplateToggledColor;\r\n } else {\r\n this._backMaterial.albedoColor = this._backplateColor;\r\n }\r\n }\r\n\r\n super._onToggle(newState);\r\n }\r\n\r\n protected override _affectMaterial(mesh: Mesh) {\r\n if (this._shareMaterials) {\r\n // Back\r\n if (!this._host._touchSharedMaterials[\"backFluentMaterial\"]) {\r\n this._createBackMaterial(mesh);\r\n this._host._touchSharedMaterials[\"backFluentMaterial\"] = this._backMaterial;\r\n } else {\r\n this._backMaterial = this._host._touchSharedMaterials[\"backFluentMaterial\"] as FluentMaterial;\r\n }\r\n\r\n // Front\r\n if (!this._host._touchSharedMaterials[\"frontFluentMaterial\"]) {\r\n this._createFrontMaterial(mesh);\r\n this._host._touchSharedMaterials[\"frontFluentMaterial\"] = this._frontMaterial;\r\n } else {\r\n this._frontMaterial = this._host._touchSharedMaterials[\"frontFluentMaterial\"] as FluentButtonMaterial;\r\n }\r\n } else {\r\n this._createBackMaterial(mesh);\r\n this._createFrontMaterial(mesh);\r\n }\r\n\r\n this._createPlateMaterial(mesh);\r\n this._backPlate.material = this._backMaterial;\r\n this._textPlate.material = this._plateMaterial;\r\n\r\n if (!this._isBackplateVisible) {\r\n this._backPlate.visibility = 0;\r\n }\r\n if (this._frontPlate) {\r\n this._frontPlate.material = this._frontMaterial;\r\n }\r\n\r\n this._rebuildContent();\r\n }\r\n\r\n /**\r\n * Releases all associated resources\r\n */\r\n public override dispose() {\r\n super.dispose(); // will dispose main mesh ie. back plate\r\n\r\n this._disposeTooltip();\r\n this.onPointerMoveObservable.remove(this._pointerHoverObserver);\r\n\r\n if (!this.shareMaterials) {\r\n this._backMaterial.dispose();\r\n this._frontMaterial.dispose();\r\n this._plateMaterial.dispose();\r\n\r\n if (this._pickedPointObserver) {\r\n this._host.onPickedPointChangedObservable.remove(this._pickedPointObserver);\r\n this._pickedPointObserver = null;\r\n }\r\n }\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"touchHolographicButton.js","sourceRoot":"","sources":["../../../../../dev/gui/src/3D/controls/touchHolographicButton.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,6CAA+B;AACjD,OAAO,EAAE,gBAAgB,EAAE,sDAAwC;AACnE,OAAO,EAAE,aAAa,EAAE,gDAAkC;AAC1D,OAAO,EAAE,IAAI,EAAE,uCAAyB;AACxC,OAAO,EAAE,WAAW,EAAE,wDAA0C;AAChE,OAAO,EAAE,SAAS,EAAE,sDAAwC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,8DAAgD;AAE5E,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,gDAAgD,CAAC;AACtF,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC1D,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AACxD,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AAEzE,OAAO,EAAE,MAAM,EAAE,4CAA8B;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,OAAO,EAAE,WAAW,EAAE,+CAAiC;AACvD,OAAO,EAAE,mBAAmB,EAAE,8CAAgC;AAC9D,OAAO,EAAE,MAAM,EAAE,6CAA+B;AAEhD;;;GAGG;AACH,MAAM,OAAO,sBAAuB,SAAQ,aAAa;IAmC7C,eAAe;QACnB,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;QACzB,IAAI,IAAI,CAAC,iBAAiB,EAAE,CA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CAAC,cAAc,CAAC;QAE/C,IAAI,CAAC,IAAI,CAAC,mBAAmB,EAAE,CAAC;YAC5B,IAAI,CAAC,UAAU,CAAC,UAAU,GAAG,CAAC,CAAC;QACnC,CAAC;QACD,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;YACnB,IAAI,CAAC,WAAW,CAAC,QAAQ,GAAG,IAAI,CAAC,cAAc,CAAC;QACpD,CAAC;QAED,IAAI,CAAC,eAAe,EAAE,CAAC;IAC3B,CAAC;IAED;;OAEG;IACa,OAAO;QACnB,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,wCAAwC;QAEzD,IAAI,CAAC,eAAe,EAAE,CAAC;QACvB,IAAI,CAAC,uBAAuB,CAAC,MAAM,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;QAEhE,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,CAAC;YACvB,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE,CAAC;YAC7B,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,CAAC;YAC9B,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,CAAC;YAE9B,IAAI,IAAI,CAAC,oBAAoB,EAAE,CAAC;gBAC5B,IAAI,CAAC,KAAK,CAAC,8BAA8B,CAAC,MAAM,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;gBAC5E,IAAI,CAAC,oBAAoB,GAAG,IAAI,CAAC;YACrC,CAAC;QACL,CAAC;IACL,CAAC;;AAxcD;;GAEG;AACW,qCAAc,GAAW,2CAA2C,AAAtD,CAAuD;AACnF;;GAEG;AACW,qCAAc,GAAW,wBAAwB,AAAnC,CAAoC","sourcesContent":["import type { Nullable } from \"core/types\";\r\nimport type { Observer } from \"core/Misc/observable\";\r\nimport { Vector3 } from \"core/Maths/math.vector\";\r\nimport { StandardMaterial } from \"core/Materials/standardMaterial\";\r\nimport { TransformNode } from \"core/Meshes/transformNode\";\r\nimport { Mesh } from \"core/Meshes/mesh\";\r\nimport { CreatePlane } from \"core/Meshes/Builders/planeBuilder\";\r\nimport { CreateBox } from \"core/Meshes/Builders/boxBuilder\";\r\nimport { FadeInOutBehavior } from \"core/Behaviors/Meshes/fadeInOutBehavior\";\r\nimport type { Scene } from \"core/scene\";\r\nimport { FluentMaterial } from \"../materials/fluent/fluentMaterial\";\r\nimport { FluentButtonMaterial } from \"../materials/fluentButton/fluentButtonMaterial\";\r\nimport { StackPanel } from \"../../2D/controls/stackPanel\";\r\nimport { Image } from \"../../2D/controls/image\";\r\nimport { TextBlock } from \"../../2D/controls/textBlock\";\r\nimport { AdvancedDynamicTexture } from \"../../2D/advancedDynamicTexture\";\r\nimport type { Control3D } from \"./control3D\";\r\nimport { Color3 } from \"core/Maths/math.color\";\r\nimport { TouchButton3D } from \"./touchButton3D\";\r\nimport type { AbstractMesh } from \"core/Meshes/abstractMesh\";\r\nimport { SceneLoader } from \"core/Loading/sceneLoader\";\r\nimport { IsDocumentAvailable } from \"core/Misc/domManagement\";\r\nimport { Scalar } from \"core/Maths/math.scalar\";\r\n\r\n/**\r\n * Class used to create a holographic button in 3D\r\n * @since 5.0.0\r\n */\r\nexport class TouchHolographicButton extends TouchButton3D {\r\n /**\r\n * Base Url for the button model.\r\n */\r\n public static MODEL_BASE_URL: string = \"https://assets.babylonjs.com/meshes/MRTK/\";\r\n /**\r\n * File name for the button model.\r\n */\r\n public static MODEL_FILENAME: string = \"mrtk-fluent-button.glb\";\r\n\r\n private _backPlate: Mesh;\r\n private _textPlate: Mesh;\r\n private _frontPlate: AbstractMesh;\r\n private _text: string;\r\n private _imageUrl: string;\r\n private _shareMaterials = true;\r\n private _isBackplateVisible = true;\r\n private _frontMaterial: FluentButtonMaterial;\r\n private _backMaterial: FluentMaterial;\r\n private _plateMaterial: StandardMaterial;\r\n private _pickedPointObserver: Nullable<Observer<Nullable<Vector3>>>;\r\n private _pointerHoverObserver: Nullable<Observer<Vector3>>;\r\n private _frontPlateDepth = 0.5;\r\n private _backPlateDepth = 0.04;\r\n private _backplateColor = new Color3(0.08, 0.15, 0.55);\r\n private _backplateToggledColor = new Color3(0.25, 0.4, 0.95);\r\n\r\n // Tooltip\r\n private _tooltipFade: Nullable<FadeInOutBehavior>;\r\n private _tooltipTextBlock: Nullable<TextBlock>;\r\n private _tooltipTexture: Nullable<AdvancedDynamicTexture>;\r\n private _tooltipMesh: Nullable<Mesh>;\r\n private _tooltipHoverObserver: Nullable<Observer<Control3D>>;\r\n private _tooltipOutObserver: Nullable<Observer<Control3D>>;\r\n\r\n private _disposeTooltip() {\r\n this._tooltipFade = null;\r\n if (this._tooltipTextBlock) {\r\n this._tooltipTextBlock.dispose();\r\n }\r\n if (this._tooltipTexture) {\r\n this._tooltipTexture.dispose();\r\n }\r\n if (this._tooltipMesh) {\r\n this._tooltipMesh.dispose();\r\n }\r\n this.onPointerEnterObservable.remove(this._tooltipHoverObserver);\r\n this.onPointerOutObservable.remove(this._tooltipOutObserver);\r\n }\r\n\r\n /**\r\n * Rendering ground id of all the mesh in the button\r\n */\r\n public set renderingGroupId(id: number) {\r\n this._backPlate.renderingGroupId = id;\r\n this._textPlate.renderingGroupId = id;\r\n this._frontPlate.renderingGroupId = id;\r\n\r\n if (this._tooltipMesh) {\r\n this._tooltipMesh.renderingGroupId = id;\r\n }\r\n }\r\n public get renderingGroupId(): number {\r\n return this._backPlate.renderingGroupId;\r\n }\r\n\r\n /**\r\n * Gets the mesh used to render this control\r\n */\r\n public override get mesh(): Nullable<AbstractMesh> {\r\n return this._backPlate as AbstractMesh;\r\n }\r\n\r\n /**\r\n * Text to be displayed on the tooltip shown when hovering on the button. When set to null tooltip is disabled. (Default: null)\r\n */\r\n public set tooltipText(text: Nullable<string>) {\r\n if (!text) {\r\n this._disposeTooltip();\r\n return;\r\n }\r\n if (!this._tooltipFade) {\r\n const rightHandedScene = this._backPlate._scene.useRightHandedSystem;\r\n // Create tooltip with mesh and text\r\n this._tooltipMesh = CreatePlane(\"\", { size: 1 }, this._backPlate._scene);\r\n const tooltipBackground = CreatePlane(\"\", { size: 1, sideOrientation: Mesh.DOUBLESIDE }, this._backPlate._scene);\r\n const mat = new StandardMaterial(\"\", this._backPlate._scene);\r\n mat.diffuseColor = Color3.FromHexString(\"#212121\");\r\n tooltipBackground.material = mat;\r\n tooltipBackground.isPickable = false;\r\n this._tooltipMesh.addChild(tooltipBackground);\r\n tooltipBackground.position = Vector3.Forward(rightHandedScene).scale(0.05);\r\n this._tooltipMesh.scaling.y = 1 / 3;\r\n this._tooltipMesh.position = Vector3.Up().scale(0.7).add(Vector3.Forward(rightHandedScene).scale(-0.15));\r\n this._tooltipMesh.isPickable = false;\r\n this._tooltipMesh.parent = this._backPlate;\r\n\r\n // Create text texture for the tooltip\r\n this._tooltipTexture = AdvancedDynamicTexture.CreateForMesh(this._tooltipMesh);\r\n this._tooltipTextBlock = new TextBlock();\r\n this._tooltipTextBlock.scaleY = 3;\r\n this._tooltipTextBlock.color = \"white\";\r\n this._tooltipTextBlock.fontSize = 130;\r\n this._tooltipTexture.addControl(this._tooltipTextBlock);\r\n\r\n // Add hover action to tooltip\r\n this._tooltipFade = new FadeInOutBehavior();\r\n this._tooltipFade.delay = 500;\r\n this._tooltipMesh.addBehavior(this._tooltipFade);\r\n this._tooltipHoverObserver = this.onPointerEnterObservable.add(() => {\r\n if (this._tooltipFade) {\r\n this._tooltipFade.fadeIn(true);\r\n }\r\n });\r\n this._tooltipOutObserver = this.onPointerOutObservable.add(() => {\r\n if (this._tooltipFade) {\r\n this._tooltipFade.fadeIn(false);\r\n }\r\n });\r\n }\r\n if (this._tooltipTextBlock) {\r\n this._tooltipTextBlock.text = text;\r\n }\r\n }\r\n\r\n public get tooltipText() {\r\n if (this._tooltipTextBlock) {\r\n return this._tooltipTextBlock.text;\r\n }\r\n return null;\r\n }\r\n\r\n /**\r\n * Gets or sets text for the button\r\n */\r\n public get text(): string {\r\n return this._text;\r\n }\r\n\r\n public set text(value: string) {\r\n if (this._text === value) {\r\n return;\r\n }\r\n\r\n this._text = value;\r\n this._rebuildContent();\r\n }\r\n\r\n /**\r\n * Gets or sets the image url for the button\r\n */\r\n public get imageUrl(): string {\r\n return this._imageUrl;\r\n }\r\n\r\n public set imageUrl(value: string) {\r\n if (this._imageUrl === value) {\r\n return;\r\n }\r\n\r\n this._imageUrl = value;\r\n this._rebuildContent();\r\n }\r\n\r\n /**\r\n * Gets the back material used by this button\r\n */\r\n public get backMaterial(): FluentMaterial {\r\n return this._backMaterial;\r\n }\r\n\r\n /**\r\n * Gets the front material used by this button\r\n */\r\n public get frontMaterial(): FluentButtonMaterial {\r\n return this._frontMaterial;\r\n }\r\n\r\n /**\r\n * Gets the plate material used by this button\r\n */\r\n public get plateMaterial(): StandardMaterial {\r\n return this._plateMaterial;\r\n }\r\n\r\n /**\r\n * Gets a boolean indicating if this button shares its material with other HolographicButtons\r\n */\r\n public get shareMaterials(): boolean {\r\n return this._shareMaterials;\r\n }\r\n\r\n /**\r\n * Sets whether the backplate is visible or hidden. Hiding the backplate is not recommended without some sort of replacement\r\n */\r\n public set isBackplateVisible(isVisible: boolean) {\r\n if (this.mesh && !!this._backMaterial) {\r\n if (isVisible && !this._isBackplateVisible) {\r\n this._backPlate.visibility = 1;\r\n } else if (!isVisible && this._isBackplateVisible) {\r\n this._backPlate.visibility = 0;\r\n }\r\n }\r\n\r\n this._isBackplateVisible = isVisible;\r\n }\r\n\r\n /**\r\n * Creates a new button\r\n * @param name defines the control name\r\n * @param shareMaterials\r\n */\r\n constructor(name?: string, shareMaterials = true) {\r\n super(name);\r\n\r\n this._shareMaterials = shareMaterials;\r\n\r\n this.pointerEnterAnimation = () => {\r\n this._frontMaterial.leftBlobEnable = true;\r\n this._frontMaterial.rightBlobEnable = true;\r\n };\r\n\r\n this.pointerOutAnimation = () => {\r\n this._frontMaterial.leftBlobEnable = false;\r\n this._frontMaterial.rightBlobEnable = false;\r\n };\r\n\r\n this.pointerDownAnimation = () => {\r\n if (this._frontPlate && !this.isActiveNearInteraction) {\r\n this._frontPlate.scaling.z = this._frontPlateDepth * 0.2;\r\n this._frontPlate.position = Vector3.Forward(this._frontPlate._scene.useRightHandedSystem).scale((this._frontPlateDepth - 0.2 * this._frontPlateDepth) / 2);\r\n this._textPlate.position = Vector3.Forward(this._textPlate._scene.useRightHandedSystem).scale(-(this._backPlateDepth + 0.2 * this._frontPlateDepth) / 2);\r\n }\r\n };\r\n this.pointerUpAnimation = () => {\r\n if (this._frontPlate) {\r\n this._frontPlate.scaling.z = this._frontPlateDepth;\r\n this._frontPlate.position = Vector3.Forward(this._frontPlate._scene.useRightHandedSystem).scale((this._frontPlateDepth - this._frontPlateDepth) / 2);\r\n this._textPlate.position = Vector3.Forward(this._textPlate._scene.useRightHandedSystem).scale(-(this._backPlateDepth + this._frontPlateDepth) / 2);\r\n }\r\n };\r\n\r\n this.onPointerMoveObservable.add((position) => {\r\n if (this._frontPlate && this.isActiveNearInteraction) {\r\n const scale = Vector3.Zero();\r\n if (this._backPlate.getWorldMatrix().decompose(scale, undefined, undefined)) {\r\n let interactionHeight = this._getInteractionHeight(position, this._backPlate.getAbsolutePosition()) / scale.z;\r\n interactionHeight = Scalar.Clamp(interactionHeight - this._backPlateDepth / 2, 0.2 * this._frontPlateDepth, this._frontPlateDepth);\r\n\r\n this._frontPlate.scaling.z = interactionHeight;\r\n this._frontPlate.position = Vector3.Forward(this._frontPlate._scene.useRightHandedSystem).scale((this._frontPlateDepth - interactionHeight) / 2);\r\n this._textPlate.position = Vector3.Forward(this._textPlate._scene.useRightHandedSystem).scale(-(this._backPlateDepth + interactionHeight) / 2);\r\n }\r\n }\r\n });\r\n\r\n this._pointerHoverObserver = this.onPointerMoveObservable.add((hoverPosition: Vector3) => {\r\n this._frontMaterial.globalLeftIndexTipPosition = hoverPosition;\r\n });\r\n }\r\n\r\n protected override _getTypeName(): string {\r\n return \"TouchHolographicButton\";\r\n }\r\n\r\n private _rebuildContent(): void {\r\n this._disposeFacadeTexture();\r\n\r\n const panel = new StackPanel();\r\n panel.isVertical = true;\r\n\r\n if (IsDocumentAvailable() && !!document.createElement) {\r\n if (this._imageUrl) {\r\n const image = new Image();\r\n image.source = this._imageUrl;\r\n image.paddingTop = \"40px\";\r\n image.height = \"180px\";\r\n image.width = \"100px\";\r\n image.paddingBottom = \"40px\";\r\n panel.addControl(image);\r\n }\r\n }\r\n\r\n if (this._text) {\r\n const text = new TextBlock();\r\n text.text = this._text;\r\n text.color = \"white\";\r\n text.height = \"30px\";\r\n text.fontSize = 24;\r\n panel.addControl(text);\r\n }\r\n\r\n this.content = panel;\r\n }\r\n\r\n // Mesh association\r\n protected override _createNode(scene: Scene): TransformNode {\r\n this.name = this.name ?? \"TouchHolographicButton\";\r\n const collisionMesh = CreateBox(\r\n `${this.name}_collisionMesh`,\r\n {\r\n width: 1.0,\r\n height: 1.0,\r\n depth: this._frontPlateDepth,\r\n },\r\n scene\r\n );\r\n collisionMesh.isPickable = true;\r\n collisionMesh.isNearPickable = true;\r\n collisionMesh.visibility = 0;\r\n collisionMesh.position = Vector3.Forward(scene.useRightHandedSystem).scale(-this._frontPlateDepth / 2);\r\n\r\n SceneLoader.ImportMeshAsync(undefined, TouchHolographicButton.MODEL_BASE_URL, TouchHolographicButton.MODEL_FILENAME, scene).then((result) => {\r\n const alphaMesh = CreateBox(\r\n \"${this.name}_alphaMesh\",\r\n {\r\n width: 1.0,\r\n height: 1.0,\r\n depth: 1.0,\r\n },\r\n scene\r\n );\r\n alphaMesh.isPickable = false;\r\n alphaMesh.material = new StandardMaterial(\"${this.name}_alphaMesh_material\", scene);\r\n alphaMesh.material.alpha = 0.15;\r\n\r\n const importedFrontPlate = result.meshes[1];\r\n importedFrontPlate.name = `${this.name}_frontPlate`;\r\n importedFrontPlate.isPickable = false;\r\n importedFrontPlate.scaling.z = this._frontPlateDepth;\r\n alphaMesh.parent = importedFrontPlate;\r\n importedFrontPlate.parent = collisionMesh;\r\n if (this._frontMaterial) {\r\n importedFrontPlate.material = this._frontMaterial;\r\n }\r\n this._frontPlate = importedFrontPlate;\r\n });\r\n\r\n this._backPlate = CreateBox(\r\n `${this.name}_backPlate`,\r\n {\r\n width: 1.0,\r\n height: 1.0,\r\n depth: this._backPlateDepth,\r\n },\r\n scene\r\n );\r\n\r\n this._backPlate.position = Vector3.Forward(scene.useRightHandedSystem).scale(this._backPlateDepth / 2);\r\n this._backPlate.isPickable = false;\r\n\r\n this._textPlate = <Mesh>super._createNode(scene);\r\n this._textPlate.name = `${this.name}_textPlate`;\r\n this._textPlate.isPickable = false;\r\n this._textPlate.position = Vector3.Forward(scene.useRightHandedSystem).scale(-this._frontPlateDepth / 2);\r\n\r\n this._backPlate.addChild(collisionMesh);\r\n this._backPlate.addChild(this._textPlate);\r\n\r\n const tn = new TransformNode(`{this.name}_root`, scene);\r\n this._backPlate.setParent(tn);\r\n\r\n this.collisionMesh = collisionMesh;\r\n this.collidableFrontDirection = this._backPlate.forward.negate(); // Mesh is facing the wrong way\r\n\r\n return tn;\r\n }\r\n\r\n protected override _applyFacade(facadeTexture: AdvancedDynamicTexture) {\r\n this._plateMaterial.emissiveTexture = facadeTexture;\r\n this._plateMaterial.opacityTexture = facadeTexture;\r\n this._plateMaterial.diffuseColor = new Color3(0.4, 0.4, 0.4);\r\n }\r\n\r\n private _createBackMaterial(mesh: Mesh) {\r\n this._backMaterial = new FluentMaterial(this.name + \"backPlateMaterial\", mesh.getScene());\r\n this._backMaterial.albedoColor = this._backplateColor;\r\n this._backMaterial.renderBorders = true;\r\n this._backMaterial.renderHoverLight = false;\r\n }\r\n\r\n private _createFrontMaterial(mesh: Mesh) {\r\n this._frontMaterial = new FluentButtonMaterial(this.name + \"Front Material\", mesh.getScene());\r\n }\r\n\r\n private _createPlateMaterial(mesh: Mesh) {\r\n this._plateMaterial = new StandardMaterial(this.name + \"Plate Material\", mesh.getScene());\r\n this._plateMaterial.specularColor = Color3.Black();\r\n }\r\n\r\n protected override _onToggle(newState: boolean) {\r\n if (this._backMaterial) {\r\n if (newState) {\r\n this._backMaterial.albedoColor = this._backplateToggledColor;\r\n } else {\r\n this._backMaterial.albedoColor = this._backplateColor;\r\n }\r\n }\r\n\r\n super._onToggle(newState);\r\n }\r\n\r\n protected override _affectMaterial(mesh: Mesh) {\r\n if (this._shareMaterials) {\r\n // Back\r\n if (!this._host._touchSharedMaterials[\"backFluentMaterial\"]) {\r\n this._createBackMaterial(mesh);\r\n this._host._touchSharedMaterials[\"backFluentMaterial\"] = this._backMaterial;\r\n } else {\r\n this._backMaterial = this._host._touchSharedMaterials[\"backFluentMaterial\"] as FluentMaterial;\r\n }\r\n\r\n // Front\r\n if (!this._host._touchSharedMaterials[\"frontFluentMaterial\"]) {\r\n this._createFrontMaterial(mesh);\r\n this._host._touchSharedMaterials[\"frontFluentMaterial\"] = this._frontMaterial;\r\n } else {\r\n this._frontMaterial = this._host._touchSharedMaterials[\"frontFluentMaterial\"] as FluentButtonMaterial;\r\n }\r\n } else {\r\n this._createBackMaterial(mesh);\r\n this._createFrontMaterial(mesh);\r\n }\r\n\r\n this._createPlateMaterial(mesh);\r\n this._backPlate.material = this._backMaterial;\r\n this._textPlate.material = this._plateMaterial;\r\n\r\n if (!this._isBackplateVisible) {\r\n this._backPlate.visibility = 0;\r\n }\r\n if (this._frontPlate) {\r\n this._frontPlate.material = this._frontMaterial;\r\n }\r\n\r\n this._rebuildContent();\r\n }\r\n\r\n /**\r\n * Releases all associated resources\r\n */\r\n public override dispose() {\r\n super.dispose(); // will dispose main mesh ie. back plate\r\n\r\n this._disposeTooltip();\r\n this.onPointerMoveObservable.remove(this._pointerHoverObserver);\r\n\r\n if (!this.shareMaterials) {\r\n this._backMaterial.dispose();\r\n this._frontMaterial.dispose();\r\n this._plateMaterial.dispose();\r\n\r\n if (this._pickedPointObserver) {\r\n this._host.onPickedPointChangedObservable.remove(this._pickedPointObserver);\r\n this._pickedPointObserver = null;\r\n }\r\n }\r\n }\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"touchHolographicMenu.js","sourceRoot":"","sources":["../../../../../dev/gui/src/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CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,IAAI,IAAI,CAAC;aACxC;SACJ;QAED,IAAI,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;IACa,UAAU,CAAC,QAAmB;QAC1C,MAAM,CAAC,IAAI,CAAC,2FAA2F,CAAC,CAAC;QAEzG,OAAO,IAAI,CAAC;IAChB,CAAC;IAED;;OAEG;IACa,OAAO;QACnB,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 override _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 override _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 override _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 override 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 override 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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C,CAAC;QACL,CAAC;QAED,IAAI,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,CAAC;YACpB,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;QAC5B,CAAC;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,CAAC;YACpB,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC;QAC7B,CAAC;QACD,OAAO,IAAI,CAAC;IAChB,CAAC;IAED;;;;;OAKG;IACa,UAAU,CAAC,QAAmB;QAC1C,MAAM,CAAC,IAAI,CAAC,2FAA2F,CAAC,CAAC;QAEzG,OAAO,IAAI,CAAC;IAChB,CAAC;IAED;;OAEG;IACa,OAAO;QACnB,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 override _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 override _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 override _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 override 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 override dispose() {\r\n super.dispose();\r\n\r\n this._host.onPickedPointChangedObservable.remove(this._pickedPointObserver);\r\n }\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"touchMeshButton3D.js","sourceRoot":"","sources":["../../../../../dev/gui/src/3D/controls/touchMeshButton3D.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD;;;GAGG;AACH,MAAM,OAAO,iBAAkB,SAAQ,aAAa;IAIhD;;;;OAIG;IACH,YAAY,IAAU,EAAE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7B,CAAC;IAED,6DAA6D;IAC1C,eAAe,CAAC,IAAkB,IAAG,CAAC;CAC5D","sourcesContent":["import type { TransformNode } from \"core/Meshes/transformNode\";\r\nimport type { AbstractMesh } from \"core/Meshes/abstractMesh\";\r\nimport type { Mesh } from \"core/Meshes/mesh\";\r\n\r\nimport { TouchButton3D } from \"./touchButton3D\";\r\n\r\n/**\r\n * Class used to create an interactable object. It's a touchable 3D button using a mesh coming from the current scene\r\n * @since 5.0.0\r\n */\r\nexport class TouchMeshButton3D extends TouchButton3D {\r\n /** @internal */\r\n protected _currentMesh: Mesh;\r\n\r\n /**\r\n * Creates a new 3D button based on a mesh\r\n * @param mesh mesh to become a 3D button. By default this is also the mesh for near interaction collision checking\r\n * @param name defines the control name\r\n */\r\n constructor(mesh: Mesh, name?: string) {\r\n super(name, mesh);\r\n\r\n this._currentMesh = mesh;\r\n\r\n /**\r\n * Provides a default behavior on hover/out & up/down\r\n * Override those function to create your own desired behavior specific to your mesh\r\n */\r\n this.pointerEnterAnimation = () => {\r\n if (!this.mesh) {\r\n return;\r\n }\r\n this.mesh.scaling.scaleInPlace(1.1);\r\n };\r\n\r\n this.pointerOutAnimation = () => {\r\n if (!this.mesh) {\r\n return;\r\n }\r\n this.mesh.scaling.scaleInPlace(1.0 / 1.1);\r\n };\r\n\r\n this.pointerDownAnimation = () => {\r\n if (!this.mesh) {\r\n return;\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 this.mesh.scaling.scaleInPlace(1.0 / 0.95);\r\n };\r\n }\r\n\r\n protected override _getTypeName(): string {\r\n return \"TouchMeshButton3D\";\r\n }\r\n\r\n // Mesh association\r\n protected override _createNode(): TransformNode {\r\n this._currentMesh.getChildMeshes().forEach((mesh) => {\r\n this._injectGUI3DReservedDataStore(mesh).control = this;\r\n });\r\n\r\n return this._currentMesh;\r\n }\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n protected override _affectMaterial(mesh: AbstractMesh) {}\r\n}\r\n"]}
1
+ {"version":3,"file":"touchMeshButton3D.js","sourceRoot":"","sources":["../../../../../dev/gui/src/3D/controls/touchMeshButton3D.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD;;;GAGG;AACH,MAAM,OAAO,iBAAkB,SAAQ,aAAa;IAIhD;;;;OAIG;IACH,YAAY,IAAU,EAAE,IAAa;QACjC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QAElB,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;QAEzB;;;WAGG;QACH,IAAI,CAAC,qBAAqB,GAAG,GAAG,EAAE;YAC9B,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;gBACb,OAAO;YACX,CAAC;YACD,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;QACxC,CAAC,CAAC;QAEF,IAAI,CAAC,mBAAmB,GAAG,GAAG,EAAE;YAC5B,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;gBACb,OAAO;YACX,CAAC;YACD,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,GAAG,GAAG,GAAG,CAAC,CAAC;QAC9C,CAAC,CAAC;QAEF,IAAI,CAAC,oBAAoB,GAAG,GAAG,EAAE;YAC7B,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;gBACb,OAAO;YACX,CAAC;YACD,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;QACzC,CAAC,CAAC;QAEF,IAAI,CAAC,kBAAkB,GAAG,GAAG,EAAE;YAC3B,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;gBACb,OAAO;YACX,CAAC;YACD,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,GAAG,GAAG,IAAI,CAAC,CAAC;QAC/C,CAAC,CAAC;IACN,CAAC;IAEkB,YAAY;QAC3B,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAED,mBAAmB;IACA,WAAW;QAC1B,IAAI,CAAC,YAAY,CAAC,cAAc,EAAE,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;YAChD,IAAI,CAAC,6BAA6B,CAAC,IAAI,CAAC,CAAC,OAAO,GAAG,IAAI,CAAC;QAC5D,CAAC,CAAC,CAAC;QAEH,OAAO,IAAI,CAAC,YAAY,CAAC;IAC7B,CAAC;IAED,6DAA6D;IAC1C,eAAe,CAAC,IAAkB,IAAG,CAAC;CAC5D","sourcesContent":["import type { TransformNode } from \"core/Meshes/transformNode\";\r\nimport type { AbstractMesh } from \"core/Meshes/abstractMesh\";\r\nimport type { Mesh } from \"core/Meshes/mesh\";\r\n\r\nimport { TouchButton3D } from \"./touchButton3D\";\r\n\r\n/**\r\n * Class used to create an interactable object. It's a touchable 3D button using a mesh coming from the current scene\r\n * @since 5.0.0\r\n */\r\nexport class TouchMeshButton3D extends TouchButton3D {\r\n /** @internal */\r\n protected _currentMesh: Mesh;\r\n\r\n /**\r\n * Creates a new 3D button based on a mesh\r\n * @param mesh mesh to become a 3D button. By default this is also the mesh for near interaction collision checking\r\n * @param name defines the control name\r\n */\r\n constructor(mesh: Mesh, name?: string) {\r\n super(name, mesh);\r\n\r\n this._currentMesh = mesh;\r\n\r\n /**\r\n * Provides a default behavior on hover/out & up/down\r\n * Override those function to create your own desired behavior specific to your mesh\r\n */\r\n this.pointerEnterAnimation = () => {\r\n if (!this.mesh) {\r\n return;\r\n }\r\n this.mesh.scaling.scaleInPlace(1.1);\r\n };\r\n\r\n this.pointerOutAnimation = () => {\r\n if (!this.mesh) {\r\n return;\r\n }\r\n this.mesh.scaling.scaleInPlace(1.0 / 1.1);\r\n };\r\n\r\n this.pointerDownAnimation = () => {\r\n if (!this.mesh) {\r\n return;\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 this.mesh.scaling.scaleInPlace(1.0 / 0.95);\r\n };\r\n }\r\n\r\n protected override _getTypeName(): string {\r\n return \"TouchMeshButton3D\";\r\n }\r\n\r\n // Mesh association\r\n protected override _createNode(): TransformNode {\r\n this._currentMesh.getChildMeshes().forEach((mesh) => {\r\n this._injectGUI3DReservedDataStore(mesh).control = this;\r\n });\r\n\r\n return this._currentMesh;\r\n }\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n protected override _affectMaterial(mesh: AbstractMesh) {}\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"volumeBasedPanel.js","sourceRoot":"","sources":["../../../../../dev/gui/src/3D/controls/volumeBasedPanel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,sCAAwB;AACxC,OAAO,EAAE,OAAO,EAAE,6CAA+B;AAGjD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAI5C;;GAEG;AACH,MAAM,OAAgB,gBAAiB,SAAQ,WAAW;IAetD;;;;;;;;;OASG;IACH,IAAW,WAAW;QAClB,OAAO,IAAI,CAAC,YAAY,CAAC;IAC7B,CAAC;IAED,IAAW,WAAW,CAAC,KAAa;QAChC,IAAI,IAAI,CAAC,YAAY,KAAK,KAAK,EAAE;YAC7B,OAAO;SACV;QAED,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC;QAE1B,KAAK,CAAC,YAAY,CAAC,GAAG,EAAE;YACpB,IAAI,CAAC,gBAAgB,EAAE,CAAC;QAC5B,CAAC,CAAC,CAAC;IACP,CAAC;IAED;;;OAGG;IACH,IAAW,OAAO;QACd,OAAO,IAAI,CAAC,QAAQ,CAAC;IACzB,CAAC;IAED,IAAW,OAAO,CAAC,KAAU;QACzB,IAAI,IAAI,CAAC,QAAQ,KAAK,KAAK,EAAE;YACzB,OAAO;SACV;QAED,I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,QAAQ,CAAC,IAAI,CAAC,IAAI,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,UAAU,GAAG,YAAY,GAAG,IAAI,CAAC,UAAU,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,WAAW,GAAG,YAAY,GAAG,IAAI,CAAC,WAAW,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;oBACpJ,WAAW,EAAE,CAAC;oBACd,IAAI,WAAW,GAAG,YAAY,EAAE;wBAC5B,MAAM;qBACT;iBACJ;aACJ;SACJ;QAED,WAAW,GAAG,CAAC,CAAC;QAChB,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,SAAS,EAAE;YAChC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE;gBACb,SAAS;aACZ;YAED,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC;YAEhD,WAAW,EAAE,CAAC;SACjB;QAED,IAAI,CAAC,gBAAgB,EAAE,CAAC;IAC5B,CAAC;IAKD,iFAAiF;IACvE,gBAAgB,KAAI,CAAC;CAClC","sourcesContent":["import { Tools } from \"core/Misc/tools\";\r\nimport { Vector3 } from \"core/Maths/math.vector\";\r\nimport type { int } from \"core/types\";\r\n\r\nimport { Container3D } from \"./container3D\";\r\nimport type { Control3D } from \"./control3D\";\r\nimport type { AbstractMesh } from \"core/Meshes/abstractMesh\";\r\n\r\n/**\r\n * Abstract class used to create a container panel deployed on the surface of a volume\r\n */\r\nexport abstract class VolumeBasedPanel extends Container3D {\r\n private _columns = 10;\r\n private _rows = 0;\r\n private _rowThenColum = true;\r\n\r\n private _orientation = Container3D.FACEORIGIN_ORIENTATION;\r\n\r\n protected _cellWidth: number;\r\n protected _cellHeight: number;\r\n\r\n /**\r\n * Gets or sets the distance between elements\r\n */\r\n public margin = 0;\r\n\r\n /**\r\n * Gets or sets the orientation to apply to all controls (BABYLON.Container3D.FaceOriginReversedOrientation by default)\r\n * | Value | Type | Description |\r\n * | ----- | ----------------------------------- | ----------- |\r\n * | 0 | UNSET_ORIENTATION | Control rotation will remain unchanged |\r\n * | 1 | FACEORIGIN_ORIENTATION | Control will rotate to make it look at sphere central axis |\r\n * | 2 | FACEORIGINREVERSED_ORIENTATION | Control will rotate to make it look back at sphere central axis |\r\n * | 3 | FACEFORWARD_ORIENTATION | Control will rotate to look at z axis (0, 0, 1) |\r\n * | 4 | FACEFORWARDREVERSED_ORIENTATION | Control will rotate to look at negative z axis (0, 0, -1) |\r\n */\r\n public get orientation(): number {\r\n return this._orientation;\r\n }\r\n\r\n public set orientation(value: number) {\r\n if (this._orientation === value) {\r\n return;\r\n }\r\n\r\n this._orientation = value;\r\n\r\n Tools.SetImmediate(() => {\r\n this._arrangeChildren();\r\n });\r\n }\r\n\r\n /**\r\n * Gets or sets the number of columns requested (10 by default).\r\n * The panel will automatically compute the number of rows based on number of child controls.\r\n */\r\n public get columns(): int {\r\n return this._columns;\r\n }\r\n\r\n public set columns(value: int) {\r\n if (this._columns === value) {\r\n return;\r\n }\r\n\r\n this._columns = value;\r\n this._rowThenColum = true;\r\n\r\n Tools.SetImmediate(() => {\r\n this._arrangeChildren();\r\n });\r\n }\r\n\r\n /**\r\n * Gets or sets a the number of rows requested.\r\n * The panel will automatically compute the number of columns based on number of child controls.\r\n */\r\n public get rows(): int {\r\n return this._rows;\r\n }\r\n\r\n public set rows(value: int) {\r\n if (this._rows === value) {\r\n return;\r\n }\r\n\r\n this._rows = value;\r\n this._rowThenColum = false;\r\n\r\n Tools.SetImmediate(() => {\r\n this._arrangeChildren();\r\n });\r\n }\r\n\r\n /**\r\n * Creates new VolumeBasedPanel\r\n * @param name\r\n */\r\n public constructor(name?: string) {\r\n super(name);\r\n }\r\n\r\n protected override _arrangeChildren() {\r\n this._cellWidth = 0;\r\n this._cellHeight = 0;\r\n let rows = 0;\r\n let columns = 0;\r\n let controlCount = 0;\r\n // Measure\r\n for (const child of this._children) {\r\n if (!child.mesh) {\r\n continue;\r\n }\r\n\r\n controlCount++;\r\n child.mesh.computeWorldMatrix(true);\r\n const extendSize = child.mesh.getBoundingInfo().boundingBox.extendSize;\r\n // to be safe, check descendants\r\n const descendants = child.mesh.getDescendants(false);\r\n for (const descendant of descendants) {\r\n descendant.computeWorldMatrix(true);\r\n const casted = descendant as AbstractMesh;\r\n if (typeof casted.getBoundingInfo === \"function\") {\r\n const extendSizeChild = casted.getBoundingInfo().boundingBox.extendSize;\r\n extendSize.x = Math.max(extendSize.x, extendSizeChild.x);\r\n extendSize.y = Math.max(extendSize.y, extendSizeChild.y);\r\n extendSize.z = Math.max(extendSize.z, extendSizeChild.z);\r\n }\r\n }\r\n\r\n this._cellWidth = Math.max(this._cellWidth, extendSize.x * 2);\r\n this._cellHeight = Math.max(this._cellHeight, extendSize.y * 2);\r\n }\r\n\r\n this._cellWidth += this.margin * 2;\r\n this._cellHeight += this.margin * 2;\r\n\r\n // Arrange\r\n if (this._rowThenColum) {\r\n columns = this._columns;\r\n rows = Math.ceil(controlCount / this._columns);\r\n } else {\r\n rows = this._rows;\r\n columns = Math.ceil(controlCount / this._rows);\r\n }\r\n\r\n const startOffsetX = columns * 0.5 * this._cellWidth;\r\n const startOffsetY = rows * 0.5 * this._cellHeight;\r\n const nodeGrid = [];\r\n let cellCounter = 0;\r\n\r\n if (this._rowThenColum) {\r\n for (let r = 0; r < rows; r++) {\r\n for (let c = 0; c < columns; c++) {\r\n nodeGrid.push(new Vector3(c * this._cellWidth - startOffsetX + this._cellWidth / 2, r * this._cellHeight - startOffsetY + this._cellHeight / 2, 0));\r\n cellCounter++;\r\n if (cellCounter > controlCount) {\r\n break;\r\n }\r\n }\r\n }\r\n } else {\r\n for (let c = 0; c < columns; c++) {\r\n for (let r = 0; r < rows; r++) {\r\n nodeGrid.push(new Vector3(c * this._cellWidth - startOffsetX + this._cellWidth / 2, r * this._cellHeight - startOffsetY + this._cellHeight / 2, 0));\r\n cellCounter++;\r\n if (cellCounter > controlCount) {\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n\r\n cellCounter = 0;\r\n for (const child of this._children) {\r\n if (!child.mesh) {\r\n continue;\r\n }\r\n\r\n this._mapGridNode(child, nodeGrid[cellCounter]);\r\n\r\n cellCounter++;\r\n }\r\n\r\n this._finalProcessing();\r\n }\r\n\r\n /** Child classes must implement this function to provide correct control positioning */\r\n protected abstract _mapGridNode(control: Control3D, nodePosition: Vector3): void;\r\n\r\n /** Child classes can implement this function to provide additional processing */\r\n protected _finalProcessing() {}\r\n}\r\n"]}
1
+ {"version":3,"file":"volumeBasedPanel.js","sourceRoot":"","sources":["../../../../../dev/gui/src/3D/controls/volumeBasedPanel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,sCAAwB;AACxC,OAAO,EAAE,OAAO,EAAE,6CAA+B;AAGjD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAI5C;;GAEG;AACH,MAAM,OAAgB,gBAAiB,SAAQ,WAAW;IAetD;;;;;;;;;OASG;IACH,IAAW,WAAW;QAClB,OAAO,IAAI,CAAC,YAAY,CAAC;IAC7B,CAAC;IAED,IAAW,WAAW,CAAC,KAAa;QAChC,IAAI,IAAI,CAAC,YAAY,KAAK,KAAK,EAAE,CAAC;YAC9B,OAAO;QACX,CAAC;QAED,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC;QAE1B,KAAK,CAAC,YAAY,CAAC,GAAG,EAAE;YACpB,IAAI,CAAC,gBAAgB,EAAE,CAAC;QAC5B,CAAC,CAAC,CAAC;IACP,CAAC;IAED;;;OAGG;IACH,IAAW,OAAO;QACd,OAAO,IAAI,CAAC,QAAQ,CAAC;IACzB,CAAC;IAED,IAAW,OAAO,CAAC,KAAU;QACzB,IAAI,IAAI,CAAC,QAAQ,KAAK,KAAK,EAAE,CAAC;YAC1B,OAAO;QACX,CAAC;QAED,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;QACtB,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;QAE1B,K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AAE,CAAC,GAAG,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC;oBAC5B,QAAQ,CAAC,IAAI,CAAC,IAAI,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,UAAU,GAAG,YAAY,GAAG,IAAI,CAAC,UAAU,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,WAAW,GAAG,YAAY,GAAG,IAAI,CAAC,WAAW,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;oBACpJ,WAAW,EAAE,CAAC;oBACd,IAAI,WAAW,GAAG,YAAY,EAAE,CAAC;wBAC7B,MAAM;oBACV,CAAC;gBACL,CAAC;YACL,CAAC;QACL,CAAC;QAED,WAAW,GAAG,CAAC,CAAC;QAChB,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;YACjC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;gBACd,SAAS;YACb,CAAC;YAED,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC;YAEhD,WAAW,EAAE,CAAC;QAClB,CAAC;QAED,IAAI,CAAC,gBAAgB,EAAE,CAAC;IAC5B,CAAC;IAKD,iFAAiF;IACvE,gBAAgB,KAAI,CAAC;CAClC","sourcesContent":["import { Tools } from \"core/Misc/tools\";\r\nimport { Vector3 } from \"core/Maths/math.vector\";\r\nimport type { int } from \"core/types\";\r\n\r\nimport { Container3D } from \"./container3D\";\r\nimport type { Control3D } from \"./control3D\";\r\nimport type { AbstractMesh } from \"core/Meshes/abstractMesh\";\r\n\r\n/**\r\n * Abstract class used to create a container panel deployed on the surface of a volume\r\n */\r\nexport abstract class VolumeBasedPanel extends Container3D {\r\n private _columns = 10;\r\n private _rows = 0;\r\n private _rowThenColum = true;\r\n\r\n private _orientation = Container3D.FACEORIGIN_ORIENTATION;\r\n\r\n protected _cellWidth: number;\r\n protected _cellHeight: number;\r\n\r\n /**\r\n * Gets or sets the distance between elements\r\n */\r\n public margin = 0;\r\n\r\n /**\r\n * Gets or sets the orientation to apply to all controls (BABYLON.Container3D.FaceOriginReversedOrientation by default)\r\n * | Value | Type | Description |\r\n * | ----- | ----------------------------------- | ----------- |\r\n * | 0 | UNSET_ORIENTATION | Control rotation will remain unchanged |\r\n * | 1 | FACEORIGIN_ORIENTATION | Control will rotate to make it look at sphere central axis |\r\n * | 2 | FACEORIGINREVERSED_ORIENTATION | Control will rotate to make it look back at sphere central axis |\r\n * | 3 | FACEFORWARD_ORIENTATION | Control will rotate to look at z axis (0, 0, 1) |\r\n * | 4 | FACEFORWARDREVERSED_ORIENTATION | Control will rotate to look at negative z axis (0, 0, -1) |\r\n */\r\n public get orientation(): number {\r\n return this._orientation;\r\n }\r\n\r\n public set orientation(value: number) {\r\n if (this._orientation === value) {\r\n return;\r\n }\r\n\r\n this._orientation = value;\r\n\r\n Tools.SetImmediate(() => {\r\n this._arrangeChildren();\r\n });\r\n }\r\n\r\n /**\r\n * Gets or sets the number of columns requested (10 by default).\r\n * The panel will automatically compute the number of rows based on number of child controls.\r\n */\r\n public get columns(): int {\r\n return this._columns;\r\n }\r\n\r\n public set columns(value: int) {\r\n if (this._columns === value) {\r\n return;\r\n }\r\n\r\n this._columns = value;\r\n this._rowThenColum = true;\r\n\r\n Tools.SetImmediate(() => {\r\n this._arrangeChildren();\r\n });\r\n }\r\n\r\n /**\r\n * Gets or sets a the number of rows requested.\r\n * The panel will automatically compute the number of columns based on number of child controls.\r\n */\r\n public get rows(): int {\r\n return this._rows;\r\n }\r\n\r\n public set rows(value: int) {\r\n if (this._rows === value) {\r\n return;\r\n }\r\n\r\n this._rows = value;\r\n this._rowThenColum = false;\r\n\r\n Tools.SetImmediate(() => {\r\n this._arrangeChildren();\r\n });\r\n }\r\n\r\n /**\r\n * Creates new VolumeBasedPanel\r\n * @param name\r\n */\r\n public constructor(name?: string) {\r\n super(name);\r\n }\r\n\r\n protected override _arrangeChildren() {\r\n this._cellWidth = 0;\r\n this._cellHeight = 0;\r\n let rows = 0;\r\n let columns = 0;\r\n let controlCount = 0;\r\n // Measure\r\n for (const child of this._children) {\r\n if (!child.mesh) {\r\n continue;\r\n }\r\n\r\n controlCount++;\r\n child.mesh.computeWorldMatrix(true);\r\n const extendSize = child.mesh.getBoundingInfo().boundingBox.extendSize;\r\n // to be safe, check descendants\r\n const descendants = child.mesh.getDescendants(false);\r\n for (const descendant of descendants) {\r\n descendant.computeWorldMatrix(true);\r\n const casted = descendant as AbstractMesh;\r\n if (typeof casted.getBoundingInfo === \"function\") {\r\n const extendSizeChild = casted.getBoundingInfo().boundingBox.extendSize;\r\n extendSize.x = Math.max(extendSize.x, extendSizeChild.x);\r\n extendSize.y = Math.max(extendSize.y, extendSizeChild.y);\r\n extendSize.z = Math.max(extendSize.z, extendSizeChild.z);\r\n }\r\n }\r\n\r\n this._cellWidth = Math.max(this._cellWidth, extendSize.x * 2);\r\n this._cellHeight = Math.max(this._cellHeight, extendSize.y * 2);\r\n }\r\n\r\n this._cellWidth += this.margin * 2;\r\n this._cellHeight += this.margin * 2;\r\n\r\n // Arrange\r\n if (this._rowThenColum) {\r\n columns = this._columns;\r\n rows = Math.ceil(controlCount / this._columns);\r\n } else {\r\n rows = this._rows;\r\n columns = Math.ceil(controlCount / this._rows);\r\n }\r\n\r\n const startOffsetX = columns * 0.5 * this._cellWidth;\r\n const startOffsetY = rows * 0.5 * this._cellHeight;\r\n const nodeGrid = [];\r\n let cellCounter = 0;\r\n\r\n if (this._rowThenColum) {\r\n for (let r = 0; r < rows; r++) {\r\n for (let c = 0; c < columns; c++) {\r\n nodeGrid.push(new Vector3(c * this._cellWidth - startOffsetX + this._cellWidth / 2, r * this._cellHeight - startOffsetY + this._cellHeight / 2, 0));\r\n cellCounter++;\r\n if (cellCounter > controlCount) {\r\n break;\r\n }\r\n }\r\n }\r\n } else {\r\n for (let c = 0; c < columns; c++) {\r\n for (let r = 0; r < rows; r++) {\r\n nodeGrid.push(new Vector3(c * this._cellWidth - startOffsetX + this._cellWidth / 2, r * this._cellHeight - startOffsetY + this._cellHeight / 2, 0));\r\n cellCounter++;\r\n if (cellCounter > controlCount) {\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n\r\n cellCounter = 0;\r\n for (const child of this._children) {\r\n if (!child.mesh) {\r\n continue;\r\n }\r\n\r\n this._mapGridNode(child, nodeGrid[cellCounter]);\r\n\r\n cellCounter++;\r\n }\r\n\r\n this._finalProcessing();\r\n }\r\n\r\n /** Child classes must implement this function to provide correct control positioning */\r\n protected abstract _mapGridNode(control: Control3D, nodePosition: Vector3): void;\r\n\r\n /** Child classes can implement this function to provide additional processing */\r\n protected _finalProcessing() {}\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"gizmoHandle.js","sourceRoot":"","sources":["../../../../../dev/gui/src/3D/gizmos/gizmoHandle.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,sDAAwC;AAC5D,OAAO,EAAE,aAAa,EAAE,gDAAkC;AAC1D,OAAO,EAAE,OAAO,EAAE,6CAA+B;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAEpE,OAAO,EAAE,sBAAsB,EAAE,mEAAqD;AAItF;;GAEG;AACH,MAAM,CAAN,IAAkB,WAajB;AAbD,WAAkB,WAAW;IACzB;;OAEG;IACH,6CAAQ,CAAA;IACR;;OAEG;IACH,+CAAS,CAAA;IACT;;OAEG;IACH,6CAAQ,CAAA;AACZ,CAAC,EAbiB,WAAW,KAAX,WAAW,QAa5B;AAED;;GAEG;AACH,MAAM,OAAgB,WAAW;IAa7B;;OAEG;IACH,IAAW,KAAK;QACZ,OAAO,IAAI,CAAC,MAAM,CAAC;IACvB,CAAC;IAID;;OAEG;IACH,IAAW,KAAK;QACZ,OAAO,IAAI,CAAC,MAAM,CAAC;IACvB,CAAC;IAED;;OAEG;IACH,IAAW,KAAK,CAAC,KAAc;QAC3B,IAAI,KAAK,EAAE;YACP,IAAI,CAAC,MAAM,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,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QACpE,WAAW,CAAC,QAAQ,GAAG,IAAI,CAAC,eAAe,CAAC,IAAI,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QAClE,WAAW,CAAC,eAAe,GAAG,IAAI,CAAC;QACnC,aAAa,CAAC,eAAe,GAAG,IAAI,CAAC;QAErC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,aAAa,CAAC,QAA0B,CAAC,CAAC;QAC/D,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,WAAW,CAAC,QAA0B,CAAC,CAAC;QAC7D,OAAO,SAAS,CAAC;IACrB,CAAC;CACJ","sourcesContent":["import type { Scene } from \"core/scene\";\r\nimport { CreateBox } from \"core/Meshes/Builders/boxBuilder\";\r\nimport { TransformNode } from \"core/Meshes/transformNode\";\r\nimport { Vector3 } from \"core/Maths/math.vector\";\r\nimport { HandleMaterial } from \"../materials/handle/handleMaterial\";\r\nimport type { SlateGizmo } from \"./slateGizmo\";\r\nimport { BaseSixDofDragBehavior } from \"core/Behaviors/Meshes/baseSixDofDragBehavior\";\r\nimport type { Nullable } from \"core/types\";\r\nimport type { Observer } from \"core/Misc/observable\";\r\n\r\n/**\r\n * State of the handle regarding user interaction\r\n */\r\nexport const enum HandleState {\r\n /**\r\n * Handle is idle\r\n */\r\n IDLE = 0,\r\n /**\r\n * Handle is hovered\r\n */\r\n HOVER = 1,\r\n /**\r\n * Handle is dragged\r\n */\r\n DRAG = 2,\r\n}\r\n\r\n/**\r\n * Base class for SlateGizmo handles\r\n */\r\nexport abstract class GizmoHandle {\r\n protected _scene: Scene;\r\n protected _state: HandleState = HandleState.IDLE;\r\n protected _materials: HandleMaterial[] = [];\r\n\r\n private _dragStartObserver: Nullable<Observer<any>>;\r\n private _draggingObserver: Nullable<Observer<any>>;\r\n private _dragEndObserver: Nullable<Observer<any>>;\r\n /**\r\n * @internal\r\n */\r\n public _dragBehavior: BaseSixDofDragBehavior;\r\n\r\n /**\r\n * The current state of the handle\r\n */\r\n public get state(): HandleState {\r\n return this._state;\r\n }\r\n\r\n private _gizmo: SlateGizmo;\r\n\r\n /**\r\n * Returns the gizmo carrying this handle\r\n */\r\n public get gizmo() {\r\n return this._gizmo;\r\n }\r\n\r\n /**\r\n * Sets hover state\r\n */\r\n public set hover(value: boolean) {\r\n if (value) {\r\n this._state |= HandleState.HOVER;\r\n } else {\r\n this._state &= ~HandleState.HOVER;\r\n }\r\n\r\n this._updateMaterial();\r\n }\r\n /**\r\n * Sets drag state\r\n */\r\n public set drag(value: boolean) {\r\n if (value) {\r\n this._state |= HandleState.DRAG;\r\n } else {\r\n this._state &= ~HandleState.DRAG;\r\n }\r\n\r\n this._updateMaterial();\r\n }\r\n\r\n /**\r\n * Node of this handle\r\n */\r\n public node: TransformNode;\r\n\r\n /**\r\n * Creates a handle for a SlateGizmo\r\n * @param gizmo associated SlateGizmo\r\n * @param scene scene\r\n */\r\n constructor(gizmo: SlateGizmo, scene: Scene) {\r\n this._scene = scene;\r\n this._gizmo = gizmo;\r\n\r\n this.node = this.createNode();\r\n this.node.reservedDataStore = {\r\n handle: this,\r\n };\r\n }\r\n\r\n protected _createMaterial(positionOffset?: Vector3) {\r\n const mat = new HandleMaterial(\"handle\", this._scene);\r\n if (positionOffset) {\r\n mat._positionOffset = positionOffset;\r\n }\r\n return mat;\r\n }\r\n\r\n private _updateMaterial() {\r\n const state = this._state;\r\n for (const mat of this._materials) {\r\n mat.hover = false;\r\n mat.drag = false;\r\n }\r\n\r\n if (state & HandleState.DRAG) {\r\n for (const mat of this._materials) {\r\n mat.drag = true;\r\n }\r\n } else if (state & HandleState.HOVER) {\r\n for (const mat of this._materials) {\r\n mat.hover = true;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Binds callbacks from dragging interaction\r\n * @param dragStartFn Function to call on drag start\r\n * @param dragFn Function to call on drag\r\n * @param dragEndFn Function to call on drag end\r\n */\r\n public setDragBehavior(dragStartFn: (event: { position: Vector3 }) => void, dragFn: (event: { position: Vector3 }) => void, dragEndFn: () => void) {\r\n const dragBehavior = new BaseSixDofDragBehavior();\r\n\r\n this._dragBehavior = dragBehavior;\r\n\r\n this._dragStartObserver = dragBehavior.onDragStartObservable.add(dragStartFn);\r\n this._draggingObserver = dragBehavior.onDragObservable.add(dragFn);\r\n this._dragEndObserver = dragBehavior.onDragEndObservable.add(dragEndFn);\r\n\r\n this._dragBehavior.attach(this.node);\r\n }\r\n\r\n /**\r\n * Creates the meshes and parent node of the handle\r\n * Should be overridden by child classes\r\n * @returns created node\r\n */\r\n public abstract createNode(): TransformNode;\r\n\r\n /**\r\n * Disposes the handle\r\n */\r\n public dispose() {\r\n this._dragBehavior.onDragStartObservable.remove(this._dragStartObserver);\r\n this._dragBehavior.onDragObservable.remove(this._draggingObserver);\r\n this._dragBehavior.onDragEndObservable.remove(this._dragEndObserver);\r\n\r\n this._dragBehavior.detach();\r\n\r\n for (const material of this._materials) {\r\n material.dispose();\r\n }\r\n this.node.dispose();\r\n }\r\n}\r\n\r\n/**\r\n * Side handle class that rotates the slate\r\n */\r\nexport class SideHandle extends GizmoHandle {\r\n /**\r\n * Creates the meshes and parent node of the handle\r\n * @returns created node\r\n */\r\n public createNode() {\r\n // Create a simple vertical rectangle\r\n const verticalBox = CreateBox(\"sideVert\", { width: 1, height: 10, depth: 0.1 }, this._scene);\r\n const sideNode = new TransformNode(\"side\", this._scene);\r\n verticalBox.parent = sideNode;\r\n\r\n const mat = this._createMaterial();\r\n verticalBox.material = mat;\r\n verticalBox.isNearGrabbable = true;\r\n this._materials.push(mat);\r\n\r\n return sideNode;\r\n }\r\n}\r\n\r\n/**\r\n * Corner handle that resizes the slate\r\n */\r\nexport class CornerHandle extends GizmoHandle {\r\n /**\r\n * Creates the meshes and parent node of the handle\r\n * @returns created node\r\n */\r\n public createNode() {\r\n // Create 2 boxes making a bottom left corner\r\n const horizontalBox = CreateBox(\"angleHor\", { width: 3, height: 1, depth: 0.1 }, this._scene);\r\n const verticalBox = CreateBox(\"angleVert\", { width: 1, height: 3, depth: 0.1 }, this._scene);\r\n\r\n const angleNode = new TransformNode(\"angle\", this._scene);\r\n horizontalBox.parent = angleNode;\r\n verticalBox.parent = angleNode;\r\n\r\n horizontalBox.material = this._createMaterial(new Vector3(1, 0, 0));\r\n verticalBox.material = this._createMaterial(new Vector3(0, 1, 0));\r\n verticalBox.isNearGrabbable = true;\r\n horizontalBox.isNearGrabbable = true;\r\n\r\n this._materials.push(horizontalBox.material as HandleMaterial);\r\n this._materials.push(verticalBox.material as HandleMaterial);\r\n return angleNode;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"gizmoHandle.js","sourceRoot":"","sources":["../../../../../dev/gui/src/3D/gizmos/gizmoHandle.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,sDAAwC;AAC5D,OAAO,EAAE,aAAa,EAAE,gDAAkC;AAC1D,OAAO,EAAE,OAAO,EAAE,6CAA+B;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAEpE,OAAO,EAAE,sBAAsB,EAAE,mEAAqD;AAItF;;GAEG;AACH,MAAM,CAAN,IAAkB,WAajB;AAbD,WAAkB,WAAW;IACzB;;OAEG;IACH,6CAAQ,CAAA;IACR;;OAEG;IACH,+CAAS,CAAA;IACT;;OAEG;IACH,6CAAQ,CAAA;AACZ,CAAC,EAbiB,WAAW,KAAX,WAAW,QAa5B;AAED;;GAEG;AACH,MAAM,OAAgB,WAAW;IAa7B;;OAEG;IACH,IAAW,KAAK;QACZ,OAAO,IAAI,CAAC,MAAM,CAAC;IACvB,CAAC;IAID;;OAEG;IACH,IAAW,KAAK;QACZ,OAAO,IAAI,CAAC,MAAM,CAAC;IACvB,CAAC;IAED;;OAEG;IACH,IAAW,KAAK,CAAC,KAAc;QAC3B,IAAI,KAAK,EAAE,CAAC;YACR,IAAI,CAAC,MAAM,6BAAqB,CAAC;QACrC,CAAC;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AAM,GAAG,SAAS,CAAC;QAE/B,aAAa,CAAC,QAAQ,GAAG,IAAI,CAAC,eAAe,CAAC,IAAI,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QACpE,WAAW,CAAC,QAAQ,GAAG,IAAI,CAAC,eAAe,CAAC,IAAI,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QAClE,WAAW,CAAC,eAAe,GAAG,IAAI,CAAC;QACnC,aAAa,CAAC,eAAe,GAAG,IAAI,CAAC;QAErC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,aAAa,CAAC,QAA0B,CAAC,CAAC;QAC/D,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,WAAW,CAAC,QAA0B,CAAC,CAAC;QAC7D,OAAO,SAAS,CAAC;IACrB,CAAC;CACJ","sourcesContent":["import type { Scene } from \"core/scene\";\r\nimport { CreateBox } from \"core/Meshes/Builders/boxBuilder\";\r\nimport { TransformNode } from \"core/Meshes/transformNode\";\r\nimport { Vector3 } from \"core/Maths/math.vector\";\r\nimport { HandleMaterial } from \"../materials/handle/handleMaterial\";\r\nimport type { SlateGizmo } from \"./slateGizmo\";\r\nimport { BaseSixDofDragBehavior } from \"core/Behaviors/Meshes/baseSixDofDragBehavior\";\r\nimport type { Nullable } from \"core/types\";\r\nimport type { Observer } from \"core/Misc/observable\";\r\n\r\n/**\r\n * State of the handle regarding user interaction\r\n */\r\nexport const enum HandleState {\r\n /**\r\n * Handle is idle\r\n */\r\n IDLE = 0,\r\n /**\r\n * Handle is hovered\r\n */\r\n HOVER = 1,\r\n /**\r\n * Handle is dragged\r\n */\r\n DRAG = 2,\r\n}\r\n\r\n/**\r\n * Base class for SlateGizmo handles\r\n */\r\nexport abstract class GizmoHandle {\r\n protected _scene: Scene;\r\n protected _state: HandleState = HandleState.IDLE;\r\n protected _materials: HandleMaterial[] = [];\r\n\r\n private _dragStartObserver: Nullable<Observer<any>>;\r\n private _draggingObserver: Nullable<Observer<any>>;\r\n private _dragEndObserver: Nullable<Observer<any>>;\r\n /**\r\n * @internal\r\n */\r\n public _dragBehavior: BaseSixDofDragBehavior;\r\n\r\n /**\r\n * The current state of the handle\r\n */\r\n public get state(): HandleState {\r\n return this._state;\r\n }\r\n\r\n private _gizmo: SlateGizmo;\r\n\r\n /**\r\n * Returns the gizmo carrying this handle\r\n */\r\n public get gizmo() {\r\n return this._gizmo;\r\n }\r\n\r\n /**\r\n * Sets hover state\r\n */\r\n public set hover(value: boolean) {\r\n if (value) {\r\n this._state |= HandleState.HOVER;\r\n } else {\r\n this._state &= ~HandleState.HOVER;\r\n }\r\n\r\n this._updateMaterial();\r\n }\r\n /**\r\n * Sets drag state\r\n */\r\n public set drag(value: boolean) {\r\n if (value) {\r\n this._state |= HandleState.DRAG;\r\n } else {\r\n this._state &= ~HandleState.DRAG;\r\n }\r\n\r\n this._updateMaterial();\r\n }\r\n\r\n /**\r\n * Node of this handle\r\n */\r\n public node: TransformNode;\r\n\r\n /**\r\n * Creates a handle for a SlateGizmo\r\n * @param gizmo associated SlateGizmo\r\n * @param scene scene\r\n */\r\n constructor(gizmo: SlateGizmo, scene: Scene) {\r\n this._scene = scene;\r\n this._gizmo = gizmo;\r\n\r\n this.node = this.createNode();\r\n this.node.reservedDataStore = {\r\n handle: this,\r\n };\r\n }\r\n\r\n protected _createMaterial(positionOffset?: Vector3) {\r\n const mat = new HandleMaterial(\"handle\", this._scene);\r\n if (positionOffset) {\r\n mat._positionOffset = positionOffset;\r\n }\r\n return mat;\r\n }\r\n\r\n private _updateMaterial() {\r\n const state = this._state;\r\n for (const mat of this._materials) {\r\n mat.hover = false;\r\n mat.drag = false;\r\n }\r\n\r\n if (state & HandleState.DRAG) {\r\n for (const mat of this._materials) {\r\n mat.drag = true;\r\n }\r\n } else if (state & HandleState.HOVER) {\r\n for (const mat of this._materials) {\r\n mat.hover = true;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Binds callbacks from dragging interaction\r\n * @param dragStartFn Function to call on drag start\r\n * @param dragFn Function to call on drag\r\n * @param dragEndFn Function to call on drag end\r\n */\r\n public setDragBehavior(dragStartFn: (event: { position: Vector3 }) => void, dragFn: (event: { position: Vector3 }) => void, dragEndFn: () => void) {\r\n const dragBehavior = new BaseSixDofDragBehavior();\r\n\r\n this._dragBehavior = dragBehavior;\r\n\r\n this._dragStartObserver = dragBehavior.onDragStartObservable.add(dragStartFn);\r\n this._draggingObserver = dragBehavior.onDragObservable.add(dragFn);\r\n this._dragEndObserver = dragBehavior.onDragEndObservable.add(dragEndFn);\r\n\r\n this._dragBehavior.attach(this.node);\r\n }\r\n\r\n /**\r\n * Creates the meshes and parent node of the handle\r\n * Should be overridden by child classes\r\n * @returns created node\r\n */\r\n public abstract createNode(): TransformNode;\r\n\r\n /**\r\n * Disposes the handle\r\n */\r\n public dispose() {\r\n this._dragBehavior.onDragStartObservable.remove(this._dragStartObserver);\r\n this._dragBehavior.onDragObservable.remove(this._draggingObserver);\r\n this._dragBehavior.onDragEndObservable.remove(this._dragEndObserver);\r\n\r\n this._dragBehavior.detach();\r\n\r\n for (const material of this._materials) {\r\n material.dispose();\r\n }\r\n this.node.dispose();\r\n }\r\n}\r\n\r\n/**\r\n * Side handle class that rotates the slate\r\n */\r\nexport class SideHandle extends GizmoHandle {\r\n /**\r\n * Creates the meshes and parent node of the handle\r\n * @returns created node\r\n */\r\n public createNode() {\r\n // Create a simple vertical rectangle\r\n const verticalBox = CreateBox(\"sideVert\", { width: 1, height: 10, depth: 0.1 }, this._scene);\r\n const sideNode = new TransformNode(\"side\", this._scene);\r\n verticalBox.parent = sideNode;\r\n\r\n const mat = this._createMaterial();\r\n verticalBox.material = mat;\r\n verticalBox.isNearGrabbable = true;\r\n this._materials.push(mat);\r\n\r\n return sideNode;\r\n }\r\n}\r\n\r\n/**\r\n * Corner handle that resizes the slate\r\n */\r\nexport class CornerHandle extends GizmoHandle {\r\n /**\r\n * Creates the meshes and parent node of the handle\r\n * @returns created node\r\n */\r\n public createNode() {\r\n // Create 2 boxes making a bottom left corner\r\n const horizontalBox = CreateBox(\"angleHor\", { width: 3, height: 1, depth: 0.1 }, this._scene);\r\n const verticalBox = CreateBox(\"angleVert\", { width: 1, height: 3, depth: 0.1 }, this._scene);\r\n\r\n const angleNode = new TransformNode(\"angle\", this._scene);\r\n horizontalBox.parent = angleNode;\r\n verticalBox.parent = angleNode;\r\n\r\n horizontalBox.material = this._createMaterial(new Vector3(1, 0, 0));\r\n verticalBox.material = this._createMaterial(new Vector3(0, 1, 0));\r\n verticalBox.isNearGrabbable = true;\r\n horizontalBox.isNearGrabbable = true;\r\n\r\n this._materials.push(horizontalBox.material as HandleMaterial);\r\n this._materials.push(verticalBox.material as HandleMaterial);\r\n return angleNode;\r\n }\r\n}\r\n"]}