shop-components 0.0.23 → 0.0.25
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.
|
@@ -62,6 +62,7 @@ export declare class Scene3D {
|
|
|
62
62
|
_slots: Slot[];
|
|
63
63
|
_logos: Logo[];
|
|
64
64
|
_skins: Skin[];
|
|
65
|
+
private _dragging;
|
|
65
66
|
readonly maxSample = 1024;
|
|
66
67
|
sampleCount: number;
|
|
67
68
|
private _usePathTracing;
|
|
@@ -88,6 +89,8 @@ export declare class Scene3D {
|
|
|
88
89
|
showState(): void;
|
|
89
90
|
hideState(): void;
|
|
90
91
|
private _loadEnv;
|
|
92
|
+
private _drag;
|
|
93
|
+
private _dragend;
|
|
91
94
|
private _pointermove;
|
|
92
95
|
private _pointerdown;
|
|
93
96
|
private _detectTrackpad;
|
package/dist/shop-components.mjs
CHANGED
|
@@ -30085,8 +30085,8 @@ const In = {
|
|
|
30085
30085
|
class U0 extends _P {
|
|
30086
30086
|
constructor(e) {
|
|
30087
30087
|
const t = document.createElement("div");
|
|
30088
|
-
super(t), this.props = e, this._emitter = new Hx(), this._slotContainer = new Kn(), 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.getWP = this._slotContainer.getWorldPosition.bind(this._slotContainer), this.name = e.name, this._slotUI = new $i({ name: e.name }), this._slotUI.slot = this, t.append(this._slotUI), this.add(this._slotContainer), this.props.slot.add(this), t.addEventListener("click", () => {
|
|
30089
|
-
this.selected = !this.selected;
|
|
30088
|
+
super(t), this.props = e, this._emitter = new Hx(), this._slotContainer = new Kn(), 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.getWP = this._slotContainer.getWorldPosition.bind(this._slotContainer), this.name = e.name, this._slotUI = new $i({ name: e.name }), this._slotUI.slot = this, t.append(this._slotUI), this.add(this._slotContainer), this.props.slot.add(this), t.addEventListener("click", (i) => {
|
|
30089
|
+
i.preventDefault(), i.stopPropagation(), this.selected = !this.selected;
|
|
30090
30090
|
}), t.addEventListener("dragover", (i) => {
|
|
30091
30091
|
if (i.preventDefault(), !this._canInstall) {
|
|
30092
30092
|
i.dataTransfer && (i.dataTransfer.dropEffect = "none");
|
|
@@ -30195,6 +30195,9 @@ class U0 extends _P {
|
|
|
30195
30195
|
this.error = e;
|
|
30196
30196
|
}, 100), this._hasError = e, this._slotUI.hasError = e, this._emitter.emit(In.ON_ERROR_STATE_CHANGE, e);
|
|
30197
30197
|
}
|
|
30198
|
+
getCanInstall() {
|
|
30199
|
+
return this._canInstall;
|
|
30200
|
+
}
|
|
30198
30201
|
canInstall(e) {
|
|
30199
30202
|
this._canInstall = e, this._slotUI.canInstall = e;
|
|
30200
30203
|
}
|
|
@@ -30206,11 +30209,10 @@ class U0 extends _P {
|
|
|
30206
30209
|
if (!i)
|
|
30207
30210
|
return;
|
|
30208
30211
|
const n = new fe(parseFloat(i[1]), parseFloat(i[2])), r = e.mousePos.distanceTo(n);
|
|
30209
|
-
let o = 12;
|
|
30210
|
-
if (this._canInstall && (o = 34), r <
|
|
30211
|
-
|
|
30212
|
-
|
|
30213
|
-
r < 20 && (a = 60), this._slotUI.setSize(a);
|
|
30212
|
+
let o = 12, a = 24, l = 30;
|
|
30213
|
+
if (this._canInstall && (o = 34, a = 60, l = 60), r < l) {
|
|
30214
|
+
let h = (l - r) * 1 + o;
|
|
30215
|
+
r < 20 && (h = a), h > a && (h = a), this._slotUI.setSize(h);
|
|
30214
30216
|
} else
|
|
30215
30217
|
this._slotUI.setSize(o);
|
|
30216
30218
|
}
|
|
@@ -30381,7 +30383,11 @@ class Uz {
|
|
|
30381
30383
|
), this._container = new Kn(), this._raycaster = new e_(), this._selected = [], this._pointerDownTimeout = 0, this.sceneInfo = {
|
|
30382
30384
|
materials: [],
|
|
30383
30385
|
textures: []
|
|
30384
|
-
}, this.css2dRenderer = new GP(), this._slots = [], this._logos = [], this._skins = [], this.maxSample = 1024, this.sampleCount = 0, this._usePathTracing = !1, this._fpsCache = [], this._fpsCacheMax = 20, this._bodyOpacity = 1, this.lines = new da(new fe(-108, 0)), this._emitter = new Hx(), this._sound = new jP(), this._materialsCache = /* @__PURE__ */ new Map(), this.opacityCache = void 0, this.addEventListener = this._emitter.on.bind(this._emitter), this.removeEventListener = this._emitter.on.bind(this._emitter), this.
|
|
30386
|
+
}, this.css2dRenderer = new GP(), this._slots = [], this._logos = [], this._skins = [], this._dragging = !1, this.maxSample = 1024, this.sampleCount = 0, this._usePathTracing = !1, this._fpsCache = [], this._fpsCacheMax = 20, this._bodyOpacity = 1, this.lines = new da(new fe(-108, 0)), this._emitter = new Hx(), this._sound = new jP(), this._materialsCache = /* @__PURE__ */ new Map(), this.opacityCache = void 0, this.addEventListener = this._emitter.on.bind(this._emitter), this.removeEventListener = this._emitter.on.bind(this._emitter), this._drag = (t) => {
|
|
30387
|
+
this._dragging = !0, this._pointermove(t);
|
|
30388
|
+
}, this._dragend = (t) => {
|
|
30389
|
+
this._dragging = !1;
|
|
30390
|
+
}, this._pointermove = (t) => {
|
|
30385
30391
|
if (this._pointerDownTimeout)
|
|
30386
30392
|
return clearTimeout(this._pointerDownTimeout), this._pointerDownTimeout = 0;
|
|
30387
30393
|
const { top: i, left: n } = this.renderer.domElement.getBoundingClientRect();
|
|
@@ -30430,7 +30436,9 @@ class Uz {
|
|
|
30430
30436
|
o.resolution.value.x = 1 / (i * r), o.resolution.value.y = 1 / (n * r);
|
|
30431
30437
|
}, this.ticker = () => {
|
|
30432
30438
|
var i;
|
|
30433
|
-
this.stats.begin(), this.slots.forEach((n) =>
|
|
30439
|
+
this.stats.begin(), this.slots.forEach((n) => {
|
|
30440
|
+
this._dragging ? n.getCanInstall() && n.render(this) : n.render(this);
|
|
30441
|
+
});
|
|
30434
30442
|
const t = this.stats.fps();
|
|
30435
30443
|
this.usePathTracing || (this._fpsCache.length > this._fpsCacheMax && this._fpsCache.shift(), this._fpsCache.push(t)), requestAnimationFrame(this.ticker), this.renderer.clear(), this.renderer.domElement.dispatchEvent(new CustomEvent("ticker")), C0.update(), this.controls.update(), this.css2dRenderer.render(this.scene, this.camera), this.updatePosition(), this.usePathTracing ? (this.sampleCount < this.maxSample && (this.ptRenderer.update(), t > 20 && (this.ptRenderer.update(), this.sampleCount++, t > 30 && (this.ptRenderer.update(), this.sampleCount++)), this.sampleCount++), this.fsQuad.material.map = this.ptRenderer.target.texture, this.fsQuad.render(this.renderer)) : this._composer.render(), (i = this.flow) == null || i.moveAlongCurve(1e-3), this.stats.end();
|
|
30436
30444
|
}, this.stats.showPanel(0), this.hideState(), this.controls = new l_(this.camera, this.renderer.domElement), this.controls.enablePan = !1, this.controls.rotateSpeed = 0.3, this.controls.dampingFactor = Q0, this.controls.enableDamping = !0, this.controls.maxDistance = 5, this.controls.minDistance = 1, this.controls.zoomSpeed = YP() ? 0.2 : 1, this.renderer.setPixelRatio(window.devicePixelRatio || 1), this.renderer.autoClear = !0, this.renderer.toneMapping = Df, this.renderer.toneMappingExposure = 1.2, this.renderer.outputColorSpace = gt, this.css2dRenderer.domElement.style.pointerEvents = "none", this.css2dRenderer.domElement.style.position = "absolute", this.css2dRenderer.domElement.style.top = "0px", Ue.tonemapping_pars_fragment = Ue.tonemapping_pars_fragment.replace(
|
|
@@ -30511,7 +30519,7 @@ class Uz {
|
|
|
30511
30519
|
});
|
|
30512
30520
|
}
|
|
30513
30521
|
_initEvents() {
|
|
30514
|
-
window.addEventListener("drag", this.
|
|
30522
|
+
window.addEventListener("drag", this._drag), window.addEventListener("dragend", this._dragend), document.addEventListener("wheel", this._detectTrackpad), window.addEventListener("pointermove", this._pointermove), this.renderer.domElement.addEventListener("pointerdown", this._pointerdown);
|
|
30515
30523
|
}
|
|
30516
30524
|
changeLogo(e, t) {
|
|
30517
30525
|
var r;
|
|
@@ -30667,7 +30675,7 @@ class Uz {
|
|
|
30667
30675
|
}
|
|
30668
30676
|
destroy() {
|
|
30669
30677
|
var t, i;
|
|
30670
|
-
this.stats.dom.remove(), this._emitter.removeAllListeners(), (t = this._fitAnimation) == null || t.stop(), window.removeEventListener("drag", this.
|
|
30678
|
+
this.stats.dom.remove(), this._emitter.removeAllListeners(), (t = this._fitAnimation) == null || t.stop(), window.removeEventListener("drag", this._drag), document.removeEventListener("wheel", this._detectTrackpad), window.removeEventListener("pointermove", this._pointermove), this.renderer.domElement.removeEventListener("pointerdown", this._pointerdown);
|
|
30671
30679
|
const e = this.renderer.domElement.parentElement;
|
|
30672
30680
|
e && ((i = this._resizeObserver) == null || i.unobserve(e)), this.controls.dispose(), this.renderer.dispose(), this._composer.dispose(), this.scene.traverse((n) => {
|
|
30673
30681
|
n instanceof Ft ? (n.geometry.dispose(), Array.isArray(n.material) ? n.material.forEach((r) => r.dispose()) : n.material && n.material.dispose()) : n instanceof U0 && n.dispose(), n.removeFromParent();
|