zakeke-configurator-react 0.0.151 → 0.0.153

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.
Files changed (2) hide show
  1. package/dist/index.js +72 -49
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -31280,6 +31280,8 @@ var SceneDesignManager = /*#__PURE__*/function () {
31280
31280
  _defineProperty(this, "_designNotifyMessageListeners", []);
31281
31281
  _defineProperty(this, "_designRemoveMessageListeners", []);
31282
31282
  _defineProperty(this, "_designEventMessages", []);
31283
+ // private _debouncedMeshRefresh: Map<string, boolean> = new Map();
31284
+ _defineProperty(this, "_meshesToBeRefreshed", new Set());
31283
31285
  this._scene = scene;
31284
31286
  this._zkScene = zkScene;
31285
31287
  this._zkModel = zkModel;
@@ -31348,7 +31350,7 @@ var SceneDesignManager = /*#__PURE__*/function () {
31348
31350
  key: "refreshAsync",
31349
31351
  value: function () {
31350
31352
  var _refreshAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
31351
- var scene, meshDesignManager, mesh, meshSide, j, meshID, submeshIdx, _j2, found, k, meshVisible, _meshID;
31353
+ var scene, meshDesignManager, mesh, meshSide, i, found, k, meshVisible, meshID, j, _meshID, submeshIdx;
31352
31354
  return _regeneratorRuntime().wrap(function _callee$(_context) {
31353
31355
  while (1) switch (_context.prev = _context.next) {
31354
31356
  case 0:
@@ -31366,68 +31368,73 @@ var SceneDesignManager = /*#__PURE__*/function () {
31366
31368
  meshSide = null; // Removed sceneID check otherwise it will not work when creating the scene in the customizer
31367
31369
  // backoffice
31368
31370
  //let sceneID = scene.get("sceneID");
31369
- // Per ogni collegamento Mesh-Side aggiorno il corrispondente gestore
31370
- j = 0;
31371
+ // Elimino tutti i gestori non più necessari
31372
+ i = 0;
31371
31373
  case 7:
31372
- if (!(j < scene.get("meshSides").length)) {
31373
- _context.next = 17;
31374
- break;
31375
- }
31376
- meshSide = scene.get("meshSides").at(j);
31377
- meshID = meshSide.get("meshID");
31378
- submeshIdx = meshSide.get("subMeshID");
31379
- if (!meshID) {
31380
- _context.next = 14;
31374
+ if (!(i < this._meshDesignManagers.length)) {
31375
+ _context.next = 25;
31381
31376
  break;
31382
31377
  }
31383
- _context.next = 14;
31384
- return this.refreshMeshDesignAsync(meshID, submeshIdx);
31385
- case 14:
31386
- j++;
31387
- _context.next = 7;
31388
- break;
31389
- case 17:
31390
- _j2 = 0;
31391
- case 18:
31392
- if (!(_j2 < this._meshDesignManagers.length)) {
31393
- _context.next = 36;
31394
- break;
31395
- }
31396
- meshDesignManager = this._meshDesignManagers[_j2];
31378
+ meshDesignManager = this._meshDesignManagers[i];
31397
31379
  found = false;
31398
31380
  k = 0;
31399
- case 22:
31381
+ case 11:
31400
31382
  if (!(k < scene.get("meshSides").length)) {
31401
- _context.next = 30;
31383
+ _context.next = 19;
31402
31384
  break;
31403
31385
  }
31404
31386
  meshSide = scene.get("meshSides").at(k);
31405
31387
  if (!(meshSide.get("meshID") == meshDesignManager.getMeshID() && meshSide.get("subMeshID") == meshDesignManager.getSubMeshIdx())) {
31406
- _context.next = 27;
31388
+ _context.next = 16;
31407
31389
  break;
31408
31390
  }
31409
31391
  found = true;
31410
- return _context.abrupt("break", 30);
31411
- case 27:
31392
+ return _context.abrupt("break", 19);
31393
+ case 16:
31412
31394
  k++;
31413
- _context.next = 22;
31395
+ _context.next = 11;
31414
31396
  break;
31415
- case 30:
31397
+ case 19:
31416
31398
  meshVisible = true;
31417
31399
  if (found) {
31418
- _meshID = meshDesignManager.getMeshID();
31419
- if (_meshID) {
31420
- mesh = this._scene.getMeshByID(_meshID);
31400
+ meshID = meshDesignManager.getMeshID();
31401
+ if (meshID) {
31402
+ mesh = this._scene.getMeshByID(meshID);
31421
31403
  if (mesh) meshVisible = mesh.isVisible;
31422
31404
  }
31423
31405
  }
31424
31406
  if (!found || !meshVisible) {
31425
31407
  meshDesignManager.dispose();
31426
- this._meshDesignManagers.splice(_j2--, 1);
31408
+ // const meshID = meshDesignManager.getMeshID();
31409
+
31410
+ // if (meshID)
31411
+ // this._debouncedMeshRefresh.delete(meshID);
31412
+
31413
+ this._meshDesignManagers.splice(i--, 1);
31427
31414
  }
31415
+ case 22:
31416
+ i++;
31417
+ _context.next = 7;
31418
+ break;
31419
+ case 25:
31420
+ j = 0;
31421
+ case 26:
31422
+ if (!(j < scene.get("meshSides").length)) {
31423
+ _context.next = 36;
31424
+ break;
31425
+ }
31426
+ meshSide = scene.get("meshSides").at(j);
31427
+ _meshID = meshSide.get("meshID");
31428
+ submeshIdx = meshSide.get("subMeshID");
31429
+ if (!_meshID) {
31430
+ _context.next = 33;
31431
+ break;
31432
+ }
31433
+ _context.next = 33;
31434
+ return this.refreshMeshDesignAsync(_meshID, submeshIdx);
31428
31435
  case 33:
31429
- _j2++;
31430
- _context.next = 18;
31436
+ j++;
31437
+ _context.next = 26;
31431
31438
  break;
31432
31439
  case 36:
31433
31440
  case "end":
@@ -31475,11 +31482,18 @@ var SceneDesignManager = /*#__PURE__*/function () {
31475
31482
  case 0:
31476
31483
  submeshID = _args2.length > 1 && _args2[1] !== undefined ? _args2[1] : 0;
31477
31484
  effect = _args2.length > 2 ? _args2[2] : undefined;
31485
+ if (!this._meshesToBeRefreshed.has(meshID)) {
31486
+ _context2.next = 4;
31487
+ break;
31488
+ }
31489
+ return _context2.abrupt("return");
31490
+ case 4:
31491
+ this._meshesToBeRefreshed.add(meshID);
31478
31492
  validEffect = effect;
31479
31493
  if (effect && !this.isValidEffectForMesh(meshID, submeshID, effect)) validEffect = undefined;
31480
31494
  mesh = this._scene.getMeshByID(meshID);
31481
31495
  if (!(mesh && mesh.isVisible)) {
31482
- _context2.next = 26;
31496
+ _context2.next = 29;
31483
31497
  break;
31484
31498
  }
31485
31499
  subMesh = null;
@@ -31488,12 +31502,12 @@ var SceneDesignManager = /*#__PURE__*/function () {
31488
31502
  }
31489
31503
  meshDesignManager = this.getMeshDesignMananger(mesh, subMesh);
31490
31504
  if (meshDesignManager) {
31491
- _context2.next = 23;
31505
+ _context2.next = 26;
31492
31506
  break;
31493
31507
  }
31494
- _context2.next = 12;
31508
+ _context2.next = 15;
31495
31509
  return _MeshDesignManager__WEBPACK_IMPORTED_MODULE_0__.MeshDesignManager.createMeshDesignManagerAsync(this._scene, this._zkScene, mesh, subMesh, this._zkModel, this._zkDesign, this._showDesign, validEffect, this._designTextureResolution);
31496
- case 12:
31510
+ case 15:
31497
31511
  meshDesignManager = _context2.sent;
31498
31512
  meshDesignManager.addRenderingNeededListener(function () {
31499
31513
  return _this.fireRenderingNeededEvent();
@@ -31523,13 +31537,15 @@ var SceneDesignManager = /*#__PURE__*/function () {
31523
31537
  _iterator2.f();
31524
31538
  }
31525
31539
  this._meshDesignManagers.push(meshDesignManager);
31526
- _context2.next = 26;
31540
+ _context2.next = 29;
31527
31541
  break;
31528
- case 23:
31542
+ case 26:
31529
31543
  meshDesignManager.showDesign = this._showDesign;
31530
- _context2.next = 26;
31544
+ _context2.next = 29;
31531
31545
  return meshDesignManager.refreshAsync(validEffect);
31532
- case 26:
31546
+ case 29:
31547
+ this._meshesToBeRefreshed["delete"](meshID);
31548
+ case 30:
31533
31549
  case "end":
31534
31550
  return _context2.stop();
31535
31551
  }
@@ -61429,7 +61445,14 @@ var ZakekeEnvironment = /*#__PURE__*/function () {
61429
61445
  _this.viewer.highlightSize = settings.size;
61430
61446
  }
61431
61447
  });
61432
- _defineProperty(this, "renderDesign", lodash__WEBPACK_IMPORTED_MODULE_0___default().throttle( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15() {
61448
+ // public renderDesign = _.throttle(async () => {
61449
+ // console.log('renderDesign environment');
61450
+ // if (this.viewer && this.zkCurrentTemplate) {
61451
+ // await this.viewer.renderDesignAsync(this.zkCurrentTemplate);
61452
+ // this.fireItemsChange();
61453
+ // }
61454
+ // }, 300);
61455
+ _defineProperty(this, "renderDesign", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15() {
61433
61456
  return _regeneratorRuntime().wrap(function _callee15$(_context15) {
61434
61457
  while (1) switch (_context15.prev = _context15.next) {
61435
61458
  case 0:
@@ -61446,7 +61469,7 @@ var ZakekeEnvironment = /*#__PURE__*/function () {
61446
61469
  return _context15.stop();
61447
61470
  }
61448
61471
  }, _callee15);
61449
- })), 300));
61472
+ })));
61450
61473
  _defineProperty(this, "resize", function () {
61451
61474
  if (!_this.viewer) return;
61452
61475
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zakeke-configurator-react",
3
- "version": "0.0.151",
3
+ "version": "0.0.153",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/declarations/composer/Module/src/index.d.ts",