@babylonjs/gui 7.34.4 → 7.35.1
Sign up to get free protection for your applications and to get access to all the features.
- package/2D/FrameGraph/guiTask.js.map +1 -1
- package/2D/FrameGraph/renderGraphGUIBlock.js.map +1 -1
- package/2D/adtInstrumentation.js.map +1 -1
- package/2D/advancedDynamicTexture.d.ts +1 -1
- package/2D/advancedDynamicTexture.js.map +1 -1
- package/2D/controls/button.js.map +1 -1
- package/2D/controls/checkbox.js.map +1 -1
- package/2D/controls/colorpicker.js.map +1 -1
- package/2D/controls/container.js.map +1 -1
- package/2D/controls/control.js.map +1 -1
- package/2D/controls/displayGrid.js.map +1 -1
- package/2D/controls/ellipse.js.map +1 -1
- package/2D/controls/focusableButton.js.map +1 -1
- package/2D/controls/gradient/BaseGradient.js.map +1 -1
- package/2D/controls/grid.js.map +1 -1
- package/2D/controls/image.js.map +1 -1
- package/2D/controls/inputPassword.js.map +1 -1
- package/2D/controls/inputText.js.map +1 -1
- package/2D/controls/inputTextArea.js.map +1 -1
- package/2D/controls/line.js.map +1 -1
- package/2D/controls/multiLine.js.map +1 -1
- package/2D/controls/radioButton.js.map +1 -1
- package/2D/controls/rectangle.js.map +1 -1
- package/2D/controls/scrollViewers/scrollViewer.js.map +1 -1
- package/2D/controls/scrollViewers/scrollViewerWindow.js.map +1 -1
- package/2D/controls/selector.js.map +1 -1
- package/2D/controls/sliders/baseSlider.js.map +1 -1
- package/2D/controls/sliders/imageBasedSlider.js.map +1 -1
- package/2D/controls/sliders/imageScrollBar.js.map +1 -1
- package/2D/controls/sliders/scrollBar.js.map +1 -1
- package/2D/controls/sliders/slider.js.map +1 -1
- package/2D/controls/stackPanel.js.map +1 -1
- package/2D/controls/statics.js.map +1 -1
- package/2D/controls/textBlock.js.map +1 -1
- package/2D/controls/textWrapper.js.map +1 -1
- package/2D/controls/toggleButton.js.map +1 -1
- package/2D/controls/virtualKeyboard.js.map +1 -1
- package/2D/math2D.js.map +1 -1
- package/2D/measure.js.map +1 -1
- package/2D/multiLinePoint.js.map +1 -1
- package/2D/style.js.map +1 -1
- package/2D/valueAndUnit.js.map +1 -1
- package/2D/xmlLoader.js.map +1 -1
- package/3D/behaviors/defaultBehavior.js.map +1 -1
- package/3D/controls/MRTK3/touchHolographicButton.js.map +1 -1
- package/3D/controls/button3D.js.map +1 -1
- package/3D/controls/container3D.js.map +1 -1
- package/3D/controls/contentDisplay3D.js.map +1 -1
- package/3D/controls/control3D.js.map +1 -1
- package/3D/controls/cylinderPanel.js.map +1 -1
- package/3D/controls/holographicBackplate.js.map +1 -1
- package/3D/controls/holographicButton.js.map +1 -1
- package/3D/controls/holographicSlate.js.map +1 -1
- package/3D/controls/meshButton3D.js.map +1 -1
- package/3D/controls/nearMenu.js.map +1 -1
- package/3D/controls/planePanel.js.map +1 -1
- package/3D/controls/scatterPanel.js.map +1 -1
- package/3D/controls/slider3D.js.map +1 -1
- package/3D/controls/spherePanel.js.map +1 -1
- package/3D/controls/stackPanel3D.js.map +1 -1
- package/3D/controls/touchButton3D.js.map +1 -1
- package/3D/controls/touchHolographicButton.js.map +1 -1
- package/3D/controls/touchHolographicMenu.js.map +1 -1
- package/3D/controls/touchMeshButton3D.js.map +1 -1
- package/3D/controls/volumeBasedPanel.js.map +1 -1
- package/3D/gizmos/gizmoHandle.js.map +1 -1
- package/3D/gizmos/slateGizmo.js.map +1 -1
- package/3D/gui3DManager.js.map +1 -1
- package/3D/materials/fluent/fluentMaterial.js.map +1 -1
- package/3D/materials/fluentBackplate/fluentBackplateMaterial.js.map +1 -1
- package/3D/materials/fluentButton/fluentButtonMaterial.js.map +1 -1
- package/3D/materials/handle/handleMaterial.js.map +1 -1
- package/3D/materials/mrdl/mrdlBackglowMaterial.js.map +1 -1
- package/3D/materials/mrdl/mrdlBackplateMaterial.js.map +1 -1
- package/3D/materials/mrdl/mrdlFrontplateMaterial.js.map +1 -1
- package/3D/materials/mrdl/mrdlInnerquadMaterial.js.map +1 -1
- package/3D/materials/mrdl/mrdlSliderBarMaterial.js.map +1 -1
- package/3D/materials/mrdl/mrdlSliderThumbMaterial.js.map +1 -1
- package/legacy/legacy.js.map +1 -1
- package/package.json +2 -2
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"holographicBackplate.js","sourceRoot":"","sources":["../../../../../dev/gui/src/3D/controls/holographicBackplate.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,sDAAwC;AAE5D,OAAO,EAAE,uBAAuB,EAAE,MAAM,sDAAsD,CAAC;AAC/F,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,+CAAiC;AAGvD;;;GAGG;AACH,MAAM,OAAO,oBAAqB,SAAQ,SAAS;IAa/C;;OAEG;IACH,IAAW,gBAAgB,CAAC,EAAU;QAClC,IAAI,CAAC,MAAM,CAAC,gBAAgB,GAAG,EAAE,CAAC;IACtC,CAAC;IACD,IAAW,gBAAgB;QACvB,OAAO,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC;IACxC,CAAC;IAED;;OAEG;IACH,IAAW,QAAQ;QACf,OAAO,IAAI,CAAC,SAAS,CAAC;IAC1B,CAAC;IAED;;OAEG;IACH,IAAW,cAAc;QACrB,OAAO,IAAI,CAAC,eAAe,CAAC;IAChC,CAAC;IAED;;;;OAIG;IACH,YACI,IAAa,EACL,kBAAkB,IAAI;QAE9B,KAAK,CAAC,IAAI,CAAC,CAAC;QAFJ,oBAAe,GAAf,eAAe,CAAO;IAGlC,CAAC;IAEkB,YAAY;QAC3B,OAAO,sBAAsB,CAAC;IAClC,CAAC;IAED,mBAAmB;IACA,WAAW,CAAC,KAAY;QACvC,MAAM,aAAa,GAAG,SAAS,CAC3B,CAAC,IAAI,CAAC,IAAI,IAAI,sBAAsB,CAAC,GAAG,gBAAgB,EACxD;YACI,KAAK,EAAE,GAAG;YACV,MAAM,EAAE,GAAG;YACX,KAAK,EAAE,GAAG;SACb,EACD,KAAK,CACR,CAAC;QACF,aAAa,CAAC,UAAU,GAAG,IAAI,CAAC;QAChC,aAAa,CAAC,UAAU,GAAG,CAAC,CAAC;QAE7B,WAAW,CAAC,eAAe,CAAC,SAAS,EAAE,oBAAoB,CAAC,cAAc,EAAE,oBAAoB,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE;YACpI,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;YACvC,aAAa,CAAC,IAAI,GAAG,GAAG,IAAI,CAAC,IAAI,aAAa,CAAC;YAC/C,aAAa,CAAC,UAAU,GAAG,KAAK,CAAC;YACjC,aAAa,CAAC,MAAM,GAAG,aAAa,CAAC;YACrC,IAAI,IAAI,CAAC,SAAS,EAAE;
|
1
|
+
{"version":3,"file":"holographicBackplate.js","sourceRoot":"","sources":["../../../../../dev/gui/src/3D/controls/holographicBackplate.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,sDAAwC;AAE5D,OAAO,EAAE,uBAAuB,EAAE,MAAM,sDAAsD,CAAC;AAC/F,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,+CAAiC;AAGvD;;;GAGG;AACH,MAAM,OAAO,oBAAqB,SAAQ,SAAS;IAa/C;;OAEG;IACH,IAAW,gBAAgB,CAAC,EAAU;QAClC,IAAI,CAAC,MAAM,CAAC,gBAAgB,GAAG,EAAE,CAAC;IACtC,CAAC;IACD,IAAW,gBAAgB;QACvB,OAAO,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC;IACxC,CAAC;IAED;;OAEG;IACH,IAAW,QAAQ;QACf,OAAO,IAAI,CAAC,SAAS,CAAC;IAC1B,CAAC;IAED;;OAEG;IACH,IAAW,cAAc;QACrB,OAAO,IAAI,CAAC,eAAe,CAAC;IAChC,CAAC;IAED;;;;OAIG;IACH,YACI,IAAa,EACL,kBAAkB,IAAI;QAE9B,KAAK,CAAC,IAAI,CAAC,CAAC;QAFJ,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vB,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,qBAAqB,CAAC,yBAAyB,CAAC,EAAE,CAAC;gBAC/D,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;gBAC3B,IAAI,CAAC,KAAK,CAAC,qBAAqB,CAAC,yBAAyB,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC;YACjF,CAAC;iBAAM,CAAC;gBACJ,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,qBAAqB,CAAC,yBAAyB,CAA4B,CAAC;YAC5G,CAAC;QACL,CAAC;aAAM,CAAC;YACJ,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;QAC/B,CAAC;IACL,CAAC;IAED;;OAEG;IACa,OAAO;QACnB,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,wCAAwC;QAEzD,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,CAAC;YACvB,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC;QAC7B,CAAC;QAED,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;IAC1B,CAAC;;AA7GD;;GAEG;AACW,mCAAc,GAAW,2CAA2C,CAAC;AACnF;;GAEG;AACW,mCAAc,GAAW,2BAA2B,CAAC","sourcesContent":["import type { TransformNode } from \"core/Meshes/transformNode\";\r\nimport type { Mesh } from \"core/Meshes/mesh\";\r\nimport { CreateBox } from \"core/Meshes/Builders/boxBuilder\";\r\nimport type { Scene } from \"core/scene\";\r\nimport { FluentBackplateMaterial } from \"../materials/fluentBackplate/fluentBackplateMaterial\";\r\nimport { Control3D } from \"./control3D\";\r\nimport { SceneLoader } from \"core/Loading/sceneLoader\";\r\nimport type { AbstractMesh } from \"core/Meshes/abstractMesh\";\r\n\r\n/**\r\n * Class used to create a holographic backplate in 3D\r\n * @since 5.0.0\r\n */\r\nexport class HolographicBackplate extends Control3D {\r\n /**\r\n * Base Url for the button model.\r\n */\r\n public static MODEL_BASE_URL: string = \"https://assets.babylonjs.com/meshes/MRTK/\";\r\n /**\r\n * File name for the button model.\r\n */\r\n public static MODEL_FILENAME: string = \"mrtk-fluent-backplate.glb\";\r\n\r\n private _model: AbstractMesh;\r\n private _material: FluentBackplateMaterial;\r\n\r\n /**\r\n * Rendering ground id of the backplate mesh.\r\n */\r\n public set renderingGroupId(id: number) {\r\n this._model.renderingGroupId = id;\r\n }\r\n public get renderingGroupId(): number {\r\n return this._model.renderingGroupId;\r\n }\r\n\r\n /**\r\n * Gets the material used by the backplate\r\n */\r\n public get material(): FluentBackplateMaterial {\r\n return this._material;\r\n }\r\n\r\n /**\r\n * Gets a boolean indicating if this backplate shares its material with other HolographicBackplates\r\n */\r\n public get shareMaterials(): boolean {\r\n return this._shareMaterials;\r\n }\r\n\r\n /**\r\n * Creates a new holographic backplate\r\n * @param name defines the control name\r\n * @param _shareMaterials\r\n */\r\n constructor(\r\n name?: string,\r\n private _shareMaterials = true\r\n ) {\r\n super(name);\r\n }\r\n\r\n protected override _getTypeName(): string {\r\n return \"HolographicBackplate\";\r\n }\r\n\r\n // Mesh association\r\n protected override _createNode(scene: Scene): TransformNode {\r\n const collisionMesh = CreateBox(\r\n (this.name ?? \"HolographicBackplate\") + \"_CollisionMesh\",\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 collisionMesh.isPickable = true;\r\n collisionMesh.visibility = 0;\r\n\r\n SceneLoader.ImportMeshAsync(undefined, HolographicBackplate.MODEL_BASE_URL, HolographicBackplate.MODEL_FILENAME, scene).then((result) => {\r\n const importedModel = result.meshes[1];\r\n importedModel.name = `${this.name}_frontPlate`;\r\n importedModel.isPickable = false;\r\n importedModel.parent = collisionMesh;\r\n if (this._material) {\r\n importedModel.material = this._material;\r\n }\r\n this._model = importedModel;\r\n });\r\n\r\n return collisionMesh;\r\n }\r\n\r\n private _createMaterial(mesh: Mesh) {\r\n this._material = new FluentBackplateMaterial(this.name + \" Material\", mesh.getScene());\r\n }\r\n\r\n protected override _affectMaterial(mesh: Mesh) {\r\n // Back\r\n if (this._shareMaterials) {\r\n if (!this._host._touchSharedMaterials[\"fluentBackplateMaterial\"]) {\r\n this._createMaterial(mesh);\r\n this._host._touchSharedMaterials[\"fluentBackplateMaterial\"] = this._material;\r\n } else {\r\n this._material = this._host._touchSharedMaterials[\"fluentBackplateMaterial\"] as FluentBackplateMaterial;\r\n }\r\n } else {\r\n this._createMaterial(mesh);\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(); // will dispose main mesh ie. back plate\r\n\r\n if (!this.shareMaterials) {\r\n this._material.dispose();\r\n }\r\n\r\n this._model.dispose();\r\n }\r\n}\r\n"]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"holographicButton.js","sourceRoot":"","sources":["../../../../../dev/gui/src/3D/controls/holographicButton.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAItC,OAAO,EAAE,OAAO,EAAE,6CAA+B;AACjD,OAAO,EAAE,gBAAgB,EAAE,sDAAwC;AAEnE,OAAO,EAAE,IAAI,EAAE,uCAAyB;AACxC,OAAO,EAAE,WAAW,EAAE,wDAA0C;AAChE,OAAO,EAAE,SAAS,EAAE,sDAAwC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,8DAAgD;AAG5E,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC1D,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AACxD,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AAEzE,OAAO,EAAE,MAAM,EAAE,4CAA8B;AAC/C,OAAO,EAAE,mBAAmB,EAAE,8CAAgC;AAE9D;;GAEG;AACH,MAAM,OAAO,iBA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C,cAAc,CAAC,OAAO,EAAE,CAAC;YAC9B,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,CAAC;YAE9B,IAAI,IAAI,CAAC,oBAAoB,EAAE;gBAC3B,IAAI,CAAC,KAAK,CAAC,8BAA8B,CAAC,MAAM,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;gBAC5E,IAAI,CAAC,oBAAoB,GAAG,IAAI,CAAC;aACpC;SACJ;IACL,CAAC;CACJ","sourcesContent":["import { Button3D } from \"./button3D\";\r\n\r\nimport type { Nullable } from \"core/types\";\r\nimport type { Observer } from \"core/Misc/observable\";\r\nimport { Vector3 } from \"core/Maths/math.vector\";\r\nimport { StandardMaterial } from \"core/Materials/standardMaterial\";\r\nimport type { TransformNode } from \"core/Meshes/transformNode\";\r\nimport { Mesh } from \"core/Meshes/mesh\";\r\nimport { CreatePlane } from \"core/Meshes/Builders/planeBuilder\";\r\nimport { CreateBox } from \"core/Meshes/Builders/boxBuilder\";\r\nimport { FadeInOutBehavior } from \"core/Behaviors/Meshes/fadeInOutBehavior\";\r\nimport type { Scene } from \"core/scene\";\r\n\r\nimport { FluentMaterial } from \"../materials/fluent/fluentMaterial\";\r\nimport { StackPanel } from \"../../2D/controls/stackPanel\";\r\nimport { Image } from \"../../2D/controls/image\";\r\nimport { TextBlock } from \"../../2D/controls/textBlock\";\r\nimport { AdvancedDynamicTexture } from \"../../2D/advancedDynamicTexture\";\r\nimport type { Control3D } from \"./control3D\";\r\nimport { Color3 } from \"core/Maths/math.color\";\r\nimport { IsDocumentAvailable } from \"core/Misc/domManagement\";\r\n\r\n/**\r\n * Class used to create a holographic button in 3D\r\n */\r\nexport class HolographicButton extends Button3D {\r\n private _backPlate: Mesh;\r\n private _textPlate: Mesh;\r\n private _frontPlate: Mesh;\r\n private _text: string;\r\n private _imageUrl: string;\r\n private _shareMaterials = true;\r\n private _frontMaterial: FluentMaterial;\r\n private _backMaterial: FluentMaterial;\r\n private _plateMaterial: StandardMaterial;\r\n private _pickedPointObserver: Nullable<Observer<Nullable<Vector3>>>;\r\n\r\n // Tooltip\r\n private _tooltipFade: Nullable<FadeInOutBehavior>;\r\n private _tooltipTextBlock: Nullable<TextBlock>;\r\n private _tooltipTexture: Nullable<AdvancedDynamicTexture>;\r\n private _tooltipMesh: Nullable<Mesh>;\r\n private _tooltipHoverObserver: Nullable<Observer<Control3D>>;\r\n private _tooltipOutObserver: Nullable<Observer<Control3D>>;\r\n\r\n private _disposeTooltip() {\r\n this._tooltipFade = null;\r\n if (this._tooltipTextBlock) {\r\n this._tooltipTextBlock.dispose();\r\n }\r\n if (this._tooltipTexture) {\r\n this._tooltipTexture.dispose();\r\n }\r\n if (this._tooltipMesh) {\r\n this._tooltipMesh.dispose();\r\n }\r\n this.onPointerEnterObservable.remove(this._tooltipHoverObserver);\r\n this.onPointerOutObservable.remove(this._tooltipOutObserver);\r\n }\r\n\r\n /**\r\n * Rendering ground id of all the mesh in the button\r\n */\r\n public set renderingGroupId(id: number) {\r\n this._backPlate.renderingGroupId = id;\r\n this._textPlate.renderingGroupId = id;\r\n this._frontPlate.renderingGroupId = id;\r\n\r\n if (this._tooltipMesh) {\r\n this._tooltipMesh.renderingGroupId = id;\r\n }\r\n }\r\n public get renderingGroupId(): number {\r\n return this._backPlate.renderingGroupId;\r\n }\r\n\r\n /**\r\n * Text to be displayed on the tooltip shown when hovering on the button. When set to null tooltip is disabled. (Default: null)\r\n */\r\n public set tooltipText(text: Nullable<string>) {\r\n if (!text) {\r\n this._disposeTooltip();\r\n return;\r\n }\r\n if (!this._tooltipFade) {\r\n const rightHandedScene = this._backPlate._scene.useRightHandedSystem;\r\n // Create tooltip with mesh and text\r\n this._tooltipMesh = CreatePlane(\"\", { size: 1 }, this._backPlate._scene);\r\n const tooltipBackground = CreatePlane(\"\", { size: 1, sideOrientation: Mesh.DOUBLESIDE }, this._backPlate._scene);\r\n const mat = new StandardMaterial(\"\", this._backPlate._scene);\r\n mat.diffuseColor = Color3.FromHexString(\"#212121\");\r\n tooltipBackground.material = mat;\r\n tooltipBackground.isPickable = false;\r\n this._tooltipMesh.addChild(tooltipBackground);\r\n tooltipBackground.position = Vector3.Forward(rightHandedScene).scale(0.05);\r\n this._tooltipMesh.scaling.y = 1 / 3;\r\n this._tooltipMesh.position = Vector3.Up().scale(0.7).add(Vector3.Forward(rightHandedScene).scale(-0.15));\r\n this._tooltipMesh.isPickable = false;\r\n this._tooltipMesh.parent = this._backPlate;\r\n\r\n // Create text texture for the tooltip\r\n this._tooltipTexture = AdvancedDynamicTexture.CreateForMesh(this._tooltipMesh);\r\n this._tooltipTextBlock = new TextBlock();\r\n this._tooltipTextBlock.scaleY = 3;\r\n this._tooltipTextBlock.color = \"white\";\r\n this._tooltipTextBlock.fontSize = 130;\r\n this._tooltipTexture.addControl(this._tooltipTextBlock);\r\n\r\n // Add hover action to tooltip\r\n this._tooltipFade = new FadeInOutBehavior();\r\n this._tooltipFade.delay = 500;\r\n this._tooltipMesh.addBehavior(this._tooltipFade);\r\n this._tooltipHoverObserver = this.onPointerEnterObservable.add(() => {\r\n if (this._tooltipFade) {\r\n this._tooltipFade.fadeIn(true);\r\n }\r\n });\r\n this._tooltipOutObserver = this.onPointerOutObservable.add(() => {\r\n if (this._tooltipFade) {\r\n this._tooltipFade.fadeIn(false);\r\n }\r\n });\r\n }\r\n if (this._tooltipTextBlock) {\r\n this._tooltipTextBlock.text = text;\r\n }\r\n }\r\n\r\n public get tooltipText() {\r\n if (this._tooltipTextBlock) {\r\n return this._tooltipTextBlock.text;\r\n }\r\n return null;\r\n }\r\n\r\n /**\r\n * Gets or sets text for the button\r\n */\r\n public get text(): string {\r\n return this._text;\r\n }\r\n\r\n public set text(value: string) {\r\n if (this._text === value) {\r\n return;\r\n }\r\n\r\n this._text = value;\r\n this._rebuildContent();\r\n }\r\n\r\n /**\r\n * Gets or sets the image url for the button\r\n */\r\n public get imageUrl(): string {\r\n return this._imageUrl;\r\n }\r\n\r\n public set imageUrl(value: string) {\r\n if (this._imageUrl === value) {\r\n return;\r\n }\r\n\r\n this._imageUrl = value;\r\n this._rebuildContent();\r\n }\r\n\r\n /**\r\n * Gets the back material used by this button\r\n */\r\n public get backMaterial(): FluentMaterial {\r\n return this._backMaterial;\r\n }\r\n\r\n /**\r\n * Gets the front material used by this button\r\n */\r\n public get frontMaterial(): FluentMaterial {\r\n return this._frontMaterial;\r\n }\r\n\r\n /**\r\n * Gets the plate material used by this button\r\n */\r\n public get plateMaterial(): StandardMaterial {\r\n return this._plateMaterial;\r\n }\r\n\r\n /**\r\n * Gets a boolean indicating if this button shares its material with other HolographicButtons\r\n */\r\n public get shareMaterials(): boolean {\r\n return this._shareMaterials;\r\n }\r\n\r\n /**\r\n * Creates a new button\r\n * @param name defines the control name\r\n * @param shareMaterials\r\n */\r\n constructor(name?: string, shareMaterials = true) {\r\n super(name);\r\n\r\n this._shareMaterials = shareMaterials;\r\n\r\n // Default animations\r\n this.pointerEnterAnimation = () => {\r\n if (!this.mesh) {\r\n return;\r\n }\r\n this._frontPlate.setEnabled(true);\r\n };\r\n\r\n this.pointerOutAnimation = () => {\r\n if (!this.mesh) {\r\n return;\r\n }\r\n this._frontPlate.setEnabled(false);\r\n };\r\n }\r\n\r\n protected override _getTypeName(): string {\r\n return \"HolographicButton\";\r\n }\r\n\r\n private _rebuildContent(): void {\r\n this._disposeFacadeTexture();\r\n\r\n const panel = new StackPanel();\r\n panel.isVertical = true;\r\n\r\n if (IsDocumentAvailable() && !!document.createElement) {\r\n if (this._imageUrl) {\r\n const image = new Image();\r\n image.source = this._imageUrl;\r\n image.paddingTop = \"40px\";\r\n image.height = \"180px\";\r\n image.width = \"100px\";\r\n image.paddingBottom = \"40px\";\r\n panel.addControl(image);\r\n }\r\n }\r\n\r\n if (this._text) {\r\n const text = new TextBlock();\r\n text.text = this._text;\r\n text.color = \"white\";\r\n text.height = \"30px\";\r\n text.fontSize = 24;\r\n panel.addControl(text);\r\n }\r\n\r\n if (this._frontPlate) {\r\n this.content = panel;\r\n }\r\n }\r\n\r\n // Mesh association\r\n protected override _createNode(scene: Scene): TransformNode {\r\n this._backPlate = CreateBox(\r\n this.name + \"BackMesh\",\r\n {\r\n width: 1.0,\r\n height: 1.0,\r\n depth: 0.08,\r\n },\r\n scene\r\n );\r\n\r\n this._frontPlate = CreateBox(\r\n this.name + \"FrontMesh\",\r\n {\r\n width: 1.0,\r\n height: 1.0,\r\n depth: 0.08,\r\n },\r\n scene\r\n );\r\n\r\n this._frontPlate.parent = this._backPlate;\r\n this._frontPlate.position = Vector3.Forward(scene.useRightHandedSystem).scale(-0.08);\r\n this._frontPlate.isPickable = false;\r\n this._frontPlate.setEnabled(false);\r\n\r\n this._textPlate = <Mesh>super._createNode(scene);\r\n this._textPlate.parent = this._backPlate;\r\n this._textPlate.position = Vector3.Forward(scene.useRightHandedSystem).scale(-0.08);\r\n this._textPlate.isPickable = false;\r\n\r\n return this._backPlate;\r\n }\r\n\r\n protected override _applyFacade(facadeTexture: AdvancedDynamicTexture) {\r\n this._plateMaterial.emissiveTexture = facadeTexture;\r\n this._plateMaterial.opacityTexture = facadeTexture;\r\n }\r\n\r\n private _createBackMaterial(mesh: Mesh) {\r\n this._backMaterial = new FluentMaterial(this.name + \"Back Material\", mesh.getScene());\r\n this._backMaterial.renderHoverLight = true;\r\n this._pickedPointObserver = this._host.onPickedPointChangedObservable.add((pickedPoint) => {\r\n if (pickedPoint) {\r\n this._backMaterial.hoverPosition = pickedPoint;\r\n this._backMaterial.hoverColor.a = 1.0;\r\n } else {\r\n this._backMaterial.hoverColor.a = 0;\r\n }\r\n });\r\n }\r\n\r\n private _createFrontMaterial(mesh: Mesh) {\r\n this._frontMaterial = new FluentMaterial(this.name + \"Front Material\", mesh.getScene());\r\n this._frontMaterial.innerGlowColorIntensity = 0; // No inner glow\r\n this._frontMaterial.alpha = 0.5; // Additive\r\n this._frontMaterial.renderBorders = true;\r\n }\r\n\r\n private _createPlateMaterial(mesh: Mesh) {\r\n this._plateMaterial = new StandardMaterial(this.name + \"Plate Material\", mesh.getScene());\r\n this._plateMaterial.specularColor = Color3.Black();\r\n }\r\n\r\n protected override _affectMaterial(mesh: Mesh) {\r\n // Back\r\n if (this._shareMaterials) {\r\n if (!this._host._sharedMaterials[\"backFluentMaterial\"]) {\r\n this._createBackMaterial(mesh);\r\n this._host._sharedMaterials[\"backFluentMaterial\"] = this._backMaterial;\r\n } else {\r\n this._backMaterial = this._host._sharedMaterials[\"backFluentMaterial\"] as FluentMaterial;\r\n }\r\n\r\n // Front\r\n if (!this._host._sharedMaterials[\"frontFluentMaterial\"]) {\r\n this._createFrontMaterial(mesh);\r\n this._host._sharedMaterials[\"frontFluentMaterial\"] = this._frontMaterial;\r\n } else {\r\n this._frontMaterial = this._host._sharedMaterials[\"frontFluentMaterial\"] as FluentMaterial;\r\n }\r\n } else {\r\n this._createBackMaterial(mesh);\r\n this._createFrontMaterial(mesh);\r\n }\r\n\r\n this._createPlateMaterial(mesh);\r\n this._backPlate.material = this._backMaterial;\r\n this._frontPlate.material = this._frontMaterial;\r\n this._textPlate.material = this._plateMaterial;\r\n\r\n this._rebuildContent();\r\n }\r\n\r\n /**\r\n * Releases all associated resources\r\n */\r\n public override dispose() {\r\n super.dispose(); // will dispose main mesh ie. back plate\r\n\r\n this._disposeTooltip();\r\n\r\n if (!this.shareMaterials) {\r\n this._backMaterial.dispose();\r\n this._frontMaterial.dispose();\r\n this._plateMaterial.dispose();\r\n\r\n if (this._pickedPointObserver) {\r\n this._host.onPickedPointChangedObservable.remove(this._pickedPointObserver);\r\n this._pickedPointObserver = null;\r\n }\r\n }\r\n }\r\n}\r\n"]}
|
1
|
+
{"version":3,"file":"holographicButton.js","sourceRoot":"","sources":["../../../../../dev/gui/src/3D/controls/holographicButton.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAItC,OAAO,EAAE,OAAO,EAAE,6CAA+B;AACjD,OAAO,EAAE,gBAAgB,EAAE,sDAAwC;AAEnE,OAAO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AAqB,CAAC,GAAG,IAAI,CAAC,cAAc,CAAC;YAC7E,CAAC;iBAAM,CAAC;gBACJ,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,qBAAqB,CAAmB,CAAC;YAC/F,CAAC;QACL,CAAC;aAAM,CAAC;YACJ,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC;YAC/B,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,CAAC;QACpC,CAAC;QAED,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,CAAC;QAChC,IAAI,CAAC,UAAU,CAAC,QAAQ,GAAG,IAAI,CAAC,aAAa,CAAC;QAC9C,IAAI,CAAC,WAAW,CAAC,QAAQ,GAAG,IAAI,CAAC,cAAc,CAAC;QAChD,IAAI,CAAC,UAAU,CAAC,QAAQ,GAAG,IAAI,CAAC,cAAc,CAAC;QAE/C,IAAI,CAAC,eAAe,EAAE,CAAC;IAC3B,CAAC;IAED;;OAEG;IACa,OAAO;QACnB,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,wCAAwC;QAEzD,IAAI,CAAC,eAAe,EAAE,CAAC;QAEvB,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,CAAC;YACvB,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE,CAAC;YAC7B,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,CAAC;YAC9B,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,CAAC;YAE9B,IAAI,IAAI,CAAC,oBAAoB,EAAE,CAAC;gBAC5B,IAAI,CAAC,KAAK,CAAC,8BAA8B,CAAC,MAAM,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;gBAC5E,IAAI,CAAC,oBAAoB,GAAG,IAAI,CAAC;YACrC,CAAC;QACL,CAAC;IACL,CAAC;CACJ","sourcesContent":["import { Button3D } from \"./button3D\";\r\n\r\nimport type { Nullable } from \"core/types\";\r\nimport type { Observer } from \"core/Misc/observable\";\r\nimport { Vector3 } from \"core/Maths/math.vector\";\r\nimport { StandardMaterial } from \"core/Materials/standardMaterial\";\r\nimport type { TransformNode } from \"core/Meshes/transformNode\";\r\nimport { Mesh } from \"core/Meshes/mesh\";\r\nimport { CreatePlane } from \"core/Meshes/Builders/planeBuilder\";\r\nimport { CreateBox } from \"core/Meshes/Builders/boxBuilder\";\r\nimport { FadeInOutBehavior } from \"core/Behaviors/Meshes/fadeInOutBehavior\";\r\nimport type { Scene } from \"core/scene\";\r\n\r\nimport { FluentMaterial } from \"../materials/fluent/fluentMaterial\";\r\nimport { StackPanel } from \"../../2D/controls/stackPanel\";\r\nimport { Image } from \"../../2D/controls/image\";\r\nimport { TextBlock } from \"../../2D/controls/textBlock\";\r\nimport { AdvancedDynamicTexture } from \"../../2D/advancedDynamicTexture\";\r\nimport type { Control3D } from \"./control3D\";\r\nimport { Color3 } from \"core/Maths/math.color\";\r\nimport { IsDocumentAvailable } from \"core/Misc/domManagement\";\r\n\r\n/**\r\n * Class used to create a holographic button in 3D\r\n */\r\nexport class HolographicButton extends Button3D {\r\n private _backPlate: Mesh;\r\n private _textPlate: Mesh;\r\n private _frontPlate: Mesh;\r\n private _text: string;\r\n private _imageUrl: string;\r\n private _shareMaterials = true;\r\n private _frontMaterial: FluentMaterial;\r\n private _backMaterial: FluentMaterial;\r\n private _plateMaterial: StandardMaterial;\r\n private _pickedPointObserver: Nullable<Observer<Nullable<Vector3>>>;\r\n\r\n // Tooltip\r\n private _tooltipFade: Nullable<FadeInOutBehavior>;\r\n private _tooltipTextBlock: Nullable<TextBlock>;\r\n private _tooltipTexture: Nullable<AdvancedDynamicTexture>;\r\n private _tooltipMesh: Nullable<Mesh>;\r\n private _tooltipHoverObserver: Nullable<Observer<Control3D>>;\r\n private _tooltipOutObserver: Nullable<Observer<Control3D>>;\r\n\r\n private _disposeTooltip() {\r\n this._tooltipFade = null;\r\n if (this._tooltipTextBlock) {\r\n this._tooltipTextBlock.dispose();\r\n }\r\n if (this._tooltipTexture) {\r\n this._tooltipTexture.dispose();\r\n }\r\n if (this._tooltipMesh) {\r\n this._tooltipMesh.dispose();\r\n }\r\n this.onPointerEnterObservable.remove(this._tooltipHoverObserver);\r\n this.onPointerOutObservable.remove(this._tooltipOutObserver);\r\n }\r\n\r\n /**\r\n * Rendering ground id of all the mesh in the button\r\n */\r\n public set renderingGroupId(id: number) {\r\n this._backPlate.renderingGroupId = id;\r\n this._textPlate.renderingGroupId = id;\r\n this._frontPlate.renderingGroupId = id;\r\n\r\n if (this._tooltipMesh) {\r\n this._tooltipMesh.renderingGroupId = id;\r\n }\r\n }\r\n public get renderingGroupId(): number {\r\n return this._backPlate.renderingGroupId;\r\n }\r\n\r\n /**\r\n * Text to be displayed on the tooltip shown when hovering on the button. When set to null tooltip is disabled. (Default: null)\r\n */\r\n public set tooltipText(text: Nullable<string>) {\r\n if (!text) {\r\n this._disposeTooltip();\r\n return;\r\n }\r\n if (!this._tooltipFade) {\r\n const rightHandedScene = this._backPlate._scene.useRightHandedSystem;\r\n // Create tooltip with mesh and text\r\n this._tooltipMesh = CreatePlane(\"\", { size: 1 }, this._backPlate._scene);\r\n const tooltipBackground = CreatePlane(\"\", { size: 1, sideOrientation: Mesh.DOUBLESIDE }, this._backPlate._scene);\r\n const mat = new StandardMaterial(\"\", this._backPlate._scene);\r\n mat.diffuseColor = Color3.FromHexString(\"#212121\");\r\n tooltipBackground.material = mat;\r\n tooltipBackground.isPickable = false;\r\n this._tooltipMesh.addChild(tooltipBackground);\r\n tooltipBackground.position = Vector3.Forward(rightHandedScene).scale(0.05);\r\n this._tooltipMesh.scaling.y = 1 / 3;\r\n this._tooltipMesh.position = Vector3.Up().scale(0.7).add(Vector3.Forward(rightHandedScene).scale(-0.15));\r\n this._tooltipMesh.isPickable = false;\r\n this._tooltipMesh.parent = this._backPlate;\r\n\r\n // Create text texture for the tooltip\r\n this._tooltipTexture = AdvancedDynamicTexture.CreateForMesh(this._tooltipMesh);\r\n this._tooltipTextBlock = new TextBlock();\r\n this._tooltipTextBlock.scaleY = 3;\r\n this._tooltipTextBlock.color = \"white\";\r\n this._tooltipTextBlock.fontSize = 130;\r\n this._tooltipTexture.addControl(this._tooltipTextBlock);\r\n\r\n // Add hover action to tooltip\r\n this._tooltipFade = new FadeInOutBehavior();\r\n this._tooltipFade.delay = 500;\r\n this._tooltipMesh.addBehavior(this._tooltipFade);\r\n this._tooltipHoverObserver = this.onPointerEnterObservable.add(() => {\r\n if (this._tooltipFade) {\r\n this._tooltipFade.fadeIn(true);\r\n }\r\n });\r\n this._tooltipOutObserver = this.onPointerOutObservable.add(() => {\r\n if (this._tooltipFade) {\r\n this._tooltipFade.fadeIn(false);\r\n }\r\n });\r\n }\r\n if (this._tooltipTextBlock) {\r\n this._tooltipTextBlock.text = text;\r\n }\r\n }\r\n\r\n public get tooltipText() {\r\n if (this._tooltipTextBlock) {\r\n return this._tooltipTextBlock.text;\r\n }\r\n return null;\r\n }\r\n\r\n /**\r\n * Gets or sets text for the button\r\n */\r\n public get text(): string {\r\n return this._text;\r\n }\r\n\r\n public set text(value: string) {\r\n if (this._text === value) {\r\n return;\r\n }\r\n\r\n this._text = value;\r\n this._rebuildContent();\r\n }\r\n\r\n /**\r\n * Gets or sets the image url for the button\r\n */\r\n public get imageUrl(): string {\r\n return this._imageUrl;\r\n }\r\n\r\n public set imageUrl(value: string) {\r\n if (this._imageUrl === value) {\r\n return;\r\n }\r\n\r\n this._imageUrl = value;\r\n this._rebuildContent();\r\n }\r\n\r\n /**\r\n * Gets the back material used by this button\r\n */\r\n public get backMaterial(): FluentMaterial {\r\n return this._backMaterial;\r\n }\r\n\r\n /**\r\n * Gets the front material used by this button\r\n */\r\n public get frontMaterial(): FluentMaterial {\r\n return this._frontMaterial;\r\n }\r\n\r\n /**\r\n * Gets the plate material used by this button\r\n */\r\n public get plateMaterial(): StandardMaterial {\r\n return this._plateMaterial;\r\n }\r\n\r\n /**\r\n * Gets a boolean indicating if this button shares its material with other HolographicButtons\r\n */\r\n public get shareMaterials(): boolean {\r\n return this._shareMaterials;\r\n }\r\n\r\n /**\r\n * Creates a new button\r\n * @param name defines the control name\r\n * @param shareMaterials\r\n */\r\n constructor(name?: string, shareMaterials = true) {\r\n super(name);\r\n\r\n this._shareMaterials = shareMaterials;\r\n\r\n // Default animations\r\n this.pointerEnterAnimation = () => {\r\n if (!this.mesh) {\r\n return;\r\n }\r\n this._frontPlate.setEnabled(true);\r\n };\r\n\r\n this.pointerOutAnimation = () => {\r\n if (!this.mesh) {\r\n return;\r\n }\r\n this._frontPlate.setEnabled(false);\r\n };\r\n }\r\n\r\n protected override _getTypeName(): string {\r\n return \"HolographicButton\";\r\n }\r\n\r\n private _rebuildContent(): void {\r\n this._disposeFacadeTexture();\r\n\r\n const panel = new StackPanel();\r\n panel.isVertical = true;\r\n\r\n if (IsDocumentAvailable() && !!document.createElement) {\r\n if (this._imageUrl) {\r\n const image = new Image();\r\n image.source = this._imageUrl;\r\n image.paddingTop = \"40px\";\r\n image.height = \"180px\";\r\n image.width = \"100px\";\r\n image.paddingBottom = \"40px\";\r\n panel.addControl(image);\r\n }\r\n }\r\n\r\n if (this._text) {\r\n const text = new TextBlock();\r\n text.text = this._text;\r\n text.color = \"white\";\r\n text.height = \"30px\";\r\n text.fontSize = 24;\r\n panel.addControl(text);\r\n }\r\n\r\n if (this._frontPlate) {\r\n this.content = panel;\r\n }\r\n }\r\n\r\n // Mesh association\r\n protected override _createNode(scene: Scene): TransformNode {\r\n this._backPlate = CreateBox(\r\n this.name + \"BackMesh\",\r\n {\r\n width: 1.0,\r\n height: 1.0,\r\n depth: 0.08,\r\n },\r\n scene\r\n );\r\n\r\n this._frontPlate = CreateBox(\r\n this.name + \"FrontMesh\",\r\n {\r\n width: 1.0,\r\n height: 1.0,\r\n depth: 0.08,\r\n },\r\n scene\r\n );\r\n\r\n this._frontPlate.parent = this._backPlate;\r\n this._frontPlate.position = Vector3.Forward(scene.useRightHandedSystem).scale(-0.08);\r\n this._frontPlate.isPickable = false;\r\n this._frontPlate.setEnabled(false);\r\n\r\n this._textPlate = <Mesh>super._createNode(scene);\r\n this._textPlate.parent = this._backPlate;\r\n this._textPlate.position = Vector3.Forward(scene.useRightHandedSystem).scale(-0.08);\r\n this._textPlate.isPickable = false;\r\n\r\n return this._backPlate;\r\n }\r\n\r\n protected override _applyFacade(facadeTexture: AdvancedDynamicTexture) {\r\n this._plateMaterial.emissiveTexture = facadeTexture;\r\n this._plateMaterial.opacityTexture = facadeTexture;\r\n }\r\n\r\n private _createBackMaterial(mesh: Mesh) {\r\n this._backMaterial = new FluentMaterial(this.name + \"Back Material\", mesh.getScene());\r\n this._backMaterial.renderHoverLight = true;\r\n this._pickedPointObserver = this._host.onPickedPointChangedObservable.add((pickedPoint) => {\r\n if (pickedPoint) {\r\n this._backMaterial.hoverPosition = pickedPoint;\r\n this._backMaterial.hoverColor.a = 1.0;\r\n } else {\r\n this._backMaterial.hoverColor.a = 0;\r\n }\r\n });\r\n }\r\n\r\n private _createFrontMaterial(mesh: Mesh) {\r\n this._frontMaterial = new FluentMaterial(this.name + \"Front Material\", mesh.getScene());\r\n this._frontMaterial.innerGlowColorIntensity = 0; // No inner glow\r\n this._frontMaterial.alpha = 0.5; // Additive\r\n this._frontMaterial.renderBorders = true;\r\n }\r\n\r\n private _createPlateMaterial(mesh: Mesh) {\r\n this._plateMaterial = new StandardMaterial(this.name + \"Plate Material\", mesh.getScene());\r\n this._plateMaterial.specularColor = Color3.Black();\r\n }\r\n\r\n protected override _affectMaterial(mesh: Mesh) {\r\n // Back\r\n if (this._shareMaterials) {\r\n if (!this._host._sharedMaterials[\"backFluentMaterial\"]) {\r\n this._createBackMaterial(mesh);\r\n this._host._sharedMaterials[\"backFluentMaterial\"] = this._backMaterial;\r\n } else {\r\n this._backMaterial = this._host._sharedMaterials[\"backFluentMaterial\"] as FluentMaterial;\r\n }\r\n\r\n // Front\r\n if (!this._host._sharedMaterials[\"frontFluentMaterial\"]) {\r\n this._createFrontMaterial(mesh);\r\n this._host._sharedMaterials[\"frontFluentMaterial\"] = this._frontMaterial;\r\n } else {\r\n this._frontMaterial = this._host._sharedMaterials[\"frontFluentMaterial\"] as FluentMaterial;\r\n }\r\n } else {\r\n this._createBackMaterial(mesh);\r\n this._createFrontMaterial(mesh);\r\n }\r\n\r\n this._createPlateMaterial(mesh);\r\n this._backPlate.material = this._backMaterial;\r\n this._frontPlate.material = this._frontMaterial;\r\n this._textPlate.material = this._plateMaterial;\r\n\r\n this._rebuildContent();\r\n }\r\n\r\n /**\r\n * Releases all associated resources\r\n */\r\n public override dispose() {\r\n super.dispose(); // will dispose main mesh ie. back plate\r\n\r\n this._disposeTooltip();\r\n\r\n if (!this.shareMaterials) {\r\n this._backMaterial.dispose();\r\n this._frontMaterial.dispose();\r\n this._plateMaterial.dispose();\r\n\r\n if (this._pickedPointObserver) {\r\n this._host.onPickedPointChangedObservable.remove(this._pickedPointObserver);\r\n this._pickedPointObserver = null;\r\n }\r\n }\r\n }\r\n}\r\n"]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"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,EAAgB,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,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,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;;AA7dD;;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 /**\r\n * If true, the content will be scaled to fit the dimensions of the slate\r\n */\r\n public fitContentToDimensions = false;\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.fitContentToDimensions ? this._contentScaleRatio : (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 = 0; // 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 if (this.fitContentToDimensions) {\r\n return;\r\n }\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 // only if position was not yet set!\r\n if (this.node.position.equalsToFloats(0, 0, 0)) {\r\n this.node.position.copyFrom(camera.position).subtractInPlace(backward).subtractInPlace(pivot);\r\n }\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
|
+
{"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,EAAgB,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;IA+ClD;;OAEG;IACH,IAAW,eAAe;QACtB,OAAO,IAAI,CAAC,gBAAgB,CAAC;IACjC,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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;;AA7dD;;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 /**\r\n * If true, the content will be scaled to fit the dimensions of the slate\r\n */\r\n public fitContentToDimensions = false;\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.fitContentToDimensions ? this._contentScaleRatio : (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 = 0; // 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 if (this.fitContentToDimensions) {\r\n return;\r\n }\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 // only if position was not yet set!\r\n if (this.node.position.equalsToFloats(0, 0, 0)) {\r\n this.node.position.copyFrom(camera.position).subtractInPlace(backward).subtractInPlace(pivot);\r\n }\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,Y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AAkB,GAAG,GAAG,EAAE;YAC3B,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;gBACb,OAAO;YACX,CAAC;YACD,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,GAAG,GAAG,IAAI,CAAC,CAAC;QAC/C,CAAC,CAAC;IACN,CAAC;IAEkB,YAAY;QAC3B,OAAO,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,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAK9D;;;GAGG;AACH,MAAM,OAAO,QAAS,SAAQ,oBAAoB;IAoB9C;;OAEG;IACH,IAAW,eAAe;QACtB,OAAO,IAAI,CAAC,gBAAgB,CAAC;IACjC,CAAC;IAGD;;OAEG;IACH,IAAW,QAAQ;QACf,OAAO,IAAI,CAAC,SAAS,CAAC;IAC1B,CAAC;IAED,IAAW,QAAQ,CAAC,KAAc;QAC9B,qFAAqF;QACrF,IAAI,IAAI,CAAC,UAAU,CAAC,SAAS,KAAK,KAAK,EAAE;
|
1
|
+
{"version":3,"file":"nearMenu.js","sourceRoot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AAS,GAAG,KAAK,CAAC;QAEvB,OAAO,IAAI,CAAC;IAChB,CAAC;IAEkB,gBAAgB;QAC/B,KAAK,CAAC,gBAAgB,EAAE,CAAC;QAEzB,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,GAAG,oBAAoB,CAAC,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;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":"planePanel.js","sourceRoot":"","sources":["../../../../../dev/gui/src/3D/controls/planePanel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,6CAA+B;AAE7D,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD;;GAEG;AACH,MAAM,OAAO,UAAW,SAAQ,gBAAgB;IAClC,YAAY,CAAC,OAAkB,EAAE,YAAqB;QAC5D,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;QAE1B,IAAI,CAAC,IAAI,EAAE;
|
1
|
+
{"version":3,"file":"planePanel.js","sourceRoot":"","sources":["../../../../../dev/gui/src/3D/controls/planePanel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,6CAA+B;AAE7D,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD;;GAEG;AACH,MAAM,OAAO,UAAW,SAAQ,gBAAgB;IAClC,YAAY,CAAC,OAAkB,EAAE,YAAqB;QAC5D,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;QAE1B,IAAI,CAAC,IAAI,EAAE,CAAC;YACR,OAAO;QACX,CAAC;QAED,OAAO,CAAC,QAAQ,GAAG,YAAY,CAAC,KAAK,EAAE,CAAC;QACxC,MAAM,MAAM,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QAErC,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;QAE9B,QAAQ,IAAI,CAAC,WAAW,EAAE,CAAC;YACvB,KAAK,WAAW,CAAC,sBAAsB,CAAC;YACxC,KAAK,WAAW,CAAC,uBAAuB;gBACpC,MAAM,CAAC,UAAU,CAAC,IAAI,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;gBACxC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;gBACpB,MAAM;YACV,KAAK,WAAW,CAAC,+BAA+B,CAAC;YACjD,KAAK,WAAW,CAAC,8BAA8B;gBAC3C,MAAM,CAAC,UAAU,CAAC,IAAI,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;gBACzC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;gBACpB,MAAM;QACd,CAAC;IACL,CAAC;CACJ","sourcesContent":["import { TmpVectors, Vector3 } from \"core/Maths/math.vector\";\r\n\r\nimport { Container3D } from \"./container3D\";\r\nimport type { Control3D } from \"./control3D\";\r\nimport { VolumeBasedPanel } from \"./volumeBasedPanel\";\r\n\r\n/**\r\n * Class used to create a container panel deployed on the surface of a plane\r\n */\r\nexport class PlanePanel extends VolumeBasedPanel {\r\n protected _mapGridNode(control: Control3D, nodePosition: Vector3) {\r\n const mesh = control.mesh;\r\n\r\n if (!mesh) {\r\n return;\r\n }\r\n\r\n control.position = nodePosition.clone();\r\n const target = TmpVectors.Vector3[0];\r\n\r\n target.copyFrom(nodePosition);\r\n\r\n switch (this.orientation) {\r\n case Container3D.FACEORIGIN_ORIENTATION:\r\n case Container3D.FACEFORWARD_ORIENTATION:\r\n target.addInPlace(new Vector3(0, 0, 1));\r\n mesh.lookAt(target);\r\n break;\r\n case Container3D.FACEFORWARDREVERSED_ORIENTATION:\r\n case Container3D.FACEORIGINREVERSED_ORIENTATION:\r\n target.addInPlace(new Vector3(0, 0, -1));\r\n mesh.lookAt(target);\r\n break;\r\n }\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,gBAA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,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,CAAC;4BAC3C,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;wBACnD,CAAC;oBACL,CAAC;gBACL,CAAC;YACL,CAAC;QACL,CAAC;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,CAAC;QAThB,sDAAsD;QAC/C,6BAAwB,GAAG,IAAI,UAAU,EAAU,CAAC;QASvD,IAAI,CAAC,uBAAuB,GAAG,sBAAsB,IAAI,KA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I,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
|
+
{"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,GAAG,IAAI,UAAU,EAAU,CAAC;QASvD,IAAI,CAAC,uBAAuB,GAAG,sBAAsB,IAAI,KAAK,CAAC;QAE/D,IAA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;QAC3B,IAAI,CAAC,YAAY,EAAE,OAAO,EAAE,CAAC;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 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"]}
|