@babylonjs/gui 6.38.1 → 6.40.0
Sign up to get free protection for your applications and to get access to all the features.
- package/2D/advancedDynamicTexture.d.ts +1 -1
- package/2D/advancedDynamicTexture.js +2 -1
- package/2D/advancedDynamicTexture.js.map +1 -1
- package/2D/controls/button.d.ts +2 -5
- package/2D/controls/button.js +6 -6
- package/2D/controls/button.js.map +1 -1
- package/2D/controls/container.d.ts +6 -1
- package/2D/controls/container.js +31 -5
- package/2D/controls/container.js.map +1 -1
- package/2D/controls/control.d.ts +9 -1
- package/2D/controls/control.js +16 -2
- package/2D/controls/control.js.map +1 -1
- package/2D/controls/focusableButton.d.ts +1 -1
- package/2D/controls/focusableButton.js +1 -1
- package/2D/controls/focusableButton.js.map +1 -1
- package/2D/controls/gradient/BaseGradient.d.ts +17 -5
- package/2D/controls/gradient/BaseGradient.js +17 -5
- package/2D/controls/gradient/BaseGradient.js.map +1 -1
- package/2D/controls/grid.d.ts +2 -1
- package/2D/controls/grid.js +6 -2
- package/2D/controls/grid.js.map +1 -1
- package/2D/controls/image.d.ts +2 -1
- package/2D/controls/image.js +2 -1
- package/2D/controls/image.js.map +1 -1
- package/2D/controls/inputText.js +2 -0
- package/2D/controls/inputText.js.map +1 -1
- package/2D/controls/stackPanel.d.ts +2 -1
- package/2D/controls/stackPanel.js +6 -2
- package/2D/controls/stackPanel.js.map +1 -1
- package/2D/xmlLoader.js +9 -0
- package/2D/xmlLoader.js.map +1 -1
- package/3D/controls/button3D.d.ts +1 -0
- package/3D/controls/button3D.js +1 -0
- package/3D/controls/button3D.js.map +1 -1
- package/3D/controls/control3D.d.ts +1 -1
- package/3D/controls/control3D.js +1 -1
- package/3D/controls/control3D.js.map +1 -1
- package/3D/controls/holographicSlate.d.ts +1 -1
- package/3D/controls/holographicSlate.js +1 -1
- package/3D/controls/holographicSlate.js.map +1 -1
- package/3D/controls/touchHolographicMenu.d.ts +2 -2
- package/3D/controls/touchHolographicMenu.js +2 -2
- package/3D/controls/touchHolographicMenu.js.map +1 -1
- package/package.json +2 -2
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"touchHolographicMenu.js","sourceRoot":"","sources":["../../../../../dev/gui/src/3D/controls/touchHolographicMenu.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,IAAI,EAAE,uCAAyB;AACxC,OAAO,EAAE,SAAS,EAAE,sDAAwC;AAE5D,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAE,MAAM,EAAE,4CAA8B;AAE/C,OAAO,EAAE,MAAM,EAAE,uCAAyB;AAI1C;;GAEG;AACH,MAAM,OAAO,oBAAqB,SAAQ,gBAAgB;IAgBtD;;;OAGG;IACH,IAAW,eAAe;QACtB,OAAO,IAAI,CAAC,gBAAgB,CAAC;IACjC,CAAC;IAED,IAAW,eAAe,CAAC,KAAa;QACpC,IAAI,CAAC,gBAAgB,GAAG,KAAK,CAAC;QAE9B,IAAI,IAAI,CAAC,SAAS,CAAC,MAAM,IAAI,CAAC,EAAE;YAC5B,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;gBAC9B,IAAI,CAAC,oBAAoB,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;YAChD,CAAC,CAAC,CAAC;YAEH,IAAI,CAAC,cAAc,EAAE,CAAC;SACzB;IACL,CAAC;IAES,WAAW,CAAC,KAAY;QAC9B,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,QAAQ,IAAI,CAAC,IAAI,EAAE,EAAE,KAAK,CAAC,CAAC;QAElD,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;QACzE,IAAI,CAAC,UAAU,CAAC,MAAM,GAAG,IAAI,CAAC;QAE9B,OAAO,IAAI,CAAC;IAChB,CAAC;IAES,eAA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","sourcesContent":["import type { Scene } from \"core/scene\";\r\nimport type { Vector3 } from \"core/Maths/math.vector\";\r\nimport type { TransformNode } from \"core/Meshes/transformNode\";\r\nimport type { Nullable } from \"core/types\";\r\nimport type { Control3D } from \"./control3D\";\r\nimport { VolumeBasedPanel } from \"./volumeBasedPanel\";\r\nimport { Mesh } from \"core/Meshes/mesh\";\r\nimport { CreateBox } from \"core/Meshes/Builders/boxBuilder\";\r\nimport type { AbstractMesh } from \"core/Meshes/abstractMesh\";\r\nimport { FluentMaterial } from \"../materials/fluent/fluentMaterial\";\r\nimport { Color3 } from \"core/Maths/math.color\";\r\nimport type { Observer } from \"core/Misc/observable\";\r\nimport { Logger } from \"core/Misc/logger\";\r\nimport type { Container3D } from \"./container3D\";\r\nimport type { TouchHolographicButton } from \"./touchHolographicButton\";\r\n\r\n/**\r\n * Simple menu that can contain holographic buttons\r\n */\r\nexport class TouchHolographicMenu extends VolumeBasedPanel {\r\n protected _backPlate: Mesh;\r\n private _backPlateMaterial: FluentMaterial;\r\n private _pickedPointObserver: Nullable<Observer<Nullable<Vector3>>>;\r\n\r\n private _currentMin: Nullable<Vector3>;\r\n private _currentMax: Nullable<Vector3>;\r\n\r\n private _backPlateMargin = 1.25;\r\n\r\n /**\r\n * Scale for the buttons added to the menu\r\n */\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n protected static MENU_BUTTON_SCALE: number = 1;\r\n\r\n /**\r\n * Gets or sets the margin size of the backplate in button size units.\r\n * Setting this to 1, will make the backPlate margin the size of 1 button\r\n */\r\n public get backPlateMargin(): number {\r\n return this._backPlateMargin;\r\n }\r\n\r\n public set backPlateMargin(value: number) {\r\n this._backPlateMargin = value;\r\n\r\n if (this._children.length >= 1) {\r\n this.children.forEach((control) => {\r\n this._updateCurrentMinMax(control.position);\r\n });\r\n\r\n this._updateMargins();\r\n }\r\n }\r\n\r\n protected _createNode(scene: Scene): Nullable<TransformNode> {\r\n const node = new Mesh(`menu_${this.name}`, scene);\r\n\r\n this._backPlate = CreateBox(\"backPlate\" + this.name, { size: 1 }, scene);\r\n this._backPlate.parent = node;\r\n\r\n return node;\r\n }\r\n\r\n protected _affectMaterial(mesh: AbstractMesh) {\r\n this._backPlateMaterial = new FluentMaterial(this.name + \"backPlateMaterial\", mesh.getScene());\r\n this._backPlateMaterial.albedoColor = new Color3(0.08, 0.15, 0.55);\r\n this._backPlateMaterial.renderBorders = true;\r\n this._backPlateMaterial.renderHoverLight = true;\r\n\r\n this._pickedPointObserver = this._host.onPickedPointChangedObservable.add((pickedPoint) => {\r\n if (pickedPoint) {\r\n this._backPlateMaterial.hoverPosition = pickedPoint;\r\n this._backPlateMaterial.hoverColor.a = 1.0;\r\n } else {\r\n this._backPlateMaterial.hoverColor.a = 0;\r\n }\r\n });\r\n\r\n this._backPlate.material = this._backPlateMaterial;\r\n }\r\n\r\n protected _mapGridNode(control: Control3D, nodePosition: Vector3) {\r\n // Simple plane mapping for the menu\r\n const mesh = control.mesh;\r\n\r\n if (!mesh) {\r\n return;\r\n }\r\n\r\n control.position = nodePosition.clone();\r\n\r\n this._updateCurrentMinMax(nodePosition);\r\n }\r\n\r\n protected _finalProcessing() {\r\n this._updateMargins();\r\n }\r\n\r\n private _updateCurrentMinMax(nodePosition: Vector3) {\r\n if (!this._currentMin) {\r\n this._currentMin = nodePosition.clone();\r\n this._currentMax = nodePosition.clone();\r\n }\r\n\r\n this._currentMin.minimizeInPlace(nodePosition);\r\n this._currentMax!.maximizeInPlace(nodePosition);\r\n }\r\n\r\n private _updateMargins() {\r\n if (this._children.length > 0) {\r\n this._currentMin!.addInPlaceFromFloats(-this._cellWidth / 2, -this._cellHeight / 2, 0);\r\n this._currentMax!.addInPlaceFromFloats(this._cellWidth / 2, this._cellHeight / 2, 0);\r\n const extendSize = this._currentMax!.subtract(this._currentMin!);\r\n\r\n // Also add a % margin\r\n this._backPlate.scaling.x = extendSize.x + this._cellWidth * this.backPlateMargin;\r\n this._backPlate.scaling.y = extendSize.y + this._cellHeight * this.backPlateMargin;\r\n this._backPlate.scaling.z = 0.001;\r\n\r\n for (let i = 0; i < this._children.length; i++) {\r\n this._children[i].position.subtractInPlace(this._currentMin!).subtractInPlace(extendSize.scale(0.5));\r\n this._children[i].position.z -= 0.01;\r\n }\r\n }\r\n\r\n this._currentMin = null;\r\n this._currentMax = null;\r\n }\r\n\r\n /**\r\n * Creates a holographic menu GUI 3D control\r\n * @param name name of the menu\r\n */\r\n constructor(name?: string) {\r\n super(name);\r\n }\r\n\r\n /**\r\n * Adds a button to the menu.\r\n * Please note that the back material of the button will be set to transparent as it is attached to the menu.\r\n *\r\n * @param button Button to add\r\n * @returns This menu\r\n */\r\n public addButton(button: TouchHolographicButton): TouchHolographicMenu {\r\n // Block updating the layout until the button is resized (which has to happen after node creation)\r\n const wasLayoutBlocked = this.blockLayout;\r\n if (!wasLayoutBlocked) {\r\n this.blockLayout = true;\r\n }\r\n\r\n super.addControl(button);\r\n\r\n button.isBackplateVisible = false;\r\n button.scaling.scaleInPlace(TouchHolographicMenu.MENU_BUTTON_SCALE);\r\n\r\n // Unblocking the layout triggers the pending layout update that uses the size of the buttons to determine the size of the backing mesh\r\n if (!wasLayoutBlocked) {\r\n this.blockLayout = false;\r\n }\r\n return this;\r\n }\r\n\r\n /**\r\n * This method should not be used directly. It is inherited from `Container3D`.\r\n * Please use `addButton` instead.\r\n * @param _control\r\n * @returns\r\n */\r\n public addControl(_control: Control3D): Container3D {\r\n Logger.Warn(\"TouchHolographicMenu can only contain buttons. Please use the method `addButton` instead.\");\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Disposes the menu\r\n */\r\n public dispose() {\r\n super.dispose();\r\n\r\n this._host.onPickedPointChangedObservable.remove(this._pickedPointObserver);\r\n }\r\n}\r\n"]}
|
1
|
+
{"version":3,"file":"touchHolographicMenu.js","sourceRoot":"","sources":["../../../../../dev/gui/src/3D/controls/touchHolographicMenu.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,gBAAgB,EAAE,MAAM,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;QAED,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;QACxB,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;IAC5B,CAAC;IAED;;;OAGG;IACH,YAAY,IAAa;QACrB,KAAK,CAAC,IAAI,CAAC,CAAC;QA5GR,qBAAgB,GAAG,IAAI,CAAC;IA6GhC,CAAC;IAED;;;;;;OAMG;IACI,SAAS,CAAC,MAA8B;QAC3C,kGAAkG;QAClG,MAAM,gBAAgB,GAAG,IAAI,CAAC,WAAW,CAAC;QAC1C,IAAI,CAAC,gBAAgB,EAAE;YACnB,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;SAC3B;QAED,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;QAEzB,MAAM,CAAC,kBAAkB,GAAG,KAAK,CAAC;QAClC,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,CAAC;QAEpE,uIAAuI;QACvI,IAAI,CAAC,gBAAgB,EAAE;YACnB,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC;SAC5B;QACD,OAAO,IAAI,CAAC;IAChB,CAAC;IAED;;;;;OAKG;IACI,UAAU,CAAC,QAAmB;QACjC,MAAM,CAAC,IAAI,CAAC,2FAA2F,CAAC,CAAC;QAEzG,OAAO,IAAI,CAAC;IAChB,CAAC;IAED;;OAEG;IACI,OAAO;QACV,KAAK,CAAC,OAAO,EAAE,CAAC;QAEhB,IAAI,CAAC,KAAK,CAAC,8BAA8B,CAAC,MAAM,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;IAChF,CAAC;;AA1JD;;GAEG;AACH,gEAAgE;AAC/C,sCAAiB,GAAW,CAAC,AAAZ,CAAa","sourcesContent":["import type { Scene } from \"core/scene\";\r\nimport type { Vector3 } from \"core/Maths/math.vector\";\r\nimport type { TransformNode } from \"core/Meshes/transformNode\";\r\nimport type { Nullable } from \"core/types\";\r\nimport type { Control3D } from \"./control3D\";\r\nimport { VolumeBasedPanel } from \"./volumeBasedPanel\";\r\nimport { Mesh } from \"core/Meshes/mesh\";\r\nimport { CreateBox } from \"core/Meshes/Builders/boxBuilder\";\r\nimport type { AbstractMesh } from \"core/Meshes/abstractMesh\";\r\nimport { FluentMaterial } from \"../materials/fluent/fluentMaterial\";\r\nimport { Color3 } from \"core/Maths/math.color\";\r\nimport type { Observer } from \"core/Misc/observable\";\r\nimport { Logger } from \"core/Misc/logger\";\r\nimport type { Container3D } from \"./container3D\";\r\nimport type { TouchHolographicButton } from \"./touchHolographicButton\";\r\n\r\n/**\r\n * Simple menu that can contain holographic buttons\r\n */\r\nexport class TouchHolographicMenu extends VolumeBasedPanel {\r\n protected _backPlate: Mesh;\r\n private _backPlateMaterial: FluentMaterial;\r\n private _pickedPointObserver: Nullable<Observer<Nullable<Vector3>>>;\r\n\r\n private _currentMin: Nullable<Vector3>;\r\n private _currentMax: Nullable<Vector3>;\r\n\r\n private _backPlateMargin = 1.25;\r\n\r\n /**\r\n * Scale for the buttons added to the menu\r\n */\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n protected static MENU_BUTTON_SCALE: number = 1;\r\n\r\n /**\r\n * Gets or sets the margin size of the backplate in button size units.\r\n * Setting this to 1, will make the backPlate margin the size of 1 button\r\n */\r\n public get backPlateMargin(): number {\r\n return this._backPlateMargin;\r\n }\r\n\r\n public set backPlateMargin(value: number) {\r\n this._backPlateMargin = value;\r\n\r\n if (this._children.length >= 1) {\r\n this.children.forEach((control) => {\r\n this._updateCurrentMinMax(control.position);\r\n });\r\n\r\n this._updateMargins();\r\n }\r\n }\r\n\r\n protected _createNode(scene: Scene): Nullable<TransformNode> {\r\n const node = new Mesh(`menu_${this.name}`, scene);\r\n\r\n this._backPlate = CreateBox(\"backPlate\" + this.name, { size: 1 }, scene);\r\n this._backPlate.parent = node;\r\n\r\n return node;\r\n }\r\n\r\n protected _affectMaterial(mesh: AbstractMesh) {\r\n this._backPlateMaterial = new FluentMaterial(this.name + \"backPlateMaterial\", mesh.getScene());\r\n this._backPlateMaterial.albedoColor = new Color3(0.08, 0.15, 0.55);\r\n this._backPlateMaterial.renderBorders = true;\r\n this._backPlateMaterial.renderHoverLight = true;\r\n\r\n this._pickedPointObserver = this._host.onPickedPointChangedObservable.add((pickedPoint) => {\r\n if (pickedPoint) {\r\n this._backPlateMaterial.hoverPosition = pickedPoint;\r\n this._backPlateMaterial.hoverColor.a = 1.0;\r\n } else {\r\n this._backPlateMaterial.hoverColor.a = 0;\r\n }\r\n });\r\n\r\n this._backPlate.material = this._backPlateMaterial;\r\n }\r\n\r\n protected _mapGridNode(control: Control3D, nodePosition: Vector3) {\r\n // Simple plane mapping for the menu\r\n const mesh = control.mesh;\r\n\r\n if (!mesh) {\r\n return;\r\n }\r\n\r\n control.position = nodePosition.clone();\r\n\r\n this._updateCurrentMinMax(nodePosition);\r\n }\r\n\r\n protected _finalProcessing() {\r\n this._updateMargins();\r\n }\r\n\r\n private _updateCurrentMinMax(nodePosition: Vector3) {\r\n if (!this._currentMin) {\r\n this._currentMin = nodePosition.clone();\r\n this._currentMax = nodePosition.clone();\r\n }\r\n\r\n this._currentMin.minimizeInPlace(nodePosition);\r\n this._currentMax!.maximizeInPlace(nodePosition);\r\n }\r\n\r\n private _updateMargins() {\r\n if (this._children.length > 0) {\r\n this._currentMin!.addInPlaceFromFloats(-this._cellWidth / 2, -this._cellHeight / 2, 0);\r\n this._currentMax!.addInPlaceFromFloats(this._cellWidth / 2, this._cellHeight / 2, 0);\r\n const extendSize = this._currentMax!.subtract(this._currentMin!);\r\n\r\n // Also add a % margin\r\n this._backPlate.scaling.x = extendSize.x + this._cellWidth * this.backPlateMargin;\r\n this._backPlate.scaling.y = extendSize.y + this._cellHeight * this.backPlateMargin;\r\n this._backPlate.scaling.z = 0.001;\r\n\r\n for (let i = 0; i < this._children.length; i++) {\r\n this._children[i].position.subtractInPlace(this._currentMin!).subtractInPlace(extendSize.scale(0.5));\r\n this._children[i].position.z -= 0.01;\r\n }\r\n }\r\n\r\n this._currentMin = null;\r\n this._currentMax = null;\r\n }\r\n\r\n /**\r\n * Creates a holographic menu GUI 3D control\r\n * @param name name of the menu\r\n */\r\n constructor(name?: string) {\r\n super(name);\r\n }\r\n\r\n /**\r\n * Adds a button to the menu.\r\n * Please note that the back material of the button will be set to transparent as it is attached to the menu.\r\n *\r\n * @param button Button to add\r\n * @returns This menu\r\n */\r\n public addButton(button: TouchHolographicButton): TouchHolographicMenu {\r\n // Block updating the layout until the button is resized (which has to happen after node creation)\r\n const wasLayoutBlocked = this.blockLayout;\r\n if (!wasLayoutBlocked) {\r\n this.blockLayout = true;\r\n }\r\n\r\n super.addControl(button);\r\n\r\n button.isBackplateVisible = false;\r\n button.scaling.scaleInPlace(TouchHolographicMenu.MENU_BUTTON_SCALE);\r\n\r\n // Unblocking the layout triggers the pending layout update that uses the size of the buttons to determine the size of the backing mesh\r\n if (!wasLayoutBlocked) {\r\n this.blockLayout = false;\r\n }\r\n return this;\r\n }\r\n\r\n /**\r\n * This method should not be used directly. It is inherited from `Container3D`.\r\n * Please use `addButton` instead.\r\n * @param _control the control to add\r\n * @returns the current container\r\n */\r\n public addControl(_control: Control3D): Container3D {\r\n Logger.Warn(\"TouchHolographicMenu can only contain buttons. Please use the method `addButton` instead.\");\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Disposes the menu\r\n */\r\n public dispose() {\r\n super.dispose();\r\n\r\n this._host.onPickedPointChangedObservable.remove(this._pickedPointObserver);\r\n }\r\n}\r\n"]}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@babylonjs/gui",
|
3
|
-
"version": "6.
|
3
|
+
"version": "6.40.0",
|
4
4
|
"main": "index.js",
|
5
5
|
"module": "index.js",
|
6
6
|
"types": "index.d.ts",
|
@@ -18,7 +18,7 @@
|
|
18
18
|
"postcompile": "build-tools -c add-js-to-es6"
|
19
19
|
},
|
20
20
|
"devDependencies": {
|
21
|
-
"@babylonjs/core": "^6.
|
21
|
+
"@babylonjs/core": "^6.40.0",
|
22
22
|
"@dev/build-tools": "^1.0.0",
|
23
23
|
"@lts/gui": "1.0.0"
|
24
24
|
},
|