kitchen-simulator 3.16.0 → 3.16.2-test-renderer-fix

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.
@@ -4,6 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
+ exports.getPlannerStateFromProps = getPlannerStateFromProps;
7
8
  exports.handleExternalEvent = handleExternalEvent;
8
9
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
9
10
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
@@ -24,34 +25,63 @@ var _models = require("../models");
24
25
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
25
26
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
26
27
  var PRECISION = 2;
28
+
29
+ // ---- compatibility: supports old + optimized props shapes ----
30
+ function getPlannerStateFromProps(props) {
31
+ var _props$state;
32
+ // New optimized path
33
+ if (props !== null && props !== void 0 && props.extractedState) return props.extractedState;
34
+
35
+ // Old path
36
+ if (props !== null && props !== void 0 && (_props$state = props.state) !== null && _props$state !== void 0 && _props$state.get) {
37
+ var kc = props.state.get('KitchenConfigurator');
38
+ if (kc) return kc;
39
+ }
40
+ return null;
41
+ }
42
+
43
+ // ---- caches: avoid re-fetch/re-parse costs (no behavior change) ----
44
+ var __jsonCache = new _immutable.Map(); // url -> Promise<any>
45
+ var __svgCache = new _immutable.Map(); // url -> Promise<svgData|null>
27
46
  function loadJSON(_x) {
28
47
  return _loadJSON.apply(this, arguments);
29
48
  }
30
49
  /********Parse TempPlaceholder from cabinetPayloadData **************/
31
50
  function _loadJSON() {
32
- _loadJSON = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee2(path) {
33
- return _regenerator["default"].wrap(function (_context2) {
34
- while (1) switch (_context2.prev = _context2.next) {
51
+ _loadJSON = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee3(path) {
52
+ var p;
53
+ return _regenerator["default"].wrap(function (_context3) {
54
+ while (1) switch (_context3.prev = _context3.next) {
35
55
  case 0:
36
- return _context2.abrupt("return", new Promise(function (resolve, reject) {
56
+ if (path) {
57
+ _context3.next = 1;
58
+ break;
59
+ }
60
+ return _context3.abrupt("return", null);
61
+ case 1:
62
+ if (!__jsonCache.has(path)) {
63
+ _context3.next = 2;
64
+ break;
65
+ }
66
+ return _context3.abrupt("return", __jsonCache.get(path));
67
+ case 2:
68
+ p = new Promise(function (resolve, reject) {
37
69
  var xhr = new XMLHttpRequest();
38
70
  xhr.onreadystatechange = function () {
39
71
  if (xhr.readyState === XMLHttpRequest.DONE) {
40
- if (xhr.status === 200) {
41
- resolve(JSON.parse(xhr.responseText));
42
- } else {
43
- reject(xhr);
44
- }
72
+ if (xhr.status === 200) resolve(JSON.parse(xhr.responseText));else reject(xhr);
45
73
  }
46
74
  };
47
75
  xhr.open('GET', path, true);
48
76
  xhr.send();
49
- }));
50
- case 1:
77
+ });
78
+ __jsonCache.set(path, p);
79
+ return _context3.abrupt("return", p);
80
+ case 3:
51
81
  case "end":
52
- return _context2.stop();
82
+ return _context3.stop();
53
83
  }
54
- }, _callee2);
84
+ }, _callee3);
55
85
  }));
56
86
  return _loadJSON.apply(this, arguments);
57
87
  }
@@ -60,10 +90,10 @@ function parseTempPlaceholdersFromCabinetPayload(_x2) {
60
90
  }
61
91
  /***** Update cabinetPayloadData with updatedTempPlaceholders *****/
62
92
  function _parseTempPlaceholdersFromCabinetPayload() {
63
- _parseTempPlaceholdersFromCabinetPayload = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee3(cabinetPayload) {
93
+ _parseTempPlaceholdersFromCabinetPayload = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee4(cabinetPayload) {
64
94
  var link, keys, temp, i, _cabinetPayload$struc, _cabinetPayload$struc2, el, tempPlaceholdersData, tempData, doorKey, drawerKey, fixedKey, doorPHs, drawerPHs, has_single_door, fixedPHs, _t2, _t3, _t4;
65
- return _regenerator["default"].wrap(function (_context3) {
66
- while (1) switch (_context3.prev = _context3.next) {
95
+ return _regenerator["default"].wrap(function (_context4) {
96
+ while (1) switch (_context4.prev = _context4.next) {
67
97
  case 0:
68
98
  link = '';
69
99
  keys = Object.keys(cabinetPayload.structure_json);
@@ -71,27 +101,27 @@ function _parseTempPlaceholdersFromCabinetPayload() {
71
101
  i = 0;
72
102
  case 1:
73
103
  if (!(i < keys.length)) {
74
- _context3.next = 4;
104
+ _context4.next = 4;
75
105
  break;
76
106
  }
77
107
  if (!((_cabinetPayload$struc = cabinetPayload.structure_json[keys[i]]) !== null && _cabinetPayload$struc !== void 0 && (_cabinetPayload$struc = _cabinetPayload$struc.toString()) !== null && _cabinetPayload$struc !== void 0 && _cabinetPayload$struc.includes('.gltf') && (_cabinetPayload$struc2 = cabinetPayload.structure_json[keys[i]]) !== null && _cabinetPayload$struc2 !== void 0 && (_cabinetPayload$struc2 = _cabinetPayload$struc2.toString()) !== null && _cabinetPayload$struc2 !== void 0 && _cabinetPayload$struc2.startsWith('http'))) {
78
- _context3.next = 3;
108
+ _context4.next = 3;
79
109
  break;
80
110
  }
81
111
  link = cabinetPayload.structure_json[keys[i]];
82
112
  _t2 = temp;
83
113
  _t3 = keys[i];
84
- _context3.next = 2;
114
+ _context4.next = 2;
85
115
  return loadJSON(link);
86
116
  case 2:
87
- _t4 = _context3.sent;
117
+ _t4 = _context4.sent;
88
118
  _t2.push.call(_t2, {
89
119
  name: _t3,
90
120
  data: _t4
91
121
  });
92
122
  case 3:
93
123
  i++;
94
- _context3.next = 1;
124
+ _context4.next = 1;
95
125
  break;
96
126
  case 4:
97
127
  el = cabinetPayload.structure_json.tempPlaceholders[0].id;
@@ -394,12 +424,12 @@ function _parseTempPlaceholdersFromCabinetPayload() {
394
424
  placeholders: tempData,
395
425
  structure: cabinetPayload.structure_json.tempPlaceholders[0].structure
396
426
  });
397
- return _context3.abrupt("return", tempPlaceholdersData);
427
+ return _context4.abrupt("return", tempPlaceholdersData);
398
428
  case 5:
399
429
  case "end":
400
- return _context3.stop();
430
+ return _context4.stop();
401
431
  }
402
- }, _callee3);
432
+ }, _callee4);
403
433
  }));
404
434
  return _parseTempPlaceholdersFromCabinetPayload.apply(this, arguments);
405
435
  }
