@babylonjs/gui 5.21.0 → 5.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/2D/adtInstrumentation.js +70 -90
- package/2D/adtInstrumentation.js.map +1 -1
- package/2D/advancedDynamicTexture.d.ts +12 -0
- package/2D/advancedDynamicTexture.js +569 -622
- package/2D/advancedDynamicTexture.js.map +1 -1
- package/2D/controls/button.js +76 -90
- package/2D/controls/button.js.map +1 -1
- package/2D/controls/checkbox.js +86 -106
- package/2D/controls/checkbox.js.map +1 -1
- package/2D/controls/colorpicker.js +395 -415
- package/2D/controls/colorpicker.js.map +1 -1
- package/2D/controls/container.js +187 -230
- package/2D/controls/container.js.map +1 -1
- package/2D/controls/control.js +1067 -1353
- package/2D/controls/control.js.map +1 -1
- package/2D/controls/displayGrid.js +152 -196
- package/2D/controls/displayGrid.js.map +1 -1
- package/2D/controls/ellipse.js +32 -40
- package/2D/controls/ellipse.js.map +1 -1
- package/2D/controls/focusableButton.js +30 -35
- package/2D/controls/focusableButton.js.map +1 -1
- package/2D/controls/grid.js +172 -212
- package/2D/controls/grid.js.map +1 -1
- package/2D/controls/image.js +489 -592
- package/2D/controls/image.js.map +1 -1
- package/2D/controls/inputPassword.js +9 -16
- package/2D/controls/inputPassword.js.map +1 -1
- package/2D/controls/inputText.js +380 -467
- package/2D/controls/inputText.js.map +1 -1
- package/2D/controls/inputTextArea.js +234 -273
- package/2D/controls/inputTextArea.js.map +1 -1
- package/2D/controls/line.js +147 -198
- package/2D/controls/line.js.map +1 -1
- package/2D/controls/multiLine.js +87 -113
- package/2D/controls/multiLine.js.map +1 -1
- package/2D/controls/radioButton.js +106 -127
- package/2D/controls/radioButton.js.map +1 -1
- package/2D/controls/rectangle.js +60 -72
- package/2D/controls/rectangle.js.map +1 -1
- package/2D/controls/scrollViewers/scrollViewer.js +439 -543
- package/2D/controls/scrollViewers/scrollViewer.js.map +1 -1
- package/2D/controls/scrollViewers/scrollViewerWindow.js +99 -118
- package/2D/controls/scrollViewers/scrollViewerWindow.js.map +1 -1
- package/2D/controls/selector.js +241 -329
- package/2D/controls/selector.js.map +1 -1
- package/2D/controls/sliders/baseSlider.js +182 -230
- package/2D/controls/sliders/baseSlider.js.map +1 -1
- package/2D/controls/sliders/imageBasedSlider.js +86 -109
- package/2D/controls/sliders/imageBasedSlider.js.map +1 -1
- package/2D/controls/sliders/imageScrollBar.js +148 -178
- package/2D/controls/sliders/imageScrollBar.js.map +1 -1
- package/2D/controls/sliders/scrollBar.js +64 -80
- package/2D/controls/sliders/scrollBar.js.map +1 -1
- package/2D/controls/sliders/slider.js +91 -115
- package/2D/controls/sliders/slider.js.map +1 -1
- package/2D/controls/stackPanel.js +114 -135
- package/2D/controls/stackPanel.js.map +1 -1
- package/2D/controls/statics.js +5 -5
- package/2D/controls/statics.js.map +1 -1
- package/2D/controls/textBlock.js +322 -384
- package/2D/controls/textBlock.js.map +1 -1
- package/2D/controls/textWrapper.js +27 -41
- package/2D/controls/textWrapper.js.map +1 -1
- package/2D/controls/toggleButton.js +105 -121
- package/2D/controls/toggleButton.js.map +1 -1
- package/2D/controls/virtualKeyboard.js +101 -123
- package/2D/controls/virtualKeyboard.js.map +1 -1
- package/2D/math2D.js +62 -70
- package/2D/math2D.js.map +1 -1
- package/2D/measure.js +30 -32
- package/2D/measure.js.map +1 -1
- package/2D/multiLinePoint.js +71 -89
- package/2D/multiLinePoint.js.map +1 -1
- package/2D/style.js +55 -73
- package/2D/style.js.map +1 -1
- package/2D/valueAndUnit.js +71 -104
- package/2D/valueAndUnit.js.map +1 -1
- package/2D/xmlLoader.js +70 -84
- package/2D/xmlLoader.js.map +1 -1
- package/3D/behaviors/defaultBehavior.js +40 -59
- package/3D/behaviors/defaultBehavior.js.map +1 -1
- package/3D/controls/abstractButton3D.js +8 -12
- package/3D/controls/abstractButton3D.js.map +1 -1
- package/3D/controls/button3D.js +30 -35
- package/3D/controls/button3D.js.map +1 -1
- package/3D/controls/container3D.js +57 -71
- package/3D/controls/container3D.js.map +1 -1
- package/3D/controls/contentDisplay3D.js +47 -60
- package/3D/controls/contentDisplay3D.js.map +1 -1
- package/3D/controls/control3D.js +123 -158
- package/3D/controls/control3D.js.map +1 -1
- package/3D/controls/cylinderPanel.js +28 -38
- package/3D/controls/cylinderPanel.js.map +1 -1
- package/3D/controls/handMenu.js +20 -29
- package/3D/controls/handMenu.js.map +1 -1
- package/3D/controls/holographicBackplate.js +52 -72
- package/3D/controls/holographicBackplate.js.map +1 -1
- package/3D/controls/holographicButton.js +160 -200
- package/3D/controls/holographicButton.js.map +1 -1
- package/3D/controls/holographicSlate.js +176 -206
- package/3D/controls/holographicSlate.js.map +1 -1
- package/3D/controls/meshButton3D.js +24 -30
- package/3D/controls/meshButton3D.js.map +1 -1
- package/3D/controls/nearMenu.js +57 -71
- package/3D/controls/nearMenu.js.map +1 -1
- package/3D/controls/planePanel.js +6 -13
- package/3D/controls/planePanel.js.map +1 -1
- package/3D/controls/scatterPanel.js +43 -54
- package/3D/controls/scatterPanel.js.map +1 -1
- package/3D/controls/slider3D.js +168 -222
- package/3D/controls/slider3D.js.map +1 -1
- package/3D/controls/spherePanel.js +29 -39
- package/3D/controls/spherePanel.js.map +1 -1
- package/3D/controls/stackPanel3D.js +36 -49
- package/3D/controls/stackPanel3D.js.map +1 -1
- package/3D/controls/touchButton3D.js +126 -154
- package/3D/controls/touchButton3D.js.map +1 -1
- package/3D/controls/touchHolographicButton.js +223 -272
- package/3D/controls/touchHolographicButton.js.map +1 -1
- package/3D/controls/touchHolographicMenu.js +55 -66
- package/3D/controls/touchHolographicMenu.js.map +1 -1
- package/3D/controls/touchMeshButton3D.js +24 -30
- package/3D/controls/touchMeshButton3D.js.map +1 -1
- package/3D/controls/volumeBasedPanel.js +85 -107
- package/3D/controls/volumeBasedPanel.js.map +1 -1
- package/3D/gizmos/gizmoHandle.js +68 -103
- package/3D/gizmos/gizmoHandle.js.map +1 -1
- package/3D/gizmos/slateGizmo.js +165 -182
- package/3D/gizmos/slateGizmo.js.map +1 -1
- package/3D/gui3DManager.js +76 -101
- package/3D/gui3DManager.js.map +1 -1
- package/3D/materials/fluent/fluentMaterial.js +110 -119
- package/3D/materials/fluent/fluentMaterial.js.map +1 -1
- package/3D/materials/fluent/shaders/fluent.fragment.js +20 -3
- package/3D/materials/fluent/shaders/fluent.fragment.js.map +1 -1
- package/3D/materials/fluent/shaders/fluent.vertex.js +11 -3
- package/3D/materials/fluent/shaders/fluent.vertex.js.map +1 -1
- package/3D/materials/fluentBackplate/fluentBackplateMaterial.js +168 -177
- package/3D/materials/fluentBackplate/fluentBackplateMaterial.js.map +1 -1
- package/3D/materials/fluentBackplate/shaders/fluentBackplate.fragment.js +9 -3
- package/3D/materials/fluentBackplate/shaders/fluentBackplate.fragment.js.map +1 -1
- package/3D/materials/fluentBackplate/shaders/fluentBackplate.vertex.js +15 -3
- package/3D/materials/fluentBackplate/shaders/fluentBackplate.vertex.js.map +1 -1
- package/3D/materials/fluentButton/fluentButtonMaterial.js +205 -213
- package/3D/materials/fluentButton/fluentButtonMaterial.js.map +1 -1
- package/3D/materials/fluentButton/shaders/fluentButton.fragment.js +6 -3
- package/3D/materials/fluentButton/shaders/fluentButton.fragment.js.map +1 -1
- package/3D/materials/fluentButton/shaders/fluentButton.vertex.js +6 -3
- package/3D/materials/fluentButton/shaders/fluentButton.vertex.js.map +1 -1
- package/3D/materials/handle/handleMaterial.js +56 -69
- package/3D/materials/handle/handleMaterial.js.map +1 -1
- package/3D/materials/handle/shaders/handle.fragment.js +3 -3
- package/3D/materials/handle/shaders/handle.fragment.js.map +1 -1
- package/3D/materials/handle/shaders/handle.vertex.js +3 -3
- package/3D/materials/handle/shaders/handle.vertex.js.map +1 -1
- package/3D/materials/mrdl/mrdlBackplateMaterial.js +158 -166
- package/3D/materials/mrdl/mrdlBackplateMaterial.js.map +1 -1
- package/3D/materials/mrdl/mrdlSliderBarMaterial.js +322 -330
- package/3D/materials/mrdl/mrdlSliderBarMaterial.js.map +1 -1
- package/3D/materials/mrdl/mrdlSliderThumbMaterial.js +322 -330
- package/3D/materials/mrdl/mrdlSliderThumbMaterial.js.map +1 -1
- package/3D/materials/mrdl/shaders/mrdlBackplate.fragment.js +9 -3
- package/3D/materials/mrdl/shaders/mrdlBackplate.fragment.js.map +1 -1
- package/3D/materials/mrdl/shaders/mrdlBackplate.vertex.js +6 -3
- package/3D/materials/mrdl/shaders/mrdlBackplate.vertex.js.map +1 -1
- package/3D/materials/mrdl/shaders/mrdlSliderBar.fragment.js +24 -3
- package/3D/materials/mrdl/shaders/mrdlSliderBar.fragment.js.map +1 -1
- package/3D/materials/mrdl/shaders/mrdlSliderBar.vertex.js +12 -3
- package/3D/materials/mrdl/shaders/mrdlSliderBar.vertex.js.map +1 -1
- package/3D/materials/mrdl/shaders/mrdlSliderThumb.fragment.js +24 -3
- package/3D/materials/mrdl/shaders/mrdlSliderThumb.fragment.js.map +1 -1
- package/3D/materials/mrdl/shaders/mrdlSliderThumb.vertex.js +12 -3
- package/3D/materials/mrdl/shaders/mrdlSliderThumb.vertex.js.map +1 -1
- package/3D/vector3WithInfo.js +6 -12
- package/3D/vector3WithInfo.js.map +1 -1
- package/legacy/legacy.js +1 -1
- package/legacy/legacy.js.map +1 -1
- package/package.json +3 -6
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { __extends } from "tslib";
|
|
2
1
|
import { Vector3 } from "@babylonjs/core/Maths/math.vector.js";
|
|
3
2
|
import { StandardMaterial } from "@babylonjs/core/Materials/standardMaterial.js";
|
|
4
3
|
import { TransformNode } from "@babylonjs/core/Meshes/transformNode.js";
|
|
@@ -21,63 +20,60 @@ import { Scalar } from "@babylonjs/core/Maths/math.scalar.js";
|
|
|
21
20
|
* Class used to create a holographic button in 3D
|
|
22
21
|
* @since 5.0.0
|
|
23
22
|
*/
|
|
24
|
-
|
|
25
|
-
__extends(TouchHolographicButton, _super);
|
|
23
|
+
export class TouchHolographicButton extends TouchButton3D {
|
|
26
24
|
/**
|
|
27
25
|
* Creates a new button
|
|
28
26
|
* @param name defines the control name
|
|
29
27
|
* @param shareMaterials
|
|
30
28
|
*/
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
_this._frontMaterial.rightBlobEnable = true;
|
|
29
|
+
constructor(name, shareMaterials = true) {
|
|
30
|
+
super(name);
|
|
31
|
+
this._shareMaterials = true;
|
|
32
|
+
this._isBackplateVisible = true;
|
|
33
|
+
this._frontPlateDepth = 0.5;
|
|
34
|
+
this._backPlateDepth = 0.04;
|
|
35
|
+
this._backplateColor = new Color3(0.08, 0.15, 0.55);
|
|
36
|
+
this._backplateToggledColor = new Color3(0.25, 0.4, 0.95);
|
|
37
|
+
this._shareMaterials = shareMaterials;
|
|
38
|
+
this.pointerEnterAnimation = () => {
|
|
39
|
+
this._frontMaterial.leftBlobEnable = true;
|
|
40
|
+
this._frontMaterial.rightBlobEnable = true;
|
|
44
41
|
};
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
42
|
+
this.pointerOutAnimation = () => {
|
|
43
|
+
this._frontMaterial.leftBlobEnable = false;
|
|
44
|
+
this._frontMaterial.rightBlobEnable = false;
|
|
48
45
|
};
|
|
49
|
-
|
|
50
|
-
if (
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
46
|
+
this.pointerDownAnimation = () => {
|
|
47
|
+
if (this._frontPlate && !this.isActiveNearInteraction) {
|
|
48
|
+
this._frontPlate.scaling.z = this._frontPlateDepth * 0.2;
|
|
49
|
+
this._frontPlate.position = Vector3.Forward(this._frontPlate._scene.useRightHandedSystem).scale((this._frontPlateDepth - 0.2 * this._frontPlateDepth) / 2);
|
|
50
|
+
this._textPlate.position = Vector3.Forward(this._textPlate._scene.useRightHandedSystem).scale(-(this._backPlateDepth + 0.2 * this._frontPlateDepth) / 2);
|
|
54
51
|
}
|
|
55
52
|
};
|
|
56
|
-
|
|
57
|
-
if (
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
53
|
+
this.pointerUpAnimation = () => {
|
|
54
|
+
if (this._frontPlate) {
|
|
55
|
+
this._frontPlate.scaling.z = this._frontPlateDepth;
|
|
56
|
+
this._frontPlate.position = Vector3.Forward(this._frontPlate._scene.useRightHandedSystem).scale((this._frontPlateDepth - this._frontPlateDepth) / 2);
|
|
57
|
+
this._textPlate.position = Vector3.Forward(this._textPlate._scene.useRightHandedSystem).scale(-(this._backPlateDepth + this._frontPlateDepth) / 2);
|
|
61
58
|
}
|
|
62
59
|
};
|
|
63
|
-
|
|
64
|
-
if (
|
|
65
|
-
|
|
66
|
-
if (
|
|
67
|
-
|
|
68
|
-
interactionHeight = Scalar.Clamp(interactionHeight -
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
60
|
+
this.onPointerMoveObservable.add((position) => {
|
|
61
|
+
if (this._frontPlate && this.isActiveNearInteraction) {
|
|
62
|
+
const scale = Vector3.Zero();
|
|
63
|
+
if (this._backPlate.getWorldMatrix().decompose(scale, undefined, undefined)) {
|
|
64
|
+
let interactionHeight = this._getInteractionHeight(position, this._backPlate.getAbsolutePosition()) / scale.z;
|
|
65
|
+
interactionHeight = Scalar.Clamp(interactionHeight - this._backPlateDepth / 2, 0.2 * this._frontPlateDepth, this._frontPlateDepth);
|
|
66
|
+
this._frontPlate.scaling.z = interactionHeight;
|
|
67
|
+
this._frontPlate.position = Vector3.Forward(this._frontPlate._scene.useRightHandedSystem).scale((this._frontPlateDepth - interactionHeight) / 2);
|
|
68
|
+
this._textPlate.position = Vector3.Forward(this._textPlate._scene.useRightHandedSystem).scale(-(this._backPlateDepth + interactionHeight) / 2);
|
|
72
69
|
}
|
|
73
70
|
}
|
|
74
71
|
});
|
|
75
|
-
|
|
76
|
-
|
|
72
|
+
this._pointerHoverObserver = this.onPointerMoveObservable.add((hoverPosition) => {
|
|
73
|
+
this._frontMaterial.globalLeftIndexTipPosition = hoverPosition;
|
|
77
74
|
});
|
|
78
|
-
return _this;
|
|
79
75
|
}
|
|
80
|
-
|
|
76
|
+
_disposeTooltip() {
|
|
81
77
|
this._tooltipFade = null;
|
|
82
78
|
if (this._tooltipTextBlock) {
|
|
83
79
|
this._tooltipTextBlock.dispose();
|
|
@@ -90,197 +86,156 @@ var TouchHolographicButton = /** @class */ (function (_super) {
|
|
|
90
86
|
}
|
|
91
87
|
this.onPointerEnterObservable.remove(this._tooltipHoverObserver);
|
|
92
88
|
this.onPointerOutObservable.remove(this._tooltipOutObserver);
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
this.
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
this.
|
|
150
|
-
|
|
151
|
-
this._tooltipMesh.isPickable = false;
|
|
152
|
-
this._tooltipMesh.parent = this._backPlate;
|
|
153
|
-
// Create text texture for the tooltip
|
|
154
|
-
this._tooltipTexture = AdvancedDynamicTexture.CreateForMesh(this._tooltipMesh);
|
|
155
|
-
this._tooltipTextBlock = new TextBlock();
|
|
156
|
-
this._tooltipTextBlock.scaleY = 3;
|
|
157
|
-
this._tooltipTextBlock.color = "white";
|
|
158
|
-
this._tooltipTextBlock.fontSize = 130;
|
|
159
|
-
this._tooltipTexture.addControl(this._tooltipTextBlock);
|
|
160
|
-
// Add hover action to tooltip
|
|
161
|
-
this._tooltipFade = new FadeInOutBehavior();
|
|
162
|
-
this._tooltipFade.delay = 500;
|
|
163
|
-
this._tooltipMesh.addBehavior(this._tooltipFade);
|
|
164
|
-
this._tooltipHoverObserver = this.onPointerEnterObservable.add(function () {
|
|
165
|
-
if (_this._tooltipFade) {
|
|
166
|
-
_this._tooltipFade.fadeIn(true);
|
|
167
|
-
}
|
|
168
|
-
});
|
|
169
|
-
this._tooltipOutObserver = this.onPointerOutObservable.add(function () {
|
|
170
|
-
if (_this._tooltipFade) {
|
|
171
|
-
_this._tooltipFade.fadeIn(false);
|
|
172
|
-
}
|
|
173
|
-
});
|
|
174
|
-
}
|
|
175
|
-
if (this._tooltipTextBlock) {
|
|
176
|
-
this._tooltipTextBlock.text = text;
|
|
177
|
-
}
|
|
178
|
-
},
|
|
179
|
-
enumerable: false,
|
|
180
|
-
configurable: true
|
|
181
|
-
});
|
|
182
|
-
Object.defineProperty(TouchHolographicButton.prototype, "text", {
|
|
183
|
-
/**
|
|
184
|
-
* Gets or sets text for the button
|
|
185
|
-
*/
|
|
186
|
-
get: function () {
|
|
187
|
-
return this._text;
|
|
188
|
-
},
|
|
189
|
-
set: function (value) {
|
|
190
|
-
if (this._text === value) {
|
|
191
|
-
return;
|
|
192
|
-
}
|
|
193
|
-
this._text = value;
|
|
194
|
-
this._rebuildContent();
|
|
195
|
-
},
|
|
196
|
-
enumerable: false,
|
|
197
|
-
configurable: true
|
|
198
|
-
});
|
|
199
|
-
Object.defineProperty(TouchHolographicButton.prototype, "imageUrl", {
|
|
200
|
-
/**
|
|
201
|
-
* Gets or sets the image url for the button
|
|
202
|
-
*/
|
|
203
|
-
get: function () {
|
|
204
|
-
return this._imageUrl;
|
|
205
|
-
},
|
|
206
|
-
set: function (value) {
|
|
207
|
-
if (this._imageUrl === value) {
|
|
208
|
-
return;
|
|
209
|
-
}
|
|
210
|
-
this._imageUrl = value;
|
|
211
|
-
this._rebuildContent();
|
|
212
|
-
},
|
|
213
|
-
enumerable: false,
|
|
214
|
-
configurable: true
|
|
215
|
-
});
|
|
216
|
-
Object.defineProperty(TouchHolographicButton.prototype, "backMaterial", {
|
|
217
|
-
/**
|
|
218
|
-
* Gets the back material used by this button
|
|
219
|
-
*/
|
|
220
|
-
get: function () {
|
|
221
|
-
return this._backMaterial;
|
|
222
|
-
},
|
|
223
|
-
enumerable: false,
|
|
224
|
-
configurable: true
|
|
225
|
-
});
|
|
226
|
-
Object.defineProperty(TouchHolographicButton.prototype, "frontMaterial", {
|
|
227
|
-
/**
|
|
228
|
-
* Gets the front material used by this button
|
|
229
|
-
*/
|
|
230
|
-
get: function () {
|
|
231
|
-
return this._frontMaterial;
|
|
232
|
-
},
|
|
233
|
-
enumerable: false,
|
|
234
|
-
configurable: true
|
|
235
|
-
});
|
|
236
|
-
Object.defineProperty(TouchHolographicButton.prototype, "plateMaterial", {
|
|
237
|
-
/**
|
|
238
|
-
* Gets the plate material used by this button
|
|
239
|
-
*/
|
|
240
|
-
get: function () {
|
|
241
|
-
return this._plateMaterial;
|
|
242
|
-
},
|
|
243
|
-
enumerable: false,
|
|
244
|
-
configurable: true
|
|
245
|
-
});
|
|
246
|
-
Object.defineProperty(TouchHolographicButton.prototype, "shareMaterials", {
|
|
247
|
-
/**
|
|
248
|
-
* Gets a boolean indicating if this button shares its material with other HolographicButtons
|
|
249
|
-
*/
|
|
250
|
-
get: function () {
|
|
251
|
-
return this._shareMaterials;
|
|
252
|
-
},
|
|
253
|
-
enumerable: false,
|
|
254
|
-
configurable: true
|
|
255
|
-
});
|
|
256
|
-
Object.defineProperty(TouchHolographicButton.prototype, "isBackplateVisible", {
|
|
257
|
-
/**
|
|
258
|
-
* Sets whether the backplate is visible or hidden. Hiding the backplate is not recommended without some sort of replacement
|
|
259
|
-
*/
|
|
260
|
-
set: function (isVisible) {
|
|
261
|
-
if (this.mesh && !!this._backMaterial) {
|
|
262
|
-
if (isVisible && !this._isBackplateVisible) {
|
|
263
|
-
this._backPlate.visibility = 1;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Rendering ground id of all the mesh in the button
|
|
92
|
+
*/
|
|
93
|
+
set renderingGroupId(id) {
|
|
94
|
+
this._backPlate.renderingGroupId = id;
|
|
95
|
+
this._textPlate.renderingGroupId = id;
|
|
96
|
+
this._frontPlate.renderingGroupId = id;
|
|
97
|
+
if (this._tooltipMesh) {
|
|
98
|
+
this._tooltipMesh.renderingGroupId = id;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
get renderingGroupId() {
|
|
102
|
+
return this._backPlate.renderingGroupId;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Gets the mesh used to render this control
|
|
106
|
+
*/
|
|
107
|
+
get mesh() {
|
|
108
|
+
return this._backPlate;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Text to be displayed on the tooltip shown when hovering on the button. When set to null tooltip is disabled. (Default: null)
|
|
112
|
+
*/
|
|
113
|
+
set tooltipText(text) {
|
|
114
|
+
if (!text) {
|
|
115
|
+
this._disposeTooltip();
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
if (!this._tooltipFade) {
|
|
119
|
+
const rightHandedScene = this._backPlate._scene.useRightHandedSystem;
|
|
120
|
+
// Create tooltip with mesh and text
|
|
121
|
+
this._tooltipMesh = CreatePlane("", { size: 1 }, this._backPlate._scene);
|
|
122
|
+
const tooltipBackground = CreatePlane("", { size: 1, sideOrientation: Mesh.DOUBLESIDE }, this._backPlate._scene);
|
|
123
|
+
const mat = new StandardMaterial("", this._backPlate._scene);
|
|
124
|
+
mat.diffuseColor = Color3.FromHexString("#212121");
|
|
125
|
+
tooltipBackground.material = mat;
|
|
126
|
+
tooltipBackground.isPickable = false;
|
|
127
|
+
this._tooltipMesh.addChild(tooltipBackground);
|
|
128
|
+
tooltipBackground.position = Vector3.Forward(rightHandedScene).scale(0.05);
|
|
129
|
+
this._tooltipMesh.scaling.y = 1 / 3;
|
|
130
|
+
this._tooltipMesh.position = Vector3.Up().scale(0.7).add(Vector3.Forward(rightHandedScene).scale(-0.15));
|
|
131
|
+
this._tooltipMesh.isPickable = false;
|
|
132
|
+
this._tooltipMesh.parent = this._backPlate;
|
|
133
|
+
// Create text texture for the tooltip
|
|
134
|
+
this._tooltipTexture = AdvancedDynamicTexture.CreateForMesh(this._tooltipMesh);
|
|
135
|
+
this._tooltipTextBlock = new TextBlock();
|
|
136
|
+
this._tooltipTextBlock.scaleY = 3;
|
|
137
|
+
this._tooltipTextBlock.color = "white";
|
|
138
|
+
this._tooltipTextBlock.fontSize = 130;
|
|
139
|
+
this._tooltipTexture.addControl(this._tooltipTextBlock);
|
|
140
|
+
// Add hover action to tooltip
|
|
141
|
+
this._tooltipFade = new FadeInOutBehavior();
|
|
142
|
+
this._tooltipFade.delay = 500;
|
|
143
|
+
this._tooltipMesh.addBehavior(this._tooltipFade);
|
|
144
|
+
this._tooltipHoverObserver = this.onPointerEnterObservable.add(() => {
|
|
145
|
+
if (this._tooltipFade) {
|
|
146
|
+
this._tooltipFade.fadeIn(true);
|
|
264
147
|
}
|
|
265
|
-
|
|
266
|
-
|
|
148
|
+
});
|
|
149
|
+
this._tooltipOutObserver = this.onPointerOutObservable.add(() => {
|
|
150
|
+
if (this._tooltipFade) {
|
|
151
|
+
this._tooltipFade.fadeIn(false);
|
|
267
152
|
}
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
if (this._tooltipTextBlock) {
|
|
156
|
+
this._tooltipTextBlock.text = text;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
get tooltipText() {
|
|
160
|
+
if (this._tooltipTextBlock) {
|
|
161
|
+
return this._tooltipTextBlock.text;
|
|
162
|
+
}
|
|
163
|
+
return null;
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Gets or sets text for the button
|
|
167
|
+
*/
|
|
168
|
+
get text() {
|
|
169
|
+
return this._text;
|
|
170
|
+
}
|
|
171
|
+
set text(value) {
|
|
172
|
+
if (this._text === value) {
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
this._text = value;
|
|
176
|
+
this._rebuildContent();
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Gets or sets the image url for the button
|
|
180
|
+
*/
|
|
181
|
+
get imageUrl() {
|
|
182
|
+
return this._imageUrl;
|
|
183
|
+
}
|
|
184
|
+
set imageUrl(value) {
|
|
185
|
+
if (this._imageUrl === value) {
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
this._imageUrl = value;
|
|
189
|
+
this._rebuildContent();
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Gets the back material used by this button
|
|
193
|
+
*/
|
|
194
|
+
get backMaterial() {
|
|
195
|
+
return this._backMaterial;
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Gets the front material used by this button
|
|
199
|
+
*/
|
|
200
|
+
get frontMaterial() {
|
|
201
|
+
return this._frontMaterial;
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Gets the plate material used by this button
|
|
205
|
+
*/
|
|
206
|
+
get plateMaterial() {
|
|
207
|
+
return this._plateMaterial;
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Gets a boolean indicating if this button shares its material with other HolographicButtons
|
|
211
|
+
*/
|
|
212
|
+
get shareMaterials() {
|
|
213
|
+
return this._shareMaterials;
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Sets whether the backplate is visible or hidden. Hiding the backplate is not recommended without some sort of replacement
|
|
217
|
+
*/
|
|
218
|
+
set isBackplateVisible(isVisible) {
|
|
219
|
+
if (this.mesh && !!this._backMaterial) {
|
|
220
|
+
if (isVisible && !this._isBackplateVisible) {
|
|
221
|
+
this._backPlate.visibility = 1;
|
|
222
|
+
}
|
|
223
|
+
else if (!isVisible && this._isBackplateVisible) {
|
|
224
|
+
this._backPlate.visibility = 0;
|
|
268
225
|
}
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
});
|
|
274
|
-
TouchHolographicButton.prototype._getTypeName = function () {
|
|
226
|
+
}
|
|
227
|
+
this._isBackplateVisible = isVisible;
|
|
228
|
+
}
|
|
229
|
+
_getTypeName() {
|
|
275
230
|
return "TouchHolographicButton";
|
|
276
|
-
}
|
|
277
|
-
|
|
231
|
+
}
|
|
232
|
+
_rebuildContent() {
|
|
278
233
|
this._disposeFacadeTexture();
|
|
279
|
-
|
|
234
|
+
const panel = new StackPanel();
|
|
280
235
|
panel.isVertical = true;
|
|
281
236
|
if (DomManagement.IsDocumentAvailable() && !!document.createElement) {
|
|
282
237
|
if (this._imageUrl) {
|
|
283
|
-
|
|
238
|
+
const image = new Image();
|
|
284
239
|
image.source = this._imageUrl;
|
|
285
240
|
image.paddingTop = "40px";
|
|
286
241
|
image.height = "180px";
|
|
@@ -290,7 +245,7 @@ var TouchHolographicButton = /** @class */ (function (_super) {
|
|
|
290
245
|
}
|
|
291
246
|
}
|
|
292
247
|
if (this._text) {
|
|
293
|
-
|
|
248
|
+
const text = new TextBlock();
|
|
294
249
|
text.text = this._text;
|
|
295
250
|
text.color = "white";
|
|
296
251
|
text.height = "30px";
|
|
@@ -298,13 +253,11 @@ var TouchHolographicButton = /** @class */ (function (_super) {
|
|
|
298
253
|
panel.addControl(text);
|
|
299
254
|
}
|
|
300
255
|
this.content = panel;
|
|
301
|
-
}
|
|
256
|
+
}
|
|
302
257
|
// Mesh association
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
this.name = (_a = this.name) !== null && _a !== void 0 ? _a : "TouchHolographicButton";
|
|
307
|
-
var collisionMesh = CreateBox("".concat(this.name, "_collisionMesh"), {
|
|
258
|
+
_createNode(scene) {
|
|
259
|
+
this.name = this.name ?? "TouchHolographicButton";
|
|
260
|
+
const collisionMesh = CreateBox(`${this.name}_collisionMesh`, {
|
|
308
261
|
width: 1.0,
|
|
309
262
|
height: 1.0,
|
|
310
263
|
depth: this._frontPlateDepth,
|
|
@@ -313,8 +266,8 @@ var TouchHolographicButton = /** @class */ (function (_super) {
|
|
|
313
266
|
collisionMesh.isNearPickable = true;
|
|
314
267
|
collisionMesh.visibility = 0;
|
|
315
268
|
collisionMesh.position = Vector3.Forward(scene.useRightHandedSystem).scale(-this._frontPlateDepth / 2);
|
|
316
|
-
SceneLoader.ImportMeshAsync(undefined, TouchHolographicButton.MODEL_BASE_URL, TouchHolographicButton.MODEL_FILENAME, scene).then(
|
|
317
|
-
|
|
269
|
+
SceneLoader.ImportMeshAsync(undefined, TouchHolographicButton.MODEL_BASE_URL, TouchHolographicButton.MODEL_FILENAME, scene).then((result) => {
|
|
270
|
+
const alphaMesh = CreateBox("${this.name}_alphaMesh", {
|
|
318
271
|
width: 1.0,
|
|
319
272
|
height: 1.0,
|
|
320
273
|
depth: 1.0,
|
|
@@ -322,55 +275,55 @@ var TouchHolographicButton = /** @class */ (function (_super) {
|
|
|
322
275
|
alphaMesh.isPickable = false;
|
|
323
276
|
alphaMesh.material = new StandardMaterial("${this.name}_alphaMesh_material", scene);
|
|
324
277
|
alphaMesh.material.alpha = 0.15;
|
|
325
|
-
|
|
326
|
-
importedFrontPlate.name =
|
|
278
|
+
const importedFrontPlate = result.meshes[1];
|
|
279
|
+
importedFrontPlate.name = `${this.name}_frontPlate`;
|
|
327
280
|
importedFrontPlate.isPickable = false;
|
|
328
|
-
importedFrontPlate.scaling.z =
|
|
281
|
+
importedFrontPlate.scaling.z = this._frontPlateDepth;
|
|
329
282
|
alphaMesh.parent = importedFrontPlate;
|
|
330
283
|
importedFrontPlate.parent = collisionMesh;
|
|
331
|
-
if (
|
|
332
|
-
importedFrontPlate.material =
|
|
284
|
+
if (this._frontMaterial) {
|
|
285
|
+
importedFrontPlate.material = this._frontMaterial;
|
|
333
286
|
}
|
|
334
|
-
|
|
287
|
+
this._frontPlate = importedFrontPlate;
|
|
335
288
|
});
|
|
336
|
-
this._backPlate = CreateBox(
|
|
289
|
+
this._backPlate = CreateBox(`${this.name}_backPlate`, {
|
|
337
290
|
width: 1.0,
|
|
338
291
|
height: 1.0,
|
|
339
292
|
depth: this._backPlateDepth,
|
|
340
293
|
}, scene);
|
|
341
294
|
this._backPlate.position = Vector3.Forward(scene.useRightHandedSystem).scale(this._backPlateDepth / 2);
|
|
342
295
|
this._backPlate.isPickable = false;
|
|
343
|
-
this._textPlate =
|
|
344
|
-
this._textPlate.name =
|
|
296
|
+
this._textPlate = super._createNode(scene);
|
|
297
|
+
this._textPlate.name = `${this.name}_textPlate`;
|
|
345
298
|
this._textPlate.isPickable = false;
|
|
346
299
|
this._textPlate.position = Vector3.Forward(scene.useRightHandedSystem).scale(-this._frontPlateDepth / 2);
|
|
347
300
|
this._backPlate.addChild(collisionMesh);
|
|
348
301
|
this._backPlate.addChild(this._textPlate);
|
|
349
|
-
|
|
302
|
+
const tn = new TransformNode(`{this.name}_root`, scene);
|
|
350
303
|
this._backPlate.setParent(tn);
|
|
351
304
|
this.collisionMesh = collisionMesh;
|
|
352
305
|
this.collidableFrontDirection = this._backPlate.forward.negate(); // Mesh is facing the wrong way
|
|
353
306
|
return tn;
|
|
354
|
-
}
|
|
355
|
-
|
|
307
|
+
}
|
|
308
|
+
_applyFacade(facadeTexture) {
|
|
356
309
|
this._plateMaterial.emissiveTexture = facadeTexture;
|
|
357
310
|
this._plateMaterial.opacityTexture = facadeTexture;
|
|
358
311
|
this._plateMaterial.diffuseColor = new Color3(0.4, 0.4, 0.4);
|
|
359
|
-
}
|
|
360
|
-
|
|
312
|
+
}
|
|
313
|
+
_createBackMaterial(mesh) {
|
|
361
314
|
this._backMaterial = new FluentMaterial(this.name + "backPlateMaterial", mesh.getScene());
|
|
362
315
|
this._backMaterial.albedoColor = this._backplateColor;
|
|
363
316
|
this._backMaterial.renderBorders = true;
|
|
364
317
|
this._backMaterial.renderHoverLight = false;
|
|
365
|
-
}
|
|
366
|
-
|
|
318
|
+
}
|
|
319
|
+
_createFrontMaterial(mesh) {
|
|
367
320
|
this._frontMaterial = new FluentButtonMaterial(this.name + "Front Material", mesh.getScene());
|
|
368
|
-
}
|
|
369
|
-
|
|
321
|
+
}
|
|
322
|
+
_createPlateMaterial(mesh) {
|
|
370
323
|
this._plateMaterial = new StandardMaterial(this.name + "Plate Material", mesh.getScene());
|
|
371
324
|
this._plateMaterial.specularColor = Color3.Black();
|
|
372
|
-
}
|
|
373
|
-
|
|
325
|
+
}
|
|
326
|
+
_onToggle(newState) {
|
|
374
327
|
if (this._backMaterial) {
|
|
375
328
|
if (newState) {
|
|
376
329
|
this._backMaterial.albedoColor = this._backplateToggledColor;
|
|
@@ -379,9 +332,9 @@ var TouchHolographicButton = /** @class */ (function (_super) {
|
|
|
379
332
|
this._backMaterial.albedoColor = this._backplateColor;
|
|
380
333
|
}
|
|
381
334
|
}
|
|
382
|
-
|
|
383
|
-
}
|
|
384
|
-
|
|
335
|
+
super._onToggle(newState);
|
|
336
|
+
}
|
|
337
|
+
_affectMaterial(mesh) {
|
|
385
338
|
if (this._shareMaterials) {
|
|
386
339
|
// Back
|
|
387
340
|
if (!this._host._touchSharedMaterials["backFluentMaterial"]) {
|
|
@@ -414,12 +367,12 @@ var TouchHolographicButton = /** @class */ (function (_super) {
|
|
|
414
367
|
this._frontPlate.material = this._frontMaterial;
|
|
415
368
|
}
|
|
416
369
|
this._rebuildContent();
|
|
417
|
-
}
|
|
370
|
+
}
|
|
418
371
|
/**
|
|
419
372
|
* Releases all associated resources
|
|
420
373
|
*/
|
|
421
|
-
|
|
422
|
-
|
|
374
|
+
dispose() {
|
|
375
|
+
super.dispose(); // will dispose main mesh ie. back plate
|
|
423
376
|
this._disposeTooltip();
|
|
424
377
|
this.onPointerMoveObservable.remove(this._pointerHoverObserver);
|
|
425
378
|
if (!this.shareMaterials) {
|
|
@@ -431,16 +384,14 @@ var TouchHolographicButton = /** @class */ (function (_super) {
|
|
|
431
384
|
this._pickedPointObserver = null;
|
|
432
385
|
}
|
|
433
386
|
}
|
|
434
|
-
}
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
}(TouchButton3D));
|
|
445
|
-
export { TouchHolographicButton };
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
/**
|
|
390
|
+
* Base Url for the button model.
|
|
391
|
+
*/
|
|
392
|
+
TouchHolographicButton.MODEL_BASE_URL = "https://assets.babylonjs.com/meshes/MRTK/";
|
|
393
|
+
/**
|
|
394
|
+
* File name for the button model.
|
|
395
|
+
*/
|
|
396
|
+
TouchHolographicButton.MODEL_FILENAME = "mrtk-fluent-button.glb";
|
|
446
397
|
//# sourceMappingURL=touchHolographicButton.js.map
|