@needle-tools/engine 4.12.1 → 4.12.2
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/CHANGELOG.md +6 -1
- package/dist/{needle-engine.bundle-BPNuWGjI.min.js → needle-engine.bundle-DrIUla7B.min.js} +92 -93
- package/dist/{needle-engine.bundle-C4PyE3dQ.js → needle-engine.bundle-soFsvDTp.js} +436 -435
- package/dist/{needle-engine.bundle-BV9DUnnS.umd.cjs → needle-engine.bundle-zpJK5gi0.umd.cjs} +46 -47
- package/dist/needle-engine.d.ts +3 -1
- package/dist/needle-engine.js +2 -2
- package/dist/needle-engine.min.js +1 -1
- package/dist/needle-engine.umd.cjs +1 -1
- package/lib/engine/debug/debug_overlay.js +5 -1
- package/lib/engine/debug/debug_overlay.js.map +1 -1
- package/lib/engine/webcomponents/buttons.d.ts +3 -1
- package/lib/engine/webcomponents/buttons.js +2 -2
- package/lib/engine/webcomponents/buttons.js.map +1 -1
- package/lib/engine/webcomponents/needle-button.js +21 -16
- package/lib/engine/webcomponents/needle-button.js.map +1 -1
- package/lib/engine/webcomponents/needle-engine.ar-overlay.js +7 -5
- package/lib/engine/webcomponents/needle-engine.ar-overlay.js.map +1 -1
- package/lib/engine/webcomponents/needle-engine.js +1 -1
- package/package.json +1 -1
- package/src/engine/debug/debug_overlay.ts +5 -1
- package/src/engine/webcomponents/buttons.ts +2 -2
- package/src/engine/webcomponents/needle-button.ts +23 -19
- package/src/engine/webcomponents/needle-engine.ar-overlay.ts +10 -9
- package/src/engine/webcomponents/needle-engine.ts +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"needle-engine.ar-overlay.js","sourceRoot":"","sources":["../../../src/engine/webcomponents/needle-engine.ar-overlay.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,
|
|
1
|
+
{"version":3,"file":"needle-engine.ar-overlay.js","sourceRoot":"","sources":["../../../src/engine/webcomponents/needle-engine.ar-overlay.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AAI,MAAM,CAAC,UAAU;YAAE,OAAO,MAAM,CAAC,UAAU,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;QACrE,OAAO,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IACvC,CAAC;CAEJ"}
|
|
@@ -224,7 +224,7 @@ export class NeedleEngineWebComponent extends HTMLElement {
|
|
|
224
224
|
<canvas></canvas>
|
|
225
225
|
</div>
|
|
226
226
|
<div class="content">
|
|
227
|
-
<slot class="overlay-content"></slot>
|
|
227
|
+
<slot class="overlay-content" style="display: contents;"></slot>
|
|
228
228
|
</div>
|
|
229
229
|
`;
|
|
230
230
|
// #endregion
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@needle-tools/engine",
|
|
3
|
-
"version": "4.12.
|
|
3
|
+
"version": "4.12.2",
|
|
4
4
|
"description": "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.",
|
|
5
5
|
"main": "dist/needle-engine.min.js",
|
|
6
6
|
"exports": {
|
|
@@ -110,7 +110,11 @@ function onParseError(args: Array<any>) {
|
|
|
110
110
|
export function addLog(type: LogType, message: string | any[], _file?: string | null, _line?: number | null) {
|
|
111
111
|
if (hide) return;
|
|
112
112
|
const context = ContextRegistry.Current;
|
|
113
|
-
|
|
113
|
+
let domElement = context?.domElement ?? document.querySelector("needle-engine");
|
|
114
|
+
// check if we're in webxr dom overlay
|
|
115
|
+
if (context.isInAR) {
|
|
116
|
+
domElement = context.arOverlayElement;
|
|
117
|
+
}
|
|
114
118
|
if (!domElement) return;
|
|
115
119
|
if (Array.isArray(message)) {
|
|
116
120
|
let newMessage = "";
|
|
@@ -176,7 +176,7 @@ export class ButtonsFactory {
|
|
|
176
176
|
* The QR code will be generated with the current URL when the button is clicked
|
|
177
177
|
* @returns the QR code button element
|
|
178
178
|
*/
|
|
179
|
-
createQRCode(): HTMLButtonElement {
|
|
179
|
+
createQRCode(opts?: { anchorElement?: HTMLElement }): HTMLButtonElement {
|
|
180
180
|
|
|
181
181
|
if (this._qrButton) return this._qrButton;
|
|
182
182
|
|
|
@@ -223,7 +223,7 @@ export class ButtonsFactory {
|
|
|
223
223
|
// TODO: we would need to search for the right engine element to insert this into if there are more
|
|
224
224
|
// Insert the QR code overlay inside the needle-engine element
|
|
225
225
|
const engine_element = document.body.querySelector("needle-engine");
|
|
226
|
-
const parent = engine_element || document.body;
|
|
226
|
+
const parent = opts?.anchorElement?.parentElement || engine_element || document.body;
|
|
227
227
|
parent.appendChild(qrCodeContainer);
|
|
228
228
|
const containerRect = qrCodeElement.getBoundingClientRect();
|
|
229
229
|
const buttonRect = qrCodeButton.getBoundingClientRect();
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { isDevEnvironment } from "../debug/index.js";
|
|
2
|
+
import { ButtonsFactory } from "./buttons.js";
|
|
2
3
|
import { iconFontUrl, loadFont } from "./fonts.js";
|
|
3
4
|
import { WebXRButtonFactory } from "./WebXRButtons.js";
|
|
4
5
|
|
|
@@ -41,7 +42,7 @@ const isDev = isDevEnvironment();
|
|
|
41
42
|
*/
|
|
42
43
|
export class NeedleButtonElement extends HTMLElement {
|
|
43
44
|
|
|
44
|
-
static observedAttributes = ["ar", "vr", "quicklook"];
|
|
45
|
+
static observedAttributes = ["ar", "vr", "quicklook", "qrcode"];
|
|
45
46
|
|
|
46
47
|
constructor() {
|
|
47
48
|
super();
|
|
@@ -62,13 +63,13 @@ export class NeedleButtonElement extends HTMLElement {
|
|
|
62
63
|
#button: HTMLButtonElement | undefined;
|
|
63
64
|
/** If AR or VR is requested we create and use the webxr button factory to create a button with default behaviour */
|
|
64
65
|
#webxrfactory: WebXRButtonFactory | undefined;
|
|
66
|
+
#buttonfactory: ButtonsFactory | undefined;
|
|
65
67
|
|
|
66
68
|
#observer: MutationObserver | undefined;
|
|
67
69
|
|
|
68
70
|
#update() {
|
|
69
71
|
this.#button?.remove();
|
|
70
72
|
|
|
71
|
-
|
|
72
73
|
if (this.getAttribute("ar") != null) {
|
|
73
74
|
this.#webxrfactory ??= new WebXRButtonFactory()
|
|
74
75
|
this.#button = this.#webxrfactory.createARButton();
|
|
@@ -81,11 +82,15 @@ export class NeedleButtonElement extends HTMLElement {
|
|
|
81
82
|
this.#webxrfactory ??= new WebXRButtonFactory()
|
|
82
83
|
this.#button = this.#webxrfactory.createQuicklookButton();
|
|
83
84
|
}
|
|
85
|
+
else if (this.getAttribute("qrcode") != null) {
|
|
86
|
+
this.#buttonfactory ??= new ButtonsFactory();
|
|
87
|
+
this.#button = this.#buttonfactory.createQRCode({ anchorElement: this });
|
|
88
|
+
}
|
|
84
89
|
else {
|
|
85
90
|
if (isDev) {
|
|
86
91
|
console.warn("No button type specified for <needle-button>. Use either ar, vr or quicklook attribute.")
|
|
87
92
|
}
|
|
88
|
-
else
|
|
93
|
+
else {
|
|
89
94
|
console.debug("No button type specified for <needle-button>. Use either ar, vr or quicklook attribute.")
|
|
90
95
|
}
|
|
91
96
|
return;
|
|
@@ -96,30 +101,29 @@ export class NeedleButtonElement extends HTMLElement {
|
|
|
96
101
|
this.#styles ??= document.createElement("style");
|
|
97
102
|
this.#styles.innerHTML = `
|
|
98
103
|
button {
|
|
99
|
-
all:
|
|
100
|
-
cursor: inherit;
|
|
101
|
-
color: inherit;
|
|
102
|
-
font-family: inherit;
|
|
103
|
-
gap: inherit;
|
|
104
|
-
white-space: nowrap;
|
|
104
|
+
all: unset;
|
|
105
105
|
}
|
|
106
106
|
`;
|
|
107
107
|
const hasUnstyledAttribute = this.getAttribute("unstyled") != undefined;
|
|
108
108
|
if (!hasUnstyledAttribute) {
|
|
109
109
|
this.#styles.innerHTML += `
|
|
110
110
|
:host {
|
|
111
|
-
display: inline-
|
|
112
|
-
|
|
113
|
-
|
|
111
|
+
display: inline-flex;
|
|
112
|
+
align-items: center;
|
|
113
|
+
justify-content: center;
|
|
114
114
|
width: fit-content;
|
|
115
|
-
transition: background .2s;
|
|
116
115
|
|
|
117
|
-
cursor: pointer;
|
|
118
116
|
padding: 0.4rem .5rem;
|
|
119
|
-
border-radius:
|
|
120
|
-
|
|
117
|
+
border-radius: 100vw;
|
|
118
|
+
|
|
121
119
|
background: rgba(245, 245, 245, .8);
|
|
120
|
+
backdrop-filter: blur(10px);
|
|
121
|
+
|
|
122
|
+
cursor: pointer;
|
|
123
|
+
color: black;
|
|
122
124
|
outline: rgba(0,0,0,.05) 1px solid;
|
|
125
|
+
|
|
126
|
+
transition: all .2s;
|
|
123
127
|
}
|
|
124
128
|
:host(:hover) {
|
|
125
129
|
background: rgba(255, 255, 255, 1);
|
|
@@ -152,8 +156,8 @@ export class NeedleButtonElement extends HTMLElement {
|
|
|
152
156
|
this.#observer?.disconnect();
|
|
153
157
|
this.#observer ??= new MutationObserver(() => this.#updateVisibility());
|
|
154
158
|
this.#observer.observe(this.#button, { attributes: true });
|
|
155
|
-
if(isDev) {
|
|
156
|
-
console.log("Needle Button updated")
|
|
159
|
+
if (isDev) {
|
|
160
|
+
console.log("Needle Button updated", this);
|
|
157
161
|
}
|
|
158
162
|
}
|
|
159
163
|
|
|
@@ -170,7 +174,7 @@ export class NeedleButtonElement extends HTMLElement {
|
|
|
170
174
|
|
|
171
175
|
#onclick = (_ev: MouseEvent) => {
|
|
172
176
|
if (isDev) {
|
|
173
|
-
console.log("Needle Button clicked")
|
|
177
|
+
console.log("Needle Button clicked", { defaultPrevented: _ev.defaultPrevented, hasButton: !!this.#button });
|
|
174
178
|
}
|
|
175
179
|
if (_ev.defaultPrevented) return;
|
|
176
180
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Context } from "../engine_setup.js";
|
|
2
|
-
import { DeviceUtilities,getParam } from "../engine_utils.js";
|
|
2
|
+
import { DeviceUtilities, getParam } from "../engine_utils.js";
|
|
3
3
|
|
|
4
4
|
const debug = getParam("debugoverlay");
|
|
5
5
|
export const arContainerClassName = "ar";
|
|
@@ -28,7 +28,7 @@ export class AROverlayHandler {
|
|
|
28
28
|
this.currentSession = session;
|
|
29
29
|
this.arContainer = overlayContainer;
|
|
30
30
|
|
|
31
|
-
if (DeviceUtilities.isMozillaXR()) {
|
|
31
|
+
if (DeviceUtilities.isMozillaXR() || DeviceUtilities.isNeedleAppClip()) {
|
|
32
32
|
const arElements = context.domElement!.children;
|
|
33
33
|
for (let i = 0; i < arElements?.length; i++) {
|
|
34
34
|
const el = arElements[i];
|
|
@@ -38,10 +38,9 @@ export class AROverlayHandler {
|
|
|
38
38
|
this.arContainer?.appendChild(el);
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
if(overlayContainer) {
|
|
41
|
+
if (overlayContainer) {
|
|
42
42
|
this.originalDomOverlayParent = overlayContainer.parentNode;
|
|
43
|
-
if (this.originalDomOverlayParent)
|
|
44
|
-
{
|
|
43
|
+
if (this.originalDomOverlayParent) {
|
|
45
44
|
console.log("Reparent DOM Overlay to body", overlayContainer, overlayContainer.style.display);
|
|
46
45
|
// mozilla webxr does hide elements on session start
|
|
47
46
|
// this is only necessary if we generated the overlay element
|
|
@@ -119,18 +118,20 @@ export class AROverlayHandler {
|
|
|
119
118
|
|
|
120
119
|
private ensureQuitARButton(element: HTMLElement) {
|
|
121
120
|
|
|
122
|
-
// No quit button in app clips, we provide one via the native UI
|
|
123
|
-
if (DeviceUtilities.isNeedleAppClip()) {
|
|
124
|
-
return;
|
|
125
|
-
}
|
|
126
121
|
|
|
127
122
|
const quitARSlot = document.createElement("slot");
|
|
123
|
+
quitARSlot.style.display = "contents";
|
|
128
124
|
quitARSlot.setAttribute("name", "quit-ar");
|
|
129
125
|
this.appendElement(quitARSlot, element);
|
|
130
126
|
this._createdAROnlyElements.push(quitARSlot);
|
|
131
127
|
// for mozilla XR reparenting we have to make sure the close button is clickable so we set it on the element directly
|
|
132
128
|
// it's in general perhaps more safe to set it on the element to ensure it's clickable
|
|
133
129
|
quitARSlot.style.pointerEvents = "auto";
|
|
130
|
+
// No default quit button in the top right corner in app clips
|
|
131
|
+
// we provide one via the native UI
|
|
132
|
+
if (DeviceUtilities.isNeedleAppClip()) {
|
|
133
|
+
quitARSlot.style.display = "none";
|
|
134
|
+
}
|
|
134
135
|
|
|
135
136
|
// We want to search the document if there's a quit-ar button
|
|
136
137
|
// In which case we don't want to populate the default button (slot) with any content
|
|
@@ -254,7 +254,7 @@ export class NeedleEngineWebComponent extends HTMLElement implements INeedleEngi
|
|
|
254
254
|
<canvas></canvas>
|
|
255
255
|
</div>
|
|
256
256
|
<div class="content">
|
|
257
|
-
<slot class="overlay-content"></slot>
|
|
257
|
+
<slot class="overlay-content" style="display: contents;"></slot>
|
|
258
258
|
</div>
|
|
259
259
|
`;
|
|
260
260
|
// #endregion
|