@babylonjs/gui 7.3.1 → 7.3.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. package/2D/advancedDynamicTexture.js.map +1 -1
  2. package/2D/controls/button.js.map +1 -1
  3. package/2D/controls/checkbox.js.map +1 -1
  4. package/2D/controls/colorpicker.js.map +1 -1
  5. package/2D/controls/container.d.ts +2 -1
  6. package/2D/controls/container.js +4 -3
  7. package/2D/controls/container.js.map +1 -1
  8. package/2D/controls/control.d.ts +2 -1
  9. package/2D/controls/control.js +5 -2
  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/LinearGradient.js.map +1 -1
  15. package/2D/controls/gradient/RadialGradient.js.map +1 -1
  16. package/2D/controls/grid.js.map +1 -1
  17. package/2D/controls/image.js.map +1 -1
  18. package/2D/controls/inputPassword.js.map +1 -1
  19. package/2D/controls/inputText.js.map +1 -1
  20. package/2D/controls/inputTextArea.js.map +1 -1
  21. package/2D/controls/line.js.map +1 -1
  22. package/2D/controls/multiLine.js.map +1 -1
  23. package/2D/controls/radioButton.js.map +1 -1
  24. package/2D/controls/rectangle.js.map +1 -1
  25. package/2D/controls/scrollViewers/scrollViewer.js.map +1 -1
  26. package/2D/controls/scrollViewers/scrollViewerWindow.js.map +1 -1
  27. package/2D/controls/selector.js.map +1 -1
  28. package/2D/controls/sliders/baseSlider.js.map +1 -1
  29. package/2D/controls/sliders/imageBasedSlider.js.map +1 -1
  30. package/2D/controls/sliders/imageScrollBar.js.map +1 -1
  31. package/2D/controls/sliders/scrollBar.js.map +1 -1
  32. package/2D/controls/sliders/slider.js.map +1 -1
  33. package/2D/controls/stackPanel.js.map +1 -1
  34. package/2D/controls/textBlock.js.map +1 -1
  35. package/2D/controls/toggleButton.js.map +1 -1
  36. package/2D/controls/virtualKeyboard.js.map +1 -1
  37. package/3D/controls/MRTK3/touchHolographicButton.js.map +1 -1
  38. package/3D/controls/abstractButton3D.js.map +1 -1
  39. package/3D/controls/button3D.js.map +1 -1
  40. package/3D/controls/container3D.js.map +1 -1
  41. package/3D/controls/handMenu.js.map +1 -1
  42. package/3D/controls/holographicBackplate.js.map +1 -1
  43. package/3D/controls/holographicButton.js.map +1 -1
  44. package/3D/controls/holographicSlate.js.map +1 -1
  45. package/3D/controls/meshButton3D.js.map +1 -1
  46. package/3D/controls/nearMenu.js.map +1 -1
  47. package/3D/controls/scatterPanel.js.map +1 -1
  48. package/3D/controls/slider3D.js.map +1 -1
  49. package/3D/controls/stackPanel3D.js.map +1 -1
  50. package/3D/controls/touchButton3D.js.map +1 -1
  51. package/3D/controls/touchHolographicButton.js.map +1 -1
  52. package/3D/controls/touchHolographicMenu.js.map +1 -1
  53. package/3D/controls/touchMeshButton3D.js.map +1 -1
  54. package/3D/controls/volumeBasedPanel.js.map +1 -1
  55. package/3D/gizmos/slateGizmo.js.map +1 -1
  56. package/3D/materials/fluent/fluentMaterial.js.map +1 -1
  57. package/3D/materials/fluentBackplate/fluentBackplateMaterial.js.map +1 -1
  58. package/3D/materials/fluentButton/fluentButtonMaterial.js.map +1 -1
  59. package/3D/materials/handle/handleMaterial.js.map +1 -1
  60. package/3D/materials/mrdl/mrdlBackglowMaterial.js.map +1 -1
  61. package/3D/materials/mrdl/mrdlBackplateMaterial.js.map +1 -1
  62. package/3D/materials/mrdl/mrdlFrontplateMaterial.js.map +1 -1
  63. package/3D/materials/mrdl/mrdlInnerquadMaterial.js.map +1 -1
  64. package/3D/materials/mrdl/mrdlSliderBarMaterial.js.map +1 -1
  65. package/3D/materials/mrdl/mrdlSliderThumbMaterial.js.map +1 -1
  66. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"holographicSlate.js","sourceRoot":"","sources":["../../../../../dev/gui/src/3D/controls/holographicSlate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,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IAED;;OAEG;IACI,OAAO;QACV,KAAK,CAAC,OAAO,EAAE,CAAC;QAChB,IAAI,CAAC,iBAAiB,CAAC,OAAO,EAAE,CAAC;QACjC,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,CAAC;QAEhC,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC;QACzB,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,CAAC;QAC9B,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE,CAAC;QAC7B,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC;QAE1B,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE,CAAC;QAC7B,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,CAAC;QAE5B,IAAI,CAAC,KAAK,CAAC,8BAA8B,CAAC,MAAM,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;QAC5E,IAAI,CAAC,gBAAgB,CAAC,kBAAkB,CAAC,2BAA2B,CAAC,MAAM,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC;QAE3G,IAAI,CAAC,gBAAgB,CAAC,MAAM,EAAE,CAAC;QAC/B,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACtB,IAAI,CAAC,oBAAoB,CAAC,MAAM,EAAE,CAAC;IACvC,CAAC;;AAldD;;GAEG;AACW,gCAAe,GAAW,2CAA2C,AAAtD,CAAuD;AACpF;;GAEG;AACW,oCAAmB,GAAW,eAAe,AAA1B,CAA2B;AAC5D;;GAEG;AACW,qCAAoB,GAAW,kBAAkB,AAA7B,CAA8B;AAEjD,2CAA0B,GAAG,KAAK,AAAR,CAAS","sourcesContent":["import { ContentDisplay3D } from \"./contentDisplay3D\";\r\nimport type { Control3D } from \"./control3D\";\r\nimport { TouchHolographicButton } from \"./touchHolographicButton\";\r\nimport { AdvancedDynamicTexture } from \"../../2D/advancedDynamicTexture\";\r\nimport { Control } from \"../../2D/controls/control\";\r\nimport { TextBlock, TextWrapping } from \"../../2D/controls/textBlock\";\r\nimport { DefaultBehavior } from \"../behaviors/defaultBehavior\";\r\nimport { SlateGizmo } from \"../gizmos/slateGizmo\";\r\nimport { FluentMaterial } from \"../materials/fluent/fluentMaterial\";\r\nimport { FluentBackplateMaterial } from \"../materials/fluentBackplate/fluentBackplateMaterial\";\r\nimport { PointerDragBehavior } from \"core/Behaviors/Meshes/pointerDragBehavior\";\r\nimport type { Texture } from \"core/Materials/Textures/texture\";\r\nimport { Vector4 } from \"core/Maths/math\";\r\nimport { Epsilon } from \"core/Maths/math.constants\";\r\nimport { Scalar } from \"core/Maths/math.scalar\";\r\nimport type { Matrix } from \"core/Maths/math.vector\";\r\nimport { Quaternion, Vector2, Vector3 } from \"core/Maths/math.vector\";\r\nimport { Viewport } from \"core/Maths/math.viewport\";\r\nimport type { AbstractMesh } from \"core/Meshes/abstractMesh\";\r\nimport { CreateBox } from \"core/Meshes/Builders/boxBuilder\";\r\nimport { CreatePlane } from \"core/Meshes/Builders/planeBuilder\";\r\nimport type { TransformNode } from \"core/Meshes/transformNode\";\r\nimport { Mesh } from \"core/Meshes/mesh\";\r\nimport { VertexData } from \"core/Meshes/mesh.vertexData\";\r\nimport type { Observer } from \"core/Misc/observable\";\r\nimport type { Scene } from \"core/scene\";\r\nimport type { Nullable } from \"core/types\";\r\n\r\n/**\r\n * Class used to create a holographic slate\r\n * @since 5.0.0\r\n */\r\nexport class HolographicSlate extends ContentDisplay3D {\r\n /**\r\n * Base Url for the assets.\r\n */\r\n public static ASSETS_BASE_URL: string = \"https://assets.babylonjs.com/meshes/MRTK/\";\r\n /**\r\n * File name for the close icon.\r\n */\r\n public static CLOSE_ICON_FILENAME: string = \"IconClose.png\";\r\n /**\r\n * File name for the close icon.\r\n */\r\n public static FOLLOW_ICON_FILENAME: string = \"IconFollowMe.png\";\r\n\r\n private static _DEFAULT_TEXT_RESOLUTION_Y = 102.4;\r\n\r\n /**\r\n * Margin between title bar and contentplate\r\n */\r\n public titleBarMargin = 0.005;\r\n\r\n /**\r\n * Origin in local coordinates (top left corner)\r\n */\r\n public origin = new Vector3(0, 0, 0);\r\n\r\n private _dimensions = new Vector2(21.875, 12.5);\r\n private _titleBarHeight = 0.625;\r\n\r\n private _titleBarMaterial: FluentBackplateMaterial;\r\n private _backMaterial: FluentBackplateMaterial;\r\n private _contentMaterial: FluentMaterial;\r\n private _pickedPointObserver: Nullable<Observer<Nullable<Vector3>>>;\r\n private _positionChangedObserver: Nullable<Observer<{ position: Vector3 }>>;\r\n\r\n private _titleText = \"\";\r\n private _titleTextComponent: TextBlock;\r\n\r\n private _contentViewport: Viewport;\r\n private _contentDragBehavior: PointerDragBehavior;\r\n\r\n private _defaultBehavior: DefaultBehavior;\r\n /**\r\n * Regroups all mesh behaviors for the slate\r\n */\r\n public get defaultBehavior(): DefaultBehavior {\r\n return this._defaultBehavior;\r\n }\r\n\r\n /** @internal */\r\n public _gizmo: SlateGizmo;\r\n\r\n protected _titleBar: Mesh;\r\n protected _titleBarTitle: Mesh;\r\n protected _contentPlate: Mesh;\r\n protected _backPlate: Mesh;\r\n /** @internal */\r\n public _followButton: TouchHolographicButton;\r\n protected _closeButton: TouchHolographicButton;\r\n protected _contentScaleRatio = 1;\r\n\r\n /**\r\n * 2D dimensions of the slate\r\n */\r\n public get dimensions() {\r\n return this._dimensions;\r\n }\r\n public set dimensions(value) {\r\n //clamp, respecting ratios\r\n let scale = 1.0;\r\n if (value.x < this.minDimensions.x || value.y < this.minDimensions.y) {\r\n const newRatio = value.x / value.y;\r\n const minRatio = this.minDimensions.x / this.minDimensions.y;\r\n if (minRatio > newRatio) {\r\n // We just need to make sure the x-val is greater than the min\r\n scale = this.minDimensions.x / value.x;\r\n } else {\r\n // We just need to make sure the y-val is greater than the min\r\n scale = this.minDimensions.y / value.y;\r\n }\r\n }\r\n\r\n this._dimensions.copyFrom(value).scaleInPlace(scale);\r\n this._updatePivot();\r\n this._positionElements();\r\n }\r\n\r\n /**\r\n * Minimum dimensions of the slate\r\n */\r\n public minDimensions = new Vector2(15.625, 6.25);\r\n\r\n /**\r\n * Default dimensions of the slate\r\n */\r\n public readonly defaultDimensions = this._dimensions.clone();\r\n\r\n /**\r\n * Height of the title bar component\r\n */\r\n public get titleBarHeight() {\r\n return this._titleBarHeight;\r\n }\r\n public set titleBarHeight(value) {\r\n this._titleBarHeight = value;\r\n }\r\n\r\n /**\r\n * Rendering ground id of all the meshes\r\n */\r\n public set renderingGroupId(id: number) {\r\n this._titleBar.renderingGroupId = id;\r\n this._titleBarTitle.renderingGroupId = id;\r\n this._contentPlate.renderingGroupId = id;\r\n this._backPlate.renderingGroupId = id;\r\n }\r\n public get renderingGroupId(): number {\r\n return this._titleBar.renderingGroupId;\r\n }\r\n\r\n /**\r\n * The title text displayed at the top of the slate\r\n */\r\n public set title(title: string) {\r\n this._titleText = title;\r\n if (this._titleTextComponent) {\r\n this._titleTextComponent.text = title;\r\n }\r\n }\r\n public get title() {\r\n return this._titleText;\r\n }\r\n\r\n /**\r\n * Creates a new slate\r\n * @param name defines the control name\r\n */\r\n constructor(name?: string) {\r\n super(name);\r\n\r\n this._followButton = new TouchHolographicButton(\"followButton\" + this.name);\r\n this._followButton.isToggleButton = true;\r\n this._closeButton = new TouchHolographicButton(\"closeButton\" + this.name);\r\n\r\n this._contentViewport = new Viewport(0, 0, 1, 1);\r\n this._contentDragBehavior = new PointerDragBehavior({\r\n dragPlaneNormal: new Vector3(0, 0, -1),\r\n });\r\n }\r\n\r\n /**\r\n * Apply the facade texture (created from the content property).\r\n * This function can be overloaded by child classes\r\n * @param facadeTexture defines the AdvancedDynamicTexture to use\r\n */\r\n protected _applyFacade(facadeTexture: AdvancedDynamicTexture) {\r\n this._contentMaterial.albedoTexture = facadeTexture;\r\n this._resetContentPositionAndZoom();\r\n this._applyContentViewport();\r\n\r\n facadeTexture.attachToMesh(this._contentPlate, true);\r\n }\r\n\r\n private _addControl(control: Control3D): void {\r\n control._host = this._host;\r\n if (this._host.utilityLayer) {\r\n control._prepareNode(this._host.utilityLayer.utilityLayerScene);\r\n }\r\n }\r\n\r\n protected _getTypeName(): string {\r\n return \"HolographicSlate\";\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _positionElements() {\r\n const followButton = this._followButton;\r\n const closeButton = this._closeButton;\r\n const titleBar = this._titleBar;\r\n const titleBarTitle = this._titleBarTitle;\r\n const contentPlate = this._contentPlate;\r\n const backPlate = this._backPlate;\r\n\r\n if (followButton && closeButton && titleBar) {\r\n closeButton.scaling.setAll(this.titleBarHeight);\r\n followButton.scaling.setAll(this.titleBarHeight);\r\n closeButton.position.copyFromFloats(this.dimensions.x - this.titleBarHeight / 2, -this.titleBarHeight / 2, 0).addInPlace(this.origin);\r\n followButton.position.copyFromFloats(this.dimensions.x - (3 * this.titleBarHeight) / 2, -this.titleBarHeight / 2, 0).addInPlace(this.origin);\r\n\r\n const contentPlateHeight = this.dimensions.y - this.titleBarHeight - this.titleBarMargin;\r\n const rightHandScene = contentPlate.getScene().useRightHandedSystem;\r\n\r\n titleBar.scaling.set(this.dimensions.x, this.titleBarHeight, Epsilon);\r\n titleBarTitle.scaling.set(this.dimensions.x - 2 * this.titleBarHeight, this.titleBarHeight, Epsilon);\r\n contentPlate.scaling.copyFromFloats(this.dimensions.x, contentPlateHeight, Epsilon);\r\n backPlate.scaling.copyFromFloats(this.dimensions.x, contentPlateHeight, Epsilon);\r\n\r\n titleBar.position.copyFromFloats(this.dimensions.x / 2, -(this.titleBarHeight / 2), 0).addInPlace(this.origin);\r\n titleBarTitle.position\r\n .copyFromFloats(this.dimensions.x / 2 - this.titleBarHeight, -(this.titleBarHeight / 2), rightHandScene ? Epsilon : -Epsilon)\r\n .addInPlace(this.origin);\r\n contentPlate.position.copyFromFloats(this.dimensions.x / 2, -(this.titleBarHeight + this.titleBarMargin + contentPlateHeight / 2), 0).addInPlace(this.origin);\r\n backPlate.position\r\n .copyFromFloats(this.dimensions.x / 2, -(this.titleBarHeight + this.titleBarMargin + contentPlateHeight / 2), rightHandScene ? -Epsilon : Epsilon)\r\n .addInPlace(this.origin);\r\n\r\n // Update the title's AdvancedDynamicTexture scale to avoid visual stretching\r\n this._titleTextComponent.host.scaleTo(\r\n (HolographicSlate._DEFAULT_TEXT_RESOLUTION_Y * titleBarTitle.scaling.x) / titleBarTitle.scaling.y,\r\n HolographicSlate._DEFAULT_TEXT_RESOLUTION_Y\r\n );\r\n\r\n const aspectRatio = this.dimensions.x / contentPlateHeight;\r\n this._contentViewport.width = this._contentScaleRatio;\r\n this._contentViewport.height = this._contentScaleRatio / aspectRatio;\r\n\r\n this._applyContentViewport();\r\n if (this._gizmo) {\r\n this._gizmo.updateBoundingBox();\r\n }\r\n }\r\n }\r\n\r\n private _applyContentViewport() {\r\n if (this._contentPlate?.material && (this._contentPlate.material as FluentMaterial).albedoTexture) {\r\n const tex = (this._contentPlate.material as FluentMaterial).albedoTexture as Texture;\r\n tex.uScale = this._contentScaleRatio;\r\n tex.vScale = (this._contentScaleRatio / this._contentViewport.width) * this._contentViewport.height;\r\n tex.uOffset = this._contentViewport.x;\r\n tex.vOffset = this._contentViewport.y;\r\n }\r\n }\r\n\r\n private _resetContentPositionAndZoom() {\r\n this._contentViewport.x = 0;\r\n this._contentViewport.y = 1 - this._contentViewport.height / this._contentViewport.width;\r\n this._contentScaleRatio = 1;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _updatePivot() {\r\n if (!this.mesh) {\r\n return;\r\n }\r\n\r\n // Update pivot point so it is at the center of geometry\r\n // As origin is topleft corner in 2D, dimensions are calculated towards bottom right corner, thus y axis is downwards\r\n const center = new Vector3(this.dimensions.x * 0.5, -this.dimensions.y * 0.5, Epsilon);\r\n center.addInPlace(this.origin);\r\n center.z = 0;\r\n\r\n const origin = new Vector3(0, 0, 0);\r\n Vector3.TransformCoordinatesToRef(origin, this.mesh.computeWorldMatrix(true), origin);\r\n this.mesh.setPivotPoint(center);\r\n const origin2 = new Vector3(0, 0, 0);\r\n Vector3.TransformCoordinatesToRef(origin2, this.mesh.computeWorldMatrix(true), origin2);\r\n this.mesh.position.addInPlace(origin).subtractInPlace(origin2);\r\n }\r\n\r\n // Mesh association\r\n protected _createNode(scene: Scene): TransformNode {\r\n const node = new Mesh(\"slate_\" + this.name, scene);\r\n\r\n this._titleBar = CreateBox(\"titleBar_\" + this.name, { size: 1 }, scene);\r\n this._titleBarTitle = CreatePlane(\"titleText_\" + this.name, { size: 1 }, scene);\r\n this._titleBarTitle.parent = node;\r\n this._titleBarTitle.isPickable = false;\r\n\r\n const adt = AdvancedDynamicTexture.CreateForMesh(this._titleBarTitle);\r\n this._titleTextComponent = new TextBlock(\"titleText_\" + this.name, this._titleText);\r\n this._titleTextComponent.textWrapping = TextWrapping.Ellipsis;\r\n this._titleTextComponent.textHorizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;\r\n this._titleTextComponent.color = \"white\";\r\n this._titleTextComponent.fontSize = HolographicSlate._DEFAULT_TEXT_RESOLUTION_Y / 2;\r\n this._titleTextComponent.paddingLeft = HolographicSlate._DEFAULT_TEXT_RESOLUTION_Y / 4;\r\n adt.addControl(this._titleTextComponent);\r\n\r\n if (scene.useRightHandedSystem) {\r\n const faceUV = new Vector4(0, 0, 1, 1);\r\n this._contentPlate = CreatePlane(\"contentPlate_\" + this.name, { size: 1, sideOrientation: VertexData.BACKSIDE, frontUVs: faceUV }, scene);\r\n this._backPlate = CreatePlane(\"backPlate_\" + this.name, { size: 1, sideOrientation: VertexData.FRONTSIDE }, scene);\r\n } else {\r\n const faceUV = new Vector4(0, 0, 1, 1);\r\n this._contentPlate = CreatePlane(\"contentPlate_\" + this.name, { size: 1, sideOrientation: VertexData.FRONTSIDE, frontUVs: faceUV }, scene);\r\n this._backPlate = CreatePlane(\"backPlate_\" + this.name, { size: 1, sideOrientation: VertexData.BACKSIDE }, scene);\r\n }\r\n\r\n this._titleBar.parent = node;\r\n this._titleBar.isNearGrabbable = true;\r\n this._contentPlate.parent = node;\r\n this._backPlate.parent = node;\r\n this._attachContentPlateBehavior();\r\n\r\n this._addControl(this._followButton);\r\n this._addControl(this._closeButton);\r\n\r\n const followButton = this._followButton;\r\n const closeButton = this._closeButton;\r\n\r\n followButton.node!.parent = node;\r\n closeButton.node!.parent = node;\r\n\r\n this._positionElements();\r\n\r\n this._followButton.imageUrl = HolographicSlate.ASSETS_BASE_URL + HolographicSlate.FOLLOW_ICON_FILENAME;\r\n this._closeButton.imageUrl = HolographicSlate.ASSETS_BASE_URL + HolographicSlate.CLOSE_ICON_FILENAME;\r\n\r\n this._followButton.isBackplateVisible = false;\r\n this._closeButton.isBackplateVisible = false;\r\n\r\n this._followButton.onToggleObservable.add((isToggled) => {\r\n this._defaultBehavior.followBehaviorEnabled = isToggled;\r\n if (this._defaultBehavior.followBehaviorEnabled) {\r\n this._defaultBehavior.followBehavior.recenter();\r\n }\r\n });\r\n\r\n this._closeButton.onPointerClickObservable.add(() => {\r\n this.dispose();\r\n });\r\n\r\n node.rotationQuaternion = Quaternion.Identity();\r\n node.isVisible = false;\r\n\r\n return node;\r\n }\r\n\r\n private _attachContentPlateBehavior() {\r\n this._contentDragBehavior.attach(this._contentPlate);\r\n this._contentDragBehavior.moveAttached = false;\r\n this._contentDragBehavior.useObjectOrientationForDragging = true;\r\n this._contentDragBehavior.updateDragPlane = false;\r\n\r\n const origin = new Vector3();\r\n const worldDimensions = new Vector3();\r\n const upWorld = new Vector3();\r\n const rightWorld = new Vector3();\r\n const projectedOffset = new Vector2();\r\n let startViewport: Viewport;\r\n let worldMatrix: Matrix;\r\n\r\n this._contentDragBehavior.onDragStartObservable.add((event) => {\r\n if (!this.node) {\r\n return;\r\n }\r\n startViewport = this._contentViewport.clone();\r\n worldMatrix = this.node.computeWorldMatrix(true);\r\n\r\n origin.copyFrom(event.dragPlanePoint);\r\n worldDimensions.set(this.dimensions.x, this.dimensions.y, Epsilon);\r\n worldDimensions.y -= this.titleBarHeight + this.titleBarMargin;\r\n Vector3.TransformNormalToRef(worldDimensions, worldMatrix, worldDimensions);\r\n upWorld.copyFromFloats(0, 1, 0);\r\n Vector3.TransformNormalToRef(upWorld, worldMatrix, upWorld);\r\n rightWorld.copyFromFloats(1, 0, 0);\r\n Vector3.TransformNormalToRef(rightWorld, worldMatrix, rightWorld);\r\n upWorld.normalize();\r\n upWorld.scaleInPlace(1 / Vector3.Dot(upWorld, worldDimensions));\r\n rightWorld.normalize();\r\n rightWorld.scaleInPlace(1 / Vector3.Dot(rightWorld, worldDimensions));\r\n });\r\n\r\n const offset = new Vector3();\r\n this._contentDragBehavior.onDragObservable.add((event) => {\r\n offset.copyFrom(event.dragPlanePoint);\r\n offset.subtractInPlace(origin);\r\n projectedOffset.copyFromFloats(Vector3.Dot(offset, rightWorld), Vector3.Dot(offset, upWorld));\r\n\r\n // By default, content takes full width available and height is cropped to keep aspect ratio\r\n this._contentViewport.x = Scalar.Clamp(startViewport.x - offset.x, 0, 1 - this._contentViewport.width * this._contentScaleRatio);\r\n this._contentViewport.y = Scalar.Clamp(startViewport.y - offset.y, 0, 1 - this._contentViewport.height * this._contentScaleRatio);\r\n this._applyContentViewport();\r\n });\r\n }\r\n\r\n protected _affectMaterial(mesh: AbstractMesh) {\r\n // TODO share materials\r\n this._titleBarMaterial = new FluentBackplateMaterial(`${this.name} plateMaterial`, mesh.getScene());\r\n\r\n this._contentMaterial = new FluentMaterial(`${this.name} contentMaterial`, mesh.getScene());\r\n this._contentMaterial.renderBorders = true;\r\n\r\n this._backMaterial = new FluentBackplateMaterial(`${this.name} backPlate`, mesh.getScene());\r\n this._backMaterial.lineWidth = Epsilon;\r\n this._backMaterial.radius = 0.005;\r\n this._backMaterial.backFaceCulling = true;\r\n\r\n this._titleBar.material = this._titleBarMaterial;\r\n this._contentPlate.material = this._contentMaterial;\r\n this._backPlate.material = this._backMaterial;\r\n\r\n this._resetContent();\r\n this._applyContentViewport();\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _prepareNode(scene: Scene): void {\r\n super._prepareNode(scene);\r\n this._gizmo = new SlateGizmo(this._host.utilityLayer!);\r\n this._gizmo.attachedSlate = this;\r\n this._defaultBehavior = new DefaultBehavior();\r\n this._defaultBehavior.attach(this.node as Mesh, [this._titleBar]);\r\n this._defaultBehavior.sixDofDragBehavior.onDragStartObservable.add(() => {\r\n this._followButton.isToggled = false;\r\n });\r\n\r\n this._positionChangedObserver = this._defaultBehavior.sixDofDragBehavior.onPositionChangedObservable.add(() => {\r\n this._gizmo.updateBoundingBox();\r\n });\r\n\r\n this._updatePivot();\r\n this.resetDefaultAspectAndPose(false);\r\n }\r\n\r\n /**\r\n * Resets the aspect and pose of the slate so it is right in front of the active camera, facing towards it.\r\n * @param resetAspect Should the slate's dimensions/aspect ratio be reset as well\r\n */\r\n public resetDefaultAspectAndPose(resetAspect: boolean = true) {\r\n if (!this._host || !this._host.utilityLayer || !this.node) {\r\n return;\r\n }\r\n const scene = this._host.utilityLayer.utilityLayerScene;\r\n const camera = scene.activeCamera;\r\n if (camera) {\r\n const worldMatrix = camera.getWorldMatrix();\r\n const backward = Vector3.TransformNormal(Vector3.Backward(scene.useRightHandedSystem), worldMatrix);\r\n this.origin.setAll(0);\r\n this._gizmo.updateBoundingBox();\r\n const pivot = this.node.getAbsolutePivotPoint();\r\n this.node.position.copyFrom(camera.position).subtractInPlace(backward).subtractInPlace(pivot);\r\n this.node.rotationQuaternion = Quaternion.FromLookDirectionLH(backward, new Vector3(0, 1, 0));\r\n\r\n if (resetAspect) {\r\n this.dimensions = this.defaultDimensions;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Releases all associated resources\r\n */\r\n public dispose() {\r\n super.dispose();\r\n this._titleBarMaterial.dispose();\r\n this._contentMaterial.dispose();\r\n\r\n this._titleBar.dispose();\r\n this._titleBarTitle.dispose();\r\n this._contentPlate.dispose();\r\n this._backPlate.dispose();\r\n\r\n this._followButton.dispose();\r\n this._closeButton.dispose();\r\n\r\n this._host.onPickedPointChangedObservable.remove(this._pickedPointObserver);\r\n this._defaultBehavior.sixDofDragBehavior.onPositionChangedObservable.remove(this._positionChangedObserver);\r\n\r\n this._defaultBehavior.detach();\r\n this._gizmo.dispose();\r\n this._contentDragBehavior.detach();\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"holographicSlate.js","sourceRoot":"","sources":["../../../../../dev/gui/src/3D/controls/holographicSlate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AACzE,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AACtE,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAE,uBAAuB,EAAE,MAAM,sDAAsD,CAAC;AAC/F,OAAO,EAAE,mBAAmB,EAAE,gEAAkD;AAEhF,OAAO,EAAE,OAAO,EAAE,sCAAwB;AAC1C,OAAO,EAAE,OAAO,EAAE,gDAAkC;AACpD,OAAO,EAAE,MAAM,EAAE,6CAA+B;AAEhD,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,6CAA+B;AACtE,OAAO,EAAE,QAAQ,EAAE,+CAAiC;AAEpD,OAAO,EAAE,SAAS,EAAE,sDAAwC;AAC5D,OAAO,EAAE,WAAW,EAAE,wDAA0C;AAEhE,OAAO,EAAE,IAAI,EAAE,uCAAyB;AACxC,OAAO,EAAE,UAAU,EAAE,kDAAoC;AAKzD;;;GAGG;AACH,MAAM,OAAO,gBAAiB,SAAQ,gBAAgB;IA0ClD;;OAEG;IACH,IAAW,eAAe;QACtB,OAAO,IAAI,CAAC,gBAAgB,CA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BAAkB,AAA7B,CAA8B;AAEjD,2CAA0B,GAAG,KAAK,AAAR,CAAS","sourcesContent":["import { ContentDisplay3D } from \"./contentDisplay3D\";\r\nimport type { Control3D } from \"./control3D\";\r\nimport { TouchHolographicButton } from \"./touchHolographicButton\";\r\nimport { AdvancedDynamicTexture } from \"../../2D/advancedDynamicTexture\";\r\nimport { Control } from \"../../2D/controls/control\";\r\nimport { TextBlock, TextWrapping } from \"../../2D/controls/textBlock\";\r\nimport { DefaultBehavior } from \"../behaviors/defaultBehavior\";\r\nimport { SlateGizmo } from \"../gizmos/slateGizmo\";\r\nimport { FluentMaterial } from \"../materials/fluent/fluentMaterial\";\r\nimport { FluentBackplateMaterial } from \"../materials/fluentBackplate/fluentBackplateMaterial\";\r\nimport { PointerDragBehavior } from \"core/Behaviors/Meshes/pointerDragBehavior\";\r\nimport type { Texture } from \"core/Materials/Textures/texture\";\r\nimport { Vector4 } from \"core/Maths/math\";\r\nimport { Epsilon } from \"core/Maths/math.constants\";\r\nimport { Scalar } from \"core/Maths/math.scalar\";\r\nimport type { Matrix } from \"core/Maths/math.vector\";\r\nimport { Quaternion, Vector2, Vector3 } from \"core/Maths/math.vector\";\r\nimport { Viewport } from \"core/Maths/math.viewport\";\r\nimport type { AbstractMesh } from \"core/Meshes/abstractMesh\";\r\nimport { CreateBox } from \"core/Meshes/Builders/boxBuilder\";\r\nimport { CreatePlane } from \"core/Meshes/Builders/planeBuilder\";\r\nimport type { TransformNode } from \"core/Meshes/transformNode\";\r\nimport { Mesh } from \"core/Meshes/mesh\";\r\nimport { VertexData } from \"core/Meshes/mesh.vertexData\";\r\nimport type { Observer } from \"core/Misc/observable\";\r\nimport type { Scene } from \"core/scene\";\r\nimport type { Nullable } from \"core/types\";\r\n\r\n/**\r\n * Class used to create a holographic slate\r\n * @since 5.0.0\r\n */\r\nexport class HolographicSlate extends ContentDisplay3D {\r\n /**\r\n * Base Url for the assets.\r\n */\r\n public static ASSETS_BASE_URL: string = \"https://assets.babylonjs.com/meshes/MRTK/\";\r\n /**\r\n * File name for the close icon.\r\n */\r\n public static CLOSE_ICON_FILENAME: string = \"IconClose.png\";\r\n /**\r\n * File name for the close icon.\r\n */\r\n public static FOLLOW_ICON_FILENAME: string = \"IconFollowMe.png\";\r\n\r\n private static _DEFAULT_TEXT_RESOLUTION_Y = 102.4;\r\n\r\n /**\r\n * Margin between title bar and contentplate\r\n */\r\n public titleBarMargin = 0.005;\r\n\r\n /**\r\n * Origin in local coordinates (top left corner)\r\n */\r\n public origin = new Vector3(0, 0, 0);\r\n\r\n private _dimensions = new Vector2(21.875, 12.5);\r\n private _titleBarHeight = 0.625;\r\n\r\n private _titleBarMaterial: FluentBackplateMaterial;\r\n private _backMaterial: FluentBackplateMaterial;\r\n private _contentMaterial: FluentMaterial;\r\n private _pickedPointObserver: Nullable<Observer<Nullable<Vector3>>>;\r\n private _positionChangedObserver: Nullable<Observer<{ position: Vector3 }>>;\r\n\r\n private _titleText = \"\";\r\n private _titleTextComponent: TextBlock;\r\n\r\n private _contentViewport: Viewport;\r\n private _contentDragBehavior: PointerDragBehavior;\r\n\r\n private _defaultBehavior: DefaultBehavior;\r\n /**\r\n * Regroups all mesh behaviors for the slate\r\n */\r\n public get defaultBehavior(): DefaultBehavior {\r\n return this._defaultBehavior;\r\n }\r\n\r\n /** @internal */\r\n public _gizmo: SlateGizmo;\r\n\r\n protected _titleBar: Mesh;\r\n protected _titleBarTitle: Mesh;\r\n protected _contentPlate: Mesh;\r\n protected _backPlate: Mesh;\r\n /** @internal */\r\n public _followButton: TouchHolographicButton;\r\n protected _closeButton: TouchHolographicButton;\r\n protected override _contentScaleRatio = 1;\r\n\r\n /**\r\n * 2D dimensions of the slate\r\n */\r\n public get dimensions() {\r\n return this._dimensions;\r\n }\r\n public set dimensions(value) {\r\n //clamp, respecting ratios\r\n let scale = 1.0;\r\n if (value.x < this.minDimensions.x || value.y < this.minDimensions.y) {\r\n const newRatio = value.x / value.y;\r\n const minRatio = this.minDimensions.x / this.minDimensions.y;\r\n if (minRatio > newRatio) {\r\n // We just need to make sure the x-val is greater than the min\r\n scale = this.minDimensions.x / value.x;\r\n } else {\r\n // We just need to make sure the y-val is greater than the min\r\n scale = this.minDimensions.y / value.y;\r\n }\r\n }\r\n\r\n this._dimensions.copyFrom(value).scaleInPlace(scale);\r\n this._updatePivot();\r\n this._positionElements();\r\n }\r\n\r\n /**\r\n * Minimum dimensions of the slate\r\n */\r\n public minDimensions = new Vector2(15.625, 6.25);\r\n\r\n /**\r\n * Default dimensions of the slate\r\n */\r\n public readonly defaultDimensions = this._dimensions.clone();\r\n\r\n /**\r\n * Height of the title bar component\r\n */\r\n public get titleBarHeight() {\r\n return this._titleBarHeight;\r\n }\r\n public set titleBarHeight(value) {\r\n this._titleBarHeight = value;\r\n }\r\n\r\n /**\r\n * Rendering ground id of all the meshes\r\n */\r\n public set renderingGroupId(id: number) {\r\n this._titleBar.renderingGroupId = id;\r\n this._titleBarTitle.renderingGroupId = id;\r\n this._contentPlate.renderingGroupId = id;\r\n this._backPlate.renderingGroupId = id;\r\n }\r\n public get renderingGroupId(): number {\r\n return this._titleBar.renderingGroupId;\r\n }\r\n\r\n /**\r\n * The title text displayed at the top of the slate\r\n */\r\n public set title(title: string) {\r\n this._titleText = title;\r\n if (this._titleTextComponent) {\r\n this._titleTextComponent.text = title;\r\n }\r\n }\r\n public get title() {\r\n return this._titleText;\r\n }\r\n\r\n /**\r\n * Creates a new slate\r\n * @param name defines the control name\r\n */\r\n constructor(name?: string) {\r\n super(name);\r\n\r\n this._followButton = new TouchHolographicButton(\"followButton\" + this.name);\r\n this._followButton.isToggleButton = true;\r\n this._closeButton = new TouchHolographicButton(\"closeButton\" + this.name);\r\n\r\n this._contentViewport = new Viewport(0, 0, 1, 1);\r\n this._contentDragBehavior = new PointerDragBehavior({\r\n dragPlaneNormal: new Vector3(0, 0, -1),\r\n });\r\n }\r\n\r\n /**\r\n * Apply the facade texture (created from the content property).\r\n * This function can be overloaded by child classes\r\n * @param facadeTexture defines the AdvancedDynamicTexture to use\r\n */\r\n protected override _applyFacade(facadeTexture: AdvancedDynamicTexture) {\r\n this._contentMaterial.albedoTexture = facadeTexture;\r\n this._resetContentPositionAndZoom();\r\n this._applyContentViewport();\r\n\r\n facadeTexture.attachToMesh(this._contentPlate, true);\r\n }\r\n\r\n private _addControl(control: Control3D): void {\r\n control._host = this._host;\r\n if (this._host.utilityLayer) {\r\n control._prepareNode(this._host.utilityLayer.utilityLayerScene);\r\n }\r\n }\r\n\r\n protected override _getTypeName(): string {\r\n return \"HolographicSlate\";\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _positionElements() {\r\n const followButton = this._followButton;\r\n const closeButton = this._closeButton;\r\n const titleBar = this._titleBar;\r\n const titleBarTitle = this._titleBarTitle;\r\n const contentPlate = this._contentPlate;\r\n const backPlate = this._backPlate;\r\n\r\n if (followButton && closeButton && titleBar) {\r\n closeButton.scaling.setAll(this.titleBarHeight);\r\n followButton.scaling.setAll(this.titleBarHeight);\r\n closeButton.position.copyFromFloats(this.dimensions.x - this.titleBarHeight / 2, -this.titleBarHeight / 2, 0).addInPlace(this.origin);\r\n followButton.position.copyFromFloats(this.dimensions.x - (3 * this.titleBarHeight) / 2, -this.titleBarHeight / 2, 0).addInPlace(this.origin);\r\n\r\n const contentPlateHeight = this.dimensions.y - this.titleBarHeight - this.titleBarMargin;\r\n const rightHandScene = contentPlate.getScene().useRightHandedSystem;\r\n\r\n titleBar.scaling.set(this.dimensions.x, this.titleBarHeight, Epsilon);\r\n titleBarTitle.scaling.set(this.dimensions.x - 2 * this.titleBarHeight, this.titleBarHeight, Epsilon);\r\n contentPlate.scaling.copyFromFloats(this.dimensions.x, contentPlateHeight, Epsilon);\r\n backPlate.scaling.copyFromFloats(this.dimensions.x, contentPlateHeight, Epsilon);\r\n\r\n titleBar.position.copyFromFloats(this.dimensions.x / 2, -(this.titleBarHeight / 2), 0).addInPlace(this.origin);\r\n titleBarTitle.position\r\n .copyFromFloats(this.dimensions.x / 2 - this.titleBarHeight, -(this.titleBarHeight / 2), rightHandScene ? Epsilon : -Epsilon)\r\n .addInPlace(this.origin);\r\n contentPlate.position.copyFromFloats(this.dimensions.x / 2, -(this.titleBarHeight + this.titleBarMargin + contentPlateHeight / 2), 0).addInPlace(this.origin);\r\n backPlate.position\r\n .copyFromFloats(this.dimensions.x / 2, -(this.titleBarHeight + this.titleBarMargin + contentPlateHeight / 2), rightHandScene ? -Epsilon : Epsilon)\r\n .addInPlace(this.origin);\r\n\r\n // Update the title's AdvancedDynamicTexture scale to avoid visual stretching\r\n this._titleTextComponent.host.scaleTo(\r\n (HolographicSlate._DEFAULT_TEXT_RESOLUTION_Y * titleBarTitle.scaling.x) / titleBarTitle.scaling.y,\r\n HolographicSlate._DEFAULT_TEXT_RESOLUTION_Y\r\n );\r\n\r\n const aspectRatio = this.dimensions.x / contentPlateHeight;\r\n this._contentViewport.width = this._contentScaleRatio;\r\n this._contentViewport.height = this._contentScaleRatio / aspectRatio;\r\n\r\n this._applyContentViewport();\r\n if (this._gizmo) {\r\n this._gizmo.updateBoundingBox();\r\n }\r\n }\r\n }\r\n\r\n private _applyContentViewport() {\r\n if (this._contentPlate?.material && (this._contentPlate.material as FluentMaterial).albedoTexture) {\r\n const tex = (this._contentPlate.material as FluentMaterial).albedoTexture as Texture;\r\n tex.uScale = this._contentScaleRatio;\r\n tex.vScale = (this._contentScaleRatio / this._contentViewport.width) * this._contentViewport.height;\r\n tex.uOffset = this._contentViewport.x;\r\n tex.vOffset = this._contentViewport.y;\r\n }\r\n }\r\n\r\n private _resetContentPositionAndZoom() {\r\n this._contentViewport.x = 0;\r\n this._contentViewport.y = 1 - this._contentViewport.height / this._contentViewport.width;\r\n this._contentScaleRatio = 1;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _updatePivot() {\r\n if (!this.mesh) {\r\n return;\r\n }\r\n\r\n // Update pivot point so it is at the center of geometry\r\n // As origin is topleft corner in 2D, dimensions are calculated towards bottom right corner, thus y axis is downwards\r\n const center = new Vector3(this.dimensions.x * 0.5, -this.dimensions.y * 0.5, Epsilon);\r\n center.addInPlace(this.origin);\r\n center.z = 0;\r\n\r\n const origin = new Vector3(0, 0, 0);\r\n Vector3.TransformCoordinatesToRef(origin, this.mesh.computeWorldMatrix(true), origin);\r\n this.mesh.setPivotPoint(center);\r\n const origin2 = new Vector3(0, 0, 0);\r\n Vector3.TransformCoordinatesToRef(origin2, this.mesh.computeWorldMatrix(true), origin2);\r\n this.mesh.position.addInPlace(origin).subtractInPlace(origin2);\r\n }\r\n\r\n // Mesh association\r\n protected override _createNode(scene: Scene): TransformNode {\r\n const node = new Mesh(\"slate_\" + this.name, scene);\r\n\r\n this._titleBar = CreateBox(\"titleBar_\" + this.name, { size: 1 }, scene);\r\n this._titleBarTitle = CreatePlane(\"titleText_\" + this.name, { size: 1 }, scene);\r\n this._titleBarTitle.parent = node;\r\n this._titleBarTitle.isPickable = false;\r\n\r\n const adt = AdvancedDynamicTexture.CreateForMesh(this._titleBarTitle);\r\n this._titleTextComponent = new TextBlock(\"titleText_\" + this.name, this._titleText);\r\n this._titleTextComponent.textWrapping = TextWrapping.Ellipsis;\r\n this._titleTextComponent.textHorizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;\r\n this._titleTextComponent.color = \"white\";\r\n this._titleTextComponent.fontSize = HolographicSlate._DEFAULT_TEXT_RESOLUTION_Y / 2;\r\n this._titleTextComponent.paddingLeft = HolographicSlate._DEFAULT_TEXT_RESOLUTION_Y / 4;\r\n adt.addControl(this._titleTextComponent);\r\n\r\n if (scene.useRightHandedSystem) {\r\n const faceUV = new Vector4(0, 0, 1, 1);\r\n this._contentPlate = CreatePlane(\"contentPlate_\" + this.name, { size: 1, sideOrientation: VertexData.BACKSIDE, frontUVs: faceUV }, scene);\r\n this._backPlate = CreatePlane(\"backPlate_\" + this.name, { size: 1, sideOrientation: VertexData.FRONTSIDE }, scene);\r\n } else {\r\n const faceUV = new Vector4(0, 0, 1, 1);\r\n this._contentPlate = CreatePlane(\"contentPlate_\" + this.name, { size: 1, sideOrientation: VertexData.FRONTSIDE, frontUVs: faceUV }, scene);\r\n this._backPlate = CreatePlane(\"backPlate_\" + this.name, { size: 1, sideOrientation: VertexData.BACKSIDE }, scene);\r\n }\r\n\r\n this._titleBar.parent = node;\r\n this._titleBar.isNearGrabbable = true;\r\n this._contentPlate.parent = node;\r\n this._backPlate.parent = node;\r\n this._attachContentPlateBehavior();\r\n\r\n this._addControl(this._followButton);\r\n this._addControl(this._closeButton);\r\n\r\n const followButton = this._followButton;\r\n const closeButton = this._closeButton;\r\n\r\n followButton.node!.parent = node;\r\n closeButton.node!.parent = node;\r\n\r\n this._positionElements();\r\n\r\n this._followButton.imageUrl = HolographicSlate.ASSETS_BASE_URL + HolographicSlate.FOLLOW_ICON_FILENAME;\r\n this._closeButton.imageUrl = HolographicSlate.ASSETS_BASE_URL + HolographicSlate.CLOSE_ICON_FILENAME;\r\n\r\n this._followButton.isBackplateVisible = false;\r\n this._closeButton.isBackplateVisible = false;\r\n\r\n this._followButton.onToggleObservable.add((isToggled) => {\r\n this._defaultBehavior.followBehaviorEnabled = isToggled;\r\n if (this._defaultBehavior.followBehaviorEnabled) {\r\n this._defaultBehavior.followBehavior.recenter();\r\n }\r\n });\r\n\r\n this._closeButton.onPointerClickObservable.add(() => {\r\n this.dispose();\r\n });\r\n\r\n node.rotationQuaternion = Quaternion.Identity();\r\n node.isVisible = false;\r\n\r\n return node;\r\n }\r\n\r\n private _attachContentPlateBehavior() {\r\n this._contentDragBehavior.attach(this._contentPlate);\r\n this._contentDragBehavior.moveAttached = false;\r\n this._contentDragBehavior.useObjectOrientationForDragging = true;\r\n this._contentDragBehavior.updateDragPlane = false;\r\n\r\n const origin = new Vector3();\r\n const worldDimensions = new Vector3();\r\n const upWorld = new Vector3();\r\n const rightWorld = new Vector3();\r\n const projectedOffset = new Vector2();\r\n let startViewport: Viewport;\r\n let worldMatrix: Matrix;\r\n\r\n this._contentDragBehavior.onDragStartObservable.add((event) => {\r\n if (!this.node) {\r\n return;\r\n }\r\n startViewport = this._contentViewport.clone();\r\n worldMatrix = this.node.computeWorldMatrix(true);\r\n\r\n origin.copyFrom(event.dragPlanePoint);\r\n worldDimensions.set(this.dimensions.x, this.dimensions.y, Epsilon);\r\n worldDimensions.y -= this.titleBarHeight + this.titleBarMargin;\r\n Vector3.TransformNormalToRef(worldDimensions, worldMatrix, worldDimensions);\r\n upWorld.copyFromFloats(0, 1, 0);\r\n Vector3.TransformNormalToRef(upWorld, worldMatrix, upWorld);\r\n rightWorld.copyFromFloats(1, 0, 0);\r\n Vector3.TransformNormalToRef(rightWorld, worldMatrix, rightWorld);\r\n upWorld.normalize();\r\n upWorld.scaleInPlace(1 / Vector3.Dot(upWorld, worldDimensions));\r\n rightWorld.normalize();\r\n rightWorld.scaleInPlace(1 / Vector3.Dot(rightWorld, worldDimensions));\r\n });\r\n\r\n const offset = new Vector3();\r\n this._contentDragBehavior.onDragObservable.add((event) => {\r\n offset.copyFrom(event.dragPlanePoint);\r\n offset.subtractInPlace(origin);\r\n projectedOffset.copyFromFloats(Vector3.Dot(offset, rightWorld), Vector3.Dot(offset, upWorld));\r\n\r\n // By default, content takes full width available and height is cropped to keep aspect ratio\r\n this._contentViewport.x = Scalar.Clamp(startViewport.x - offset.x, 0, 1 - this._contentViewport.width * this._contentScaleRatio);\r\n this._contentViewport.y = Scalar.Clamp(startViewport.y - offset.y, 0, 1 - this._contentViewport.height * this._contentScaleRatio);\r\n this._applyContentViewport();\r\n });\r\n }\r\n\r\n protected override _affectMaterial(mesh: AbstractMesh) {\r\n // TODO share materials\r\n this._titleBarMaterial = new FluentBackplateMaterial(`${this.name} plateMaterial`, mesh.getScene());\r\n\r\n this._contentMaterial = new FluentMaterial(`${this.name} contentMaterial`, mesh.getScene());\r\n this._contentMaterial.renderBorders = true;\r\n\r\n this._backMaterial = new FluentBackplateMaterial(`${this.name} backPlate`, mesh.getScene());\r\n this._backMaterial.lineWidth = Epsilon;\r\n this._backMaterial.radius = 0.005;\r\n this._backMaterial.backFaceCulling = true;\r\n\r\n this._titleBar.material = this._titleBarMaterial;\r\n this._contentPlate.material = this._contentMaterial;\r\n this._backPlate.material = this._backMaterial;\r\n\r\n this._resetContent();\r\n this._applyContentViewport();\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public override _prepareNode(scene: Scene): void {\r\n super._prepareNode(scene);\r\n this._gizmo = new SlateGizmo(this._host.utilityLayer!);\r\n this._gizmo.attachedSlate = this;\r\n this._defaultBehavior = new DefaultBehavior();\r\n this._defaultBehavior.attach(this.node as Mesh, [this._titleBar]);\r\n this._defaultBehavior.sixDofDragBehavior.onDragStartObservable.add(() => {\r\n this._followButton.isToggled = false;\r\n });\r\n\r\n this._positionChangedObserver = this._defaultBehavior.sixDofDragBehavior.onPositionChangedObservable.add(() => {\r\n this._gizmo.updateBoundingBox();\r\n });\r\n\r\n this._updatePivot();\r\n this.resetDefaultAspectAndPose(false);\r\n }\r\n\r\n /**\r\n * Resets the aspect and pose of the slate so it is right in front of the active camera, facing towards it.\r\n * @param resetAspect Should the slate's dimensions/aspect ratio be reset as well\r\n */\r\n public resetDefaultAspectAndPose(resetAspect: boolean = true) {\r\n if (!this._host || !this._host.utilityLayer || !this.node) {\r\n return;\r\n }\r\n const scene = this._host.utilityLayer.utilityLayerScene;\r\n const camera = scene.activeCamera;\r\n if (camera) {\r\n const worldMatrix = camera.getWorldMatrix();\r\n const backward = Vector3.TransformNormal(Vector3.Backward(scene.useRightHandedSystem), worldMatrix);\r\n this.origin.setAll(0);\r\n this._gizmo.updateBoundingBox();\r\n const pivot = this.node.getAbsolutePivotPoint();\r\n this.node.position.copyFrom(camera.position).subtractInPlace(backward).subtractInPlace(pivot);\r\n this.node.rotationQuaternion = Quaternion.FromLookDirectionLH(backward, new Vector3(0, 1, 0));\r\n\r\n if (resetAspect) {\r\n this.dimensions = this.defaultDimensions;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Releases all associated resources\r\n */\r\n public override dispose() {\r\n super.dispose();\r\n this._titleBarMaterial.dispose();\r\n this._contentMaterial.dispose();\r\n\r\n this._titleBar.dispose();\r\n this._titleBarTitle.dispose();\r\n this._contentPlate.dispose();\r\n this._backPlate.dispose();\r\n\r\n this._followButton.dispose();\r\n this._closeButton.dispose();\r\n\r\n this._host.onPickedPointChangedObservable.remove(this._pickedPointObserver);\r\n this._defaultBehavior.sixDofDragBehavior.onPositionChangedObservable.remove(this._positionChangedObserver);\r\n\r\n this._defaultBehavior.detach();\r\n this._gizmo.dispose();\r\n this._contentDragBehavior.detach();\r\n }\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"meshButton3D.js","sourceRoot":"","sources":["../../../../../dev/gui/src/3D/controls/meshButton3D.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC;;GAEG;AACH,MAAM,OAAO,YAAa,SAAQ,QAAQ;IAItC;;;;OAIG;IACH,YAAY,IAAU,EAAE,IAAa;QACjC,KAAK,CAAC,IAAI,CAAC,CAAC;QACZ,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;QAEzB;;;WAGG;QACH,IAAI,CAAC,qBAAqB,GAAG,GAAG,EAAE;YAC9B,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE;gBACZ,OAAO;aACV;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;gBACZ,OAAO;aACV;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;gBACZ,OAAO;aACV;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;gBACZ,OAAO;aACV;YACD,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,GAAG,GAAG,IAAI,CAAC,CAAC;QAC/C,CAAC,CAAC;IACN,CAAC;IAES,YAAY;QAClB,OAAO,cAAc,CAAC;IAC1B,CAAC;IAED,mBAAmB;IACnB,6DAA6D;IACnD,WAAW,CAAC,KAAY;QAC9B,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;QACH,OAAO,IAAI,CAAC,YAAY,CAAC;IAC7B,CAAC;IAED,6DAA6D;IACnD,eAAe,CAAC,IAAkB,IAAG,CAAC;CACnD","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\nimport type { Scene } from \"core/scene\";\r\n\r\nimport { Button3D } from \"./button3D\";\r\n\r\n/**\r\n * Class used to create an interactable object. It's a 3D button using a mesh coming from the current scene\r\n */\r\nexport class MeshButton3D extends Button3D {\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\r\n * @param name defines the control name\r\n */\r\n constructor(mesh: Mesh, name?: string) {\r\n super(name);\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 _getTypeName(): string {\r\n return \"MeshButton3D\";\r\n }\r\n\r\n // Mesh association\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n protected _createNode(scene: Scene): TransformNode {\r\n this._currentMesh.getChildMeshes().forEach((mesh) => {\r\n this._injectGUI3DReservedDataStore(mesh).control = this;\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 _affectMaterial(mesh: AbstractMesh) {}\r\n}\r\n"]}
