lunchboxjs 2.1.18 → 2.2.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/dist/lunchboxjs.cjs +1 -1
- package/dist/lunchboxjs.js +19 -21
- package/dist/lunchboxjs.umd.cjs +1 -1
- package/package.json +1 -1
- package/src/html-anchor.ts +9 -6
package/dist/lunchboxjs.cjs
CHANGED
|
@@ -40,4 +40,4 @@
|
|
|
40
40
|
max-width: 100%;
|
|
41
41
|
max-height: 100%;
|
|
42
42
|
}
|
|
43
|
-
`;let f=re;A([y()],f.prototype,"background");A([y()],f.prototype,"dpr");A([y()],f.prototype,"headless");A([y({attribute:"manual-render",type:Boolean})],f.prototype,"manualRender");A([y({attribute:"dispatch-before-render",type:Boolean})],f.prototype,"dispatchBeforeRender");A([y({attribute:"dispatch-after-render",type:Boolean})],f.prototype,"dispatchAfterRender");A([y({attribute:"renderer-args",type:Object})],f.prototype,"rendererArgs");A([y({attribute:"camera-args",type:Object})],f.prototype,"cameraArgs");class Pe extends C{constructor(){super(...arguments),this.parentLunchbox=null,this.frame=-1,this.scratchV3=new p.Vector3,this.scratchFrustum=new p.Frustum,this.scratchMatrix4=new p.Matrix4}tryAttachUpdate(){var o;const e=(o=this.parentLunchbox)==null?void 0:o.instance;if(!e)return!1;if(!e.isObject3D)throw new Error("html-anchor must be the child of an Object3D");const t=k(this,a=>{var h;return!!((h=a==null?void 0:a.three)!=null&&h.renderer)});if(!t)return console.error("three-lunchbox parent required for html-anchor"),!1;const s=t.three.camera;if(!s)return console.error("camera required for html-anchor"),!1;const r=t.three.renderer;if(!(r!=null&&r.domElement))return console.error("renderer and DOM element required for html-anchor"),!1;const n=()=>{this.frame=requestAnimationFrame(n),s.updateMatrix(),s.updateMatrixWorld(),e.getWorldPosition(this.scratchV3);const a=this.scratchV3.clone();this.scratchV3.project(s),this.scratchV3.multiplyScalar(.5).addScalar(.5),this.scratchV3.y=1-this.scratchV3.y;const h=this.scratchV3.clone().set(r.domElement.width,r.domElement.height,1);h.divideScalar(devicePixelRatio),this.scratchV3.multiply(h);const c=e.position.clone().distanceTo(s.getWorldPosition(this.scratchV3.clone()));this.scratchFrustum.setFromProjectionMatrix(this.scratchMatrix4.clone().multiplyMatrices(s.projectionMatrix,s.matrixWorldInverse));const d=this.scratchFrustum.containsPoint(a);
|
|
43
|
+
`;let f=re;A([y()],f.prototype,"background");A([y()],f.prototype,"dpr");A([y()],f.prototype,"headless");A([y({attribute:"manual-render",type:Boolean})],f.prototype,"manualRender");A([y({attribute:"dispatch-before-render",type:Boolean})],f.prototype,"dispatchBeforeRender");A([y({attribute:"dispatch-after-render",type:Boolean})],f.prototype,"dispatchAfterRender");A([y({attribute:"renderer-args",type:Object})],f.prototype,"rendererArgs");A([y({attribute:"camera-args",type:Object})],f.prototype,"cameraArgs");class Pe extends C{constructor(){super(...arguments),this.parentLunchbox=null,this.frame=-1,this.scratchV3=new p.Vector3,this.scratchFrustum=new p.Frustum,this.scratchMatrix4=new p.Matrix4}tryAttachUpdate(){var o;const e=(o=this.parentLunchbox)==null?void 0:o.instance;if(!e)return!1;if(!e.isObject3D)throw new Error("html-anchor must be the child of an Object3D");const t=k(this,a=>{var h;return!!((h=a==null?void 0:a.three)!=null&&h.renderer)});if(!t)return console.error("three-lunchbox parent required for html-anchor"),!1;const s=t.three.camera;if(!s)return console.error("camera required for html-anchor"),!1;const r=t.three.renderer;if(!(r!=null&&r.domElement))return console.error("renderer and DOM element required for html-anchor"),!1;const n=()=>{this.frame=requestAnimationFrame(n),s.updateMatrix(),s.updateMatrixWorld(),e.getWorldPosition(this.scratchV3);const a=this.scratchV3.clone();this.scratchV3.project(s),this.scratchV3.multiplyScalar(.5).addScalar(.5),this.scratchV3.y=1-this.scratchV3.y;const h=this.scratchV3.clone().set(r.domElement.width,r.domElement.height,1);h.divideScalar(devicePixelRatio),this.scratchV3.multiply(h);const c=e.position.clone().distanceTo(s.getWorldPosition(this.scratchV3.clone()));this.scratchFrustum.setFromProjectionMatrix(this.scratchMatrix4.clone().multiplyMatrices(s.projectionMatrix,s.matrixWorldInverse));const d=this.scratchFrustum.containsPoint(a);this.style.setProperty("--left",`${this.scratchV3.x}px`),this.style.setProperty("--top",`${this.scratchV3.y}px`),this.style.setProperty("--distance-from-camera",`${c}`),this.style.setProperty("--in-frustum",`${d?1:0}`),d?this.classList.add("in-frustum"):this.classList.remove("in-frustum")};return n(),!0}connectedCallback(){super.connectedCallback();const e=this.parentNode;if(!e)throw new Error("html-anchor requires a 3D parent");this.parentLunchbox=e,this.tryAttachUpdate()||this.parentLunchbox.addEventListener("instanceadded",()=>{if(!this.tryAttachUpdate())throw new Error("error attaching html-anchor to Object3D")},{once:!0})}disconnectedCallback(){this.frame!==-1&&cancelAnimationFrame(this.frame)}render(){return se`<slot></slot>`}createRenderRoot(){return this}}const mt=({prependList:i=[]}={})=>{Object.entries({"three-lunchbox":f,"html-anchor":Pe}).forEach(([t,s])=>{customElements.get(t)||customElements.define(t,s)}),[...i,...Y].forEach(t=>{const s=Le(t);if(customElements.get(s))return;const r=Te(t);r&&customElements.define(s,r)})},ft=(i,e,t=window)=>{if(t.customElements.get(i)){console.log(`${i} already registered as a custom element. Try a different name if registering is still required.`);return}const s=Te(e);if(s)t.customElements.define(i,s);else throw new Error(`Could not extend ${i}. The second paramater must be a class.`)},Me="threepointermove",Oe="threemousemove",xe="threeclick",Re="beforerender",Ne="afterrender",Le=i=>{let e=i.split(/\.?(?=[A-Z])/).join("-").toLowerCase().replace(/-g-l-/,"-gl-");return e.includes("-")||(e=`three-${e}`),e},yt=Y.map(Le);exports.AFTER_RENDER_EVENT_NAME=Ne;exports.BEFORE_RENDER_EVENT_NAME=Re;exports.HtmlAnchor=Pe;exports.THREE_CLICK_EVENT_NAME=xe;exports.THREE_MOUSE_MOVE_EVENT_NAME=Oe;exports.THREE_POINTER_MOVE_EVENT_NAME=Me;exports.ThreeBase=U;exports.ThreeLunchbox=f;exports.autoComponents=Y;exports.extend=ft;exports.initLunchbox=mt;exports.webComponentNames=yt;
|
package/dist/lunchboxjs.js
CHANGED
|
@@ -92,7 +92,7 @@ const Ae = [
|
|
|
92
92
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
93
93
|
*/
|
|
94
94
|
const j = globalThis, Y = j.ShadowRoot && (j.ShadyCSS === void 0 || j.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, X = Symbol(), re = /* @__PURE__ */ new WeakMap();
|
|
95
|
-
let
|
|
95
|
+
let be = class {
|
|
96
96
|
constructor(e, t, s) {
|
|
97
97
|
if (this._$cssResult$ = !0, s !== X)
|
|
98
98
|
throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
|
|
@@ -111,7 +111,7 @@ let Ee = class {
|
|
|
111
111
|
return this.cssText;
|
|
112
112
|
}
|
|
113
113
|
};
|
|
114
|
-
const Me = (i) => new
|
|
114
|
+
const Me = (i) => new be(typeof i == "string" ? i : i + "", void 0, X), Oe = (i, ...e) => {
|
|
115
115
|
const t = i.length === 1 ? i[0] : e.reduce((s, r, n) => s + ((o) => {
|
|
116
116
|
if (o._$cssResult$ === !0)
|
|
117
117
|
return o.cssText;
|
|
@@ -119,7 +119,7 @@ const Me = (i) => new Ee(typeof i == "string" ? i : i + "", void 0, X), Oe = (i,
|
|
|
119
119
|
return o;
|
|
120
120
|
throw Error("Value passed to 'css' function must be a 'css' function result: " + o + ". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.");
|
|
121
121
|
})(r) + i[n + 1], i[0]);
|
|
122
|
-
return new
|
|
122
|
+
return new be(t, i, X);
|
|
123
123
|
}, xe = (i, e) => {
|
|
124
124
|
if (Y)
|
|
125
125
|
i.adoptedStyleSheets = e.map((t) => t instanceof CSSStyleSheet ? t : t.styleSheet);
|
|
@@ -390,8 +390,8 @@ S.elementStyles = [], S.shadowRootOptions = { mode: "open" }, S[O("elementProper
|
|
|
390
390
|
* Copyright 2017 Google LLC
|
|
391
391
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
392
392
|
*/
|
|
393
|
-
const x = globalThis, ae = (i) => i, I = x.trustedTypes, he = I ? I.createPolicy("lit-html", { createHTML: (i) => i }) : void 0,
|
|
394
|
-
\f\r]`, M = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, ce = /-->/g, le = />/g,
|
|
393
|
+
const x = globalThis, ae = (i) => i, I = x.trustedTypes, he = I ? I.createPolicy("lit-html", { createHTML: (i) => i }) : void 0, Ee = "$lit$", g = `lit$${Math.random().toFixed(9).slice(2)}$`, _e = "?" + g, ke = `<${_e}>`, C = document, R = () => C.createComment(""), N = (i) => i === null || typeof i != "object" && typeof i != "function", ee = Array.isArray, Ie = (i) => ee(i) || typeof (i == null ? void 0 : i[Symbol.iterator]) == "function", q = `[
|
|
394
|
+
\f\r]`, M = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, ce = /-->/g, le = />/g, E = RegExp(`>|${q}(?:([^\\s"'>=/]+)(${q}*=${q}*(?:[^
|
|
395
395
|
\f\r"'\`<>=]|("|')|))|$)`, "g"), de = /'/g, ue = /"/g, ve = /^(?:script|style|textarea|title)$/i, Be = (i) => (e, ...t) => ({ _$litType$: i, strings: e, values: t }), te = Be(1), P = Symbol.for("lit-noChange"), u = Symbol.for("lit-nothing"), pe = /* @__PURE__ */ new WeakMap(), _ = C.createTreeWalker(C, 129);
|
|
396
396
|
function we(i, e) {
|
|
397
397
|
if (!ee(i) || !i.hasOwnProperty("raw"))
|
|
@@ -405,9 +405,9 @@ const Ge = (i, e) => {
|
|
|
405
405
|
const h = i[a];
|
|
406
406
|
let c, d, l = -1, m = 0;
|
|
407
407
|
for (; m < h.length && (o.lastIndex = m, d = o.exec(h), d !== null); )
|
|
408
|
-
m = o.lastIndex, o === M ? d[1] === "!--" ? o = ce : d[1] !== void 0 ? o = le : d[2] !== void 0 ? (ve.test(d[2]) && (r = RegExp("</" + d[2], "g")), o =
|
|
409
|
-
const $ = o ===
|
|
410
|
-
n += o === M ? h + ke : l >= 0 ? (s.push(c), h.slice(0, l) +
|
|
408
|
+
m = o.lastIndex, o === M ? d[1] === "!--" ? o = ce : d[1] !== void 0 ? o = le : d[2] !== void 0 ? (ve.test(d[2]) && (r = RegExp("</" + d[2], "g")), o = E) : d[3] !== void 0 && (o = E) : o === E ? d[0] === ">" ? (o = r ?? M, l = -1) : d[1] === void 0 ? l = -2 : (l = o.lastIndex - d[2].length, c = d[1], o = d[3] === void 0 ? E : d[3] === '"' ? ue : de) : o === ue || o === de ? o = E : o === ce || o === le ? o = M : (o = E, r = void 0);
|
|
409
|
+
const $ = o === E && i[a + 1].startsWith("/>") ? " " : "";
|
|
410
|
+
n += o === M ? h + ke : l >= 0 ? (s.push(c), h.slice(0, l) + Ee + h.slice(l) + g + $) : h + g + (l === -2 ? a : $);
|
|
411
411
|
}
|
|
412
412
|
return [we(i, n + (i[t] || "<?>") + (e === 2 ? "</svg>" : e === 3 ? "</math>" : "")), s];
|
|
413
413
|
};
|
|
@@ -425,7 +425,7 @@ class L {
|
|
|
425
425
|
if (r.nodeType === 1) {
|
|
426
426
|
if (r.hasAttributes())
|
|
427
427
|
for (const l of r.getAttributeNames())
|
|
428
|
-
if (l.endsWith(
|
|
428
|
+
if (l.endsWith(Ee)) {
|
|
429
429
|
const m = d[o++], $ = r.getAttribute(l).split(g), H = /([.?@])?(.*)/.exec(m);
|
|
430
430
|
h.push({ type: 1, index: n, name: H[2], strings: $, ctor: H[1] === "." ? We : H[1] === "?" ? qe : H[1] === "@" ? Fe : z }), r.removeAttribute(l);
|
|
431
431
|
} else
|
|
@@ -968,7 +968,7 @@ const Pe = (i) => {
|
|
|
968
968
|
}
|
|
969
969
|
return t ? r : s;
|
|
970
970
|
};
|
|
971
|
-
var it = Object.defineProperty,
|
|
971
|
+
var it = Object.defineProperty, b = (i, e, t, s) => {
|
|
972
972
|
for (var r = void 0, n = i.length - 1, o; n >= 0; n--)
|
|
973
973
|
(o = i[n]) && (r = o(e, t, r) || r);
|
|
974
974
|
return r && it(e, t, r), r;
|
|
@@ -1101,40 +1101,40 @@ se.styles = Oe`
|
|
|
1101
1101
|
}
|
|
1102
1102
|
`;
|
|
1103
1103
|
let f = se;
|
|
1104
|
-
|
|
1104
|
+
b([
|
|
1105
1105
|
y()
|
|
1106
1106
|
], f.prototype, "background");
|
|
1107
|
-
|
|
1107
|
+
b([
|
|
1108
1108
|
y()
|
|
1109
1109
|
], f.prototype, "dpr");
|
|
1110
|
-
|
|
1110
|
+
b([
|
|
1111
1111
|
y()
|
|
1112
1112
|
], f.prototype, "headless");
|
|
1113
|
-
|
|
1113
|
+
b([
|
|
1114
1114
|
y({
|
|
1115
1115
|
attribute: "manual-render",
|
|
1116
1116
|
type: Boolean
|
|
1117
1117
|
})
|
|
1118
1118
|
], f.prototype, "manualRender");
|
|
1119
|
-
|
|
1119
|
+
b([
|
|
1120
1120
|
y({
|
|
1121
1121
|
attribute: "dispatch-before-render",
|
|
1122
1122
|
type: Boolean
|
|
1123
1123
|
})
|
|
1124
1124
|
], f.prototype, "dispatchBeforeRender");
|
|
1125
|
-
|
|
1125
|
+
b([
|
|
1126
1126
|
y({
|
|
1127
1127
|
attribute: "dispatch-after-render",
|
|
1128
1128
|
type: Boolean
|
|
1129
1129
|
})
|
|
1130
1130
|
], f.prototype, "dispatchAfterRender");
|
|
1131
|
-
|
|
1131
|
+
b([
|
|
1132
1132
|
y({
|
|
1133
1133
|
attribute: "renderer-args",
|
|
1134
1134
|
type: Object
|
|
1135
1135
|
})
|
|
1136
1136
|
], f.prototype, "rendererArgs");
|
|
1137
|
-
|
|
1137
|
+
b([
|
|
1138
1138
|
y({
|
|
1139
1139
|
attribute: "camera-args",
|
|
1140
1140
|
type: Object
|
|
@@ -1173,9 +1173,7 @@ class ot extends w {
|
|
|
1173
1173
|
const c = e.position.clone().distanceTo(s.getWorldPosition(this.scratchV3.clone()));
|
|
1174
1174
|
this.scratchFrustum.setFromProjectionMatrix(this.scratchMatrix4.clone().multiplyMatrices(s.projectionMatrix, s.matrixWorldInverse));
|
|
1175
1175
|
const d = this.scratchFrustum.containsPoint(a);
|
|
1176
|
-
|
|
1177
|
-
l.style.setProperty("--left", `${this.scratchV3.x}px`), l.style.setProperty("--top", `${this.scratchV3.y}px`), l.style.setProperty("--distance-from-camera", `${c}`), l.style.setProperty("--in-frustum", `${d ? 1 : 0}`);
|
|
1178
|
-
});
|
|
1176
|
+
this.style.setProperty("--left", `${this.scratchV3.x}px`), this.style.setProperty("--top", `${this.scratchV3.y}px`), this.style.setProperty("--distance-from-camera", `${c}`), this.style.setProperty("--in-frustum", `${d ? 1 : 0}`), d ? this.classList.add("in-frustum") : this.classList.remove("in-frustum");
|
|
1179
1177
|
};
|
|
1180
1178
|
return n(), !0;
|
|
1181
1179
|
}
|
package/dist/lunchboxjs.umd.cjs
CHANGED
|
@@ -40,4 +40,4 @@
|
|
|
40
40
|
max-width: 100%;
|
|
41
41
|
max-height: 100%;
|
|
42
42
|
}
|
|
43
|
-
`;let f=ne;_([E()],f.prototype,"background"),_([E()],f.prototype,"dpr"),_([E()],f.prototype,"headless"),_([E({attribute:"manual-render",type:Boolean})],f.prototype,"manualRender"),_([E({attribute:"dispatch-before-render",type:Boolean})],f.prototype,"dispatchBeforeRender"),_([E({attribute:"dispatch-after-render",type:Boolean})],f.prototype,"dispatchAfterRender"),_([E({attribute:"renderer-args",type:Object})],f.prototype,"rendererArgs"),_([E({attribute:"camera-args",type:Object})],f.prototype,"cameraArgs");class Me extends S{constructor(){super(...arguments),this.parentLunchbox=null,this.frame=-1,this.scratchV3=new m.Vector3,this.scratchFrustum=new m.Frustum,this.scratchMatrix4=new m.Matrix4}tryAttachUpdate(){var o;const e=(o=this.parentLunchbox)==null?void 0:o.instance;if(!e)return!1;if(!e.isObject3D)throw new Error("html-anchor must be the child of an Object3D");const t=z(this,a=>{var h;return!!((h=a==null?void 0:a.three)!=null&&h.renderer)});if(!t)return console.error("three-lunchbox parent required for html-anchor"),!1;const s=t.three.camera;if(!s)return console.error("camera required for html-anchor"),!1;const r=t.three.renderer;if(!(r!=null&&r.domElement))return console.error("renderer and DOM element required for html-anchor"),!1;const n=()=>{this.frame=requestAnimationFrame(n),s.updateMatrix(),s.updateMatrixWorld(),e.getWorldPosition(this.scratchV3);const a=this.scratchV3.clone();this.scratchV3.project(s),this.scratchV3.multiplyScalar(.5).addScalar(.5),this.scratchV3.y=1-this.scratchV3.y;const h=this.scratchV3.clone().set(r.domElement.width,r.domElement.height,1);h.divideScalar(devicePixelRatio),this.scratchV3.multiply(h);const c=e.position.clone().distanceTo(s.getWorldPosition(this.scratchV3.clone()));this.scratchFrustum.setFromProjectionMatrix(this.scratchMatrix4.clone().multiplyMatrices(s.projectionMatrix,s.matrixWorldInverse));const d=this.scratchFrustum.containsPoint(a);
|
|
43
|
+
`;let f=ne;_([E()],f.prototype,"background"),_([E()],f.prototype,"dpr"),_([E()],f.prototype,"headless"),_([E({attribute:"manual-render",type:Boolean})],f.prototype,"manualRender"),_([E({attribute:"dispatch-before-render",type:Boolean})],f.prototype,"dispatchBeforeRender"),_([E({attribute:"dispatch-after-render",type:Boolean})],f.prototype,"dispatchAfterRender"),_([E({attribute:"renderer-args",type:Object})],f.prototype,"rendererArgs"),_([E({attribute:"camera-args",type:Object})],f.prototype,"cameraArgs");class Me extends S{constructor(){super(...arguments),this.parentLunchbox=null,this.frame=-1,this.scratchV3=new m.Vector3,this.scratchFrustum=new m.Frustum,this.scratchMatrix4=new m.Matrix4}tryAttachUpdate(){var o;const e=(o=this.parentLunchbox)==null?void 0:o.instance;if(!e)return!1;if(!e.isObject3D)throw new Error("html-anchor must be the child of an Object3D");const t=z(this,a=>{var h;return!!((h=a==null?void 0:a.three)!=null&&h.renderer)});if(!t)return console.error("three-lunchbox parent required for html-anchor"),!1;const s=t.three.camera;if(!s)return console.error("camera required for html-anchor"),!1;const r=t.three.renderer;if(!(r!=null&&r.domElement))return console.error("renderer and DOM element required for html-anchor"),!1;const n=()=>{this.frame=requestAnimationFrame(n),s.updateMatrix(),s.updateMatrixWorld(),e.getWorldPosition(this.scratchV3);const a=this.scratchV3.clone();this.scratchV3.project(s),this.scratchV3.multiplyScalar(.5).addScalar(.5),this.scratchV3.y=1-this.scratchV3.y;const h=this.scratchV3.clone().set(r.domElement.width,r.domElement.height,1);h.divideScalar(devicePixelRatio),this.scratchV3.multiply(h);const c=e.position.clone().distanceTo(s.getWorldPosition(this.scratchV3.clone()));this.scratchFrustum.setFromProjectionMatrix(this.scratchMatrix4.clone().multiplyMatrices(s.projectionMatrix,s.matrixWorldInverse));const d=this.scratchFrustum.containsPoint(a);this.style.setProperty("--left",`${this.scratchV3.x}px`),this.style.setProperty("--top",`${this.scratchV3.y}px`),this.style.setProperty("--distance-from-camera",`${c}`),this.style.setProperty("--in-frustum",`${d?1:0}`),d?this.classList.add("in-frustum"):this.classList.remove("in-frustum")};return n(),!0}connectedCallback(){super.connectedCallback();const e=this.parentNode;if(!e)throw new Error("html-anchor requires a 3D parent");this.parentLunchbox=e,this.tryAttachUpdate()||this.parentLunchbox.addEventListener("instanceadded",()=>{if(!this.tryAttachUpdate())throw new Error("error attaching html-anchor to Object3D")},{once:!0})}disconnectedCallback(){this.frame!==-1&&cancelAnimationFrame(this.frame)}render(){return Q`<slot></slot>`}createRenderRoot(){return this}}const mt=({prependList:i=[]}={})=>{Object.entries({"three-lunchbox":f,"html-anchor":Me}).forEach(([t,s])=>{customElements.get(t)||customElements.define(t,s)}),[...i,...W].forEach(t=>{const s=Ue(t);if(customElements.get(s))return;const r=Te(t);r&&customElements.define(s,r)})},ft=(i,e,t=window)=>{if(t.customElements.get(i)){console.log(`${i} already registered as a custom element. Try a different name if registering is still required.`);return}const s=Te(e);if(s)t.customElements.define(i,s);else throw new Error(`Could not extend ${i}. The second paramater must be a class.`)},Oe="threepointermove",Re="threemousemove",Ne="threeclick",xe="beforerender",Le="afterrender",Ue=i=>{let e=i.split(/\.?(?=[A-Z])/).join("-").toLowerCase().replace(/-g-l-/,"-gl-");return e.includes("-")||(e=`three-${e}`),e},yt=W.map(Ue);u.AFTER_RENDER_EVENT_NAME=Le,u.BEFORE_RENDER_EVENT_NAME=xe,u.HtmlAnchor=Me,u.THREE_CLICK_EVENT_NAME=Ne,u.THREE_MOUSE_MOVE_EVENT_NAME=Re,u.THREE_POINTER_MOVE_EVENT_NAME=Oe,u.ThreeBase=D,u.ThreeLunchbox=f,u.autoComponents=W,u.extend=ft,u.initLunchbox=mt,u.webComponentNames=yt,Object.defineProperty(u,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED
package/src/html-anchor.ts
CHANGED
|
@@ -60,12 +60,15 @@ export class HtmlAnchor extends LitElement {
|
|
|
60
60
|
const inFrustum = this.scratchFrustum.containsPoint(worldPosition);
|
|
61
61
|
|
|
62
62
|
// apply position data as CSS vars
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
63
|
+
this.style.setProperty('--left', `${this.scratchV3.x}px`);
|
|
64
|
+
this.style.setProperty('--top', `${this.scratchV3.y}px`);
|
|
65
|
+
this.style.setProperty('--distance-from-camera', `${distance}`);
|
|
66
|
+
this.style.setProperty('--in-frustum', `${inFrustum ? 1 : 0}`);
|
|
67
|
+
if (inFrustum){
|
|
68
|
+
this.classList.add('in-frustum');
|
|
69
|
+
} else {
|
|
70
|
+
this.classList.remove('in-frustum');
|
|
71
|
+
}
|
|
69
72
|
}
|
|
70
73
|
update();
|
|
71
74
|
|