Cleaned up menus and local environment.

This commit is contained in:
Michael Mainguy 2023-12-11 15:15:17 -06:00
parent 7d5ef80b5b
commit 410a88099e
4 changed files with 15 additions and 16 deletions

View File

@ -167,14 +167,13 @@ export class Base {
}
private toolboxHandleWasGrabbed(mesh: AbstractMesh): boolean {
if (isDiagramEntity(mesh)
&& mesh?.metadata?.handle == true) {
if (isDiagramEntity(mesh)) {
this.grabbedMesh = null;
this.previousParentId = null;
mesh.setParent(null);
return true;
} else {
return false;
} else {
return (mesh?.metadata?.handle == true);
}
}
private drop() {

View File

@ -39,10 +39,9 @@ export function diagramEventHandler(event: DiagramEvent,
switch (event.type) {
case DiagramEventType.RESET:
scene.getNodes().forEach((m) => {
if (m?.metadata?.template && !m?.metadata?.tool) {
m.dispose();
scene.getNodes().forEach((node) => {
if (node?.metadata?.template && !node?.metadata?.tool) {
node.dispose();
}
});
break;

View File

@ -16,12 +16,9 @@ export class DiagramListingMenu extends AbstractMenu {
constructor(scene: Scene, xr: WebXRDefaultExperience, controllers: Controllers, diagramManager: DiagramManager) {
super(scene, xr, controllers);
this.diagramManager = diagramManager;
this.buildMenu();
this.controllers.controllerObserver.add((event) => {
if (event.type == ControllerEventType.B_BUTTON) {
this.toggle();
}
});
@ -47,6 +44,8 @@ export class DiagramListingMenu extends AbstractMenu {
height: .5
}, this.scene);
this.mesh = configPlane;
this.createHandle(this.mesh);
this.mesh.position = new Vector3(0, .32, 0);
const configTexture = AdvancedDynamicTexture.CreateForMesh(configPlane, 2048, 1024);
configTexture.background = "white";
@ -55,8 +54,7 @@ export class DiagramListingMenu extends AbstractMenu {
this.panel = new StackPanel('diagramListingStack');
scrollViewer.addControl(this.panel);
this.createHandle(configPlane);
configPlane.position.y = .5;
//configPlane.position.y = .5;
setMenuPosition(this.handle.mesh, this.scene, new Vector3(0, .4, 0));
this.mesh.isVisible = false;
(this.mesh.parent as AbstractMesh).isVisible = false;

View File

@ -48,15 +48,18 @@ export class CustomEnvironment {
sound.play()
}, 2000, sounds.background);
const effects: Array<Sound> = sounds.backgroundEffects;
window.setInterval((sounds: Array<Sound>) => {
if (Math.random() < .5) {
return;
}
const MAX_DISTANCE = 40;
const sound = Math.floor(Math.random() * sounds.length);
const x = Math.floor(Math.random() * 20) - 10;
const z = Math.floor(Math.random() * 20) - 10;
const x = (Math.random() * MAX_DISTANCE) - (MAX_DISTANCE / 2);
const y = Math.random() * (MAX_DISTANCE / 2);
const z = (Math.random() * MAX_DISTANCE) - (MAX_DISTANCE / 2);
const position = new Vector3(x, 0, z);
const position = new Vector3(x, y, z);
if (sounds[sound].isPlaying) {
} else {