1
+ {"version":3,"file":"meshButton3D.js","sourceRoot":"","sources":["../../../../../dev/gui/src/3D/controls/meshButton3D.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC;;GAEG;AACH,MAAM,OAAO,YAAa,SAAQ,QAAQ;IAItC;;;;OAIG;IACH,YAAY,IAAU,EAAE,IAAa;QACjC,KAAK,CAAC,IAAI,CAAC,CAAC;QACZ,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;QAEzB;;;WAGG;QACH,IAAI,CAAC,qBAAqB,GAAG,GAAG,EAAE;YAC9B,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE;gBACZ,OAAO;aACV;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;gBACZ,OAAO;aACV;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;gBACZ,OAAO;aACV;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;gBACZ,OAAO;aACV;YACD,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,GAAG,GAAG,IAAI,CAAC,CAAC;QAC/C,CAAC,CAAC;IACN,CAAC;IAEkB,YAAY;QAC3B,OAAO,cAAc,CAAC;IAC1B,CAAC;IAED,mBAAmB;IACnB,6DAA6D;IAC1C,WAAW,CAAC,KAAY;QACvC,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;QACH,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\nimport type { Scene } from \"core/scene\";\r\n\r\nimport { Button3D } from \"./button3D\";\r\n\r\n/**\r\n * Class used to create an interactable object. It's a 3D button using a mesh coming from the current scene\r\n */\r\nexport class MeshButton3D extends Button3D {\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\r\n * @param name defines the control name\r\n */\r\n constructor(mesh: Mesh, name?: string) {\r\n super(name);\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 \"MeshButton3D\";\r\n }\r\n\r\n // Mesh association\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n protected override _createNode(scene: Scene): TransformNode {\r\n this._currentMesh.getChildMeshes().forEach((mesh) => {\r\n this._injectGUI3DReservedDataStore(mesh).control = this;\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":"nearMenu.js","sourceRoot":"","sources":["../../../../../dev/gui/src/3D/controls/nearMenu.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,E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iBAAiB,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;IACxJ,CAAC;IAED;;;OAGG;IACH,YAAY,IAAa;QACrB,KAAK,CAAC,IAAI,CAAC,CAAC;QA5ER,cAAS,GAAY,KAAK,CAAC;QA8E/B,IAAI,CAAC,gBAAgB,GAAG,IAAI,eAAe,EAAE,CAAC;QAC9C,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,gBAAgB,CAAC,kBAAkB,CAAC,gBAAgB,CAAC,GAAG,CAAC,GAAG,EAAE;YACpF,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QACzB,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,eAAe,GAAG,CAAC,CAAC;IAC7B,CAAC;IAED;;OAEG;IACI,OAAO;QACV,KAAK,CAAC,OAAO,EAAE,CAAC;QAEhB,IAAI,CAAC,gBAAgB,CAAC,kBAAkB,CAAC,gBAAgB,CAAC,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QACrF,IAAI,CAAC,gBAAgB,CAAC,MAAM,EAAE,CAAC;IACnC,CAAC;;AAxHD;;GAEG;AACY,yBAAgB,GAAW,2CAA2C,AAAtD,CAAuD;AACtF;;GAEG;AACY,2BAAkB,GAAW,aAAa,AAAxB,CAAyB","sourcesContent":["import type { Scene } from \"core/scene\";\r\nimport type { TransformNode } from \"core/Meshes/transformNode\";\r\nimport type { Nullable } from \"core/types\";\r\nimport type { Mesh } from \"core/Meshes/mesh\";\r\nimport { TouchHolographicButton } from \"./touchHolographicButton\";\r\nimport { DefaultBehavior } from \"../behaviors/defaultBehavior\";\r\nimport { TouchHolographicMenu } from \"./touchHolographicMenu\";\r\nimport type { Observer } from \"core/Misc/observable\";\r\nimport type { Vector3 } from \"core/Maths/math.vector\";\r\nimport type { PickingInfo } from \"core/Collisions/pickingInfo\";\r\n\r\n/**\r\n * NearMenu that displays buttons and follows the camera\r\n * @since 5.0.0\r\n */\r\nexport class NearMenu extends TouchHolographicMenu {\r\n /**\r\n * Base Url for the assets.\r\n */\r\n private static _ASSETS_BASE_URL: string = \"https://assets.babylonjs.com/meshes/MRTK/\";\r\n /**\r\n * File name for the close icon.\r\n */\r\n private static _PIN_ICON_FILENAME: string = \"IconPin.png\";\r\n\r\n private _pinButton: TouchHolographicButton;\r\n private _dragObserver: Nullable<\r\n Observer<{\r\n delta: Vector3;\r\n position: Vector3;\r\n pickInfo: PickingInfo;\r\n }>\r\n >;\r\n\r\n private _defaultBehavior: DefaultBehavior;\r\n /**\r\n * Regroups all mesh behaviors for the near menu\r\n */\r\n public get defaultBehavior(): DefaultBehavior {\r\n return this._defaultBehavior;\r\n }\r\n\r\n private _isPinned: boolean = false;\r\n /**\r\n * Indicates if the near menu is world-pinned\r\n */\r\n public get isPinned(): boolean {\r\n return this._isPinned;\r\n }\r\n\r\n public set isPinned(value: boolean) {\r\n // Tell the pin button to toggle if this was called manually, for clean state control\r\n if (this._pinButton.isToggled !== value) {\r\n this._pinButton.isToggled = value;\r\n return;\r\n }\r\n\r\n this._isPinned = value;\r\n\r\n if (value) {\r\n this._defaultBehavior.followBehaviorEnabled = false;\r\n } else {\r\n this._defaultBehavior.followBehaviorEnabled = true;\r\n }\r\n }\r\n\r\n private _createPinButton(parent: TransformNode) {\r\n const control = new TouchHolographicButton(\"pin\" + this.name, false);\r\n control.imageUrl = NearMenu._ASSETS_BASE_URL + NearMenu._PIN_ICON_FILENAME;\r\n control.parent = this;\r\n control._host = this._host;\r\n control.isToggleButton = true;\r\n control.onToggleObservable.add((newState) => {\r\n this.isPinned = newState;\r\n });\r\n\r\n if (this._host.utilityLayer) {\r\n control._prepareNode(this._host.utilityLayer.utilityLayerScene);\r\n control.scaling.scaleInPlace(TouchHolographicMenu.MENU_BUTTON_SCALE);\r\n\r\n if (control.node) {\r\n control.node.parent = parent;\r\n }\r\n }\r\n\r\n return control;\r\n }\r\n\r\n protected _createNode(scene: Scene): Nullable<TransformNode> {\r\n const node = super._createNode(scene)! as Mesh;\r\n\r\n this._pinButton = this._createPinButton(node);\r\n this.isPinned = false;\r\n\r\n this._defaultBehavior.attach(node, [this._backPlate]);\r\n this._defaultBehavior.followBehavior.ignoreCameraPitchAndRoll = true;\r\n this._defaultBehavior.followBehavior.pitchOffset = -15;\r\n this._defaultBehavior.followBehavior.minimumDistance = 0.3;\r\n this._defaultBehavior.followBehavior.defaultDistance = 0.4;\r\n this._defaultBehavior.followBehavior.maximumDistance = 0.6;\r\n\r\n this._backPlate.isNearGrabbable = true;\r\n node.isVisible = false;\r\n\r\n return node;\r\n }\r\n\r\n protected _finalProcessing() {\r\n super._finalProcessing();\r\n\r\n this._pinButton.position.copyFromFloats((this._backPlate.scaling.x + TouchHolographicMenu.MENU_BUTTON_SCALE) / 2, this._backPlate.scaling.y / 2, 0);\r\n }\r\n\r\n /**\r\n * Creates a near menu GUI 3D control\r\n * @param name name of the near menu\r\n */\r\n constructor(name?: string) {\r\n super(name);\r\n\r\n this._defaultBehavior = new DefaultBehavior();\r\n this._dragObserver = this._defaultBehavior.sixDofDragBehavior.onDragObservable.add(() => {\r\n this.isPinned = true;\r\n });\r\n\r\n this.backPlateMargin = 1;\r\n }\r\n\r\n /**\r\n * Disposes the near menu\r\n */\r\n public dispose() {\r\n super.dispose();\r\n\r\n this._defaultBehavior.sixDofDragBehavior.onDragObservable.remove(this._dragObserver);\r\n this._defaultBehavior.detach();\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"nearMenu.js","sourceRoot":"","sources":["../../../../../dev/gui/src/3D/controls/nearMenu.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAK9D;;;GAGG;AACH,MAAM,OAAO,QAAS,SAAQ,oBAAoB;IA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,CAAC,CAAC,CAAC;IACxJ,CAAC;IAED;;;OAGG;IACH,YAAY,IAAa;QACrB,KAAK,CAAC,IAAI,CAAC,CAAC;QA5ER,cAAS,GAAY,KAAK,CAAC;QA8E/B,IAAI,CAAC,gBAAgB,GAAG,IAAI,eAAe,EAAE,CAAC;QAC9C,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,gBAAgB,CAAC,kBAAkB,CAAC,gBAAgB,CAAC,GAAG,CAAC,GAAG,EAAE;YACpF,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QACzB,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,eAAe,GAAG,CAAC,CAAC;IAC7B,CAAC;IAED;;OAEG;IACa,OAAO;QACnB,KAAK,CAAC,OAAO,EAAE,CAAC;QAEhB,IAAI,CAAC,gBAAgB,CAAC,kBAAkB,CAAC,gBAAgB,CAAC,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QACrF,IAAI,CAAC,gBAAgB,CAAC,MAAM,EAAE,CAAC;IACnC,CAAC;;AAxHD;;GAEG;AACY,yBAAgB,GAAW,2CAA2C,AAAtD,CAAuD;AACtF;;GAEG;AACY,2BAAkB,GAAW,aAAa,AAAxB,CAAyB","sourcesContent":["import type { Scene } from \"core/scene\";\r\nimport type { TransformNode } from \"core/Meshes/transformNode\";\r\nimport type { Nullable } from \"core/types\";\r\nimport type { Mesh } from \"core/Meshes/mesh\";\r\nimport { TouchHolographicButton } from \"./touchHolographicButton\";\r\nimport { DefaultBehavior } from \"../behaviors/defaultBehavior\";\r\nimport { TouchHolographicMenu } from \"./touchHolographicMenu\";\r\nimport type { Observer } from \"core/Misc/observable\";\r\nimport type { Vector3 } from \"core/Maths/math.vector\";\r\nimport type { PickingInfo } from \"core/Collisions/pickingInfo\";\r\n\r\n/**\r\n * NearMenu that displays buttons and follows the camera\r\n * @since 5.0.0\r\n */\r\nexport class NearMenu extends TouchHolographicMenu {\r\n /**\r\n * Base Url for the assets.\r\n */\r\n private static _ASSETS_BASE_URL: string = \"https://assets.babylonjs.com/meshes/MRTK/\";\r\n /**\r\n * File name for the close icon.\r\n */\r\n private static _PIN_ICON_FILENAME: string = \"IconPin.png\";\r\n\r\n private _pinButton: TouchHolographicButton;\r\n private _dragObserver: Nullable<\r\n Observer<{\r\n delta: Vector3;\r\n position: Vector3;\r\n pickInfo: PickingInfo;\r\n }>\r\n >;\r\n\r\n private _defaultBehavior: DefaultBehavior;\r\n /**\r\n * Regroups all mesh behaviors for the near menu\r\n */\r\n public get defaultBehavior(): DefaultBehavior {\r\n return this._defaultBehavior;\r\n }\r\n\r\n private _isPinned: boolean = false;\r\n /**\r\n * Indicates if the near menu is world-pinned\r\n */\r\n public get isPinned(): boolean {\r\n return this._isPinned;\r\n }\r\n\r\n public set isPinned(value: boolean) {\r\n // Tell the pin button to toggle if this was called manually, for clean state control\r\n if (this._pinButton.isToggled !== value) {\r\n this._pinButton.isToggled = value;\r\n return;\r\n }\r\n\r\n this._isPinned = value;\r\n\r\n if (value) {\r\n this._defaultBehavior.followBehaviorEnabled = false;\r\n } else {\r\n this._defaultBehavior.followBehaviorEnabled = true;\r\n }\r\n }\r\n\r\n private _createPinButton(parent: TransformNode) {\r\n const control = new TouchHolographicButton(\"pin\" + this.name, false);\r\n control.imageUrl = NearMenu._ASSETS_BASE_URL + NearMenu._PIN_ICON_FILENAME;\r\n control.parent = this;\r\n control._host = this._host;\r\n control.isToggleButton = true;\r\n control.onToggleObservable.add((newState) => {\r\n this.isPinned = newState;\r\n });\r\n\r\n if (this._host.utilityLayer) {\r\n control._prepareNode(this._host.utilityLayer.utilityLayerScene);\r\n control.scaling.scaleInPlace(TouchHolographicMenu.MENU_BUTTON_SCALE);\r\n\r\n if (control.node) {\r\n control.node.parent = parent;\r\n }\r\n }\r\n\r\n return control;\r\n }\r\n\r\n protected override _createNode(scene: Scene): Nullable<TransformNode> {\r\n const node = super._createNode(scene)! as Mesh;\r\n\r\n this._pinButton = this._createPinButton(node);\r\n this.isPinned = false;\r\n\r\n this._defaultBehavior.attach(node, [this._backPlate]);\r\n this._defaultBehavior.followBehavior.ignoreCameraPitchAndRoll = true;\r\n this._defaultBehavior.followBehavior.pitchOffset = -15;\r\n this._defaultBehavior.followBehavior.minimumDistance = 0.3;\r\n this._defaultBehavior.followBehavior.defaultDistance = 0.4;\r\n this._defaultBehavior.followBehavior.maximumDistance = 0.6;\r\n\r\n this._backPlate.isNearGrabbable = true;\r\n node.isVisible = false;\r\n\r\n return node;\r\n }\r\n\r\n protected override _finalProcessing() {\r\n super._finalProcessing();\r\n\r\n this._pinButton.position.copyFromFloats((this._backPlate.scaling.x + TouchHolographicMenu.MENU_BUTTON_SCALE) / 2, this._backPlate.scaling.y / 2, 0);\r\n }\r\n\r\n /**\r\n * Creates a near menu GUI 3D control\r\n * @param name name of the near menu\r\n */\r\n constructor(name?: string) {\r\n super(name);\r\n\r\n this._defaultBehavior = new DefaultBehavior();\r\n this._dragObserver = this._defaultBehavior.sixDofDragBehavior.onDragObservable.add(() => {\r\n this.isPinned = true;\r\n });\r\n\r\n this.backPlateMargin = 1;\r\n }\r\n\r\n /**\r\n * Disposes the near menu\r\n */\r\n public override dispose() {\r\n super.dispose();\r\n\r\n this._defaultBehavior.sixDofDragBehavior.onDragObservable.remove(this._dragObserver);\r\n this._defaultBehavior.detach();\r\n }\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"scatterPanel.js","sourceRoot":"","sources":["../../../../../dev/gui/src/3D/controls/scatterPanel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,sCAAwB;AACxC,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,6CAA+B;AAG7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C;;GAEG;AACH,MAAM,OAAO,YAAa,SAAQ,gBAAgB;IAAlD;;QACY,eAAU,GAAG,KAAK,CAAC;IA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EAAE,EAAE;gBACxC,KAAK,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;oBACxC,IAAI,CAAC,IAAI,CAAC,EAAE;wBACR,MAAM,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;wBAEjE,gBAAgB;wBAChB,YAAY,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC;wBAC9B,YAAY,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC;wBAC9B,MAAM,cAAc,GAAG,QAAQ,CAAC;wBAChC,IAAI,QAAQ,GAAG,YAAY,CAAC,aAAa,EAAE,GAAG,oBAAoB,CAAC;wBACnE,MAAM,aAAa,GAAG,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,oBAAoB,CAAC,CAAC;wBAC/D,QAAQ,IAAI,aAAa,CAAC;wBAE1B,IAAI,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,cAAc,EAAE,GAAG,CAAC,EAAE;4BAC1C,YAAY,CAAC,SAAS,EAAE,CAAC;4BACzB,UAAU,CAAC,YAAY,CAAC,CAAC,cAAc,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC;4BACtE,MAAM,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;4BAC1C,MAAM,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC;yBAClD;qBACJ;iBACJ;aACJ;SACJ;IACL,CAAC;CACJ","sourcesContent":["import { Tools } from \"core/Misc/tools\";\r\nimport { 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\n\r\n/**\r\n * Class used to create a container panel where items get randomized planar mapping\r\n */\r\nexport class ScatterPanel extends VolumeBasedPanel {\r\n private _iteration = 100.0;\r\n\r\n /**\r\n * Gets or sets the number of iteration to use to scatter the controls (100 by default)\r\n */\r\n public get iteration(): float {\r\n return this._iteration;\r\n }\r\n\r\n public set iteration(value: float) {\r\n if (this._iteration === value) {\r\n return;\r\n }\r\n\r\n this._iteration = 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 const newPos = this._scatterMapping(nodePosition);\r\n\r\n if (!mesh) {\r\n return;\r\n }\r\n\r\n switch (this.orientation) {\r\n case Container3D.FACEORIGIN_ORIENTATION:\r\n case Container3D.FACEFORWARD_ORIENTATION:\r\n mesh.lookAt(new Vector3(0, 0, 1));\r\n break;\r\n case Container3D.FACEFORWARDREVERSED_ORIENTATION:\r\n case Container3D.FACEORIGINREVERSED_ORIENTATION:\r\n mesh.lookAt(new Vector3(0, 0, -1));\r\n break;\r\n }\r\n\r\n control.position = newPos;\r\n }\r\n\r\n private _scatterMapping(source: Vector3): Vector3 {\r\n source.x = (1.0 - Math.random() * 2.0) * this._cellWidth;\r\n source.y = (1.0 - Math.random() * 2.0) * this._cellHeight;\r\n\r\n return source;\r\n }\r\n\r\n protected _finalProcessing() {\r\n const meshes = [];\r\n for (const child of this._children) {\r\n if (!child.mesh) {\r\n continue;\r\n }\r\n\r\n meshes.push(child.mesh);\r\n }\r\n\r\n for (let count = 0; count < this._iteration; count++) {\r\n meshes.sort((a, b) => {\r\n const distance1 = a.position.lengthSquared();\r\n const distance2 = b.position.lengthSquared();\r\n\r\n if (distance1 < distance2) {\r\n return 1;\r\n } else if (distance1 > distance2) {\r\n return -1;\r\n }\r\n\r\n return 0;\r\n });\r\n\r\n const radiusPaddingSquared = Math.pow(this.margin, 2.0);\r\n const cellSize = Math.max(this._cellWidth, this._cellHeight);\r\n const difference2D = TmpVectors.Vector2[0];\r\n const difference = TmpVectors.Vector3[0];\r\n\r\n for (let i = 0; i < meshes.length - 1; i++) {\r\n for (let j = i + 1; j < meshes.length; j++) {\r\n if (i != j) {\r\n meshes[j].position.subtractToRef(meshes[i].position, difference);\r\n\r\n // Ignore Z axis\r\n difference2D.x = difference.x;\r\n difference2D.y = difference.y;\r\n const combinedRadius = cellSize;\r\n let distance = difference2D.lengthSquared() - radiusPaddingSquared;\r\n const minSeparation = Math.min(distance, radiusPaddingSquared);\r\n distance -= minSeparation;\r\n\r\n if (distance < Math.pow(combinedRadius, 2.0)) {\r\n difference2D.normalize();\r\n difference.scaleInPlace((combinedRadius - Math.sqrt(distance)) * 0.5);\r\n meshes[j].position.addInPlace(difference);\r\n meshes[i].position.subtractInPlace(difference);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"scatterPanel.js","sourceRoot":"","sources":["../../../../../dev/gui/src/3D/controls/scatterPanel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,sCAAwB;AACxC,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,6CAA+B;AAG7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C;;GAEG;AACH,MAAM,OAAO,YAAa,SAAQ,gBAAgB;IAAlD;;QACY,eAAU,GAAG,KAAK,CAAC;IAuG/B,CAAC;IArGG;;OAEG;IACH,IAAW,SAAS;QAChB,OAAO,IAAI,CAAC,UAAU,CAAC;IAC3B,CAAC;IAED,IAAW,SAAS,CAAC,KAAY;QAC7B,IAAI,IAAI,CAAC,UAAU,KAAK,KAAK,EAAE;YAC3B,OAAO;SACV;QAED,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;QAExB,KAAK,C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CAAC,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;wBAEjE,gBAAgB;wBAChB,YAAY,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC;wBAC9B,YAAY,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC;wBAC9B,MAAM,cAAc,GAAG,QAAQ,CAAC;wBAChC,IAAI,QAAQ,GAAG,YAAY,CAAC,aAAa,EAAE,GAAG,oBAAoB,CAAC;wBACnE,MAAM,aAAa,GAAG,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,oBAAoB,CAAC,CAAC;wBAC/D,QAAQ,IAAI,aAAa,CAAC;wBAE1B,IAAI,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,cAAc,EAAE,GAAG,CAAC,EAAE;4BAC1C,YAAY,CAAC,SAAS,EAAE,CAAC;4BACzB,UAAU,CAAC,YAAY,CAAC,CAAC,cAAc,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC;4BACtE,MAAM,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;4BAC1C,MAAM,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC;yBAClD;qBACJ;iBACJ;aACJ;SACJ;IACL,CAAC;CACJ","sourcesContent":["import { Tools } from \"core/Misc/tools\";\r\nimport { 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\n\r\n/**\r\n * Class used to create a container panel where items get randomized planar mapping\r\n */\r\nexport class ScatterPanel extends VolumeBasedPanel {\r\n private _iteration = 100.0;\r\n\r\n /**\r\n * Gets or sets the number of iteration to use to scatter the controls (100 by default)\r\n */\r\n public get iteration(): float {\r\n return this._iteration;\r\n }\r\n\r\n public set iteration(value: float) {\r\n if (this._iteration === value) {\r\n return;\r\n }\r\n\r\n this._iteration = 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 const newPos = this._scatterMapping(nodePosition);\r\n\r\n if (!mesh) {\r\n return;\r\n }\r\n\r\n switch (this.orientation) {\r\n case Container3D.FACEORIGIN_ORIENTATION:\r\n case Container3D.FACEFORWARD_ORIENTATION:\r\n mesh.lookAt(new Vector3(0, 0, 1));\r\n break;\r\n case Container3D.FACEFORWARDREVERSED_ORIENTATION:\r\n case Container3D.FACEORIGINREVERSED_ORIENTATION:\r\n mesh.lookAt(new Vector3(0, 0, -1));\r\n break;\r\n }\r\n\r\n control.position = newPos;\r\n }\r\n\r\n private _scatterMapping(source: Vector3): Vector3 {\r\n source.x = (1.0 - Math.random() * 2.0) * this._cellWidth;\r\n source.y = (1.0 - Math.random() * 2.0) * this._cellHeight;\r\n\r\n return source;\r\n }\r\n\r\n protected override _finalProcessing() {\r\n const meshes = [];\r\n for (const child of this._children) {\r\n if (!child.mesh) {\r\n continue;\r\n }\r\n\r\n meshes.push(child.mesh);\r\n }\r\n\r\n for (let count = 0; count < this._iteration; count++) {\r\n meshes.sort((a, b) => {\r\n const distance1 = a.position.lengthSquared();\r\n const distance2 = b.position.lengthSquared();\r\n\r\n if (distance1 < distance2) {\r\n return 1;\r\n } else if (distance1 > distance2) {\r\n return -1;\r\n }\r\n\r\n return 0;\r\n });\r\n\r\n const radiusPaddingSquared = Math.pow(this.margin, 2.0);\r\n const cellSize = Math.max(this._cellWidth, this._cellHeight);\r\n const difference2D = TmpVectors.Vector2[0];\r\n const difference = TmpVectors.Vector3[0];\r\n\r\n for (let i = 0; i < meshes.length - 1; i++) {\r\n for (let j = i + 1; j < meshes.length; j++) {\r\n if (i != j) {\r\n meshes[j].position.subtractToRef(meshes[i].position, difference);\r\n\r\n // Ignore Z axis\r\n difference2D.x = difference.x;\r\n difference2D.y = difference.y;\r\n const combinedRadius = cellSize;\r\n let distance = difference2D.lengthSquared() - radiusPaddingSquared;\r\n const minSeparation = Math.min(distance, radiusPaddingSquared);\r\n distance -= minSeparation;\r\n\r\n if (distance < Math.pow(combinedRadius, 2.0)) {\r\n difference2D.normalize();\r\n difference.scaleInPlace((combinedRadius - Math.sqrt(distance)) * 0.5);\r\n meshes[j].position.addInPlace(difference);\r\n meshes[i].position.subtractInPlace(difference);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"slider3D.js","sourceRoot":"","sources":["../../../../../dev/gui/src/3D/controls/slider3D.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,2CAA6B;AAClD,OAAO,EAAE,OAAO,EAAE,6CAA+B;AAGjD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,sDAAwC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,gEAAkD;AAEhF,OAAO,EAAE,WAAW,EAAE,+CAAiC;AACvD,OAAO,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;AAChF,OAAO,EAAE,uBAAuB,EAAE,MAAM,2CAA2C,CAAC;AACpF,OAAO,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;AAEhF,MAAM,UAAU,GAAW,CAAC,CAAC;AAC7B,MAAM,UAAU,GAAW,GAAG,CAAC;AAC/B,MAAM,UAAU,GAAW,EAAE,CAAC;AAC9B,MAAM,WAAW,GAAW,CAAC,CAAC;AAC9B,MAAM,cAAc,GAAW,GAAG,CAAC;AACnC,MAAM,aAAa,GAAW,GAAG,CAAC;AAElC;;GAEG;AACH,MAAM,OAAO,QAAS,SAAQ,SAAS;IA6BnC;;;;OAIG;IACH,YAAY,IAAa,EAAE,sBAAgC;QACvD,KAAK,CAAC,IAAI,CAAC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QAC7B,IAAI,CAAC,kBAAkB,EAAE,OAAO,EAAE,CAAC;QACnC,IAAI,CAAC,oBAAoB,EAAE,OAAO,EAAE,CAAC;QACrC,IAAI,CAAC,gBAAgB,EAAE,OAAO,EAAE,CAAC;QACjC,IAAI,CAAC,wBAAwB,EAAE,OAAO,EAAE,CAAC;IAC7C,CAAC;;AAxSD;;GAEG;AACW,uBAAc,GAAW,2CAA2C,AAAtD,CAAuD;AAEnF;;GAEG;AACW,uBAAc,GAAW,2BAA2B,AAAtC,CAAuC","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\nimport type { Nullable } from \"core/types\";\r\nimport { Observable } from \"core/Misc/observable\";\r\nimport { Vector3 } from \"core/Maths/math.vector\";\r\nimport type { TransformNode } from \"core/Meshes/transformNode\";\r\nimport type { Scene } from \"core/scene\";\r\nimport { Control3D } from \"./control3D\";\r\nimport { CreateBox } from \"core/Meshes/Builders/boxBuilder\";\r\nimport { PointerDragBehavior } from \"core/Behaviors/Meshes/pointerDragBehavior\";\r\nimport type { AbstractMesh } from \"core/Meshes/abstractMesh\";\r\nimport { SceneLoader } from \"core/Loading/sceneLoader\";\r\nimport { MRDLSliderBarMaterial } from \"../materials/mrdl/mrdlSliderBarMaterial\";\r\nimport { MRDLSliderThumbMaterial } from \"../materials/mrdl/mrdlSliderThumbMaterial\";\r\nimport { MRDLBackplateMaterial } from \"../materials/mrdl/mrdlBackplateMaterial\";\r\n\r\nconst SLIDER_MIN: number = 0;\r\nconst SLIDER_MAX: number = 100;\r\nconst SLIDER_VAL: number = 50;\r\nconst SLIDER_STEP: number = 0;\r\nconst SLIDER_SCALING: number = 1.0;\r\nconst SLIDER_MARGIN: number = 0.2;\r\n\r\n/**\r\n * Class used to create a slider in 3D\r\n */\r\nexport class Slider3D extends Control3D {\r\n /**\r\n * Base Url for the models.\r\n */\r\n public static MODEL_BASE_URL: string = \"https://assets.babylonjs.com/meshes/MRTK/\";\r\n\r\n /**\r\n * File name for the 8x4 model.\r\n */\r\n public static MODEL_FILENAME: string = \"mrtk-fluent-backplate.glb\";\r\n\r\n private _sliderBackplate: AbstractMesh;\r\n private _sliderBackplateMaterial: MRDLBackplateMaterial;\r\n private _sliderBarMaterial: MRDLSliderBarMaterial;\r\n private _sliderThumbMaterial: MRDLSliderThumbMaterial;\r\n private _sliderThumb: AbstractMesh;\r\n private _sliderBar: AbstractMesh;\r\n private _sliderBackplateVisible: boolean;\r\n\r\n private _minimum: number;\r\n private _maximum: number;\r\n private _value: number;\r\n private _step: number;\r\n\r\n private _draggedPosition: number;\r\n\r\n /** Observable raised when the sldier value changes */\r\n public onValueChangedObservable = new Observable<number>();\r\n\r\n /**\r\n * Creates a new slider\r\n * @param name defines the control name\r\n * @param sliderBackplateVisible defines if the control has a backplate, default is false\r\n */\r\n constructor(name?: string, sliderBackplateVisible?: boolean) {\r\n super(name);\r\n this._sliderBackplateVisible = sliderBackplateVisible || false;\r\n\r\n this._minimum = SLIDER_MIN;\r\n this._maximum = SLIDER_MAX;\r\n this._step = SLIDER_STEP;\r\n this._value = SLIDER_VAL;\r\n }\r\n\r\n /**\r\n * Gets the mesh used to render this control\r\n */\r\n public get mesh(): Nullable<AbstractMesh> {\r\n if (this.node) {\r\n return this._sliderThumb;\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /** Gets or sets minimum value */\r\n public get minimum(): number {\r\n return this._minimum;\r\n }\r\n\r\n public set minimum(value: number) {\r\n if (this._minimum === value) {\r\n return;\r\n }\r\n\r\n this._minimum = Math.max(value, SLIDER_MIN);\r\n this._value = Math.max(Math.min(this._value, this._maximum), this._minimum);\r\n }\r\n\r\n /** Gets or sets maximum value */\r\n public get maximum(): number {\r\n return this._maximum;\r\n }\r\n\r\n public set maximum(value: number) {\r\n if (this._maximum === value) {\r\n return;\r\n }\r\n\r\n this._maximum = Math.max(value, this._minimum);\r\n this._value = Math.max(Math.min(this._value, this._maximum), this._minimum);\r\n }\r\n\r\n /** Gets or sets step value */\r\n public get step(): number {\r\n return this._step;\r\n }\r\n\r\n public set step(value: number) {\r\n if (this._step === value) {\r\n return;\r\n }\r\n\r\n this._step = Math.max(Math.min(value, this._maximum - this._minimum), SLIDER_STEP);\r\n }\r\n\r\n /** Gets or sets current value */\r\n public get value(): number {\r\n return this._value;\r\n }\r\n\r\n public set value(value: number) {\r\n if (this._value === value) {\r\n return;\r\n }\r\n\r\n this._value = Math.max(Math.min(value, this._maximum), this._minimum);\r\n if (this._sliderThumb) {\r\n this._sliderThumb.position.x = this._convertToPosition(this.value);\r\n }\r\n this.onValueChangedObservable.notifyObservers(this._value);\r\n }\r\n\r\n protected get start(): number {\r\n if (!this.node) {\r\n return -SLIDER_SCALING / 2;\r\n }\r\n\r\n return this._sliderBar.position.x - this._sliderBar.scaling.x / 2;\r\n }\r\n\r\n protected get end(): number {\r\n if (!this.node) {\r\n return SLIDER_SCALING / 2;\r\n }\r\n\r\n return this._sliderBar.position.x + this._sliderBar.scaling.x / 2;\r\n }\r\n\r\n /**\r\n * Gets the slider bar material used by this control\r\n */\r\n public get sliderBarMaterial(): MRDLSliderBarMaterial {\r\n return this._sliderBarMaterial;\r\n }\r\n\r\n /**\r\n * Gets the slider thumb material used by this control\r\n */\r\n public get sliderThumbMaterial(): MRDLSliderThumbMaterial {\r\n return this._sliderThumbMaterial;\r\n }\r\n\r\n /**\r\n * Gets the slider backplate material used by this control\r\n */\r\n public get sliderBackplateMaterial(): MRDLBackplateMaterial {\r\n return this._sliderBackplateMaterial;\r\n }\r\n\r\n /**\r\n * Gets the slider bar mesh used by this control\r\n */\r\n public get sliderBar(): AbstractMesh {\r\n return this._sliderBar;\r\n }\r\n\r\n /**\r\n * Gets the slider thumb mesh used by this control\r\n */\r\n public get sliderThumb(): AbstractMesh {\r\n return this._sliderThumb;\r\n }\r\n\r\n /**\r\n * Gets the slider backplate mesh used by this control\r\n */\r\n public get sliderBackplate(): AbstractMesh {\r\n return this._sliderBackplate;\r\n }\r\n\r\n /** Sets a boolean indicating if the control is visible */\r\n public set isVisible(value: boolean) {\r\n if (this._isVisible === value) {\r\n return;\r\n }\r\n\r\n this._isVisible = value;\r\n\r\n this.node?.setEnabled(value);\r\n }\r\n\r\n // Mesh association\r\n protected _createNode(scene: Scene): TransformNode {\r\n const sliderBackplate = CreateBox(\r\n `${this.name}_sliderbackplate`,\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 sliderBackplate.isPickable = false;\r\n sliderBackplate.visibility = 0;\r\n sliderBackplate.scaling = new Vector3(1, 0.5, 0.8);\r\n\r\n SceneLoader.ImportMeshAsync(undefined, Slider3D.MODEL_BASE_URL, Slider3D.MODEL_FILENAME, scene).then((result) => {\r\n // make all meshes not pickable. Required meshes' pickable state will be set later.\r\n result.meshes.forEach((m) => {\r\n m.isPickable = false;\r\n });\r\n const sliderBackplateModel = result.meshes[1];\r\n const sliderBarModel = result.meshes[1].clone(`${this.name}_sliderbar`, sliderBackplate);\r\n const sliderThumbModel = result.meshes[1].clone(`${this.name}_sliderthumb`, sliderBackplate);\r\n sliderBackplateModel.visibility = 0;\r\n\r\n if (this._sliderBackplateVisible) {\r\n sliderBackplateModel.visibility = 1;\r\n sliderBackplateModel.name = `${this.name}_sliderbackplate`;\r\n sliderBackplateModel.scaling.x = 1;\r\n sliderBackplateModel.scaling.z = 0.2;\r\n sliderBackplateModel.parent = sliderBackplate;\r\n if (this._sliderBackplateMaterial) {\r\n sliderBackplateModel.material = this._sliderBackplateMaterial;\r\n }\r\n this._sliderBackplate = sliderBackplateModel;\r\n }\r\n\r\n if (sliderBarModel) {\r\n sliderBarModel.parent = sliderBackplate;\r\n sliderBarModel.position.z = -0.1;\r\n sliderBarModel.scaling = new Vector3(SLIDER_SCALING - SLIDER_MARGIN, 0.04, 0.3);\r\n if (this._sliderBarMaterial) {\r\n sliderBarModel.material = this._sliderBarMaterial;\r\n }\r\n this._sliderBar = sliderBarModel;\r\n }\r\n\r\n if (sliderThumbModel) {\r\n sliderThumbModel.parent = sliderBackplate;\r\n sliderThumbModel.isPickable = true;\r\n sliderThumbModel.position.z = -0.115;\r\n sliderThumbModel.scaling = new Vector3(0.025, 0.3, 0.6);\r\n sliderThumbModel.position.x = this._convertToPosition(this.value);\r\n sliderThumbModel.addBehavior(this._createBehavior());\r\n if (this._sliderThumbMaterial) {\r\n sliderThumbModel.material = this._sliderThumbMaterial;\r\n }\r\n this._sliderThumb = sliderThumbModel;\r\n }\r\n\r\n this._injectGUI3DReservedDataStore(sliderBackplate).control = this;\r\n sliderBackplate.getChildMeshes().forEach((mesh) => {\r\n this._injectGUI3DReservedDataStore(mesh).control = this;\r\n });\r\n });\r\n\r\n this._affectMaterial(sliderBackplate);\r\n return sliderBackplate;\r\n }\r\n\r\n protected _affectMaterial(mesh: AbstractMesh) {\r\n this._sliderBackplateMaterial = this._sliderBackplateMaterial ?? new MRDLBackplateMaterial(`${this.name}_sliderbackplate_material`, mesh.getScene());\r\n this._sliderBarMaterial = this._sliderBarMaterial ?? new MRDLSliderBarMaterial(`${this.name}_sliderbar_material`, mesh.getScene());\r\n this._sliderThumbMaterial = this._sliderThumbMaterial ?? new MRDLSliderThumbMaterial(`${this.name}_sliderthumb_material`, mesh.getScene());\r\n }\r\n\r\n private _createBehavior(): PointerDragBehavior {\r\n const pointerDragBehavior = new PointerDragBehavior({ dragAxis: Vector3.Right() });\r\n pointerDragBehavior.moveAttached = false;\r\n\r\n pointerDragBehavior.onDragStartObservable.add(() => {\r\n this._draggedPosition = this._sliderThumb.position.x;\r\n });\r\n\r\n pointerDragBehavior.onDragObservable.add((event) => {\r\n this._draggedPosition += event.dragDistance / this.scaling.x;\r\n this.value = this._convertToValue(this._draggedPosition);\r\n });\r\n\r\n return pointerDragBehavior;\r\n }\r\n\r\n private _convertToPosition(value: number): number {\r\n const position = ((value - this.minimum) / (this.maximum - this.minimum)) * (this.end - this.start) + this.start;\r\n return Math.min(Math.max(position, this.start), this.end);\r\n }\r\n\r\n private _convertToValue(position: number): number {\r\n let value = ((position - this.start) / (this.end - this.start)) * (this.maximum - this.minimum);\r\n value = this.step ? Math.round(value / this.step) * this.step : value;\r\n\r\n return Math.max(Math.min(this.minimum + value, this._maximum), this._minimum);\r\n }\r\n\r\n /**\r\n * Releases all associated resources\r\n */\r\n public dispose() {\r\n super.dispose();\r\n this._sliderBar?.dispose();\r\n this._sliderThumb?.dispose();\r\n this._sliderBarMaterial?.dispose();\r\n this._sliderThumbMaterial?.dispose();\r\n this._sliderBackplate?.dispose();\r\n this._sliderBackplateMaterial?.dispose();\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"slider3D.js","sourceRoot":"","sources":["../../../../../dev/gui/src/3D/controls/slider3D.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,2CAA6B;AAClD,OAAO,EAAE,OAAO,EAAE,6CAA+B;AAGjD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,sDAAwC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,gEAAkD;AAEhF,OAAO,EAAE,WAAW,EAAE,+CAAiC;AACvD,OAAO,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;AAChF,OAAO,EAAE,uBAAuB,EAAE,MAAM,2CAA2C,CAAC;AACpF,OAAO,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;AAEhF,MAAM,UAAU,GAAW,CAAC,CAAC;AAC7B,MAAM,UAAU,GAAW,GAAG,CAAC;AAC/B,MAAM,UAAU,GAAW,EAAE,CAAC;AAC9B,MAAM,WAAW,GAAW,CAAC,CAAC;AAC9B,MAAM,cAAc,GAAW,GAAG,CAAC;AACnC,MAAM,aAAa,GAAW,GAAG,CAAC;AAElC;;GAEG;AACH,MAAM,OAAO,QAAS,SAAQ,SAAS;IA6BnC;;;;OAIG;IACH,YAAY,IAAa,EAAE,sBAAgC;QACvD,KAAK,CAAC,IAAI,CAAC,CAAC;QAThB,sDAAsD;QAC/C,6BAAwB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E,OAAO,EAAE,CAAC;QACnC,IAAI,CAAC,oBAAoB,EAAE,OAAO,EAAE,CAAC;QACrC,IAAI,CAAC,gBAAgB,EAAE,OAAO,EAAE,CAAC;QACjC,IAAI,CAAC,wBAAwB,EAAE,OAAO,EAAE,CAAC;IAC7C,CAAC;;AAxSD;;GAEG;AACW,uBAAc,GAAW,2CAA2C,AAAtD,CAAuD;AAEnF;;GAEG;AACW,uBAAc,GAAW,2BAA2B,AAAtC,CAAuC","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\nimport type { Nullable } from \"core/types\";\r\nimport { Observable } from \"core/Misc/observable\";\r\nimport { Vector3 } from \"core/Maths/math.vector\";\r\nimport type { TransformNode } from \"core/Meshes/transformNode\";\r\nimport type { Scene } from \"core/scene\";\r\nimport { Control3D } from \"./control3D\";\r\nimport { CreateBox } from \"core/Meshes/Builders/boxBuilder\";\r\nimport { PointerDragBehavior } from \"core/Behaviors/Meshes/pointerDragBehavior\";\r\nimport type { AbstractMesh } from \"core/Meshes/abstractMesh\";\r\nimport { SceneLoader } from \"core/Loading/sceneLoader\";\r\nimport { MRDLSliderBarMaterial } from \"../materials/mrdl/mrdlSliderBarMaterial\";\r\nimport { MRDLSliderThumbMaterial } from \"../materials/mrdl/mrdlSliderThumbMaterial\";\r\nimport { MRDLBackplateMaterial } from \"../materials/mrdl/mrdlBackplateMaterial\";\r\n\r\nconst SLIDER_MIN: number = 0;\r\nconst SLIDER_MAX: number = 100;\r\nconst SLIDER_VAL: number = 50;\r\nconst SLIDER_STEP: number = 0;\r\nconst SLIDER_SCALING: number = 1.0;\r\nconst SLIDER_MARGIN: number = 0.2;\r\n\r\n/**\r\n * Class used to create a slider in 3D\r\n */\r\nexport class Slider3D extends Control3D {\r\n /**\r\n * Base Url for the models.\r\n */\r\n public static MODEL_BASE_URL: string = \"https://assets.babylonjs.com/meshes/MRTK/\";\r\n\r\n /**\r\n * File name for the 8x4 model.\r\n */\r\n public static MODEL_FILENAME: string = \"mrtk-fluent-backplate.glb\";\r\n\r\n private _sliderBackplate: AbstractMesh;\r\n private _sliderBackplateMaterial: MRDLBackplateMaterial;\r\n private _sliderBarMaterial: MRDLSliderBarMaterial;\r\n private _sliderThumbMaterial: MRDLSliderThumbMaterial;\r\n private _sliderThumb: AbstractMesh;\r\n private _sliderBar: AbstractMesh;\r\n private _sliderBackplateVisible: boolean;\r\n\r\n private _minimum: number;\r\n private _maximum: number;\r\n private _value: number;\r\n private _step: number;\r\n\r\n private _draggedPosition: number;\r\n\r\n /** Observable raised when the sldier value changes */\r\n public onValueChangedObservable = new Observable<number>();\r\n\r\n /**\r\n * Creates a new slider\r\n * @param name defines the control name\r\n * @param sliderBackplateVisible defines if the control has a backplate, default is false\r\n */\r\n constructor(name?: string, sliderBackplateVisible?: boolean) {\r\n super(name);\r\n this._sliderBackplateVisible = sliderBackplateVisible || false;\r\n\r\n this._minimum = SLIDER_MIN;\r\n this._maximum = SLIDER_MAX;\r\n this._step = SLIDER_STEP;\r\n this._value = SLIDER_VAL;\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 if (this.node) {\r\n return this._sliderThumb;\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /** Gets or sets minimum value */\r\n public get minimum(): number {\r\n return this._minimum;\r\n }\r\n\r\n public set minimum(value: number) {\r\n if (this._minimum === value) {\r\n return;\r\n }\r\n\r\n this._minimum = Math.max(value, SLIDER_MIN);\r\n this._value = Math.max(Math.min(this._value, this._maximum), this._minimum);\r\n }\r\n\r\n /** Gets or sets maximum value */\r\n public get maximum(): number {\r\n return this._maximum;\r\n }\r\n\r\n public set maximum(value: number) {\r\n if (this._maximum === value) {\r\n return;\r\n }\r\n\r\n this._maximum = Math.max(value, this._minimum);\r\n this._value = Math.max(Math.min(this._value, this._maximum), this._minimum);\r\n }\r\n\r\n /** Gets or sets step value */\r\n public get step(): number {\r\n return this._step;\r\n }\r\n\r\n public set step(value: number) {\r\n if (this._step === value) {\r\n return;\r\n }\r\n\r\n this._step = Math.max(Math.min(value, this._maximum - this._minimum), SLIDER_STEP);\r\n }\r\n\r\n /** Gets or sets current value */\r\n public get value(): number {\r\n return this._value;\r\n }\r\n\r\n public set value(value: number) {\r\n if (this._value === value) {\r\n return;\r\n }\r\n\r\n this._value = Math.max(Math.min(value, this._maximum), this._minimum);\r\n if (this._sliderThumb) {\r\n this._sliderThumb.position.x = this._convertToPosition(this.value);\r\n }\r\n this.onValueChangedObservable.notifyObservers(this._value);\r\n }\r\n\r\n protected get start(): number {\r\n if (!this.node) {\r\n return -SLIDER_SCALING / 2;\r\n }\r\n\r\n return this._sliderBar.position.x - this._sliderBar.scaling.x / 2;\r\n }\r\n\r\n protected get end(): number {\r\n if (!this.node) {\r\n return SLIDER_SCALING / 2;\r\n }\r\n\r\n return this._sliderBar.position.x + this._sliderBar.scaling.x / 2;\r\n }\r\n\r\n /**\r\n * Gets the slider bar material used by this control\r\n */\r\n public get sliderBarMaterial(): MRDLSliderBarMaterial {\r\n return this._sliderBarMaterial;\r\n }\r\n\r\n /**\r\n * Gets the slider thumb material used by this control\r\n */\r\n public get sliderThumbMaterial(): MRDLSliderThumbMaterial {\r\n return this._sliderThumbMaterial;\r\n }\r\n\r\n /**\r\n * Gets the slider backplate material used by this control\r\n */\r\n public get sliderBackplateMaterial(): MRDLBackplateMaterial {\r\n return this._sliderBackplateMaterial;\r\n }\r\n\r\n /**\r\n * Gets the slider bar mesh used by this control\r\n */\r\n public get sliderBar(): AbstractMesh {\r\n return this._sliderBar;\r\n }\r\n\r\n /**\r\n * Gets the slider thumb mesh used by this control\r\n */\r\n public get sliderThumb(): AbstractMesh {\r\n return this._sliderThumb;\r\n }\r\n\r\n /**\r\n * Gets the slider backplate mesh used by this control\r\n */\r\n public get sliderBackplate(): AbstractMesh {\r\n return this._sliderBackplate;\r\n }\r\n\r\n /** Sets a boolean indicating if the control is visible */\r\n public override set isVisible(value: boolean) {\r\n if (this._isVisible === value) {\r\n return;\r\n }\r\n\r\n this._isVisible = value;\r\n\r\n this.node?.setEnabled(value);\r\n }\r\n\r\n // Mesh association\r\n protected override _createNode(scene: Scene): TransformNode {\r\n const sliderBackplate = CreateBox(\r\n `${this.name}_sliderbackplate`,\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 sliderBackplate.isPickable = false;\r\n sliderBackplate.visibility = 0;\r\n sliderBackplate.scaling = new Vector3(1, 0.5, 0.8);\r\n\r\n SceneLoader.ImportMeshAsync(undefined, Slider3D.MODEL_BASE_URL, Slider3D.MODEL_FILENAME, scene).then((result) => {\r\n // make all meshes not pickable. Required meshes' pickable state will be set later.\r\n result.meshes.forEach((m) => {\r\n m.isPickable = false;\r\n });\r\n const sliderBackplateModel = result.meshes[1];\r\n const sliderBarModel = result.meshes[1].clone(`${this.name}_sliderbar`, sliderBackplate);\r\n const sliderThumbModel = result.meshes[1].clone(`${this.name}_sliderthumb`, sliderBackplate);\r\n sliderBackplateModel.visibility = 0;\r\n\r\n if (this._sliderBackplateVisible) {\r\n sliderBackplateModel.visibility = 1;\r\n sliderBackplateModel.name = `${this.name}_sliderbackplate`;\r\n sliderBackplateModel.scaling.x = 1;\r\n sliderBackplateModel.scaling.z = 0.2;\r\n sliderBackplateModel.parent = sliderBackplate;\r\n if (this._sliderBackplateMaterial) {\r\n sliderBackplateModel.material = this._sliderBackplateMaterial;\r\n }\r\n this._sliderBackplate = sliderBackplateModel;\r\n }\r\n\r\n if (sliderBarModel) {\r\n sliderBarModel.parent = sliderBackplate;\r\n sliderBarModel.position.z = -0.1;\r\n sliderBarModel.scaling = new Vector3(SLIDER_SCALING - SLIDER_MARGIN, 0.04, 0.3);\r\n if (this._sliderBarMaterial) {\r\n sliderBarModel.material = this._sliderBarMaterial;\r\n }\r\n this._sliderBar = sliderBarModel;\r\n }\r\n\r\n if (sliderThumbModel) {\r\n sliderThumbModel.parent = sliderBackplate;\r\n sliderThumbModel.isPickable = true;\r\n sliderThumbModel.position.z = -0.115;\r\n sliderThumbModel.scaling = new Vector3(0.025, 0.3, 0.6);\r\n sliderThumbModel.position.x = this._convertToPosition(this.value);\r\n sliderThumbModel.addBehavior(this._createBehavior());\r\n if (this._sliderThumbMaterial) {\r\n sliderThumbModel.material = this._sliderThumbMaterial;\r\n }\r\n this._sliderThumb = sliderThumbModel;\r\n }\r\n\r\n this._injectGUI3DReservedDataStore(sliderBackplate).control = this;\r\n sliderBackplate.getChildMeshes().forEach((mesh) => {\r\n this._injectGUI3DReservedDataStore(mesh).control = this;\r\n });\r\n });\r\n\r\n this._affectMaterial(sliderBackplate);\r\n return sliderBackplate;\r\n }\r\n\r\n protected override _affectMaterial(mesh: AbstractMesh) {\r\n this._sliderBackplateMaterial = this._sliderBackplateMaterial ?? new MRDLBackplateMaterial(`${this.name}_sliderbackplate_material`, mesh.getScene());\r\n this._sliderBarMaterial = this._sliderBarMaterial ?? new MRDLSliderBarMaterial(`${this.name}_sliderbar_material`, mesh.getScene());\r\n this._sliderThumbMaterial = this._sliderThumbMaterial ?? new MRDLSliderThumbMaterial(`${this.name}_sliderthumb_material`, mesh.getScene());\r\n }\r\n\r\n private _createBehavior(): PointerDragBehavior {\r\n const pointerDragBehavior = new PointerDragBehavior({ dragAxis: Vector3.Right() });\r\n pointerDragBehavior.moveAttached = false;\r\n\r\n pointerDragBehavior.onDragStartObservable.add(() => {\r\n this._draggedPosition = this._sliderThumb.position.x;\r\n });\r\n\r\n pointerDragBehavior.onDragObservable.add((event) => {\r\n this._draggedPosition += event.dragDistance / this.scaling.x;\r\n this.value = this._convertToValue(this._draggedPosition);\r\n });\r\n\r\n return pointerDragBehavior;\r\n }\r\n\r\n private _convertToPosition(value: number): number {\r\n const position = ((value - this.minimum) / (this.maximum - this.minimum)) * (this.end - this.start) + this.start;\r\n return Math.min(Math.max(position, this.start), this.end);\r\n }\r\n\r\n private _convertToValue(position: number): number {\r\n let value = ((position - this.start) / (this.end - this.start)) * (this.maximum - this.minimum);\r\n value = this.step ? Math.round(value / this.step) * this.step : value;\r\n\r\n return Math.max(Math.min(this.minimum + value, this._maximum), this._minimum);\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 this._sliderBar?.dispose();\r\n this._sliderThumb?.dispose();\r\n this._sliderBarMaterial?.dispose();\r\n this._sliderThumbMaterial?.dispose();\r\n this._sliderBackplate?.dispose();\r\n this._sliderBackplateMaterial?.dispose();\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,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,KAAc;QAChC,IAAI,IAAI,CAAC,WAAW,KAAK,KAAK,EAAE;YAC5B,OAAO;SACV;QAED,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC;QAEzB,KAAK,CAAC,YAAY,CAAC,GAAG,EAAE;YACpB,IAAI,CAAC,gBAAgB,EAAE,CAAC;QAC5B,CAAC,CAAC,CAAC;IACP,CAAC;IAOD;;;OAGG;IACH,YAAmB,UAAU,GAAG,KAAK;QACjC,KAAK,EAAE,CAAC;QA/BJ,gBAAW,GAAG,KAAK,CAAC;QAqB5B;;WAEG;QACI,WAAM,GAAG,GAAG,CAAC;QAShB,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;IAClC,CAAC;IAES,gBAAgB;QACtB,IAAI,KAAK,GAAG,CAAC,CAAC;QACd,IAAI,M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B,IAAI,IAAI,CAAC,WAAW,EAAE;YAClB,MAAM,GAAG,CAAC,MAAM,CAAC;SACpB;aAAM;YACH,MAAM,GAAG,CAAC,KAAK,CAAC;SACnB;QAED,IAAI,KAAK,GAAG,CAAC,CAAC;QACd,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,SAAS,EAAE;YAChC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE;gBACb,SAAS;aACZ;YACD,YAAY,EAAE,CAAC;YACf,MAAM,UAAU,GAAG,WAAW,CAAC,KAAK,EAAE,CAAC,CAAC;YAExC,IAAI,IAAI,CAAC,WAAW,EAAE;gBAClB,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;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 _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,KAAc;QAChC,IAAI,IAAI,CAAC,WAAW,KAAK,KAAK,EAAE;YAC5B,OAAO;SACV;QAED,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC;QAEzB,KAAK,CAAC,YAAY,CAAC,GAAG,EAAE;YACpB,IAAI,CAAC,gBAAgB,EAAE,CAAC;QAC5B,CAAC,CAAC,CAAC;IACP,CAAC;IAOD;;;OAGG;IACH,YAAmB,UAAU,GAAG,KAAK;QACjC,KAAK,EAAE,CAAC;QA/BJ,gBAAW,GAAG,KAAK,CAAC;QAqB5B;;WAEG;QACI,WAAM,GAAG,GAAG,CAAC;QAShB,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;IAClC,CAAC;IAEkB,gBAAgB;QAC/B,IAAI,KAAK,GAAG,CAAC,CAAC;QACd,IAAI,MAAM,GAAG,CAAC,CAAC;QACf,IAAI,YAAY,GAAG,CAAC,CAAC;QACrB,MAAM,WAAW,GAAG,EAAE,CAAC;QAEvB,MAAM,mBAAmB,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,IAAK,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC,CAAC;QAE/E,UAAU;QACV,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,SAAS,EAAE;YAChC,IAAI,CA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AC;YACf,MAAM,UAAU,GAAG,WAAW,CAAC,KAAK,EAAE,CAAC,CAAC;YAExC,IAAI,IAAI,CAAC,WAAW,EAAE;gBAClB,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;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 +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,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EAAE,CAAC,CAAC;aAC5H;SACJ;QACD,IAAI,YAAY,KAAK,iBAAiB,CAAC,SAAS,EAAE;YAC9C,IAAI,sBAAsB,IAAI,CAAC,EAAE;gBAC7B,wEAAwE;gBACxE,OAAO,iBAAiB,CAAC,WAAW,CAAC;aACxC;iBAAM;gBACH,IAAI,CAAC,cAAc,GAAG,KAAK,CAAC;aAC/B;SACJ;QAED,OAAO,YAAY,CAAC;IACxB,CAAC;IAES,YAAY;QAClB,OAAO,eAAe,CAAC;IAC3B,CAAC;IAED,mBAAmB;IACT,WAAW,CAAC,KAAY;QAC9B,OAAO,KAAK,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;IAED;;OAEG;IACI,OAAO;QACV,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 _getTypeName(): string {\r\n return \"TouchButton3D\";\r\n }\r\n\r\n // Mesh association\r\n protected _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 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;YACf,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;SACtC;IACL,CAAC;IAED;;OAEG;IACH,IAAW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AAE;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"]}