@@ -407,16 +437,16 @@ function updateCabinetPayload(_x3) {
407
437
  return _updateCabinetPayload.apply(this, arguments);
408
438
  }
409
439
  function _updateCabinetPayload() {
410
- _updateCabinetPayload = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee4(cabinetPayload) {
440
+ _updateCabinetPayload = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee5(cabinetPayload) {
411
441
  var tempPlaceholders, cabinetPayloadKeys, i;
412
- return _regenerator["default"].wrap(function (_context4) {
413
- while (1) switch (_context4.prev = _context4.next) {
442
+ return _regenerator["default"].wrap(function (_context5) {
443
+ while (1) switch (_context5.prev = _context5.next) {
414
444
  case 0:
415
445
  tempPlaceholders = [];
416
- _context4.next = 1;
446
+ _context5.next = 1;
417
447
  return parseTempPlaceholdersFromCabinetPayload(cabinetPayload);
418
448
  case 1:
419
- tempPlaceholders = _context4.sent;
449
+ tempPlaceholders = _context5.sent;
420
450
  cabinetPayloadKeys = Object.keys(cabinetPayload);
421
451
  for (i = 0; i < cabinetPayloadKeys.length; i++) {
422
452
  if (cabinetPayloadKeys[i] === 'structure_json') {
@@ -424,62 +454,82 @@ function _updateCabinetPayload() {
424
454
  cabinetPayload[cabinetPayloadKeys[i]]['tempPlaceholders'] = tempPlaceholders;
425
455
  }
426
456
  }
427
- return _context4.abrupt("return", cabinetPayload);
457
+ return _context5.abrupt("return", cabinetPayload);
428
458
  case 2:
429
459
  case "end":
430
- return _context4.stop();
460
+ return _context5.stop();
431
461
  }
432
- }, _callee4);
462
+ }, _callee5);
433
463
  }));
434
464
  return _updateCabinetPayload.apply(this, arguments);
435
465
  }
436
466
  var loadSVGsByItem = /*#__PURE__*/function () {
437
- var _ref = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee(item) {
438
- var _parsed$xml$viewBox, _parsed$xml$viewBox2, response, svgText, loader, parsed, _t;
439
- return _regenerator["default"].wrap(function (_context) {
440
- while (1) switch (_context.prev = _context.next) {
467
+ var _ref = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee2(item) {
468
+ var url, p;
469
+ return _regenerator["default"].wrap(function (_context2) {
470
+ while (1) switch (_context2.prev = _context2.next) {
441
471
  case 0:
442
- if (item.outline) {
443
- _context.next = 1;
472
+ if (item !== null && item !== void 0 && item.outline) {
473
+ _context2.next = 1;
444
474
  break;
445
475
  }
446
- return _context.abrupt("return", null);
476
+ return _context2.abrupt("return", null);
447
477
  case 1:
448
- _context.prev = 1;
449
- _context.next = 2;
450
- return fetch(item.outline, {
451
- cache: 'no-store'
452
- });
453
- case 2:
454
- response = _context.sent;
455
- _context.next = 3;
456
- return response.text();
457
- case 3:
458
- svgText = _context.sent;
459
- loader = new _SVGLoader.SVGLoader();
460
- parsed = loader.parse(svgText);
461
- if (!(0, _helper.isEmpty)(parsed.paths)) {
462
- _context.next = 4;
478
+ url = item.outline;
479
+ if (!__svgCache.has(url)) {
480
+ _context2.next = 2;
463
481
  break;
464
482
  }
465
- return _context.abrupt("return", null);
466
- case 4:
467
- return _context.abrupt("return", {
468
- paths: parsed.paths,
469
- svgWidth: parseFloat(parsed.xml.getAttribute('width')) || ((_parsed$xml$viewBox = parsed.xml.viewBox) === null || _parsed$xml$viewBox === void 0 || (_parsed$xml$viewBox = _parsed$xml$viewBox.animVal) === null || _parsed$xml$viewBox === void 0 ? void 0 : _parsed$xml$viewBox.width) || 0,
470
- svgHeight: parseFloat(parsed.xml.getAttribute('height')) || ((_parsed$xml$viewBox2 = parsed.xml.viewBox) === null || _parsed$xml$viewBox2 === void 0 || (_parsed$xml$viewBox2 = _parsed$xml$viewBox2.animVal) === null || _parsed$xml$viewBox2 === void 0 ? void 0 : _parsed$xml$viewBox2.height) || 0,
471
- reverse: !parseFloat(parsed.xml.getAttribute('height'))
472
- });
473
- case 5:
474
- _context.prev = 5;
475
- _t = _context["catch"](1);
476
- console.error('Failed to load SVG:', item.outline, _t);
477
- return _context.abrupt("return", null);
478
- case 6:
483
+ return _context2.abrupt("return", __svgCache.get(url));
484
+ case 2:
485
+ p = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee() {
486
+ var _parsed$xml$viewBox, _parsed$xml$viewBox2, response, svgText, loader, parsed, _t;
487
+ return _regenerator["default"].wrap(function (_context) {
488
+ while (1) switch (_context.prev = _context.next) {
489
+ case 0:
490
+ _context.prev = 0;
491
+ _context.next = 1;
492
+ return fetch(url, {
493
+ cache: 'no-store'
494
+ });
495
+ case 1:
496
+ response = _context.sent;
497
+ _context.next = 2;
498
+ return response.text();
499
+ case 2:
500
+ svgText = _context.sent;
501
+ loader = new _SVGLoader.SVGLoader();
502
+ parsed = loader.parse(svgText);
503
+ if (!(0, _helper.isEmpty)(parsed.paths)) {
504
+ _context.next = 3;
505
+ break;
506
+ }
507
+ return _context.abrupt("return", null);
508
+ case 3:
509
+ return _context.abrupt("return", {
510
+ paths: parsed.paths,
511
+ svgWidth: parseFloat(parsed.xml.getAttribute('width')) || ((_parsed$xml$viewBox = parsed.xml.viewBox) === null || _parsed$xml$viewBox === void 0 || (_parsed$xml$viewBox = _parsed$xml$viewBox.animVal) === null || _parsed$xml$viewBox === void 0 ? void 0 : _parsed$xml$viewBox.width) || 0,
512
+ svgHeight: parseFloat(parsed.xml.getAttribute('height')) || ((_parsed$xml$viewBox2 = parsed.xml.viewBox) === null || _parsed$xml$viewBox2 === void 0 || (_parsed$xml$viewBox2 = _parsed$xml$viewBox2.animVal) === null || _parsed$xml$viewBox2 === void 0 ? void 0 : _parsed$xml$viewBox2.height) || 0,
513
+ reverse: !parseFloat(parsed.xml.getAttribute('height'))
514
+ });
515
+ case 4:
516
+ _context.prev = 4;
517
+ _t = _context["catch"](0);
518
+ console.error('Failed to load SVG:', url, _t);
519
+ return _context.abrupt("return", null);
520
+ case 5:
521
+ case "end":
522
+ return _context.stop();
523
+ }
524
+ }, _callee, null, [[0, 4]]);
525
+ }))();
526
+ __svgCache.set(url, p);
527
+ return _context2.abrupt("return", p);
528
+ case 3:
479
529
  case "end":
480
- return _context.stop();
530
+ return _context2.stop();
481
531
  }
482
- }, _callee, null, [[1, 5]]);
532
+ }, _callee2);
483
533
  }));
484
534
  return function loadSVGsByItem(_x4) {
485
535
  return _ref.apply(this, arguments);
@@ -489,26 +539,26 @@ function addItemToCatalog(_x5, _x6, _x7, _x8) {
489
539
  return _addItemToCatalog.apply(this, arguments);
490
540
  } // Get attributs of current selected element
491
541
  function _addItemToCatalog() {
492
- _addItemToCatalog = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee5(element, state, catalogInstance, projectActions) {
542
+ _addItemToCatalog = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee6(element, state, catalogInstance, projectActions) {
493
543
  var _elementJs, _elementJs3;
494
544
  var elementJs, outlineSVGData, _state$getIn, _elementJs$structure_, _elementJs$structure_2, _elementJs$structure_3, cds, _cds$find, _elementJs2, currentCdsId, cdsIdx, ttph, updatedStructureJson, catalogElements, catalogElementKeys, catalogItem, k, _catalogElements$cata, tempPlaceholderArray, _catalogItem$structur, newTempPlaceholderArray, mergedTempPlaceholder;
495
- return _regenerator["default"].wrap(function (_context5) {
496
- while (1) switch (_context5.prev = _context5.next) {
545
+ return _regenerator["default"].wrap(function (_context6) {
546
+ while (1) switch (_context6.prev = _context6.next) {
497
547
  case 0:
498
548
  if (!(0, _helper.isEmpty)(element === null || element === void 0 ? void 0 : element.name)) {
499
- _context5.next = 1;
549
+ _context6.next = 1;
500
550
  break;
501
551
  }
502
- return _context5.abrupt("return");
552
+ return _context6.abrupt("return");
503
553
  case 1:
504
554
  // clone element
505
555
  elementJs = Object.assign({}, element); // if (isEmpty(catalog?.elements[element.name])) {
506
- _context5.next = 2;
556
+ _context6.next = 2;
507
557
  return loadSVGsByItem(elementJs);
508
558
  case 2:
509
- outlineSVGData = _context5.sent;
559
+ outlineSVGData = _context6.sent;
510
560
  if (!(((_elementJs = elementJs) === null || _elementJs === void 0 ? void 0 : _elementJs.type) === 'cabinet')) {
511
- _context5.next = 4;
561
+ _context6.next = 4;
512
562
  break;
513
563
  }
514
564
  // move the tempPlaceholder of current door style to first of tempPlaceholders array
@@ -536,13 +586,13 @@ function _addItemToCatalog() {
536
586
  }
537
587
  });
538
588
  if ((0, _helper.isEmpty)((_elementJs$structure_3 = elementJs.structure_json) === null || _elementJs$structure_3 === void 0 ? void 0 : _elementJs$structure_3.tempPlaceholders)) {
539
- _context5.next = 4;
589
+ _context6.next = 4;
540
590
  break;
541
591
  }
542
- _context5.next = 3;
592
+ _context6.next = 3;
543
593
  return updateCabinetPayload(elementJs);
544
594
  case 3:
545
- elementJs = _context5.sent;
595
+ elementJs = _context6.sent;
546
596
  case 4:
547
597
  elementJs = _objectSpread(_objectSpread({}, elementJs), {}, {
548
598
  outlineSVGData: outlineSVGData,
@@ -559,18 +609,18 @@ function _addItemToCatalog() {
559
609
  k = 0;
560
610
  case 5:
561
611
  if (!(k < catalogElementKeys.length)) {
562
- _context5.next = 7;
612
+ _context6.next = 7;
563
613
  break;
564
614
  }
565
615
  if (!(((_catalogElements$cata = catalogElements[catalogElementKeys[k]]) === null || _catalogElements$cata === void 0 ? void 0 : _catalogElements$cata.itemID) === elementJs.itemID)) {
566
- _context5.next = 6;
616
+ _context6.next = 6;
567
617
  break;
568
618
  }
569
619
  catalogItem = catalogElements[catalogElementKeys[k]];
570
- return _context5.abrupt("continue", 7);
620
+ return _context6.abrupt("continue", 7);
571
621
  case 6:
572
622
  k++;
573
- _context5.next = 5;
623
+ _context6.next = 5;
574
624
  break;
575
625
  case 7:
576
626
  // get old tempPlaceholder array from catalog item
@@ -601,9 +651,9 @@ function _addItemToCatalog() {
601
651
  }
602
652
  case 8:
603
653
  case "end":
604
- return _context5.stop();
654
+ return _context6.stop();
605
655
  }
606
- }, _callee5);
656
+ }, _callee6);
607
657
  }));
608
658
  return _addItemToCatalog.apply(this, arguments);
609
659
  }
@@ -833,8 +883,8 @@ function updateAttributeOfSelectedElement(element, attrPayload, state, layer, ca
833
883
  var xp = (lengthValue + halfWidthLength) * Math.cos(alpha) + x0;
834
884
  var yp = (lengthValue + halfWidthLength) * Math.sin(alpha) + y0;
835
885
  var offset = _export.GeometryUtils.pointPositionOnLineSegment(x0, y0, x1, y1, xp, yp);
836
- /*
837
- if (x0 > x1) offset = 1 - offset;
886
+ /*
887
+ if (x0 > x1) offset = 1 - offset;
838
888
  */
839
889
  var endAt = _export.MathUtils.toFixedFloat(lineLength - lineLength * offset - halfWidthLength, PRECISION);
840
890
  var offsetUnit = attributesFormData.getIn(['offsetB', '_unit']);
@@ -871,8 +921,8 @@ function updateAttributeOfSelectedElement(element, attrPayload, state, layer, ca
871
921
  var _xp = _x0 - (_lengthValue + _halfWidthLength) * Math.cos(_alpha);
872
922
  var _yp = _y2 - (_lengthValue + _halfWidthLength) * Math.sin(_alpha);
873
923
  var _offset = _export.GeometryUtils.pointPositionOnLineSegment(_x9, _y, _x0, _y2, _xp, _yp);
874
- /*
875
- if (x0 > x1) offset = 1 - offset;
924
+ /*
925
+ if (x0 > x1) offset = 1 - offset;
876
926
  */
877
927
  var startAt = _export.MathUtils.toFixedFloat(_lineLength * _offset - _halfWidthLength, PRECISION);
878
928
  var _offsetUnit = attributesFormData.getIn(['offsetA', '_unit']);
@@ -990,11 +1040,11 @@ function loadMoldingSvg(_x1) {
990
1040
  return _loadMoldingSvg.apply(this, arguments);
991
1041
  }
992
1042
  function _loadMoldingSvg() {
993
- _loadMoldingSvg = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee6(molding) {
994
- return _regenerator["default"].wrap(function (_context6) {
995
- while (1) switch (_context6.prev = _context6.next) {
1043
+ _loadMoldingSvg = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee7(molding) {
1044
+ return _regenerator["default"].wrap(function (_context7) {
1045
+ while (1) switch (_context7.prev = _context7.next) {
996
1046
  case 0:
997
- return _context6.abrupt("return", new Promise(function (resolve, reject) {
1047
+ return _context7.abrupt("return", new Promise(function (resolve, reject) {
998
1048
  var url = molding === null || molding === void 0 ? void 0 : molding.shape_svg;
999
1049
  if (!url) {
1000
1050
  // Skip if no SVG URL available
@@ -1016,9 +1066,9 @@ function _loadMoldingSvg() {
1016
1066
  }));
1017
1067
  case 1:
1018
1068
  case "end":
1019
- return _context6.stop();
1069
+ return _context7.stop();
1020
1070
  }
1021
- }, _callee6);
1071
+ }, _callee7);
1022
1072
  }));
1023
1073
  return _loadMoldingSvg.apply(this, arguments);
1024
1074
  }
@@ -1138,23 +1188,29 @@ function handleExternalEvent(_x10) {
1138
1188
  return _handleExternalEvent.apply(this, arguments);
1139
1189
  }
1140
1190
  function _handleExternalEvent() {
1141
- _handleExternalEvent = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee9(props) {
1191
+ _handleExternalEvent = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee0(props) {
1142
1192
  var _evt$payload3, _evt$payload4;
1143
1193
  var evt, state, layerId, layer, _evt$payload, cdsItems, itemKeys, _loop3, i, newScene, _props$onInternalEven, sLineCnt, element, _state$viewer2D, _evt$payload$initialP, mouseX, mouseY, v2d, vPosX, vPosY, layerID, defaulTitle, _Object$keys, _evt$payload5, doorStyle, itemCDS, isAll, _layerId, _cdsItems, allItems, selectedItemId, _itemKeys, _loop4, _i2, _props$onInternalEven2, _evt$payload6, roomShapeType, width, height, _doorStyle, value, _value, _evt$payload7, moldingInfo, isGlobal, distElement, _distElement, _evt$payload8, option, _value2, _layerId2, _layer, _layer$getIn, selectedLines, selectedHoles, selectedItems, _i4, _i5, _i6, _evt$payload9, _evt$payload0, _evt$payload1, _evt$payload10, _layerID, _layer2, orginalItemInfo, originalItem, originalItemPos, replaceItem, _props$onInternalEven3, sceneData, currentTexture, _t5, _t6;
1144
- return _regenerator["default"].wrap(function (_context1) {
1145
- while (1) switch (_context1.prev = _context1.next) {
1194
+ return _regenerator["default"].wrap(function (_context10) {
1195
+ while (1) switch (_context10.prev = _context10.next) {
1146
1196
  case 0:
1147
1197
  // console.log('***external event****', props);
1148
1198
  evt = props.externalEvent;
1149
- state = props.state.get('KitchenConfigurator');
1199
+ state = getPlannerStateFromProps(props);
1200
+ if (state) {
1201
+ _context10.next = 1;
1202
+ break;
1203
+ }
1204
+ return _context10.abrupt("return");
1205
+ case 1:
1150
1206
  layerId = state.getIn(['scene', 'selectedLayer']);
1151
1207
  layer = state.getIn(['scene', 'layers', layerId]);
1152
1208
  _t5 = evt === null || evt === void 0 ? void 0 : evt.type;
1153
- _context1.next = _t5 === _constants.EXTERNAL_EVENT_LOAD_PROJECT ? 1 : _t5 === _constants.EXTERNAL_EVENT_TOGGLE_TO_3D ? 6 : _t5 === _constants.EXTERNAL_EVENT_TOGGLE_TO_2D ? 7 : _t5 === _constants.EXTERNAL_EVENT_TOGGLE_TO_ELEVATION ? 8 : _t5 === _constants.EXTERNAL_EVENT_ADD_WALL ? 9 : _t5 === _constants.EXTERNAL_EVENT_ADD_ITEM ? 10 : _t5 === _constants.EXTERNAL_EVENT_ADD_HOLE ? 13 : _t5 === _constants.EXTERNAL_EVENT_ROTATE_PAN ? 14 : _t5 === _constants.EXTERNAL_EVENT_MOVE_PAN ? 14 : _t5 === _constants.EXTERNAL_EVENT_NEW_PROJECT ? 15 : _t5 === _constants.EXTERNAL_EVENT_CHANGE_DOORSTYLE ? 16 : _t5 === _constants.EXTERNAL_EVENT_ADD_ROOM_SHAPE ? 20 : _t5 === _constants.EXTERNAL_EVENT_ZOOM_IN ? 21 : _t5 === _constants.EXTERNAL_EVENT_ZOOM_OUT ? 22 : _t5 === _constants.EXTERNAL_EVENT_CENTERING_2D ? 23 : _t5 === _constants.EXTERNAL_EVENT_UNDO ? 24 : _t5 === _constants.EXTERNAL_EVENT_REDO ? 25 : _t5 === _constants.EXTERNAL_EVENT_SET_MOLDING ? 26 : _t5 === _constants.EXTERNAL_EVENT_DUPLICATE_ELEMENT ? 28 : _t5 === _constants.EXTERNAL_EVENT_DELETE_ELEMENT ? 29 : _t5 === _constants.EXTERNAL_EVENT_PROJECT_SETTING ? 30 : _t5 === _constants.EXTERNAL_EVENT_UPDATE_ATTRIBUTE ? 39 : _t5 === _constants.EXTERNAL_EVENT_UPDATE_PROPERTY ? 39 : _t5 === _constants.EXTERNAL_EVENT_REPLACE_CABINET ? 40 : _t5 === _constants.EXTERNAL_EVENT_SET_FINISHING ? 42 : _t5 === _constants.EXTERNAL_EVENT_SYNC_SCENE ? 43 : 44;
1209
+ _context10.next = _t5 === _constants.EXTERNAL_EVENT_LOAD_PROJECT ? 2 : _t5 === _constants.EXTERNAL_EVENT_TOGGLE_TO_3D ? 7 : _t5 === _constants.EXTERNAL_EVENT_TOGGLE_TO_2D ? 8 : _t5 === _constants.EXTERNAL_EVENT_TOGGLE_TO_ELEVATION ? 9 : _t5 === _constants.EXTERNAL_EVENT_ADD_WALL ? 10 : _t5 === _constants.EXTERNAL_EVENT_ADD_ITEM ? 11 : _t5 === _constants.EXTERNAL_EVENT_ADD_HOLE ? 14 : _t5 === _constants.EXTERNAL_EVENT_ROTATE_PAN ? 15 : _t5 === _constants.EXTERNAL_EVENT_MOVE_PAN ? 15 : _t5 === _constants.EXTERNAL_EVENT_NEW_PROJECT ? 16 : _t5 === _constants.EXTERNAL_EVENT_CHANGE_DOORSTYLE ? 17 : _t5 === _constants.EXTERNAL_EVENT_ADD_ROOM_SHAPE ? 21 : _t5 === _constants.EXTERNAL_EVENT_ZOOM_IN ? 22 : _t5 === _constants.EXTERNAL_EVENT_ZOOM_OUT ? 23 : _t5 === _constants.EXTERNAL_EVENT_CENTERING_2D ? 24 : _t5 === _constants.EXTERNAL_EVENT_UNDO ? 25 : _t5 === _constants.EXTERNAL_EVENT_REDO ? 26 : _t5 === _constants.EXTERNAL_EVENT_SET_MOLDING ? 27 : _t5 === _constants.EXTERNAL_EVENT_DUPLICATE_ELEMENT ? 29 : _t5 === _constants.EXTERNAL_EVENT_DELETE_ELEMENT ? 30 : _t5 === _constants.EXTERNAL_EVENT_PROJECT_SETTING ? 31 : _t5 === _constants.EXTERNAL_EVENT_UPDATE_ATTRIBUTE ? 40 : _t5 === _constants.EXTERNAL_EVENT_UPDATE_PROPERTY ? 40 : _t5 === _constants.EXTERNAL_EVENT_REPLACE_CABINET ? 41 : _t5 === _constants.EXTERNAL_EVENT_SET_FINISHING ? 43 : _t5 === _constants.EXTERNAL_EVENT_SYNC_SCENE ? 44 : 45;
1154
1210
  break;
1155
- case 1:
1211
+ case 2:
1156
1212
  if (!(evt !== null && evt !== void 0 && evt.payload)) {
1157
- _context1.next = 5;
1213
+ _context10.next = 6;
1158
1214
  break;
1159
1215
  }
1160
1216
  // prepare item data request
@@ -1163,8 +1219,8 @@ function _handleExternalEvent() {
1163
1219
  _loop3 = /*#__PURE__*/_regenerator["default"].mark(function _loop3() {
1164
1220
  var _evt$payload2, _it$doorStyle2;
1165
1221
  var it;
1166
- return _regenerator["default"].wrap(function (_context8) {
1167
- while (1) switch (_context8.prev = _context8.next) {
1222
+ return _regenerator["default"].wrap(function (_context9) {
1223
+ while (1) switch (_context9.prev = _context9.next) {
1168
1224
  case 0:
1169
1225
  it = evt === null || evt === void 0 || (_evt$payload2 = evt.payload) === null || _evt$payload2 === void 0 || (_evt$payload2 = _evt$payload2.layers['layer-1']) === null || _evt$payload2 === void 0 ? void 0 : _evt$payload2.items[itemKeys[i]]; //////// check altitude of item property and change length from _length (convert length from 'in' fo 'cm')
1170
1226
  // if (
@@ -1192,22 +1248,22 @@ function _handleExternalEvent() {
1192
1248
  });
1193
1249
  case 1:
1194
1250
  case "end":
1195
- return _context8.stop();
1251
+ return _context9.stop();
1196
1252
  }
1197
1253
  }, _loop3);
1198
1254
  });
1199
1255
  i = 0;
1200
- case 2:
1256
+ case 3:
1201
1257
  if (!(i < itemKeys.length)) {
1202
- _context1.next = 4;
1258
+ _context10.next = 5;
1203
1259
  break;
1204
1260
  }
1205
- return _context1.delegateYield(_loop3(), "t0", 3);
1206
- case 3:
1261
+ return _context10.delegateYield(_loop3(), "t0", 4);
1262
+ case 4:
1207
1263
  i++;
1208
- _context1.next = 2;
1264
+ _context10.next = 3;
1209
1265
  break;
1210
- case 4:
1266
+ case 5:
1211
1267
  newScene = new _models.Scene(evt === null || evt === void 0 ? void 0 : evt.payload);
1212
1268
  state = new _models.State({
1213
1269
  scene: newScene.toJS()
@@ -1220,63 +1276,63 @@ function _handleExternalEvent() {
1220
1276
  cdsItems: cdsItems
1221
1277
  }
1222
1278
  }, /*#__PURE__*/function () {
1223
- var _ref2 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee7(result) {
1279
+ var _ref3 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee8(result) {
1224
1280
  var _i, _result$elements;
1225
- return _regenerator["default"].wrap(function (_context7) {
1226
- while (1) switch (_context7.prev = _context7.next) {
1281
+ return _regenerator["default"].wrap(function (_context8) {
1282
+ while (1) switch (_context8.prev = _context8.next) {
1227
1283
  case 0:
1228
1284
  _i = 0;
1229
1285
  case 1:
1230
1286
  if (!(_i < (result === null || result === void 0 || (_result$elements = result.elements) === null || _result$elements === void 0 ? void 0 : _result$elements.length))) {
1231
- _context7.next = 3;
1287
+ _context8.next = 3;
1232
1288
  break;
1233
1289
  }
1234
- _context7.next = 2;
1290
+ _context8.next = 2;
1235
1291
  return addItemToCatalog(result.elements[_i], state, props.catalog, props.projectActions);
1236
1292
  case 2:
1237
1293
  _i++;
1238
- _context7.next = 1;
1294
+ _context8.next = 1;
1239
1295
  break;
1240
1296
  case 3:
1241
1297
  props.projectActions.loadProject(evt.payload);
1242
1298
  case 4:
1243
1299
  case "end":
1244
- return _context7.stop();
1300
+ return _context8.stop();
1245
1301
  }
1246
- }, _callee7);
1302
+ }, _callee8);
1247
1303
  }));
1248
1304
  return function (_x11) {
1249
- return _ref2.apply(this, arguments);
1305
+ return _ref3.apply(this, arguments);
1250
1306
  };
1251
1307
  }());
1252
1308
  } else props.projectActions.loadProject(evt.payload);
1253
- case 5:
1254
- return _context1.abrupt("continue", 44);
1255
1309
  case 6:
1256
- props.projectActions.setMode(_constants.MODE_IDLE_3D);
1257
- return _context1.abrupt("continue", 44);
1310
+ return _context10.abrupt("continue", 45);
1258
1311
  case 7:
1259
- props.projectActions.setMode(_constants.MODE_IDLE);
1260
- return _context1.abrupt("continue", 44);
1312
+ props.projectActions.setMode(_constants.MODE_IDLE_3D);
1313
+ return _context10.abrupt("continue", 45);
1261
1314
  case 8:
1315
+ props.projectActions.setMode(_constants.MODE_IDLE);
1316
+ return _context10.abrupt("continue", 45);
1317
+ case 9:
1262
1318
  sLineCnt = layer.selected.lines.size;
1263
1319
  if (sLineCnt > 0) props.projectActions.setMode(_constants.MODE_ELEVATION_VIEW);
1264
- return _context1.abrupt("continue", 44);
1265
- case 9:
1320
+ return _context10.abrupt("continue", 45);
1321
+ case 10:
1266
1322
  if (state.mode === _constants.MODE_IDLE || state.mode === _constants.MODE_2D_PAN) props.linesActions.selectToolDrawingLine('wall');else {
1267
1323
  props.projectActions.setMode(_constants.MODE_IDLE);
1268
1324
  props.linesActions.selectToolDrawingLine('wall');
1269
1325
  }
1270
- return _context1.abrupt("continue", 44);
1271
- case 10:
1326
+ return _context10.abrupt("continue", 45);
1327
+ case 11:
1272
1328
  if ((0, _helper.isEmpty)(evt === null || evt === void 0 ? void 0 : evt.payload)) {
1273
- _context1.next = 12;
1329
+ _context10.next = 13;
1274
1330
  break;
1275
1331
  }
1276
1332
  element = evt.payload;
1277
- _context1.next = 11;
1333
+ _context10.next = 12;
1278
1334
  return addItemToCatalog(element, state, props.catalog, props.projectActions);
1279
- case 11:
1335
+ case 12:
1280
1336
  // start drawing item
1281
1337
  if (_constants.ARRAY_3D_MODES.includes(state.mode)) {
1282
1338
  // in 3d view
@@ -1297,20 +1353,20 @@ function _handleExternalEvent() {
1297
1353
  }
1298
1354
  props.projectActions.pushLastSelectedCatalogElementToHistory(element);
1299
1355
  props.projectActions.setIsCabinetDrawing(true);
1300
- case 12:
1301
- return _context1.abrupt("continue", 44);
1302
1356
  case 13:
1303
- _constants.ARRAY_3D_MODES.includes(state.mode) ? props.holesActions.selectToolDrawingHole3D(evt === null || evt === void 0 || (_evt$payload3 = evt.payload) === null || _evt$payload3 === void 0 ? void 0 : _evt$payload3.holeName) : props.holesActions.selectToolDrawingHole(evt === null || evt === void 0 || (_evt$payload4 = evt.payload) === null || _evt$payload4 === void 0 ? void 0 : _evt$payload4.holeName);
1304
- return _context1.abrupt("continue", 44);
1357
+ return _context10.abrupt("continue", 45);
1305
1358
  case 14:
1306
- moveAndRotatePan2D3D(evt.type, props, evt.payload, state);
1307
- return _context1.abrupt("continue", 44);
1359
+ _constants.ARRAY_3D_MODES.includes(state.mode) ? props.holesActions.selectToolDrawingHole3D(evt === null || evt === void 0 || (_evt$payload3 = evt.payload) === null || _evt$payload3 === void 0 ? void 0 : _evt$payload3.holeName) : props.holesActions.selectToolDrawingHole(evt === null || evt === void 0 || (_evt$payload4 = evt.payload) === null || _evt$payload4 === void 0 ? void 0 : _evt$payload4.holeName);
1360
+ return _context10.abrupt("continue", 45);
1308
1361
  case 15:
1362
+ moveAndRotatePan2D3D(evt.type, props, evt.payload, state);
1363
+ return _context10.abrupt("continue", 45);
1364
+ case 16:
1309
1365
  defaulTitle = 'Untitle';
1310
1366
  props.projectActions.newProject();
1311
1367
  props.projectActions.rename(defaulTitle);
1312
- return _context1.abrupt("continue", 44);
1313
- case 16:
1368
+ return _context10.abrupt("continue", 45);
1369
+ case 17:
1314
1370
  _evt$payload5 = evt.payload, doorStyle = _evt$payload5.doorStyle, itemCDS = _evt$payload5.itemCDS, isAll = _evt$payload5.isAll; // prepare item data request
1315
1371
  _layerId = state.getIn(['scene', 'selectedLayer']);
1316
1372
  _cdsItems = [];
@@ -1320,8 +1376,8 @@ function _handleExternalEvent() {
1320
1376
  _loop4 = /*#__PURE__*/_regenerator["default"].mark(function _loop4() {
1321
1377
  var _itemCDS$find;
1322
1378
  var item, cdsId;
1323
- return _regenerator["default"].wrap(function (_context0) {
1324
- while (1) switch (_context0.prev = _context0.next) {
1379
+ return _regenerator["default"].wrap(function (_context1) {
1380
+ while (1) switch (_context1.prev = _context1.next) {
1325
1381
  case 0:
1326
1382
  item = allItems[_itemKeys[_i2]];
1327
1383
  cdsId = (_itemCDS$find = itemCDS.find(function (itCDS) {
@@ -1340,22 +1396,22 @@ function _handleExternalEvent() {
1340
1396
  });
1341
1397
  case 1:
1342
1398
  case "end":
1343
- return _context0.stop();
1399
+ return _context1.stop();
1344
1400
  }
1345
1401
  }, _loop4);
1346
1402
  });
1347
1403
  _i2 = 0;
1348
- case 17:
1404
+ case 18:
1349
1405
  if (!(_i2 < _itemKeys.length)) {
1350
- _context1.next = 19;
1406
+ _context10.next = 20;
1351
1407
  break;
1352
1408
  }
1353
- return _context1.delegateYield(_loop4(), "t1", 18);
1354
- case 18:
1409
+ return _context10.delegateYield(_loop4(), "t1", 19);
1410
+ case 19:
1355
1411
  _i2++;
1356
- _context1.next = 17;
1412
+ _context10.next = 18;
1357
1413
  break;
1358
- case 19:
1414
+ case 20:
1359
1415
  // request item catalog data to host app
1360
1416
  if (_cdsItems.length > 0) {
1361
1417
  (_props$onInternalEven2 = props.onInternalEvent) === null || _props$onInternalEven2 === void 0 || _props$onInternalEven2.call(props, {
@@ -1364,127 +1420,127 @@ function _handleExternalEvent() {
1364
1420
  cdsItems: _cdsItems
1365
1421
  }
1366
1422
  }, /*#__PURE__*/function () {
1367
- var _ref3 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee8(result) {
1423
+ var _ref4 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee9(result) {
1368
1424
  var _i3, _result$elements2;
1369
- return _regenerator["default"].wrap(function (_context9) {
1370
- while (1) switch (_context9.prev = _context9.next) {
1425
+ return _regenerator["default"].wrap(function (_context0) {
1426
+ while (1) switch (_context0.prev = _context0.next) {
1371
1427
  case 0:
1372
1428
  _i3 = 0;
1373
1429
  case 1:
1374
1430
  if (!(_i3 < (result === null || result === void 0 || (_result$elements2 = result.elements) === null || _result$elements2 === void 0 ? void 0 : _result$elements2.length))) {
1375
- _context9.next = 3;
1431
+ _context0.next = 3;
1376
1432
  break;
1377
1433
  }
1378
- _context9.next = 2;
1434
+ _context0.next = 2;
1379
1435
  return addItemToCatalog(result.elements[_i3], state, props.catalog, props.projectActions);
1380
1436
  case 2:
1381
1437
  _i3++;
1382
- _context9.next = 1;
1438
+ _context0.next = 1;
1383
1439
  break;
1384
1440
  case 3:
1385
1441
  props.itemsActions.setDoorStyle(doorStyle, itemCDS, isAll);
1386
1442
  case 4:
1387
1443
  case "end":
1388
- return _context9.stop();
1444
+ return _context0.stop();
1389
1445
  }
1390
- }, _callee8);
1446
+ }, _callee9);
1391
1447
  }));
1392
1448
  return function (_x12) {
1393
- return _ref3.apply(this, arguments);
1449
+ return _ref4.apply(this, arguments);
1394
1450
  };
1395
1451
  }());
1396
1452
  } else props.itemsActions.setDoorStyle(doorStyle, itemCDS, isAll);
1397
- return _context1.abrupt("continue", 44);
1398
- case 20:
1453
+ return _context10.abrupt("continue", 45);
1454
+ case 21:
1399
1455
  _evt$payload6 = evt.payload, roomShapeType = _evt$payload6.roomShapeType, width = _evt$payload6.width, height = _evt$payload6.height, _doorStyle = _evt$payload6.doorStyle;
1400
1456
  props.projectActions.createRoomWithShape(roomShapeType, width, height, _doorStyle);
1401
- return _context1.abrupt("continue", 44);
1402
- case 21:
1457
+ return _context10.abrupt("continue", 45);
1458
+ case 22:
1403
1459
  value = state.getIn(['viewer2D']).toJS();
1404
1460
  value.a += 0.1;
1405
1461
  value.d += 0.1;
1406
1462
  value.e -= value.SVGWidth * 0.1 / 2;
1407
1463
  value.f -= value.SVGHeight * 0.1 / 2;
1408
1464
  (0, _helper.updateViwer2D)(value, props.viewer2DActions);
1409
- return _context1.abrupt("continue", 44);
1410
- case 22:
1465
+ return _context10.abrupt("continue", 45);
1466
+ case 23:
1411
1467
  _value = state.getIn(['viewer2D']).toJS();
1412
1468
  _value.a -= 0.1;
1413
1469
  _value.d -= 0.1;
1414
1470
  _value.e += _value.SVGWidth * 0.1 / 2;
1415
1471
  _value.f += _value.SVGHeight * 0.1 / 2;
1416
1472
  (0, _helper.updateViwer2D)(_value, props.viewer2DActions);
1417
- return _context1.abrupt("continue", 44);
1418
- case 23:
1419
- (0, _helper.centering2D)(state, props.viewer2DActions);
1420
- return _context1.abrupt("continue", 44);
1473
+ return _context10.abrupt("continue", 45);
1421
1474
  case 24:
1422
- props.projectActions.undo();
1423
- return _context1.abrupt("continue", 44);
1475
+ (0, _helper.centering2D)(state, props.viewer2DActions);
1476
+ return _context10.abrupt("continue", 45);
1424
1477
  case 25:
1425
- props.projectActions.redo();
1426
- return _context1.abrupt("continue", 44);
1478
+ props.projectActions.undo();
1479
+ return _context10.abrupt("continue", 45);
1427
1480
  case 26:
1481
+ props.projectActions.redo();
1482
+ return _context10.abrupt("continue", 45);
1483
+ case 27:
1428
1484
  _evt$payload7 = evt.payload, moldingInfo = _evt$payload7.moldingInfo, isGlobal = _evt$payload7.isGlobal;
1429
- _context1.next = 27;
1485
+ _context10.next = 28;
1430
1486
  return loadMoldingSvg(moldingInfo);
1431
- case 27:
1432
- props.itemsActions.setMolding(moldingInfo, isGlobal);
1433
- return _context1.abrupt("continue", 44);
1434
1487
  case 28:
1488
+ props.itemsActions.setMolding(moldingInfo, isGlobal);
1489
+ return _context10.abrupt("continue", 45);
1490
+ case 29:
1435
1491
  distElement = getElement(evt.payload, state);
1436
1492
  if (distElement) props.itemsActions.duplicateSelected(distElement, props.onInternalEvent);
1437
- return _context1.abrupt("continue", 44);
1438
- case 29:
1493
+ return _context10.abrupt("continue", 45);
1494
+ case 30:
1439
1495
  _distElement = getElement(evt.payload, state);
1440
1496
  if (_distElement) props.projectActions.remove(_distElement);
1441
- return _context1.abrupt("continue", 44);
1442
- case 30:
1497
+ return _context10.abrupt("continue", 45);
1498
+ case 31:
1443
1499
  _evt$payload8 = evt.payload, option = _evt$payload8.option, _value2 = _evt$payload8.value;
1444
1500
  _t6 = option;
1445
- _context1.next = _t6 === _constants.PROJECT_SETTING_OPTION.CHANGE_MEASUREMENT_UNIT ? 31 : _t6 === _constants.PROJECT_SETTING_OPTION.UPDATE_CEIL_HEIGHT ? 32 : _t6 === _constants.PROJECT_SETTING_OPTION.CHANGE_WALL_LENGTH_MEASURE ? 33 : _t6 === _constants.PROJECT_SETTING_OPTION.CHANGE_BASE_CABINET_MEASURE ? 34 : _t6 === _constants.PROJECT_SETTING_OPTION.CHANGE_WALL_CABINET_MEASURE ? 35 : _t6 === _constants.PROJECT_SETTING_OPTION.CHANGE_WINDOW_DOOR_MEASURE ? 36 : 37;
1501
+ _context10.next = _t6 === _constants.PROJECT_SETTING_OPTION.CHANGE_MEASUREMENT_UNIT ? 32 : _t6 === _constants.PROJECT_SETTING_OPTION.UPDATE_CEIL_HEIGHT ? 33 : _t6 === _constants.PROJECT_SETTING_OPTION.CHANGE_WALL_LENGTH_MEASURE ? 34 : _t6 === _constants.PROJECT_SETTING_OPTION.CHANGE_BASE_CABINET_MEASURE ? 35 : _t6 === _constants.PROJECT_SETTING_OPTION.CHANGE_WALL_CABINET_MEASURE ? 36 : _t6 === _constants.PROJECT_SETTING_OPTION.CHANGE_WINDOW_DOOR_MEASURE ? 37 : 38;
1446
1502
  break;
1447
- case 31:
1503
+ case 32:
1448
1504
  props.viewer2DActions.updateCeilHeight((0, _convertUnitsLite.convert)(layer.ceilHeight).from(layer.unit).to(_value2));
1449
1505
  props.viewer2DActions.updateCeilHeightUnit(_value2);
1450
1506
  props.viewer3DActions.update3DCeilHeightUnit(_value2);
1451
1507
  props.viewer3DActions.update3DCeilHeight((0, _convertUnitsLite.convert)(layer.ceilHeight).from(layer.unit).to(_value2));
1452
- case 32:
1508
+ case 33:
1453
1509
  props.viewer2DActions.updateCeilHeight(_value2);
1454
1510
  props.viewer3DActions.update3DCeilHeight(_value2);
1455
- return _context1.abrupt("continue", 38);
1456
- case 33:
1457
- props.viewer2DActions.changeWallLengthMeasure(_value2);
1458
- return _context1.abrupt("continue", 38);
1511
+ return _context10.abrupt("continue", 39);
1459
1512
  case 34:
1460
- props.viewer2DActions.changeBaseCabinetMeasure(_value2);
1461
- return _context1.abrupt("continue", 38);
1513
+ props.viewer2DActions.changeWallLengthMeasure(_value2);
1514
+ return _context10.abrupt("continue", 39);
1462
1515
  case 35:
1463
- props.viewer2DActions.changeWallCabinetMeasure(_value2);
1464
- return _context1.abrupt("continue", 38);
1516
+ props.viewer2DActions.changeBaseCabinetMeasure(_value2);
1517
+ return _context10.abrupt("continue", 39);
1465
1518
  case 36:
1466
- props.viewer2DActions.changeWindowDoorMeasure(_value2);
1467
- return _context1.abrupt("continue", 38);
1519
+ props.viewer2DActions.changeWallCabinetMeasure(_value2);
1520
+ return _context10.abrupt("continue", 39);
1468
1521
  case 37:
1469
- return _context1.abrupt("continue", 38);
1522
+ props.viewer2DActions.changeWindowDoorMeasure(_value2);
1523
+ return _context10.abrupt("continue", 39);
1470
1524
  case 38:
1471
- return _context1.abrupt("continue", 44);
1525
+ return _context10.abrupt("continue", 39);
1472
1526
  case 39:
1527
+ return _context10.abrupt("continue", 45);
1528
+ case 40:
1473
1529
  _layerId2 = state.getIn(['scene', 'selectedLayer']);
1474
1530
  _layer = state.getIn(['scene', 'layers', _layerId2]);
1475
1531
  _layer$getIn = _layer.getIn(['selected']), selectedLines = _layer$getIn.lines, selectedHoles = _layer$getIn.holes, selectedItems = _layer$getIn.items;
1476
1532
  for (_i4 = 0; _i4 < selectedLines.size; _i4++) (evt === null || evt === void 0 ? void 0 : evt.type) === _constants.EXTERNAL_EVENT_UPDATE_ATTRIBUTE ? updateAttributeOfSelectedElement(_layer.getIn(['lines', selectedLines.get(_i4)]), evt.payload, state, _layer, props.catalog, props.projectActions, evt.callback) : updatePropertyOfSelectedElement(_layer.getIn(['lines', selectedLines.get(_i4)]), evt.payload, props.catalog, props.projectActions, evt.callback);
1477
1533
  for (_i5 = 0; _i5 < selectedHoles.size; _i5++) (evt === null || evt === void 0 ? void 0 : evt.type) === _constants.EXTERNAL_EVENT_UPDATE_ATTRIBUTE ? updateAttributeOfSelectedElement(_layer.getIn(['holes', selectedHoles.get(_i5)]), evt.payload, state, _layer, props.catalog, props.projectActions, evt.callback) : updatePropertyOfSelectedElement(_layer.getIn(['holes', selectedHoles.get(_i5)]), evt.payload, props.catalog, props.projectActions, evt.callback);
1478
1534
  for (_i6 = 0; _i6 < selectedItems.size; _i6++) (evt === null || evt === void 0 ? void 0 : evt.type) === _constants.EXTERNAL_EVENT_UPDATE_ATTRIBUTE ? updateAttributeOfSelectedElement(_layer.getIn(['items', selectedItems.get(_i6)]), evt.payload, state, _layer, props.catalog, props.projectActions, evt.callback) : updatePropertyOfSelectedElement(_layer.getIn(['items', selectedItems.get(_i6)]), evt.payload, props.catalog, props.projectActions, evt.callback);
1479
- return _context1.abrupt("continue", 44);
1480
- case 40:
1535
+ return _context10.abrupt("continue", 45);
1536
+ case 41:
1481
1537
  _layerID = state.scene.selectedLayer;
1482
1538
  _layer2 = state.scene.getIn(['layers', _layerID]).toJS();
1483
1539
  orginalItemInfo = evt === null || evt === void 0 || (_evt$payload9 = evt.payload) === null || _evt$payload9 === void 0 ? void 0 : _evt$payload9.orginalItemInfo;
1484
1540
  originalItem = _layer2 === null || _layer2 === void 0 ? void 0 : _layer2.items[orginalItemInfo.id];
1485
- _context1.next = 41;
1541
+ _context10.next = 42;
1486
1542
  return addItemToCatalog(evt.payload.replaceItemInfo, state, props.catalog, props.projectActions);
1487
- case 41:
1543
+ case 42:
1488
1544
  originalItemPos = {
1489
1545
  rotation: originalItem.rotation,
1490
1546
  selectedItemId: originalItem.id,
@@ -1499,11 +1555,11 @@ function _handleExternalEvent() {
1499
1555
  }
1500
1556
  };
1501
1557
  props.itemsActions.replaceItem(originalItemPos, originalItem, replaceItem);
1502
- return _context1.abrupt("continue", 44);
1503
- case 42:
1504
- setFinishing(props, state, evt.payload);
1505
- return _context1.abrupt("continue", 44);
1558
+ return _context10.abrupt("continue", 45);
1506
1559
  case 43:
1560
+ setFinishing(props, state, evt.payload);
1561
+ return _context10.abrupt("continue", 45);
1562
+ case 44:
1507
1563
  sceneData = state.scene.toJS(); // get molding data for "ReviewForQuote"
1508
1564
  currentTexture = layer.doorStyle !== null || layer.doorStyle !== undefined ? layer.doorStyle : props.state.doorStyle.toJS();
1509
1565
  sceneData.layers[layerId].moldingData = (0, _molding.getMoldingDataOfScene2)(layer, props.catalog, currentTexture);
@@ -1514,12 +1570,12 @@ function _handleExternalEvent() {
1514
1570
  scene: sceneData
1515
1571
  }
1516
1572
  });
1517
- return _context1.abrupt("continue", 44);
1518
- case 44:
1573
+ return _context10.abrupt("continue", 45);
1574
+ case 45:
1519
1575
  case "end":
1520
- return _context1.stop();
1576
+ return _context10.stop();
1521
1577
  }
1522
- }, _callee9);
1578
+ }, _callee0);
1523
1579
  }));
1524
1580
  return _handleExternalEvent.apply(this, arguments);
1525
1581
  }