shop-components 0.4.11 → 0.4.12

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.
@@ -9854,7 +9854,7 @@ const Bn = new mn();
9854
9854
  Bn.crossOrigin = "anonymous";
9855
9855
  class Ac extends Bt {
9856
9856
  constructor(e) {
9857
- super(), this._props = e, this._emitter = new Ot(), this.addEventListener = this._emitter.addListener.bind(this._emitter), this._container = new ge(), this.lines = new ge(), this._clips = [], this._actionsMap = /* @__PURE__ */ new Map(), this._animationClock = new qi(), this.sizeBox = new wc(), this._goodsSize = new lc(0, 0, 0), this._slots = [], this._logos = [], this._skins = [], this._levels = /* @__PURE__ */ new Map(), this._rollerLevel = /* @__PURE__ */ new Map(), this._liftBrackets = [], this._rollerColumns = 1, this._bodyOpacity = 1, this._masts = /* @__PURE__ */ new Map(), this._liftMaxHeight = 0, this._jackMaxHeight = 0, this._forkMaxHeight = 0, this.controllers = [], this.goods = [], this._breathLights = [], this._shelves = /* @__PURE__ */ new Map(), this._shelfMaxLevel = 1, this._url = "", this._showController = !0, this._showSlots = !0, this._shapeKeys = /* @__PURE__ */ new Map(), this._shapeKeyTargets = /* @__PURE__ */ new Map(), this._shapeKeyTimer = 0, this._shapeKeyCache = "", this._materialsCache = /* @__PURE__ */ new Map(), this.opacityCache = void 0, this.actions = [], this._currentAction = null, this._pendingFinishedCallback = null, this._url = e.url || "", this._url && this.load(this._url).then(), this.add(this._container, this.lines), this._props.showSizeBox && this.add(this.sizeBox), this.showController = typeof e.showController == "boolean" ? e.showController : !0, this._showSlots = typeof e.showSlots == "boolean" ? e.showSlots : !0;
9857
+ super(), this._props = e, this._emitter = new Ot(), this.addEventListener = this._emitter.addListener.bind(this._emitter), this._container = new ge(), this.lines = new ge(), this._clips = [], this._actionsMap = /* @__PURE__ */ new Map(), this._animationClock = new qi(), this.sizeBox = new wc(), this._goodsSize = new lc(0, 0, 0), this._slots = [], this._logos = [], this._skins = [], this._levels = /* @__PURE__ */ new Map(), this._rollerLevel = /* @__PURE__ */ new Map(), this._liftBrackets = [], this._rollerColumns = 1, this._bodyOpacity = 1, this._masts = /* @__PURE__ */ new Map(), this._liftMaxHeight = 0, this._jackMaxHeight = 0, this._forkMaxHeight = 0, this.controllers = [], this.goods = [], this._breathLights = [], this._shelves = /* @__PURE__ */ new Map(), this._shelfMaxLevel = 1, this._url = "", this._showController = !0, this._showSlots = !0, this._shapeKeys = /* @__PURE__ */ new Map(), this._shapeKeyTargets = /* @__PURE__ */ new Map(), this._shapeKeyTimer = 0, this._shapeKeyCache = "", this._materialsCache = /* @__PURE__ */ new Map(), this.opacityCache = void 0, this.actions = [], this._levelCount = 1, this._currentAction = null, this._pendingFinishedCallback = null, this._url = e.url || "", this._url && this.load(this._url).then(), this.add(this._container, this.lines), this._props.showSizeBox && this.add(this.sizeBox), this.showController = typeof e.showController == "boolean" ? e.showController : !0, this._showSlots = typeof e.showSlots == "boolean" ? e.showSlots : !0;
9858
9858
  }
9859
9859
  get shapeKeys() {
9860
9860
  return this._shapeKeys;
@@ -9937,22 +9937,22 @@ class Ac extends Bt {
9937
9937
  const s = i + 0.14 - 0.54;
9938
9938
  this.setShapeKey("boxLength", s);
9939
9939
  const a = i + 0.14;
9940
- if (this.setShapeKey("topLength", a), this.isTopInvert) {
9940
+ if (this.setShapeKey("topWidth", a), this.isTopInvert) {
9941
9941
  const n = i - 0.257;
9942
- this.setShapeKey("width", n);
9942
+ this.setShapeKey("length", n);
9943
9943
  } else
9944
- this.setShapeKey("length", a);
9944
+ this.setShapeKey("width", a);
9945
9945
  this._generateRollers();
9946
9946
  }
9947
9947
  if (t === "goodsWidth") {
9948
9948
  const s = i + 0.193;
9949
9949
  this.setShapeKey("boxWidth", s);
9950
9950
  const a = i + 0.219;
9951
- if (this.setShapeKey("topWidth", a), this.isTopInvert) {
9951
+ if (this.setShapeKey("topLength", a), this.isTopInvert) {
9952
9952
  const n = i + 0.62;
9953
- this.setShapeKey("length", n);
9953
+ this.setShapeKey("width", n);
9954
9954
  } else
9955
- this.setShapeKey("width", a);
9955
+ this.setShapeKey("length", a);
9956
9956
  this._generateRollers();
9957
9957
  }
9958
9958
  });
@@ -10056,11 +10056,7 @@ class Ac extends Bt {
10056
10056
  const s = this._mixer.clipAction(i);
10057
10057
  this._actionsMap.set(i.name, s);
10058
10058
  }), this.actions = t.map((i) => i.name)), this._shapeKeyTargets.clear(), this._shapeKeys.clear(), e.traverse((i) => {
10059
- if (i.userData.isShelf && (this._shelf = i), i.userData.isFork && (this._fork = i), i.userData.isMast && i.userData.mastLevel && this._masts.set(i.userData.mastLevel, i), i.userData.isJack && (this._jack = i), i.userData.isLift && (this._lift = i), i.userData.isRollerLevel) {
10060
- const s = `1-${i.userData.level || 0}`;
10061
- this._rollerLevel.set(s, i);
10062
- }
10063
- i.userData.isLift && (this._lift = i), i.userData.isCenterModel && (i.visible = !1, this._centerModel = i), i.userData.isSwitch && i.userData.switchName === "top" && (this._rollerTop = i), i.userData.isLiftBracket && this._liftBrackets.push(i), i.userData.isBaffle && (this._rollerBaffle = i, i.visible = !1), i.userData.isRoller && (this._roller = i, this._generateRollers()), i.userData.isRollerLevelBox && (this._rollerGoodsBox = i), Object.keys(i.morphTargetDictionary || {}).forEach((s) => {
10059
+ i.userData.isShelf && (this._shelf = i), i.userData.isFork && (this._fork = i), i.userData.isMast && i.userData.mastLevel && this._masts.set(i.userData.mastLevel, i), i.userData.isJack && (this._jack = i), i.userData.isLift && (this._lift = i), i.userData.isRollerLevel && this._rollerLevel.set(i.userData.level || 0, i), i.userData.isLift && (this._lift = i), i.userData.isCenterModel && (i.visible = !1, this._centerModel = i), i.userData.isSwitch && i.userData.switchName === "top" && (this._rollerTop = i), i.userData.isLiftBracket && this._liftBrackets.push(i), i.userData.isBaffle && (this._rollerBaffle = i, i.visible = !1), i.userData.isRoller && (this._roller = i, this._generateRollers()), i.userData.isRollerLevelBox && (this._rollerGoodsBox = i), Object.keys(i.morphTargetDictionary || {}).forEach((s) => {
10064
10060
  let a = i.morphTargetInfluences[i.morphTargetDictionary[s]];
10065
10061
  i.userData[`origin_${s}`] && (a += i.userData[`origin_${s}`]), this._shapeKeys.has(s) || this._shapeKeys.set(s, a);
10066
10062
  const n = this._shapeKeyTargets.get(s);
@@ -10225,10 +10221,27 @@ class Ac extends Bt {
10225
10221
  return Math.abs(this._rollerTop.rotation.z) === Math.PI / 2;
10226
10222
  }
10227
10223
  setTopInvert(e = !0) {
10228
- this._rollerTop && (this._rollerTop.rotation.z = e ? Math.PI / 2 : 0, this.setShapeKey("switch", e ? 1 : 0), this.setShapeKey("goodsWidth", this.goodsSize.length), this.setShapeKey("goodsLength", this.goodsSize.width));
10224
+ this._rollerTop && (this._rollerTop.rotation.z = e ? Math.PI / 2 : 0, this.setShapeKey("switch", e ? 1 : 0), this.setShapeKey("goodsWidth", this.goodsSize.width), this.setShapeKey("goodsLength", this.goodsSize.length));
10225
+ }
10226
+ get levels() {
10227
+ return this._levelCount;
10228
+ }
10229
+ setLevels(e) {
10230
+ var a;
10231
+ if (!e)
10232
+ return;
10233
+ this._levelCount = e;
10234
+ const t = this._rollerLevel.size;
10235
+ let i = e - t;
10236
+ const s = this._rollerLevel.get(0);
10237
+ if (i > 0 && s)
10238
+ for (let n = t; n < e; n++) {
10239
+ const c = s.clone(!0);
10240
+ c.position.z += 0.2, this._rollerLevel.set(n, c), (a = s.parent) == null || a.add(c);
10241
+ }
10229
10242
  }
10230
10243
  setRollerHeight(e, t) {
10231
- const i = this._rollerLevel.get(`1-${e}`);
10244
+ const i = this._rollerLevel.get(e);
10232
10245
  i && (i.position.z = t);
10233
10246
  }
10234
10247
  _generateRollers() {
@@ -13249,7 +13262,7 @@ class Lh {
13249
13262
  Mt || typeof Mt < "u" || (Fi === 0 && (Ws = performance.now()), Fi++, performance.now() - Ws > 66 && (Fi > 5 ? Mt = !0 : Mt = !1, Mt ? this.controls.zoomSpeed = 0.2 : this.controls.zoomSpeed = 1, setTimeout(Vu, 2e3)));
13250
13263
  }, this.debounceForkHeightChange = ac(() => {
13251
13264
  var c;
13252
- (c = this._progressShadow) == null || c.recalculate();
13265
+ this._progressShadow.clear(), (c = this._progressShadow) == null || c.recalculate();
13253
13266
  }, 300), this.focusObjects = (c, u) => {
13254
13267
  var se;
13255
13268
  if (!c.length) {
@@ -13462,7 +13475,7 @@ class Lh {
13462
13475
  frames: e.isMobile ? 80 : 120,
13463
13476
  lightRadius: 8,
13464
13477
  ambientWeight: 0.8
13465
- }), this._progressShadow.lightOrigin.position.set(3, 2.5, 6), this._progressShadow.visible = !1, this._container.add(this.amr), this.scene.add(this._container), this.ticker(), this._loadEnv(), this._initEvents(), this.scene.add(this._cameraPositionUI), this._ground.rotateX(-Math.PI / 2), this.scene.add(this._ground), this._jumpFlood = new Bu(this.renderer, this.scene, this.camera, {
13478
+ }), this._progressShadow.lightOrigin.position.set(3, 2.5, 6), this._progressShadow.visible = !1, this._container.add(this.amr), this.scene.add(this._container), this.ticker(0), this._loadEnv(), this._initEvents(), this.scene.add(this._cameraPositionUI), this._ground.rotateX(-Math.PI / 2), this.scene.add(this._ground), this._jumpFlood = new Bu(this.renderer, this.scene, this.camera, {
13466
13479
  thickness: 4,
13467
13480
  color: "#fff"
13468
13481
  }), (typeof e.useAxisBall != "boolean" || e.useAxisBall) && (this._controlsGizmo = new Iu(this.controls, {
@@ -13492,7 +13505,7 @@ class Lh {
13492
13505
  e ? (this._progressShadow.visible = !1, this.amr.bodyOpacity = 0.2) : (this._progressShadow.visible = !0, this.amr.bodyOpacity = 1, this._progressShadow.isFinished || this._progressShadow.recalculate().then()), this._shadowMode = e;
13493
13506
  }
13494
13507
  set usePathTracing(e) {
13495
- this._clearAmrContent(), e ? (this.renderer.toneMappingExposure = 1.8, this.overlayScene.add(this._progressShadow.shadowCatcherMesh), this.amr && (this.amr.bodyOpacity = 1), this.hideAmrUI(), this.pathTracer.renderToCanvas = !0, this.scene.background = null, this._ptEnvMap ? (this.scene.environment = this._ptEnvMap, this.pathTracer.updateEnvironment()) : new cr().load(Uu, (t) => {
13508
+ this._clearAmrContent(), e ? (this.scene.background = new K("transparent"), this.renderer.toneMappingExposure = 1.8, this.overlayScene.add(this._progressShadow.shadowCatcherMesh), this.amr && (this.amr.bodyOpacity = 1), this.hideAmrUI(), this.pathTracer.renderToCanvas = !0, this.scene.background = null, this._ptEnvMap ? (this.scene.environment = this._ptEnvMap, this.pathTracer.updateEnvironment()) : new cr().load(Uu, (t) => {
13496
13509
  t.mapping = ki, this._ptEnvMap = t, this.usePathTracing && (this.scene.environment = t, this.pathTracer.updateEnvironment());
13497
13510
  })) : (this.renderer.toneMappingExposure = 1.4, this.scene.add(this._progressShadow.shadowCatcherMesh), this.pathTracer.renderToCanvas = !1, this.amr.logos.forEach((t) => {
13498
13511
  var i;
@@ -13643,7 +13656,7 @@ class Lh {
13643
13656
  "liftLength",
13644
13657
  "liftWidth",
13645
13658
  "liftOuterWidth"
13646
- ].includes(i) && (this._progressShadow.clear(), this._progressShadow.recalculate());
13659
+ ].includes(i) && (this._progressShadow.clear(), this.debounceForkHeightChange());
13647
13660
  });
13648
13661
  }
13649
13662
  _animateCamera(e, t, i, s, a, n) {
@@ -13679,12 +13692,12 @@ class Lh {
13679
13692
  typeof e == "string" || (Array.isArray(e) ? this._selectedForOutline = [...e] : this._selectedForOutline = [e]);
13680
13693
  }
13681
13694
  appendTo(e) {
13682
- e.append(this.renderer.domElement), e.append(this.stats.dom), e.append(this.css2dRenderer.domElement), this.props.isMobile && (e.classList.add("is-mobile"), e.style.cssText = `
13695
+ e.append(this.renderer.domElement), e.append(this.stats.dom), e.append(this.css2dRenderer.domElement), this.props.isMobile ? (e.classList.add("is-mobile"), e.style.cssText = `
13683
13696
  -webkit-user-select: none;
13684
13697
  user-select: none;
13685
13698
  touch-action: none;
13686
13699
  -webkit-touch-callout: none;
13687
- `), this._controlsGizmo && this._controlsGizmo.appendTo(e), this.stats.dom.style.bottom = "0", this.stats.dom.style.top = "auto", this.resize(), this._resizeObserver = new ResizeObserver(this.resize.bind(this)), this._resizeObserver.observe(e);
13700
+ `) : e.style.background = "radial-gradient(326% 141% at 50% 103%, #E0E0E0 0%, #D9D9D9 38%, #C2C2C2 47%, #C2C2C2 52%, #F0F0F0 100%)", this._controlsGizmo && this._controlsGizmo.appendTo(e), this.stats.dom.style.bottom = "0", this.stats.dom.style.top = "auto", this.resize(), this._resizeObserver = new ResizeObserver(this.resize.bind(this)), this._resizeObserver.observe(e);
13688
13701
  }
13689
13702
  add(e) {
13690
13703
  this._container.add(e);
package/dist/test.glb CHANGED
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shop-components",
3
- "version": "0.4.11",
3
+ "version": "0.4.12",
4
4
  "description": "Shop components",
5
5
  "main": "dist/shop-components.umd.js",
6
6
  "module": "dist/shop-components.mjs",