@babylonjs/gui 5.26.1 → 5.27.1
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/advancedDynamicTexture.js +5 -4
- package/2D/advancedDynamicTexture.js.map +1 -1
- package/2D/controls/container.js +5 -3
- package/2D/controls/container.js.map +1 -1
- package/2D/controls/control.js +8 -7
- package/2D/controls/control.js.map +1 -1
- package/2D/controls/grid.js +2 -2
- package/2D/controls/grid.js.map +1 -1
- package/2D/controls/image.js +8 -4
- package/2D/controls/image.js.map +1 -1
- package/2D/controls/inputText.d.ts +1 -1
- package/2D/controls/inputText.js +10 -29
- package/2D/controls/inputText.js.map +1 -1
- package/2D/controls/inputTextArea.js +9 -7
- package/2D/controls/inputTextArea.js.map +1 -1
- package/2D/controls/textBlock.js +2 -1
- package/2D/controls/textBlock.js.map +1 -1
- package/2D/controls/toggleButton.js +4 -3
- package/2D/controls/toggleButton.js.map +1 -1
- package/3D/controls/MRTK3/touchHolographicButton.d.ts +220 -0
- package/3D/controls/MRTK3/touchHolographicButton.js +866 -0
- package/3D/controls/MRTK3/touchHolographicButton.js.map +1 -0
- package/3D/controls/control3D.js +3 -2
- package/3D/controls/control3D.js.map +1 -1
- package/3D/controls/holographicBackplate.js +2 -1
- package/3D/controls/holographicBackplate.js.map +1 -1
- package/3D/controls/holographicSlate.js +2 -1
- package/3D/controls/holographicSlate.js.map +1 -1
- package/3D/controls/index.d.ts +3 -2
- package/3D/controls/index.js +4 -2
- package/3D/controls/index.js.map +1 -1
- package/3D/controls/slider3D.js +13 -10
- package/3D/controls/slider3D.js.map +1 -1
- package/3D/controls/touchButton3D.js +4 -2
- package/3D/controls/touchButton3D.js.map +1 -1
- package/3D/controls/touchHolographicButton.js +2 -1
- package/3D/controls/touchHolographicButton.js.map +1 -1
- package/3D/gui3DManager.js +5 -3
- package/3D/gui3DManager.js.map +1 -1
- package/3D/materials/fluentBackplate/fluentBackplateMaterial.js +2 -1
- package/3D/materials/fluentBackplate/fluentBackplateMaterial.js.map +1 -1
- package/3D/materials/mrdl/mrdlBackglowMaterial.d.ts +87 -0
- package/3D/materials/mrdl/mrdlBackglowMaterial.js +300 -0
- package/3D/materials/mrdl/mrdlBackglowMaterial.js.map +1 -0
- package/3D/materials/mrdl/mrdlFrontplateMaterial.d.ts +186 -0
- package/3D/materials/mrdl/mrdlFrontplateMaterial.js +530 -0
- package/3D/materials/mrdl/mrdlFrontplateMaterial.js.map +1 -0
- package/3D/materials/mrdl/mrdlInnerquadMaterial.d.ts +56 -0
- package/3D/materials/mrdl/mrdlInnerquadMaterial.js +228 -0
- package/3D/materials/mrdl/mrdlInnerquadMaterial.js.map +1 -0
- package/3D/materials/mrdl/shaders/mrdlBackglow.fragment.d.ts +5 -0
- package/3D/materials/mrdl/shaders/mrdlBackglow.fragment.js +9 -0
- package/3D/materials/mrdl/shaders/mrdlBackglow.fragment.js.map +1 -0
- package/3D/materials/mrdl/shaders/mrdlBackglow.vertex.d.ts +5 -0
- package/3D/materials/mrdl/shaders/mrdlBackglow.vertex.js +9 -0
- package/3D/materials/mrdl/shaders/mrdlBackglow.vertex.js.map +1 -0
- package/3D/materials/mrdl/shaders/mrdlFrontplate.fragment.d.ts +5 -0
- package/3D/materials/mrdl/shaders/mrdlFrontplate.fragment.js +9 -0
- package/3D/materials/mrdl/shaders/mrdlFrontplate.fragment.js.map +1 -0
- package/3D/materials/mrdl/shaders/mrdlFrontplate.vertex.d.ts +5 -0
- package/3D/materials/mrdl/shaders/mrdlFrontplate.vertex.js +9 -0
- package/3D/materials/mrdl/shaders/mrdlFrontplate.vertex.js.map +1 -0
- package/3D/materials/mrdl/shaders/mrdlInnerquad.fragment.d.ts +5 -0
- package/3D/materials/mrdl/shaders/mrdlInnerquad.fragment.js +9 -0
- package/3D/materials/mrdl/shaders/mrdlInnerquad.fragment.js.map +1 -0
- package/3D/materials/mrdl/shaders/mrdlInnerquad.vertex.d.ts +5 -0
- package/3D/materials/mrdl/shaders/mrdlInnerquad.vertex.js +9 -0
- package/3D/materials/mrdl/shaders/mrdlInnerquad.vertex.js.map +1 -0
- package/package.json +2 -2
@@ -0,0 +1,866 @@
|
|
1
|
+
import { AdvancedDynamicTexture } from "../../../2D/advancedDynamicTexture.js";
|
2
|
+
import { Animation } from "@babylonjs/core/Animations/animation.js";
|
3
|
+
import { AnimationGroup } from "@babylonjs/core/Animations/animationGroup.js";
|
4
|
+
import { Color3, Color4 } from "@babylonjs/core/Maths/math.color.js";
|
5
|
+
import { Control } from "../../../2D/controls/control.js";
|
6
|
+
import { CreatePlane } from "@babylonjs/core/Meshes/Builders/planeBuilder.js";
|
7
|
+
import { CreateBox } from "@babylonjs/core/Meshes/Builders/boxBuilder.js";
|
8
|
+
import { DomManagement } from "@babylonjs/core/Misc/domManagement.js";
|
9
|
+
import { FadeInOutBehavior } from "@babylonjs/core/Behaviors/Meshes/fadeInOutBehavior.js";
|
10
|
+
import { Grid } from "../../../2D/controls/grid.js";
|
11
|
+
import { Image } from "../../../2D/controls/image.js";
|
12
|
+
import { MRDLBackglowMaterial } from "../../materials/mrdl/mrdlBackglowMaterial.js";
|
13
|
+
import { MRDLBackplateMaterial } from "../../materials/mrdl/mrdlBackplateMaterial.js";
|
14
|
+
import { MRDLFrontplateMaterial } from "../../materials/mrdl/mrdlFrontplateMaterial.js";
|
15
|
+
import { MRDLInnerquadMaterial } from "../../materials/mrdl/mrdlInnerquadMaterial.js";
|
16
|
+
import { Rectangle } from "../../../2D/controls/rectangle.js";
|
17
|
+
import { SceneLoader } from "@babylonjs/core/Loading/sceneLoader.js";
|
18
|
+
import { StackPanel } from "../../../2D/controls/stackPanel.js";
|
19
|
+
import { StandardMaterial } from "@babylonjs/core/Materials/standardMaterial.js";
|
20
|
+
import { TextBlock } from "../../../2D/controls/textBlock.js";
|
21
|
+
import { TouchButton3D } from "../touchButton3D.js";
|
22
|
+
import { TransformNode } from "@babylonjs/core/Meshes/transformNode.js";
|
23
|
+
import { Vector3 } from "@babylonjs/core/Maths/math.vector.js";
|
24
|
+
/**
|
25
|
+
* Class used to create the mrtkv3 button
|
26
|
+
*/
|
27
|
+
export class TouchHolographicButton extends TouchButton3D {
|
28
|
+
/**
|
29
|
+
* Creates a new button
|
30
|
+
* @param name defines the control name
|
31
|
+
* @param shareMaterials
|
32
|
+
*/
|
33
|
+
constructor(name, shareMaterials = true) {
|
34
|
+
super(name);
|
35
|
+
/**
|
36
|
+
* Gets or sets the horizontal scaling for the button.
|
37
|
+
*/
|
38
|
+
this.width = 1;
|
39
|
+
/**
|
40
|
+
* Gets or sets the vertical scaling for the button.
|
41
|
+
*/
|
42
|
+
this.height = 1;
|
43
|
+
/**
|
44
|
+
* Gets or sets the bevel radius for the button.
|
45
|
+
*/
|
46
|
+
this.radius = 0.14;
|
47
|
+
/**
|
48
|
+
* Gets or sets the font size of the button text in pixels.
|
49
|
+
* This is only adjustable for a button with width to height ratio greater than 1.
|
50
|
+
*/
|
51
|
+
this.textSizeInPixels = 18;
|
52
|
+
/**
|
53
|
+
* Gets or sets the size of the button image in pixels.
|
54
|
+
* This is only adjustable for a button with width to height ratio greater than 1.
|
55
|
+
*/
|
56
|
+
this.imageSizeInPixels = 40;
|
57
|
+
/**
|
58
|
+
* Gets or sets the color of the button plate.
|
59
|
+
*/
|
60
|
+
this.plateMaterialColor = new Color3(0.4, 0.4, 0.4);
|
61
|
+
// Shared variables for meshes
|
62
|
+
/**
|
63
|
+
* Gets or sets the depth of the button's front plate.
|
64
|
+
* This variable determines the z scaling and z position for some of the button's meshes.
|
65
|
+
*/
|
66
|
+
this.frontPlateDepth = 0.2;
|
67
|
+
/**
|
68
|
+
* Gets or sets the depth of the button's back plate.
|
69
|
+
* This variable determines the z scaling and z position for some of the button's meshes.
|
70
|
+
*/
|
71
|
+
this.backPlateDepth = 0.04;
|
72
|
+
/**
|
73
|
+
* Gets or sets the offset value for button's back glow.
|
74
|
+
* This variable determines the x, y scaling of the button's meshes.
|
75
|
+
*/
|
76
|
+
this.backGlowOffset = 0.1;
|
77
|
+
/**
|
78
|
+
* Gets or sets the value that determines the z scaling and z position for the innerQuad and BackGlow meshes.
|
79
|
+
*/
|
80
|
+
this.flatPlaneDepth = 0.001;
|
81
|
+
/**
|
82
|
+
* Gets or sets the radius for FrontMaterial and innerQuadMaterial.
|
83
|
+
*/
|
84
|
+
this.innerQuadRadius = this.radius - 0.04;
|
85
|
+
/**
|
86
|
+
* Gets or sets the color for innerQuadMaterial.
|
87
|
+
*/
|
88
|
+
this.innerQuadColor = new Color4(0, 0, 0, 0);
|
89
|
+
/**
|
90
|
+
* Gets or sets the color for innerQuadMaterial for when it is toggled.
|
91
|
+
*/
|
92
|
+
this.innerQuadToggledColor = new Color4(0.5197843, 0.6485234, 0.9607843, 0.6);
|
93
|
+
/**
|
94
|
+
* Gets or sets the color for innerQuadMaterial for when it is hovered.
|
95
|
+
*/
|
96
|
+
this.innerQuadHoverColor = new Color4(1, 1, 1, 0.05);
|
97
|
+
/**
|
98
|
+
* Gets or sets the color for innerQuadMaterial for when it is toggled and hovered.
|
99
|
+
*/
|
100
|
+
this.innerQuadToggledHoverColor = new Color4(0.5197843, 0.6485234, 0.9607843, 1);
|
101
|
+
this._isBackplateVisible = true;
|
102
|
+
// Materials
|
103
|
+
this._shareMaterials = true;
|
104
|
+
this._shareMaterials = shareMaterials;
|
105
|
+
this.pointerEnterAnimation = () => {
|
106
|
+
if (this._frontPlate && this._textPlate && !this.isToggleButton) {
|
107
|
+
this._performEnterExitAnimation(1);
|
108
|
+
}
|
109
|
+
if (this.isToggleButton && this._innerQuadMaterial) {
|
110
|
+
if (this.isToggled) {
|
111
|
+
this._innerQuadMaterial.color = this.innerQuadToggledHoverColor;
|
112
|
+
}
|
113
|
+
else {
|
114
|
+
this._innerQuadMaterial.color = this.innerQuadHoverColor;
|
115
|
+
}
|
116
|
+
}
|
117
|
+
};
|
118
|
+
this.pointerOutAnimation = () => {
|
119
|
+
if (this._frontPlate && this._textPlate && !this.isToggleButton) {
|
120
|
+
this._performEnterExitAnimation(-0.8);
|
121
|
+
}
|
122
|
+
if (this.isToggleButton && this._innerQuadMaterial) {
|
123
|
+
this._onToggle(this.isToggled);
|
124
|
+
}
|
125
|
+
};
|
126
|
+
this.pointerDownAnimation = () => {
|
127
|
+
// Do nothing
|
128
|
+
};
|
129
|
+
this.pointerUpAnimation = () => {
|
130
|
+
// Do nothing
|
131
|
+
};
|
132
|
+
this._pointerClickObserver = this.onPointerClickObservable.add(() => {
|
133
|
+
if (this._frontPlate && this._backGlow && !this.isActiveNearInteraction) {
|
134
|
+
this._performClickAnimation();
|
135
|
+
}
|
136
|
+
if (this.isToggleButton && this._innerQuadMaterial) {
|
137
|
+
this._onToggle(this.isToggled);
|
138
|
+
}
|
139
|
+
});
|
140
|
+
this._pointerEnterObserver = this.onPointerEnterObservable.add(() => {
|
141
|
+
this.pointerEnterAnimation();
|
142
|
+
});
|
143
|
+
this._pointerOutObserver = this.onPointerOutObservable.add(() => {
|
144
|
+
this.pointerOutAnimation();
|
145
|
+
});
|
146
|
+
this._toggleObserver = this.onToggleObservable.add((isToggled) => {
|
147
|
+
if (isToggled) {
|
148
|
+
this._innerQuadMaterial.color = this.innerQuadToggledColor;
|
149
|
+
}
|
150
|
+
else {
|
151
|
+
this._innerQuadMaterial.color = this.innerQuadColor;
|
152
|
+
}
|
153
|
+
});
|
154
|
+
}
|
155
|
+
_disposeTooltip() {
|
156
|
+
this._tooltipFade = null;
|
157
|
+
if (this._tooltipTextBlock) {
|
158
|
+
this._tooltipTextBlock.dispose();
|
159
|
+
}
|
160
|
+
if (this._tooltipTexture) {
|
161
|
+
this._tooltipTexture.dispose();
|
162
|
+
}
|
163
|
+
if (this._tooltipMesh) {
|
164
|
+
this._tooltipMesh.dispose();
|
165
|
+
}
|
166
|
+
this.onPointerEnterObservable.remove(this._tooltipHoverObserver);
|
167
|
+
this.onPointerOutObservable.remove(this._tooltipOutObserver);
|
168
|
+
}
|
169
|
+
/**
|
170
|
+
* Rendering ground id of all the mesh in the button
|
171
|
+
*/
|
172
|
+
set renderingGroupId(id) {
|
173
|
+
this._backPlate.renderingGroupId = id;
|
174
|
+
this._textPlate.renderingGroupId = id;
|
175
|
+
this._frontPlate.renderingGroupId = id;
|
176
|
+
this._backGlow.renderingGroupId = id;
|
177
|
+
this._innerQuad.renderingGroupId = id;
|
178
|
+
if (this._tooltipMesh) {
|
179
|
+
this._tooltipMesh.renderingGroupId = id;
|
180
|
+
}
|
181
|
+
}
|
182
|
+
get renderingGroupId() {
|
183
|
+
return this._backPlate.renderingGroupId;
|
184
|
+
}
|
185
|
+
/**
|
186
|
+
* Gets the mesh used to render this control
|
187
|
+
*/
|
188
|
+
get mesh() {
|
189
|
+
return this._backPlate;
|
190
|
+
}
|
191
|
+
/**
|
192
|
+
* Text to be displayed on the tooltip shown when hovering on the button. When set to null tooltip is disabled. (Default: null)
|
193
|
+
* Set this property after adding the button to the GUI3DManager
|
194
|
+
*/
|
195
|
+
set tooltipText(text) {
|
196
|
+
if (!text) {
|
197
|
+
this._disposeTooltip();
|
198
|
+
return;
|
199
|
+
}
|
200
|
+
if (!this._tooltipFade) {
|
201
|
+
const rightHandedScene = this._backPlate._scene.useRightHandedSystem;
|
202
|
+
// Create tooltip with mesh and text
|
203
|
+
this._tooltipMesh = CreatePlane("", { size: 1 }, this._backPlate._scene);
|
204
|
+
this._tooltipMesh.position = Vector3.Down().scale(0.7).add(Vector3.Forward(rightHandedScene).scale(-0.15));
|
205
|
+
this._tooltipMesh.isPickable = false;
|
206
|
+
this._tooltipMesh.parent = this._frontPlateCollisionMesh;
|
207
|
+
// Create text texture for the tooltip
|
208
|
+
this._tooltipTexture = AdvancedDynamicTexture.CreateForMesh(this._tooltipMesh);
|
209
|
+
const tooltipBackground = new Rectangle();
|
210
|
+
tooltipBackground.height = 0.25;
|
211
|
+
tooltipBackground.width = 0.8;
|
212
|
+
tooltipBackground.cornerRadius = 25;
|
213
|
+
tooltipBackground.color = "#ffffff";
|
214
|
+
tooltipBackground.thickness = 20;
|
215
|
+
tooltipBackground.background = "#060668";
|
216
|
+
this._tooltipTexture.addControl(tooltipBackground);
|
217
|
+
this._tooltipTextBlock = new TextBlock();
|
218
|
+
this._tooltipTextBlock.color = "white";
|
219
|
+
this._tooltipTextBlock.fontSize = 100;
|
220
|
+
this._tooltipTexture.addControl(this._tooltipTextBlock);
|
221
|
+
// Add hover action to tooltip
|
222
|
+
this._tooltipFade = new FadeInOutBehavior();
|
223
|
+
this._tooltipFade.delay = 500;
|
224
|
+
this._tooltipMesh.addBehavior(this._tooltipFade);
|
225
|
+
this._tooltipHoverObserver = this.onPointerEnterObservable.add(() => {
|
226
|
+
if (this._tooltipFade) {
|
227
|
+
this._tooltipFade.fadeIn(true);
|
228
|
+
}
|
229
|
+
});
|
230
|
+
this._tooltipOutObserver = this.onPointerOutObservable.add(() => {
|
231
|
+
if (this._tooltipFade) {
|
232
|
+
this._tooltipFade.fadeIn(false);
|
233
|
+
}
|
234
|
+
});
|
235
|
+
}
|
236
|
+
if (this._tooltipTextBlock) {
|
237
|
+
this._tooltipTextBlock.text = text;
|
238
|
+
}
|
239
|
+
}
|
240
|
+
get tooltipText() {
|
241
|
+
var _a;
|
242
|
+
return ((_a = this._tooltipTextBlock) === null || _a === void 0 ? void 0 : _a.text) || null;
|
243
|
+
}
|
244
|
+
/**
|
245
|
+
* Gets or sets text for the button
|
246
|
+
*/
|
247
|
+
get text() {
|
248
|
+
return this._text;
|
249
|
+
}
|
250
|
+
set text(value) {
|
251
|
+
if (this._text === value) {
|
252
|
+
return;
|
253
|
+
}
|
254
|
+
this._text = value;
|
255
|
+
this._rebuildContent();
|
256
|
+
}
|
257
|
+
/**
|
258
|
+
* Gets or sets subtext for a button with larger width
|
259
|
+
*/
|
260
|
+
get subtext() {
|
261
|
+
return this._subtext;
|
262
|
+
}
|
263
|
+
set subtext(value) {
|
264
|
+
if (this._subtext === value) {
|
265
|
+
return;
|
266
|
+
}
|
267
|
+
this._subtext = value;
|
268
|
+
this._rebuildContent();
|
269
|
+
}
|
270
|
+
/**
|
271
|
+
* Gets or sets the image url for the button
|
272
|
+
*/
|
273
|
+
get imageUrl() {
|
274
|
+
return this._imageUrl;
|
275
|
+
}
|
276
|
+
set imageUrl(value) {
|
277
|
+
if (this._imageUrl === value) {
|
278
|
+
return;
|
279
|
+
}
|
280
|
+
this._imageUrl = value;
|
281
|
+
this._rebuildContent();
|
282
|
+
}
|
283
|
+
/**
|
284
|
+
* Gets the back material used by this button
|
285
|
+
*/
|
286
|
+
get backMaterial() {
|
287
|
+
return this._backMaterial;
|
288
|
+
}
|
289
|
+
/**
|
290
|
+
* Gets the front material used by this button
|
291
|
+
*/
|
292
|
+
get frontMaterial() {
|
293
|
+
return this._frontMaterial;
|
294
|
+
}
|
295
|
+
/**
|
296
|
+
* Gets the back glow material used by this button
|
297
|
+
*/
|
298
|
+
get backGlowMaterial() {
|
299
|
+
return this._backGlowMaterial;
|
300
|
+
}
|
301
|
+
/**
|
302
|
+
* Gets the inner quad material used by this button
|
303
|
+
*/
|
304
|
+
get innerQuadMaterial() {
|
305
|
+
return this._innerQuadMaterial;
|
306
|
+
}
|
307
|
+
/**
|
308
|
+
* Gets the plate material used by this button
|
309
|
+
*/
|
310
|
+
get plateMaterial() {
|
311
|
+
return this._plateMaterial;
|
312
|
+
}
|
313
|
+
/**
|
314
|
+
* Gets a boolean indicating if this button shares its material with other V3 Buttons
|
315
|
+
*/
|
316
|
+
get shareMaterials() {
|
317
|
+
return this._shareMaterials;
|
318
|
+
}
|
319
|
+
/**
|
320
|
+
* Sets whether the backplate is visible or hidden. Hiding the backplate is not recommended without some sort of replacement
|
321
|
+
*/
|
322
|
+
set isBackplateVisible(isVisible) {
|
323
|
+
if (this.mesh && this._backMaterial) {
|
324
|
+
if (isVisible && !this._isBackplateVisible) {
|
325
|
+
this._backPlate.visibility = 1;
|
326
|
+
}
|
327
|
+
else if (!isVisible && this._isBackplateVisible) {
|
328
|
+
this._backPlate.visibility = 0;
|
329
|
+
}
|
330
|
+
}
|
331
|
+
this._isBackplateVisible = isVisible;
|
332
|
+
}
|
333
|
+
_getTypeName() {
|
334
|
+
return "TouchHolographicButton";
|
335
|
+
}
|
336
|
+
_rebuildContent() {
|
337
|
+
let content;
|
338
|
+
if (this._getAspectRatio() <= 1) {
|
339
|
+
// align text and image vertically
|
340
|
+
content = this._alignContentVertically();
|
341
|
+
}
|
342
|
+
else {
|
343
|
+
// align text and image horizontally
|
344
|
+
content = this._alignContentHorizontally();
|
345
|
+
}
|
346
|
+
this.content = content;
|
347
|
+
}
|
348
|
+
_getAspectRatio() {
|
349
|
+
return this.width / this.height;
|
350
|
+
}
|
351
|
+
_alignContentVertically() {
|
352
|
+
const panel = new StackPanel();
|
353
|
+
panel.isVertical = true;
|
354
|
+
if (DomManagement.IsDocumentAvailable() && !!document.createElement) {
|
355
|
+
if (this._imageUrl) {
|
356
|
+
const image = new Image();
|
357
|
+
image.source = this._imageUrl;
|
358
|
+
image.heightInPixels = 180;
|
359
|
+
image.widthInPixels = 100;
|
360
|
+
image.paddingTopInPixels = 40;
|
361
|
+
image.paddingBottomInPixels = 40;
|
362
|
+
panel.addControl(image);
|
363
|
+
}
|
364
|
+
}
|
365
|
+
if (this._text) {
|
366
|
+
const text = new TextBlock();
|
367
|
+
text.text = this._text;
|
368
|
+
text.color = "white";
|
369
|
+
text.heightInPixels = 30;
|
370
|
+
text.fontSize = 24;
|
371
|
+
panel.addControl(text);
|
372
|
+
}
|
373
|
+
return panel;
|
374
|
+
}
|
375
|
+
_alignContentHorizontally() {
|
376
|
+
let totalPanelWidthInPixels = 240;
|
377
|
+
const padding = 15;
|
378
|
+
const contentContainer = new Rectangle();
|
379
|
+
contentContainer.widthInPixels = totalPanelWidthInPixels;
|
380
|
+
contentContainer.heightInPixels = totalPanelWidthInPixels;
|
381
|
+
contentContainer.color = "transparent";
|
382
|
+
contentContainer.setPaddingInPixels(padding, padding, padding, padding);
|
383
|
+
totalPanelWidthInPixels -= padding * 2;
|
384
|
+
const panel = new StackPanel();
|
385
|
+
panel.isVertical = false;
|
386
|
+
panel.scaleY = this._getAspectRatio();
|
387
|
+
if (DomManagement.IsDocumentAvailable() && !!document.createElement) {
|
388
|
+
if (this._imageUrl) {
|
389
|
+
const imageContainer = new Rectangle(`${this.name}_image`);
|
390
|
+
imageContainer.widthInPixels = this.imageSizeInPixels;
|
391
|
+
imageContainer.heightInPixels = this.imageSizeInPixels;
|
392
|
+
imageContainer.color = "transparent";
|
393
|
+
totalPanelWidthInPixels -= this.imageSizeInPixels;
|
394
|
+
const image = new Image();
|
395
|
+
image.source = this._imageUrl;
|
396
|
+
imageContainer.addControl(image);
|
397
|
+
panel.addControl(imageContainer);
|
398
|
+
}
|
399
|
+
}
|
400
|
+
if (this._text) {
|
401
|
+
const text = new TextBlock(`${this.name}_text`);
|
402
|
+
text.text = this._text;
|
403
|
+
text.color = "white";
|
404
|
+
text.fontSize = this.textSizeInPixels;
|
405
|
+
text.widthInPixels = totalPanelWidthInPixels;
|
406
|
+
if (this._imageUrl) {
|
407
|
+
text.textHorizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;
|
408
|
+
text.paddingLeftInPixels = padding;
|
409
|
+
}
|
410
|
+
if (this._subtext) {
|
411
|
+
const textContainer = new Grid();
|
412
|
+
textContainer.addColumnDefinition(1);
|
413
|
+
textContainer.addRowDefinition(0.5);
|
414
|
+
textContainer.addRowDefinition(0.5);
|
415
|
+
textContainer.widthInPixels = totalPanelWidthInPixels;
|
416
|
+
textContainer.heightInPixels = 45;
|
417
|
+
const subtext = new TextBlock(`${this.name}_subtext`);
|
418
|
+
subtext.text = this._subtext;
|
419
|
+
subtext.color = "#EEEEEEAB";
|
420
|
+
subtext.fontSize = this.textSizeInPixels * 0.75;
|
421
|
+
subtext.fontWeight = "600";
|
422
|
+
if (this._imageUrl) {
|
423
|
+
subtext.textHorizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;
|
424
|
+
subtext.paddingLeftInPixels = padding;
|
425
|
+
}
|
426
|
+
textContainer.addControl(text, 0);
|
427
|
+
textContainer.addControl(subtext, 1);
|
428
|
+
panel.addControl(textContainer);
|
429
|
+
}
|
430
|
+
else {
|
431
|
+
panel.addControl(text);
|
432
|
+
}
|
433
|
+
}
|
434
|
+
contentContainer.addControl(panel);
|
435
|
+
return contentContainer;
|
436
|
+
}
|
437
|
+
// Mesh association
|
438
|
+
_createNode(scene) {
|
439
|
+
var _a;
|
440
|
+
this.name = (_a = this.name) !== null && _a !== void 0 ? _a : "TouchHolographicButton";
|
441
|
+
const backPlateMesh = this._createBackPlate(scene);
|
442
|
+
const collisionMesh = this._createFrontPlate(scene);
|
443
|
+
const innerQuadMesh = this._createInnerQuad(scene);
|
444
|
+
const backGlowMesh = this._createBackGlow(scene);
|
445
|
+
this._frontPlateCollisionMesh = collisionMesh;
|
446
|
+
this._textPlate = super._createNode(scene);
|
447
|
+
this._textPlate.name = `${this.name}_textPlate`;
|
448
|
+
this._textPlate.isPickable = false;
|
449
|
+
this._textPlate.scaling.x = this.width;
|
450
|
+
this._textPlate.parent = collisionMesh;
|
451
|
+
this._backPlate = backPlateMesh;
|
452
|
+
this._backPlate.position = Vector3.Forward(scene.useRightHandedSystem).scale(this.backPlateDepth / 2);
|
453
|
+
this._backPlate.isPickable = false;
|
454
|
+
this._backPlate.addChild(collisionMesh);
|
455
|
+
this._backPlate.addChild(innerQuadMesh);
|
456
|
+
if (backGlowMesh) {
|
457
|
+
this._backPlate.addChild(backGlowMesh);
|
458
|
+
}
|
459
|
+
const tn = new TransformNode(`${this.name}_root`, scene);
|
460
|
+
this._backPlate.setParent(tn);
|
461
|
+
this.collisionMesh = collisionMesh;
|
462
|
+
this.collidableFrontDirection = this._backPlate.forward.negate(); // Mesh is facing the wrong way
|
463
|
+
return tn;
|
464
|
+
}
|
465
|
+
_createBackPlate(scene) {
|
466
|
+
const backPlateMesh = CreateBox(`${this.name}_backPlate`, {}, scene);
|
467
|
+
backPlateMesh.isPickable = false;
|
468
|
+
backPlateMesh.visibility = 0;
|
469
|
+
backPlateMesh.scaling.z = 0.2;
|
470
|
+
SceneLoader.ImportMeshAsync(undefined, TouchHolographicButton.MRTK_ASSET_BASE_URL, TouchHolographicButton.BACKPLATE_MODEL_FILENAME, scene).then((result) => {
|
471
|
+
const backPlateModel = result.meshes[1];
|
472
|
+
backPlateModel.visibility = 0;
|
473
|
+
if (this._isBackplateVisible) {
|
474
|
+
backPlateModel.visibility = 1;
|
475
|
+
backPlateModel.name = `${this.name}_backPlate`;
|
476
|
+
backPlateModel.isPickable = false;
|
477
|
+
backPlateModel.scaling.x = this.width;
|
478
|
+
backPlateModel.scaling.y = this.height;
|
479
|
+
backPlateModel.parent = backPlateMesh;
|
480
|
+
}
|
481
|
+
if (this._backMaterial) {
|
482
|
+
backPlateModel.material = this._backMaterial;
|
483
|
+
}
|
484
|
+
this._backPlate = backPlateModel;
|
485
|
+
});
|
486
|
+
return backPlateMesh;
|
487
|
+
}
|
488
|
+
_createFrontPlate(scene) {
|
489
|
+
const collisionMesh = CreateBox(`${this.name}_frontPlate`, {
|
490
|
+
width: this.width,
|
491
|
+
height: this.height,
|
492
|
+
depth: this.frontPlateDepth,
|
493
|
+
}, scene);
|
494
|
+
collisionMesh.isPickable = true;
|
495
|
+
collisionMesh.isNearPickable = true;
|
496
|
+
collisionMesh.visibility = 0;
|
497
|
+
collisionMesh.position = Vector3.Forward(scene.useRightHandedSystem).scale((this.backPlateDepth - this.frontPlateDepth) / 2);
|
498
|
+
SceneLoader.ImportMeshAsync(undefined, TouchHolographicButton.MRTK_ASSET_BASE_URL, TouchHolographicButton.FRONTPLATE_MODEL_FILENAME, scene).then((result) => {
|
499
|
+
const collisionPlate = CreateBox(`${this.name}_collisionPlate`, {
|
500
|
+
width: this.width,
|
501
|
+
height: this.height,
|
502
|
+
}, scene);
|
503
|
+
collisionPlate.isPickable = false;
|
504
|
+
collisionPlate.scaling.z = this.frontPlateDepth;
|
505
|
+
collisionPlate.visibility = 0;
|
506
|
+
collisionPlate.parent = collisionMesh;
|
507
|
+
this._collisionPlate = collisionPlate;
|
508
|
+
const frontPlateModel = result.meshes[1];
|
509
|
+
frontPlateModel.name = `${this.name}_frontPlate`;
|
510
|
+
frontPlateModel.isPickable = false;
|
511
|
+
frontPlateModel.scaling.x = this.width - this.backGlowOffset;
|
512
|
+
frontPlateModel.scaling.y = this.height - this.backGlowOffset;
|
513
|
+
frontPlateModel.position = Vector3.Forward(scene.useRightHandedSystem).scale(-0.5);
|
514
|
+
frontPlateModel.parent = collisionPlate;
|
515
|
+
if (this.isToggleButton) {
|
516
|
+
frontPlateModel.visibility = 0;
|
517
|
+
}
|
518
|
+
if (this._frontMaterial) {
|
519
|
+
frontPlateModel.material = this._frontMaterial;
|
520
|
+
}
|
521
|
+
this._textPlate.scaling.x = 1;
|
522
|
+
this._textPlate.parent = frontPlateModel;
|
523
|
+
this._frontPlate = frontPlateModel;
|
524
|
+
});
|
525
|
+
return collisionMesh;
|
526
|
+
}
|
527
|
+
_createInnerQuad(scene) {
|
528
|
+
const innerQuadMesh = CreateBox(`${this.name}_innerQuad`, {}, scene);
|
529
|
+
innerQuadMesh.isPickable = false;
|
530
|
+
innerQuadMesh.visibility = 0;
|
531
|
+
innerQuadMesh.scaling.z = this.flatPlaneDepth;
|
532
|
+
innerQuadMesh.position.z += this.backPlateDepth / 2 - this.flatPlaneDepth;
|
533
|
+
SceneLoader.ImportMeshAsync(undefined, TouchHolographicButton.MRTK_ASSET_BASE_URL, TouchHolographicButton.INNERQUAD_MODEL_FILENAME, scene).then((result) => {
|
534
|
+
const innerQuadModel = result.meshes[1];
|
535
|
+
innerQuadModel.name = `${this.name}_innerQuad`;
|
536
|
+
innerQuadModel.isPickable = false;
|
537
|
+
innerQuadModel.scaling.x = this.width - this.backGlowOffset;
|
538
|
+
innerQuadModel.scaling.y = this.height - this.backGlowOffset;
|
539
|
+
innerQuadModel.parent = innerQuadMesh;
|
540
|
+
if (this._innerQuadMaterial) {
|
541
|
+
innerQuadModel.material = this._innerQuadMaterial;
|
542
|
+
}
|
543
|
+
this._innerQuad = innerQuadModel;
|
544
|
+
});
|
545
|
+
return innerQuadMesh;
|
546
|
+
}
|
547
|
+
_createBackGlow(scene) {
|
548
|
+
if (this.isToggleButton) {
|
549
|
+
return;
|
550
|
+
}
|
551
|
+
const backGlowMesh = CreateBox(`${this.name}_backGlow`, {}, scene);
|
552
|
+
backGlowMesh.isPickable = false;
|
553
|
+
backGlowMesh.visibility = 0;
|
554
|
+
backGlowMesh.scaling.z = this.flatPlaneDepth;
|
555
|
+
backGlowMesh.position.z += this.backPlateDepth / 2 - this.flatPlaneDepth * 2;
|
556
|
+
SceneLoader.ImportMeshAsync(undefined, TouchHolographicButton.MRTK_ASSET_BASE_URL, TouchHolographicButton.BACKGLOW_MODEL_FILENAME, scene).then((result) => {
|
557
|
+
const backGlowModel = result.meshes[1];
|
558
|
+
backGlowModel.name = `${this.name}_backGlow`;
|
559
|
+
backGlowModel.isPickable = false;
|
560
|
+
backGlowModel.scaling.x = this.width - this.backGlowOffset;
|
561
|
+
backGlowModel.scaling.y = this.height - this.backGlowOffset;
|
562
|
+
backGlowModel.parent = backGlowMesh;
|
563
|
+
if (this._backGlowMaterial) {
|
564
|
+
backGlowModel.material = this._backGlowMaterial;
|
565
|
+
}
|
566
|
+
this._backGlow = backGlowModel;
|
567
|
+
});
|
568
|
+
return backGlowMesh;
|
569
|
+
}
|
570
|
+
_applyFacade(facadeTexture) {
|
571
|
+
this._plateMaterial.emissiveTexture = facadeTexture;
|
572
|
+
this._plateMaterial.opacityTexture = facadeTexture;
|
573
|
+
this._plateMaterial.diffuseColor = this.plateMaterialColor;
|
574
|
+
}
|
575
|
+
_performClickAnimation() {
|
576
|
+
const frameRate = 60;
|
577
|
+
const animationGroup = new AnimationGroup("Click Animation Group");
|
578
|
+
const animations = [
|
579
|
+
{
|
580
|
+
name: "backGlowMotion",
|
581
|
+
mesh: this._backGlow,
|
582
|
+
property: "material.motion",
|
583
|
+
keys: [
|
584
|
+
{
|
585
|
+
frame: 0,
|
586
|
+
values: [0, 0, 0],
|
587
|
+
},
|
588
|
+
{
|
589
|
+
frame: 20,
|
590
|
+
values: [1, 0.0144, 0.0144],
|
591
|
+
},
|
592
|
+
{
|
593
|
+
frame: 40,
|
594
|
+
values: [0.0027713229489760476, 0, 0],
|
595
|
+
},
|
596
|
+
{
|
597
|
+
frame: 45,
|
598
|
+
values: [0.0027713229489760476],
|
599
|
+
},
|
600
|
+
],
|
601
|
+
},
|
602
|
+
{
|
603
|
+
name: "_collisionPlateZSlide",
|
604
|
+
mesh: this._collisionPlate,
|
605
|
+
property: "position.z",
|
606
|
+
keys: [
|
607
|
+
{
|
608
|
+
frame: 0,
|
609
|
+
values: [0.0, 0.0, 0.0],
|
610
|
+
},
|
611
|
+
{
|
612
|
+
frame: 20,
|
613
|
+
values: [Vector3.Forward(this._collisionPlate._scene.useRightHandedSystem).scale(this.frontPlateDepth / 2).z, 0.0, 0.0],
|
614
|
+
},
|
615
|
+
{
|
616
|
+
frame: 40,
|
617
|
+
values: [0.0, 0.005403332496794331],
|
618
|
+
},
|
619
|
+
{
|
620
|
+
frame: 45,
|
621
|
+
values: [0.0],
|
622
|
+
},
|
623
|
+
],
|
624
|
+
},
|
625
|
+
{
|
626
|
+
name: "_collisionPlateZScale",
|
627
|
+
mesh: this._collisionPlate,
|
628
|
+
property: "scaling.z",
|
629
|
+
keys: [
|
630
|
+
{
|
631
|
+
frame: 0,
|
632
|
+
values: [this.frontPlateDepth, 0.0, 0.0],
|
633
|
+
},
|
634
|
+
{
|
635
|
+
frame: 20,
|
636
|
+
values: [this.backPlateDepth, 0.0, 0.0],
|
637
|
+
},
|
638
|
+
{
|
639
|
+
frame: 40,
|
640
|
+
values: [this.frontPlateDepth, 0.0054],
|
641
|
+
},
|
642
|
+
{
|
643
|
+
frame: 45,
|
644
|
+
values: [this.frontPlateDepth],
|
645
|
+
},
|
646
|
+
],
|
647
|
+
},
|
648
|
+
];
|
649
|
+
for (const animation of animations) {
|
650
|
+
const anim = new Animation(animation.name, animation.property, frameRate, Animation.ANIMATIONTYPE_FLOAT, Animation.ANIMATIONLOOPMODE_CYCLE);
|
651
|
+
const animkeyFrames = [];
|
652
|
+
for (const key of animation.keys) {
|
653
|
+
animkeyFrames.push({
|
654
|
+
frame: key.frame,
|
655
|
+
value: key.values[0],
|
656
|
+
inTangent: key.values[1],
|
657
|
+
outTangent: key.values[2],
|
658
|
+
interpolation: key.values[3],
|
659
|
+
});
|
660
|
+
}
|
661
|
+
anim.setKeys(animkeyFrames);
|
662
|
+
if (!animation.mesh) {
|
663
|
+
continue;
|
664
|
+
}
|
665
|
+
animationGroup.addTargetedAnimation(anim, animation.mesh);
|
666
|
+
}
|
667
|
+
animationGroup.normalize(0, 45);
|
668
|
+
animationGroup.speedRatio = 1;
|
669
|
+
animationGroup.play();
|
670
|
+
}
|
671
|
+
_performEnterExitAnimation(speedRatio) {
|
672
|
+
const frameRate = 60;
|
673
|
+
const animationGroup = new AnimationGroup("Enter Exit Animation Group");
|
674
|
+
const animations = [
|
675
|
+
{
|
676
|
+
name: "frontPlateFadeOut",
|
677
|
+
mesh: this._frontPlate,
|
678
|
+
property: "material.fadeOut",
|
679
|
+
keys: [
|
680
|
+
{
|
681
|
+
frame: 0,
|
682
|
+
values: [0, 0, 0.025045314830017686, 0],
|
683
|
+
},
|
684
|
+
{
|
685
|
+
frame: 40,
|
686
|
+
values: [1.00205599570012, 0.025045314830017686, 0, 0],
|
687
|
+
},
|
688
|
+
],
|
689
|
+
},
|
690
|
+
{
|
691
|
+
name: "textPlateZSlide",
|
692
|
+
mesh: this._textPlate,
|
693
|
+
property: "position.z",
|
694
|
+
keys: [
|
695
|
+
{
|
696
|
+
frame: 0,
|
697
|
+
values: [0, 0.0, 0.0],
|
698
|
+
},
|
699
|
+
{
|
700
|
+
frame: 40,
|
701
|
+
values: [Vector3.Forward(this._textPlate._scene.useRightHandedSystem).scale(-0.15).z, 0.0, 0.0],
|
702
|
+
},
|
703
|
+
],
|
704
|
+
},
|
705
|
+
];
|
706
|
+
for (const animation of animations) {
|
707
|
+
const anim = new Animation(animation.name, animation.property, frameRate, Animation.ANIMATIONTYPE_FLOAT, Animation.ANIMATIONLOOPMODE_CYCLE);
|
708
|
+
const animkeyFrames = [];
|
709
|
+
for (const key of animation.keys) {
|
710
|
+
animkeyFrames.push({
|
711
|
+
frame: key.frame,
|
712
|
+
value: key.values[0],
|
713
|
+
inTangent: key.values[1],
|
714
|
+
outTangent: key.values[2],
|
715
|
+
interpolation: key.values[3],
|
716
|
+
});
|
717
|
+
}
|
718
|
+
anim.setKeys(animkeyFrames);
|
719
|
+
if (!animation.mesh) {
|
720
|
+
continue;
|
721
|
+
}
|
722
|
+
animationGroup.addTargetedAnimation(anim, animation.mesh);
|
723
|
+
}
|
724
|
+
animationGroup.normalize(0, 45);
|
725
|
+
animationGroup.speedRatio = speedRatio;
|
726
|
+
animationGroup.play();
|
727
|
+
}
|
728
|
+
_createBackMaterial(mesh) {
|
729
|
+
var _a;
|
730
|
+
this._backMaterial = (_a = this._backMaterial) !== null && _a !== void 0 ? _a : new MRDLBackplateMaterial(this.name + "backPlateMaterial", mesh.getScene());
|
731
|
+
this._backMaterial.absoluteSizes = true;
|
732
|
+
this._backMaterial.radius = this.radius;
|
733
|
+
this._backMaterial.lineWidth = 0.02;
|
734
|
+
}
|
735
|
+
_createFrontMaterial(mesh) {
|
736
|
+
var _a;
|
737
|
+
this._frontMaterial = (_a = this._frontMaterial) !== null && _a !== void 0 ? _a : new MRDLFrontplateMaterial(this.name + "Front Material", mesh.getScene());
|
738
|
+
this.frontMaterial.radius = this.innerQuadRadius;
|
739
|
+
this.frontMaterial.fadeOut = 0.0;
|
740
|
+
}
|
741
|
+
_createBackGlowMaterial(mesh) {
|
742
|
+
var _a;
|
743
|
+
const glowRadius = this.radius + 0.04;
|
744
|
+
this._backGlowMaterial = (_a = this._backGlowMaterial) !== null && _a !== void 0 ? _a : new MRDLBackglowMaterial(this.name + "Back Glow Material", mesh.getScene());
|
745
|
+
this._backGlowMaterial.bevelRadius = glowRadius;
|
746
|
+
this._backGlowMaterial.lineWidth = glowRadius;
|
747
|
+
this._backGlowMaterial.motion = 0.0;
|
748
|
+
}
|
749
|
+
_createInnerQuadMaterial(mesh) {
|
750
|
+
var _a;
|
751
|
+
this._innerQuadMaterial = (_a = this._innerQuadMaterial) !== null && _a !== void 0 ? _a : new MRDLInnerquadMaterial("inner_quad", mesh.getScene());
|
752
|
+
this._innerQuadMaterial.radius = this.innerQuadRadius;
|
753
|
+
if (this.isToggleButton) {
|
754
|
+
this._innerQuadMaterial.color = this.innerQuadColor;
|
755
|
+
}
|
756
|
+
}
|
757
|
+
_createPlateMaterial(mesh) {
|
758
|
+
var _a;
|
759
|
+
this._plateMaterial = (_a = this._plateMaterial) !== null && _a !== void 0 ? _a : new StandardMaterial(this.name + "Plate Material", mesh.getScene());
|
760
|
+
this._plateMaterial.specularColor = Color3.Black();
|
761
|
+
}
|
762
|
+
_onToggle(newState) {
|
763
|
+
super._onToggle(newState);
|
764
|
+
}
|
765
|
+
_affectMaterial(mesh) {
|
766
|
+
if (this._shareMaterials) {
|
767
|
+
// Back
|
768
|
+
if (!this._host._touchSharedMaterials["mrdlBackplateMaterial"]) {
|
769
|
+
this._createBackMaterial(mesh);
|
770
|
+
this._host._touchSharedMaterials["mrdlBackplateMaterial"] = this._backMaterial;
|
771
|
+
}
|
772
|
+
else {
|
773
|
+
this._backMaterial = this._host._touchSharedMaterials["mrdlBackplateMaterial"];
|
774
|
+
}
|
775
|
+
// Front
|
776
|
+
if (!this._host._touchSharedMaterials["mrdlFrontplateMaterial"]) {
|
777
|
+
this._createFrontMaterial(mesh);
|
778
|
+
this._host._touchSharedMaterials["mrdlFrontplateMaterial"] = this._frontMaterial;
|
779
|
+
}
|
780
|
+
else {
|
781
|
+
this._frontMaterial = this._host._touchSharedMaterials["mrdlFrontplateMaterial"];
|
782
|
+
}
|
783
|
+
// Back glow
|
784
|
+
if (!this._host._touchSharedMaterials["mrdlBackglowMaterial"]) {
|
785
|
+
this._createBackGlowMaterial(mesh);
|
786
|
+
this._host._touchSharedMaterials["mrdlBackglowMaterial"] = this._backGlowMaterial;
|
787
|
+
}
|
788
|
+
else {
|
789
|
+
this._backGlowMaterial = this._host._touchSharedMaterials["mrdlBackglowMaterial"];
|
790
|
+
}
|
791
|
+
// Inner quad
|
792
|
+
if (!this._host._touchSharedMaterials["mrdlInnerQuadMaterial"]) {
|
793
|
+
this._createInnerQuadMaterial(mesh);
|
794
|
+
this._host._touchSharedMaterials["mrdlInnerQuadMaterial"] = this._innerQuadMaterial;
|
795
|
+
}
|
796
|
+
else {
|
797
|
+
this._innerQuadMaterial = this._host._touchSharedMaterials["mrdlInnerQuadMaterial"];
|
798
|
+
}
|
799
|
+
}
|
800
|
+
else {
|
801
|
+
this._createBackMaterial(mesh);
|
802
|
+
this._createFrontMaterial(mesh);
|
803
|
+
this._createBackGlowMaterial(mesh);
|
804
|
+
this._createInnerQuadMaterial(mesh);
|
805
|
+
}
|
806
|
+
this._createPlateMaterial(mesh);
|
807
|
+
this._backPlate.material = this._backMaterial;
|
808
|
+
this._textPlate.material = this._plateMaterial;
|
809
|
+
if (!this._isBackplateVisible) {
|
810
|
+
this._backPlate.visibility = 0;
|
811
|
+
}
|
812
|
+
if (this._frontPlate) {
|
813
|
+
this._frontPlate.material = this._frontMaterial;
|
814
|
+
}
|
815
|
+
if (this._backGlow) {
|
816
|
+
this._backGlow.material = this._backGlowMaterial;
|
817
|
+
}
|
818
|
+
if (this._innerQuad) {
|
819
|
+
this._innerQuad.material = this._innerQuadMaterial;
|
820
|
+
}
|
821
|
+
this._rebuildContent();
|
822
|
+
}
|
823
|
+
/**
|
824
|
+
* Releases all associated resources
|
825
|
+
*/
|
826
|
+
dispose() {
|
827
|
+
super.dispose(); // will dispose main mesh ie. back plate
|
828
|
+
this._disposeTooltip();
|
829
|
+
this.onPointerClickObservable.remove(this._pointerClickObserver);
|
830
|
+
this.onPointerEnterObservable.remove(this._pointerEnterObserver);
|
831
|
+
this.onPointerOutObservable.remove(this._pointerOutObserver);
|
832
|
+
this.onToggleObservable.remove(this._toggleObserver);
|
833
|
+
if (!this.shareMaterials) {
|
834
|
+
this._backMaterial.dispose();
|
835
|
+
this._frontMaterial.dispose();
|
836
|
+
this._plateMaterial.dispose();
|
837
|
+
this._backGlowMaterial.dispose();
|
838
|
+
this._innerQuadMaterial.dispose();
|
839
|
+
if (this._pickedPointObserver) {
|
840
|
+
this._host.onPickedPointChangedObservable.remove(this._pickedPointObserver);
|
841
|
+
this._pickedPointObserver = null;
|
842
|
+
}
|
843
|
+
}
|
844
|
+
}
|
845
|
+
}
|
846
|
+
/**
|
847
|
+
* Base Url for the frontplate model.
|
848
|
+
*/
|
849
|
+
TouchHolographicButton.MRTK_ASSET_BASE_URL = "https://assets.babylonjs.com/meshes/MRTK/";
|
850
|
+
/**
|
851
|
+
* File name for the frontplate model.
|
852
|
+
*/
|
853
|
+
TouchHolographicButton.FRONTPLATE_MODEL_FILENAME = "mrtk-fluent-frontplate.glb";
|
854
|
+
/**
|
855
|
+
* File name for the backplate model.
|
856
|
+
*/
|
857
|
+
TouchHolographicButton.BACKPLATE_MODEL_FILENAME = "mrtk-fluent-backplate.glb";
|
858
|
+
/**
|
859
|
+
* File name for the backglow model.
|
860
|
+
*/
|
861
|
+
TouchHolographicButton.BACKGLOW_MODEL_FILENAME = "mrtk-fluent-button.glb";
|
862
|
+
/**
|
863
|
+
* File name for the innerquad model.
|
864
|
+
*/
|
865
|
+
TouchHolographicButton.INNERQUAD_MODEL_FILENAME = "SlateProximity.glb";
|
866
|
+
//# sourceMappingURL=touchHolographicButton.js.map
|