@needle-tools/engine
Version:
Needle Engine is a web-based runtime for 3D apps. It runs on your machine for development with great integrations into editors like Unity or Blender - and can be deployed onto any device! It is flexible, extensible and networking and XR are built-in
76 lines • 3.03 kB
JavaScript
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
import { serializable } from '../engine/engine_serialization.js';
import { DeviceUtilities } from '../engine/engine_utils.js';
import { Behaviour } from './Component.js';
/**
* Exposes options to customize the built-in Needle Menu.
* From code, you can access the menu via {@link Context.menu}.
* @category User Interface
* @group Components
**/
export class NeedleMenu extends Behaviour {
position = "bottom";
/** Show the Needle logo in the menu (requires PRO license) */
showNeedleLogo = true;
/** When enabled the menu will also be visible in VR/AR when you look up
* @default undefined
*/
showSpatialMenu;
/** When enabled a button to enter fullscreen will be added to the menu
* @default undefined
*/
createFullscreenButton;
/** When enabled a button to mute the application will be added to the menu
* @default undefined
*/
createMuteButton;
/**
* When enabled a button to show a QR code will be added to the menu.
* @default undefined
*/
createQRCodeButton;
/** @hidden */
onEnable() {
this.applyOptions();
}
/** applies the options to `this.context.menu` */
applyOptions() {
this.context.menu.setPosition(this.position);
this.context.menu.showNeedleLogo(this.showNeedleLogo);
if (this.createFullscreenButton === true)
this.context.menu.showFullscreenOption(true);
if (this.createMuteButton === true)
this.context.menu.showAudioPlaybackOption(true);
if (this.showSpatialMenu === true)
this.context.menu.showSpatialMenu(this.showSpatialMenu);
if (this.createQRCodeButton === true) {
if (!DeviceUtilities.isMobileDevice()) {
this.context.menu.showQRCodeButton(true);
}
}
}
}
__decorate([
serializable()
], NeedleMenu.prototype, "position", void 0);
__decorate([
serializable()
], NeedleMenu.prototype, "showNeedleLogo", void 0);
__decorate([
serializable()
], NeedleMenu.prototype, "showSpatialMenu", void 0);
__decorate([
serializable()
], NeedleMenu.prototype, "createFullscreenButton", void 0);
__decorate([
serializable()
], NeedleMenu.prototype, "createMuteButton", void 0);
__decorate([
serializable()
], NeedleMenu.prototype, "createQRCodeButton", void 0);
//# sourceMappingURL=NeedleMenu.js.map