shop-components 0.1.43 → 0.1.45
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.
|
@@ -38,7 +38,7 @@ export declare class DeviceViewer extends LitElement {
|
|
|
38
38
|
sizeHeight: HTMLDivElement | undefined;
|
|
39
39
|
fit: () => void;
|
|
40
40
|
generateBVH: () => void;
|
|
41
|
-
download: () =>
|
|
41
|
+
download: () => Promise<void>;
|
|
42
42
|
clearAMR: () => void;
|
|
43
43
|
exportAMR: () => Promise<void>;
|
|
44
44
|
addAMR: () => void;
|
|
@@ -125,7 +125,7 @@ export declare class Scene3D {
|
|
|
125
125
|
private _detectTrackpad;
|
|
126
126
|
private _initEvents;
|
|
127
127
|
generateBVH(): Promise<void>;
|
|
128
|
-
download(): string
|
|
128
|
+
download(): Promise<string>;
|
|
129
129
|
clearAMR(): void;
|
|
130
130
|
exportAMR(): Promise<ArrayBuffer | {
|
|
131
131
|
[key: string]: any;
|
|
@@ -29,7 +29,7 @@ export declare const SLOT_EVENTS: {
|
|
|
29
29
|
ON_FUNCTION_ADDED: string;
|
|
30
30
|
};
|
|
31
31
|
export declare class Slot extends CSS2DObject {
|
|
32
|
-
|
|
32
|
+
props: SlotProps;
|
|
33
33
|
private _emitter;
|
|
34
34
|
private _slotContainer;
|
|
35
35
|
private _slotUI;
|
|
@@ -52,6 +52,7 @@ export declare class Slot extends CSS2DObject {
|
|
|
52
52
|
holeTarget: Object3D | undefined;
|
|
53
53
|
private _showSlot;
|
|
54
54
|
constructor(props: SlotProps);
|
|
55
|
+
private _preventDefaults;
|
|
55
56
|
shapeKeyChanged(key: string, value: number): void;
|
|
56
57
|
loadGlb(sglb: string): Promise<Object3D<import("three").Object3DEventMap> | undefined>;
|
|
57
58
|
installBracket(url: string): Promise<void>;
|
package/dist/shop-components.mjs
CHANGED
|
@@ -57405,17 +57405,21 @@ const xi = {
|
|
|
57405
57405
|
class lI extends Iv {
|
|
57406
57406
|
constructor(A) {
|
|
57407
57407
|
const e = document.createElement("div");
|
|
57408
|
-
super(e), this.props = A, this._emitter = new Vr(), this._slotContainer = new St(), this._bracketSlots = [], this._hasError = !1, this.useBracket = !1, this.addEventListener = this._emitter.addListener.bind(this._emitter), this.removeEventListener = this._emitter.removeListener.bind(this._emitter), this._canInstall = !1, this._loading = !1, this._selected = !1, this._deviceSelected = !1, this._allFunctions = /* @__PURE__ */ new Set(), this._functions = /* @__PURE__ */ new Set(), this._timer = 0, this._parentPos = new O(), this._wrapper = new St(), this._showSlot = !0, this.
|
|
57408
|
+
super(e), this.props = A, this._emitter = new Vr(), this._slotContainer = new St(), this._bracketSlots = [], this._hasError = !1, this.useBracket = !1, this.addEventListener = this._emitter.addListener.bind(this._emitter), this.removeEventListener = this._emitter.removeListener.bind(this._emitter), this._canInstall = !1, this._loading = !1, this._selected = !1, this._deviceSelected = !1, this._allFunctions = /* @__PURE__ */ new Set(), this._functions = /* @__PURE__ */ new Set(), this._timer = 0, this._parentPos = new O(), this._wrapper = new St(), this._showSlot = !0, this._preventDefaults = (t) => {
|
|
57409
|
+
t.preventDefault(), t.stopPropagation();
|
|
57410
|
+
}, this.getWP = this._slotContainer.getWorldPosition.bind(this._slotContainer), this._showSlot = typeof A.show == "boolean" ? A.show : !0, this.name = A.name, this._slotUI = new qt({ name: A.name }), this._slotUI.slot = this, this._slotUI.hide = !this._showSlot, e.append(this._slotUI), this._parentPos.copy(this.props.slot.position), this._slotUI.addEventListener("function-removed", ({ detail: t }) => {
|
|
57409
57411
|
this.removeFunction(t);
|
|
57410
57412
|
}), this._slotUI.addEventListener("function-added", ({ detail: t }) => {
|
|
57411
57413
|
this.addFunction(t);
|
|
57412
57414
|
}), this.add(this._slotContainer), this.props.slot.add(this), setTimeout(() => {
|
|
57413
57415
|
var t;
|
|
57414
57416
|
(t = this.props.slot.parent) == null || t.add(this._wrapper), this._wrapper.add(this.props.slot);
|
|
57415
|
-
}, 10),
|
|
57417
|
+
}, 10), ["dragenter", "dragover", "dragleave", "drop"].forEach((t) => {
|
|
57418
|
+
e.addEventListener(t, this._preventDefaults, !1);
|
|
57419
|
+
}), e.addEventListener("click", (t) => {
|
|
57416
57420
|
t.preventDefault(), t.stopPropagation(), this.selected = !this.selected;
|
|
57417
57421
|
}), e.addEventListener("dragover", (t) => {
|
|
57418
|
-
if (t.preventDefault(), !this._canInstall) {
|
|
57422
|
+
if (t.preventDefault(), t.dataTransfer.dropEffect = "copy", !this._canInstall) {
|
|
57419
57423
|
t.dataTransfer && (t.dataTransfer.dropEffect = "none");
|
|
57420
57424
|
return;
|
|
57421
57425
|
}
|
|
@@ -57444,7 +57448,7 @@ class lI extends Iv {
|
|
|
57444
57448
|
const i = this.props.follows.get(A);
|
|
57445
57449
|
if (i) {
|
|
57446
57450
|
let r = "x";
|
|
57447
|
-
A === "height" ? r = "y" :
|
|
57451
|
+
A === "height" ? r = "y" : ["width", "liftOuterWidth"].includes(A) && (r = "z");
|
|
57448
57452
|
const s = ((t = this.props.slot) == null ? void 0 : t.position[r]) > 0 ? 1 : -1;
|
|
57449
57453
|
this._wrapper.position[r] = (e - i.origin) * i.scale * s;
|
|
57450
57454
|
}
|
|
@@ -57565,7 +57569,9 @@ class lI extends Iv {
|
|
|
57565
57569
|
this._canInstall = A, this._slotUI.canInstall = A;
|
|
57566
57570
|
}
|
|
57567
57571
|
dispose() {
|
|
57568
|
-
cancelAnimationFrame(this._timer),
|
|
57572
|
+
cancelAnimationFrame(this._timer), ["dragenter", "dragover", "dragleave", "drop"].forEach((A) => {
|
|
57573
|
+
this.element.addEventListener(A, this._preventDefaults, !1);
|
|
57574
|
+
}), this.clearSlot(), this._emitter.removeAllListeners(), Ni(this._slotContainer), this.element.remove();
|
|
57569
57575
|
}
|
|
57570
57576
|
render(A) {
|
|
57571
57577
|
const e = this.element.style.transform, t = /translate\(-?\d*\.?\d*%?,?\s-?\d*\.?\d*%?\)\s*translate\((-?\d*\.?\d*)px,\s*(-?\d*\.?\d*)px\)/.exec(e);
|
|
@@ -62527,7 +62533,7 @@ class mK extends Ie {
|
|
|
62527
62533
|
init(A) {
|
|
62528
62534
|
this._app = A, this.sizeBox.init(A), this.addEventListener("shape-key-changed", (e, t) => {
|
|
62529
62535
|
this._slots.forEach((i) => i.shapeKeyChanged(e, t)), this.sizeBox.follow === e ? (this.sizeBox.generate(this._container, t), this.sizeBox.originOffset && (this._container.traverse((i) => {
|
|
62530
|
-
i instanceof Pe && !i.userData.isDevice && !i.userData.isBracket && i.geometry.translate(this.sizeBox.originOffset - this.sizeBox.translateCache, 0, 0), i instanceof lI && i.parent && i.parent.position.add(new O(this.sizeBox.originOffset - this.sizeBox.translateCache, 0, 0));
|
|
62536
|
+
i instanceof Pe && !i.userData.isDevice && !i.userData.isBracket && i.geometry.translate(this.sizeBox.originOffset - this.sizeBox.translateCache, 0, 0), i instanceof lI && !i.props.slot.userData.ignoreOriginChanged && i.parent && i.parent.position.add(new O(this.sizeBox.originOffset - this.sizeBox.translateCache, 0, 0));
|
|
62531
62537
|
}), this.sizeBox.translateCache = this.sizeBox.originOffset, this.sizeBox.generate(this._container))) : this.sizeBox.generate(this._container), ["width", "length", "height"].includes(e) && this._emitter.emit("size-changed", e, t);
|
|
62532
62538
|
});
|
|
62533
62539
|
}
|
|
@@ -65173,8 +65179,15 @@ class lH {
|
|
|
65173
65179
|
A.target.updateMatrixWorld(!0), e.applyMatrix4(A.target.matrixWorld), e.add(A.target), this.overlayScene.add(e);
|
|
65174
65180
|
})), this.usePathTracing = !0, this.pathTracer.setScene(this.scene, this.camera);
|
|
65175
65181
|
}
|
|
65176
|
-
download() {
|
|
65177
|
-
return this.renderer.domElement.toDataURL("image/png")
|
|
65182
|
+
async download() {
|
|
65183
|
+
return this.usePathTracing ? Promise.resolve(this.renderer.domElement.toDataURL("image/png")) : new Promise((A, e) => {
|
|
65184
|
+
this.amr.sizeBox.hide();
|
|
65185
|
+
const t = this.amr.bodyOpacity;
|
|
65186
|
+
this.amr.bodyOpacity = 1, setTimeout(() => {
|
|
65187
|
+
const i = this.renderer.domElement.toDataURL("image/png");
|
|
65188
|
+
return this.amr.sizeBox.show(), this.amr.bodyOpacity = t, A(i);
|
|
65189
|
+
}, this.fpsAverage);
|
|
65190
|
+
});
|
|
65178
65191
|
}
|
|
65179
65192
|
clearAMR() {
|
|
65180
65193
|
Ni(this.overlayScene), this.amr.clean(), this.usePathTracing = !1, this.lines.clear();
|