kitchen-simulator 4.3.9 → 4.4.1

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.
@@ -17,6 +17,7 @@ import { SVGLoader } from 'three/addons/loaders/SVGLoader';
17
17
  import { getMoldingDataOfScene2 } from "./molding";
18
18
  import { Scene, State } from "../models";
19
19
  import { calcDistancesFromHoleToNearestOneOrWall } from "./geometry";
20
+ import { computeSkinPanels } from "./skinPanelEngine";
20
21
  var PRECISION = 2;
21
22
 
22
23
  // ---- compatibility: supports old + optimized props shapes ----
@@ -39,7 +40,7 @@ var __svgCache = new Map(); // url -> Promise<svgData|null>
39
40
  function loadJSON(_x) {
40
41
  return _loadJSON.apply(this, arguments);
41
42
  }
42
- /********Parse TempPlaceholder from cabinetPayloadData **************/
43
+ /***** Update cabinetPayloadData with updatedTempPlaceholders *****/
43
44
  function _loadJSON() {
44
45
  _loadJSON = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(path) {
45
46
  var p;
@@ -78,407 +79,27 @@ function _loadJSON() {
78
79
  }));
79
80
  return _loadJSON.apply(this, arguments);
80
81
  }
81
- function parseTempPlaceholdersFromCabinetPayload(_x2) {
82
- return _parseTempPlaceholdersFromCabinetPayload.apply(this, arguments);
83
- }
84
- /***** Update cabinetPayloadData with updatedTempPlaceholders *****/
85
- function _parseTempPlaceholdersFromCabinetPayload() {
86
- _parseTempPlaceholdersFromCabinetPayload = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4(cabinetPayload) {
87
- var link, keys, temp, i, _cabinetPayload$struc, _cabinetPayload$struc2, tempPlaceholdersData, _loop3, tempData, doorKey, drawerKey, fixedKey, doorPHs, drawerPHs, has_single_door, fixedPHs, k, _cabinetPayload$struc3, _t2, _t3, _t4;
88
- return _regeneratorRuntime.wrap(function (_context5) {
89
- while (1) switch (_context5.prev = _context5.next) {
90
- case 0:
91
- link = '';
92
- keys = Object.keys(cabinetPayload.structure_json);
93
- temp = [];
94
- i = 0;
95
- case 1:
96
- if (!(i < keys.length)) {
97
- _context5.next = 4;
98
- break;
99
- }
100
- 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'))) {
101
- _context5.next = 3;
102
- break;
103
- }
104
- link = cabinetPayload.structure_json[keys[i]];
105
- _t2 = temp;
106
- _t3 = keys[i];
107
- _context5.next = 2;
108
- return loadJSON(link);
109
- case 2:
110
- _t4 = _context5.sent;
111
- _t2.push.call(_t2, {
112
- name: _t3,
113
- data: _t4
114
- });
115
- case 3:
116
- i++;
117
- _context5.next = 1;
118
- break;
119
- case 4:
120
- tempPlaceholdersData = [];
121
- _loop3 = /*#__PURE__*/_regeneratorRuntime.mark(function _loop3(k) {
122
- var el;
123
- return _regeneratorRuntime.wrap(function (_context4) {
124
- while (1) switch (_context4.prev = _context4.next) {
125
- case 0:
126
- el = cabinetPayload.structure_json.tempPlaceholders[k].id;
127
- tempData = {};
128
- doorKey = 0;
129
- drawerKey = 0;
130
- fixedKey = 0;
131
- doorPHs = 0;
132
- drawerPHs = 0;
133
- has_single_door = false;
134
- fixedPHs = 0;
135
- temp.forEach(function (t, index) {
136
- var nodes = t.data.nodes;
137
- if (nodes === undefined) {
138
- nodes = [];
139
- }
140
- var tempPlaceholders = nodes.filter(function (element) {
141
- return element.name.startsWith('ph_');
142
- });
143
- tempPlaceholders.sort(function (a, b) {
144
- return a.name > b.name ? 1 : -1;
145
- });
146
- if (tempPlaceholders.length > 0) {
147
- if (t.name === 'base') {
148
- tempPlaceholders.map(function (element) {
149
- var sink_match = element.name.match(/\d_(sink_[^LR12]*)(_[LR12])?$/);
150
- if (sink_match && sink_match.length >= 2) {
151
- var _process$env$API_URL, _cabinetPayload$struc4;
152
- tempData['sink'] = tempData['sink'] || [];
153
- tempData['sink'].push(element.name);
154
- var sink_url = (_process$env$API_URL = process.env.API_URL) !== null && _process$env$API_URL !== void 0 ? _process$env$API_URL :
155
- // server url from 3DTool env
156
- import.meta.env.VITE_APP_API_URL + // server url from Host env
157
- "/uploads/assets/default/".concat(sink_match[1], ".gltf");
158
- if (cabinetPayload !== null && cabinetPayload !== void 0 && (_cabinetPayload$struc4 = cabinetPayload.structure_json) !== null && _cabinetPayload$struc4 !== void 0 && (_cabinetPayload$struc4 = _cabinetPayload$struc4.tempPlaceholders[k]) !== null && _cabinetPayload$struc4 !== void 0 && _cabinetPayload$struc4.structure) cabinetPayload.structure_json.tempPlaceholders[k].structure.sink = sink_url;
159
- } else if (temp.some(function (felement) {
160
- return felement.name.includes('base_drawer');
161
- }) && element.name.includes('interior_drawer')) {
162
- var objCnt = temp.filter(function (felement) {
163
- return felement.name.includes('base_drawer') && !felement.name.includes('_door');
164
- }).length;
165
- var phCnt = tempPlaceholders.filter(function (felement) {
166
- return felement.name.includes('interior');
167
- }).length;
168
- drawerPHs = phCnt;
169
- if (objCnt === 1 || phCnt % objCnt !== 0) {
170
- if (tempData['base_drawer_1'] === undefined) {
171
- tempData['base_drawer_1'] = [];
172
- }
173
- tempData['base_drawer_1'].push(element.name);
174
- drawerKey++;
175
- } else if (objCnt > 1 && phCnt % objCnt === 0) {
176
- if (tempData['base_drawer_' + (drawerKey % objCnt + 1)] === undefined) {
177
- tempData['base_drawer_' + (drawerKey % objCnt + 1)] = [];
178
- }
179
- tempData['base_drawer_' + (drawerKey % objCnt + 1)].push(element.name);
180
- drawerKey++;
181
- }
182
- } else if (temp.some(function (felement) {
183
- return felement.name.includes('base_door');
184
- }) && !element.name.includes('interior_drawer') && !element.name.includes('drawer') && element.name.includes('door')) {
185
- var _objCnt = temp.filter(function (felement) {
186
- return felement.name.includes('base_door');
187
- }).length;
188
- var _phCnt = tempPlaceholders.filter(function (felement) {
189
- return !felement.name.includes('interior') && !felement.name.includes('drawer') && felement.name.includes('door');
190
- }).length;
191
- doorPHs = _phCnt;
192
- if (_objCnt === 1 || _phCnt % _objCnt !== 0) {
193
- if (tempData['base_door_1'] === undefined) {
194
- tempData['base_door_1'] = [];
195
- }
196
- tempData['base_door_1'].push(element.name);
197
- doorKey++;
198
- } else if (_objCnt > 1) {
199
- if (tempData['base_door_' + (doorKey % _objCnt + 1)] === undefined) {
200
- tempData['base_door_' + (doorKey % _objCnt + 1)] = [];
201
- }
202
- tempData['base_door_' + (doorKey % _objCnt + 1)].push(element.name);
203
- doorKey++;
204
- }
205
- } else if (temp.some(function (felement) {
206
- return felement.name.includes('base_fixed_drawer_door');
207
- }) && element.name.includes('_drawer_door_fixed')) {
208
- var _objCnt2 = temp.filter(function (felement) {
209
- return felement.name.includes('base_fixed_drawer_door');
210
- }).length;
211
- var _phCnt2 = tempPlaceholders.filter(function (felement) {
212
- return felement.name.includes('_drawer_door_fixed');
213
- }).length;
214
- fixedPHs = _phCnt2;
215
- if (_objCnt2 === 1 || _phCnt2 % _objCnt2 !== 0) {
216
- if (tempData['base_fixed_drawer_door_1'] === undefined) {
217
- tempData['base_fixed_drawer_door_1'] = [];
218
- }
219
- tempData['base_fixed_drawer_door_1'].push(element.name);
220
- fixedKey++;
221
- } else if (_objCnt2 > 1) {
222
- if (tempData['base_fixed_drawer_door_' + (fixedKey % _objCnt2 + 1)] === undefined) {
223
- tempData['base_fixed_drawer_door_' + (fixedKey % _objCnt2 + 1)] = [];
224
- }
225
- tempData['base_fixed_drawer_door_' + (fixedKey % _objCnt2 + 1)].push(element.name);
226
- fixedKey++;
227
- }
228
- }
229
- });
230
- } else if (t.name.includes('base_drawer') && !t.name.includes('_door')) {
231
- var objCnt = temp.filter(function (felement) {
232
- return felement.name.includes('base_drawer') && !felement.name.includes('_door');
233
- }).length;
234
- if (objCnt === 1 || drawerPHs % objCnt !== 0) {
235
- if (tempData['base_drawer_door_1'] === undefined) tempData['base_drawer_door_1'] = [];
236
- //get drawer door handle placeholders
237
- var ph_temp = temp.find(function (felement) {
238
- return felement.name === 'base_drawer_door_1';
239
- });
240
- if (ph_temp != undefined) {
241
- var ph_drawer_door_handle = ph_temp.data.nodes;
242
- ph_drawer_door_handle = ph_drawer_door_handle.filter(function (element) {
243
- return element.name.startsWith('ph_') && element.name.includes('handle');
244
- });
245
- for (var w = 0; w < drawerPHs; w++) {
246
- if (!tempData['base_drawer_door_1'].some(function (el) {
247
- return el === 'base_drawer_door_1/' + tempPlaceholders[0].name;
248
- })) {
249
- tempData['base_drawer_door_1'].push('base_drawer_1/' + tempPlaceholders[0].name);
250
- //add drawer door handle placeholders
251
- if (tempData['drawer_door_handle_1'] === undefined) tempData['drawer_door_handle_1'] = [];
252
- if (ph_drawer_door_handle.length > 0) tempData['drawer_door_handle_1'].push('base_drawer_door_1/' + ph_drawer_door_handle[0].name);
253
- }
254
- }
255
- }
256
- } else if (objCnt > 1 && drawerPHs > 0 && drawerPHs % objCnt === 0) {
257
- if (tempData['base_drawer_door' + t.name.slice(-2)] === undefined) tempData['base_drawer_door' + t.name.slice(-2)] = [];
258
- //get drawer door handle placeholders
259
- var ph_temp = temp.find(function (felement) {
260
- return felement.name === 'base_drawer_door' + t.name.slice(-2);
261
- });
262
- if (ph_temp != undefined) {
263
- var ph_drawer_door_handle = ph_temp.data.nodes;
264
- ph_drawer_door_handle = ph_drawer_door_handle.filter(function (element) {
265
- return element.name.startsWith('ph_') && element.name.includes('handle');
266
- });
267
- tempPlaceholders.forEach(function (element) {
268
- if (!tempData['base_drawer_door' + t.name.slice(-2)].some(function (el) {
269
- return el === t.name + '/' + element.name;
270
- })) {
271
- tempData['base_drawer_door' + t.name.slice(-2)].push(t.name + '/' + element.name);
272
- //add drawer door handle placeholders
273
- if (tempData['drawer_door_handle' + t.name.slice(-2)] === undefined) tempData['drawer_door_handle' + t.name.slice(-2)] = [];
274
- if (ph_drawer_door_handle.length > 0) tempData['drawer_door_handle' + t.name.slice(-2)].push('base_drawer_door' + t.name.slice(-2) + '/' + ph_drawer_door_handle[0].name);
275
- }
276
- });
277
- }
278
- }
279
- } else if (t.name.includes('base_door')) {
280
- var _objCnt3 = temp.filter(function (felement) {
281
- return felement.name.includes('base_door');
282
- }).length;
283
- tempPlaceholders = tempPlaceholders.filter(function (el) {
284
- return el.name.includes('handle');
285
- });
286
- if (tempPlaceholders.length > 0) if (_objCnt3 === 1 || doorPHs % _objCnt3 !== 0) {
287
- if (tempData['door_handle_1'] === undefined) {
288
- tempData['door_handle_1'] = [];
289
- }
290
- var _loop4 = function _loop4() {
291
- var phname = tempPlaceholders[0].name;
292
- var newph = undefined;
293
- if (tempData['base_door_1'][_w].isLeftPlaceholder()) {
294
- newph = tempPlaceholders.find(function (el) {
295
- return el.name.isRightPlaceholder();
296
- });
297
- }
298
- if (tempData['base_door_1'][_w].isRightPlaceholder()) {
299
- newph = tempPlaceholders.find(function (el) {
300
- return el.name.isLeftPlaceholder();
301
- });
302
- }
303
- if (newph != undefined) {
304
- phname = newph.name;
305
- }
306
- if (doorPHs === 1 && tempPlaceholders.find(function (el) {
307
- return el.name.isLeftPlaceholder();
308
- }) != undefined && tempPlaceholders.find(function (el) {
309
- return el.name.isRightPlaceholder();
310
- }) != undefined) {
311
- has_single_door = true;
312
- }
313
- if (!tempData['door_handle_1'].some(function (el) {
314
- return el === 'door_handle_1/' + phname;
315
- })) {
316
- tempData['door_handle_1'].push('base_door_1/' + phname);
317
- }
318
- };
319
- for (var _w = 0; _w < doorPHs; _w++) {
320
- _loop4();
321
- }
322
- } else if (_objCnt3 > 1 && doorPHs > 0 && doorPHs % _objCnt3 === 0) {
323
- if (tempData['door_handle' + t.name.slice(-2)] === undefined) tempData['door_handle' + t.name.slice(-2)] = [];
324
- var phname = tempPlaceholders[0].name;
325
- var newph = undefined;
326
- var blAdd = true;
327
- if (cabinetPayload.is_corner) {
328
- if (tempData['base_door' + t.name.slice(-2)][0].isLeftPlaceholder()) {
329
- newph = tempPlaceholders.find(function (el) {
330
- return el.name.isLeftPlaceholder();
331
- });
332
- } else {
333
- blAdd = false;
334
- }
335
- } else {
336
- if (tempData['base_door' + t.name.slice(-2)][0].isLeftPlaceholder()) {
337
- newph = tempPlaceholders.find(function (el) {
338
- return el.name.isRightPlaceholder();
339
- });
340
- }
341
- if (tempData['base_door' + t.name.slice(-2)][0].isRightPlaceholder()) {
342
- newph = tempPlaceholders.find(function (el) {
343
- return el.name.isLeftPlaceholder();
344
- });
345
- }
346
- }
347
- if (blAdd) {
348
- if (newph != undefined) {
349
- phname = newph.name;
350
- }
351
- if (!tempData['door_handle' + t.name.slice(-2)].some(function (el) {
352
- return el === t.name + '/' + phname;
353
- })) {
354
- tempData['door_handle' + t.name.slice(-2)].push(t.name + '/' + phname);
355
- }
356
- }
357
- }
358
- } else if (t.name.includes('base_fixed_drawer_door')) {
359
- var _objCnt4 = temp.filter(function (felement) {
360
- return felement.name.includes('base_fixed_drawer_door');
361
- }).length;
362
- tempPlaceholders = tempPlaceholders.filter(function (el) {
363
- return el.name.includes('handle');
364
- });
365
- if (tempPlaceholders.length > 0) if (_objCnt4 === 1 || fixedPHs % _objCnt4 !== 0) {
366
- if (tempData['fixed_drawer_door_handle_1'] === undefined) tempData['fixed_drawer_door_handle_1'] = [];
367
- var _loop5 = function _loop5() {
368
- var phname = tempPlaceholders[0].name;
369
- var newph = undefined;
370
- if (tempData['base_fixed_drawer_door_1'][_w2].isLeftPlaceholder()) {
371
- newph = tempPlaceholders.find(function (el) {
372
- return el.name.isRightPlaceholder();
373
- });
374
- }
375
- if (tempData['base_fixed_drawer_door_1'][_w2].isRightPlaceholder()) {
376
- newph = tempPlaceholders.find(function (el) {
377
- return el.name.isLeftPlaceholder();
378
- });
379
- }
380
- if (newph != undefined) {
381
- phname = newph.name;
382
- }
383
- if (!tempData['fixed_drawer_door_handle_1'].some(function (el) {
384
- return el === 'fixed_drawer_door_handle_1/' + phname;
385
- })) {
386
- tempData['fixed_drawer_door_handle_1'].push('base_fixed_drawer_door_1/' + phname);
387
- }
388
- };
389
- for (var _w2 = 0; _w2 < fixedPHs; _w2++) {
390
- _loop5();
391
- }
392
- } else if (_objCnt4 > 1 && fixedPHs > 0 && fixedPHs % _objCnt4 === 0) {
393
- if (tempData['fixed_drawer_door_handle' + t.name.slice(-2)] === undefined) {
394
- tempData['fixed_drawer_door_handle' + t.name.slice(-2)] = [];
395
- }
396
- var _phname = tempPlaceholders[0].name;
397
- var _newph = undefined;
398
- if (tempData['base_fixed_drawer_door' + t.name.slice(-2)][0].isLeftPlaceholder()) {
399
- _newph = tempPlaceholders.find(function (el) {
400
- return el.name.isRightPlaceholder();
401
- });
402
- }
403
- if (tempData['base_fixed_drawer_door' + t.name.slice(-2)][0].isRightPlaceholder()) {
404
- _newph = tempPlaceholders.find(function (el) {
405
- return el.name.isLeftPlaceholder();
406
- });
407
- }
408
- if (_newph != undefined) {
409
- _phname = _newph.name;
410
- }
411
- if (!tempData['fixed_drawer_door_handle' + t.name.slice(-2)].some(function (el) {
412
- return el === t.name + '/' + _phname;
413
- })) {
414
- tempData['fixed_drawer_door_handle' + t.name.slice(-2)].push(t.name + '/' + _phname);
415
- }
416
- }
417
- }
418
- }
419
- });
420
- tempPlaceholdersData.push({
421
- id: parseInt(el, 10),
422
- placeholders: tempData,
423
- structure: cabinetPayload.structure_json.tempPlaceholders[k].structure
424
- });
425
- case 1:
426
- case "end":
427
- return _context4.stop();
428
- }
429
- }, _loop3);
430
- });
431
- k = 0;
432
- case 5:
433
- if (!(k < (cabinetPayload === null || cabinetPayload === void 0 || (_cabinetPayload$struc3 = cabinetPayload.structure_json) === null || _cabinetPayload$struc3 === void 0 || (_cabinetPayload$struc3 = _cabinetPayload$struc3.tempPlaceholders) === null || _cabinetPayload$struc3 === void 0 ? void 0 : _cabinetPayload$struc3.length))) {
434
- _context5.next = 7;
435
- break;
436
- }
437
- return _context5.delegateYield(_loop3(k), "t0", 6);
438
- case 6:
439
- k++;
440
- _context5.next = 5;
441
- break;
442
- case 7:
443
- return _context5.abrupt("return", tempPlaceholdersData);
444
- case 8:
445
- case "end":
446
- return _context5.stop();
447
- }
448
- }, _callee4);
449
- }));
450
- return _parseTempPlaceholdersFromCabinetPayload.apply(this, arguments);
451
- }
452
- function updateCabinetPayload(_x3) {
82
+ function updateCabinetPayload(_x2) {
453
83
  return _updateCabinetPayload.apply(this, arguments);
454
84
  }
455
85
  function _updateCabinetPayload() {
456
- _updateCabinetPayload = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5(cabinetPayload) {
86
+ _updateCabinetPayload = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4(cabinetPayload) {
457
87
  var cabinetPayloadKeys, i, _cabinetPayload$cabin, _cabinetPayload$cabin2;
458
- return _regeneratorRuntime.wrap(function (_context6) {
459
- while (1) switch (_context6.prev = _context6.next) {
88
+ return _regeneratorRuntime.wrap(function (_context4) {
89
+ while (1) switch (_context4.prev = _context4.next) {
460
90
  case 0:
461
- // let tempPlaceholders = [];
462
- // tempPlaceholders = await parseTempPlaceholdersFromCabinetPayload(
463
- // cabinetPayload
464
- // );
465
91
  cabinetPayloadKeys = Object.keys(cabinetPayload);
466
92
  for (i = 0; i < cabinetPayloadKeys.length; i++) {
467
93
  if (cabinetPayloadKeys[i] === 'structure_json') {
468
94
  cabinetPayload[cabinetPayloadKeys[i]]['placeholders'] = (_cabinetPayload$cabin = (_cabinetPayload$cabin2 = cabinetPayload[cabinetPayloadKeys[i]]['tempPlaceholders'][0]) === null || _cabinetPayload$cabin2 === void 0 ? void 0 : _cabinetPayload$cabin2.placeholders) !== null && _cabinetPayload$cabin !== void 0 ? _cabinetPayload$cabin : [];
469
-
470
- // cabinetPayload[cabinetPayloadKeys[i]]['placeholders'] =
471
- // tempPlaceholders[0].placeholders;
472
- // cabinetPayload[cabinetPayloadKeys[i]]['tempPlaceholders'] =
473
- // tempPlaceholders;
474
95
  }
475
96
  }
476
- return _context6.abrupt("return", cabinetPayload);
97
+ return _context4.abrupt("return", cabinetPayload);
477
98
  case 1:
478
99
  case "end":
479
- return _context6.stop();
100
+ return _context4.stop();
480
101
  }
481
- }, _callee5);
102
+ }, _callee4);
482
103
  }));
483
104
  return _updateCabinetPayload.apply(this, arguments);
484
105
  }
@@ -550,34 +171,34 @@ var loadSVGsByItem = /*#__PURE__*/function () {
550
171
  }
551
172
  }, _callee2);
552
173
  }));
553
- return function loadSVGsByItem(_x4) {
174
+ return function loadSVGsByItem(_x3) {
554
175
  return _ref.apply(this, arguments);
555
176
  };
556
177
  }();
557
- function addItemToCatalog(_x5, _x6, _x7, _x8) {
178
+ function addItemToCatalog(_x4, _x5, _x6, _x7) {
558
179
  return _addItemToCatalog.apply(this, arguments);
559
180
  } // Get attributs of current selected element
560
181
  function _addItemToCatalog() {
561
- _addItemToCatalog = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee6(element, state, catalogInstance, projectActions) {
182
+ _addItemToCatalog = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5(element, state, catalogInstance, projectActions) {
562
183
  var _elementJs, _elementJs3;
563
184
  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;
564
- return _regeneratorRuntime.wrap(function (_context7) {
565
- while (1) switch (_context7.prev = _context7.next) {
185
+ return _regeneratorRuntime.wrap(function (_context5) {
186
+ while (1) switch (_context5.prev = _context5.next) {
566
187
  case 0:
567
188
  if (!isEmpty(element === null || element === void 0 ? void 0 : element.name)) {
568
- _context7.next = 1;
189
+ _context5.next = 1;
569
190
  break;
570
191
  }
571
- return _context7.abrupt("return");
192
+ return _context5.abrupt("return");
572
193
  case 1:
573
194
  // clone element
574
195
  elementJs = Object.assign({}, element); // if (isEmpty(catalog?.elements[element.name])) {
575
- _context7.next = 2;
196
+ _context5.next = 2;
576
197
  return loadSVGsByItem(elementJs);
577
198
  case 2:
578
- outlineSVGData = _context7.sent;
199
+ outlineSVGData = _context5.sent;
579
200
  if (!(((_elementJs = elementJs) === null || _elementJs === void 0 ? void 0 : _elementJs.type) === 'cabinet')) {
580
- _context7.next = 4;
201
+ _context5.next = 4;
581
202
  break;
582
203
  }
583
204
  // move the tempPlaceholder of current door style to first of tempPlaceholders array
@@ -605,13 +226,13 @@ function _addItemToCatalog() {
605
226
  }
606
227
  });
607
228
  if (isEmpty((_elementJs$structure_3 = elementJs.structure_json) === null || _elementJs$structure_3 === void 0 ? void 0 : _elementJs$structure_3.tempPlaceholders)) {
608
- _context7.next = 4;
229
+ _context5.next = 4;
609
230
  break;
610
231
  }
611
- _context7.next = 3;
232
+ _context5.next = 3;
612
233
  return updateCabinetPayload(elementJs);
613
234
  case 3:
614
- elementJs = _context7.sent;
235
+ elementJs = _context5.sent;
615
236
  case 4:
616
237
  elementJs = _objectSpread(_objectSpread({}, elementJs), {}, {
617
238
  outlineSVGData: outlineSVGData,
@@ -628,18 +249,18 @@ function _addItemToCatalog() {
628
249
  k = 0;
629
250
  case 5:
630
251
  if (!(k < catalogElementKeys.length)) {
631
- _context7.next = 7;
252
+ _context5.next = 7;
632
253
  break;
633
254
  }
634
255
  if (!(((_catalogElements$cata = catalogElements[catalogElementKeys[k]]) === null || _catalogElements$cata === void 0 ? void 0 : _catalogElements$cata.itemID) === elementJs.itemID)) {
635
- _context7.next = 6;
256
+ _context5.next = 6;
636
257
  break;
637
258
  }
638
259
  catalogItem = catalogElements[catalogElementKeys[k]];
639
- return _context7.abrupt("continue", 7);
260
+ return _context5.abrupt("continue", 7);
640
261
  case 6:
641
262
  k++;
642
- _context7.next = 5;
263
+ _context5.next = 5;
643
264
  break;
644
265
  case 7:
645
266
  // get old tempPlaceholder array from catalog item
@@ -670,9 +291,9 @@ function _addItemToCatalog() {
670
291
  }
671
292
  case 8:
672
293
  case "end":
673
- return _context7.stop();
294
+ return _context5.stop();
674
295
  }
675
- }, _callee6);
296
+ }, _callee5);
676
297
  }));
677
298
  return _addItemToCatalog.apply(this, arguments);
678
299
  }
@@ -1032,15 +653,15 @@ function getElement(objProps, state) {
1032
653
  }
1033
654
  return curObject;
1034
655
  }
1035
- function loadMoldingSvg(_x9) {
656
+ function loadMoldingSvg(_x8) {
1036
657
  return _loadMoldingSvg.apply(this, arguments);
1037
658
  }
1038
659
  function _loadMoldingSvg() {
1039
- _loadMoldingSvg = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee7(molding) {
1040
- return _regeneratorRuntime.wrap(function (_context8) {
1041
- while (1) switch (_context8.prev = _context8.next) {
660
+ _loadMoldingSvg = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee6(molding) {
661
+ return _regeneratorRuntime.wrap(function (_context6) {
662
+ while (1) switch (_context6.prev = _context6.next) {
1042
663
  case 0:
1043
- return _context8.abrupt("return", new Promise(function (resolve, reject) {
664
+ return _context6.abrupt("return", new Promise(function (resolve, reject) {
1044
665
  var url = molding === null || molding === void 0 ? void 0 : molding.shape_svg;
1045
666
  if (!url) {
1046
667
  // Skip if no SVG URL available
@@ -1062,9 +683,9 @@ function _loadMoldingSvg() {
1062
683
  }));
1063
684
  case 1:
1064
685
  case "end":
1065
- return _context8.stop();
686
+ return _context6.stop();
1066
687
  }
1067
- }, _callee7);
688
+ }, _callee6);
1068
689
  }));
1069
690
  return _loadMoldingSvg.apply(this, arguments);
1070
691
  }
@@ -1205,43 +826,43 @@ function mergeSameElements(projectItemsCatalog) {
1205
826
  }
1206
827
  return result;
1207
828
  }
1208
- export function handleExternalEvent(_x0) {
829
+ export function handleExternalEvent(_x9) {
1209
830
  return _handleExternalEvent.apply(this, arguments);
1210
831
  }
1211
832
  function _handleExternalEvent() {
1212
- _handleExternalEvent = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee0(props) {
833
+ _handleExternalEvent = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee9(props) {
1213
834
  var _evt$payload3, _evt$payload4;
1214
- var evt, state, layerId, layer, _evt$payload, _state$catalog, cdsItems, itemKeys, _loop6, i, newScene, tempState, _props$onInternalEven, sLineCnt, element, _state$viewer2D, _evt$payload$initialP, mouseX, mouseY, v2d, vPosX, vPosY, layerID, defaulTitle, _evt$payload5, doorStyle, itemCDS, applyScope, _evt$payload5$itemIds, itemIds, _layerId, allItems, targetItems, idSet, selectedItemIds, _cdsItems, _loop7, _i2, _props$onInternalEven2, _evt$payload6, roomShapeType, width, height, measurementUnit, _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, _t7;
1215
- return _regeneratorRuntime.wrap(function (_context11) {
1216
- while (1) switch (_context11.prev = _context11.next) {
835
+ var evt, state, layerId, layer, _evt$payload, _state$catalog, cdsItems, itemKeys, _loop3, i, newScene, tempState, _props$onInternalEven, sLineCnt, element, _state$viewer2D, _evt$payload$initialP, mouseX, mouseY, v2d, vPosX, vPosY, layerID, defaulTitle, _evt$payload5, doorStyle, itemCDS, applyScope, _evt$payload5$itemIds, itemIds, _layerId, allItems, targetItems, idSet, selectedItemIds, _cdsItems, _loop4, _i2, _props$onInternalEven2, _evt$payload6, roomShapeType, width, height, measurementUnit, _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, _t2, _t3, _t4;
836
+ return _regeneratorRuntime.wrap(function (_context1) {
837
+ while (1) switch (_context1.prev = _context1.next) {
1217
838
  case 0:
1218
839
  // console.log('***external event****', props.externalEvent);
1219
840
  evt = props.externalEvent;
1220
841
  state = getPlannerStateFromProps(props);
1221
842
  if (state) {
1222
- _context11.next = 1;
843
+ _context1.next = 1;
1223
844
  break;
1224
845
  }
1225
- return _context11.abrupt("return");
846
+ return _context1.abrupt("return");
1226
847
  case 1:
1227
848
  layerId = state.getIn(['scene', 'selectedLayer']);
1228
849
  layer = state.getIn(['scene', 'layers', layerId]);
1229
- _t5 = evt === null || evt === void 0 ? void 0 : evt.type;
1230
- _context11.next = _t5 === EXTERNAL_EVENT_LOAD_PROJECT ? 2 : _t5 === EXTERNAL_EVENT_TOGGLE_TO_3D ? 7 : _t5 === EXTERNAL_EVENT_TOGGLE_TO_2D ? 8 : _t5 === EXTERNAL_EVENT_TOGGLE_TO_ELEVATION ? 9 : _t5 === EXTERNAL_EVENT_ADD_WALL ? 10 : _t5 === EXTERNAL_EVENT_ADD_ITEM ? 11 : _t5 === EXTERNAL_EVENT_ADD_HOLE ? 14 : _t5 === EXTERNAL_EVENT_ROTATE_PAN ? 15 : _t5 === EXTERNAL_EVENT_MOVE_PAN ? 15 : _t5 === EXTERNAL_EVENT_NEW_PROJECT ? 16 : _t5 === EXTERNAL_EVENT_CHANGE_DOORSTYLE ? 17 : _t5 === EXTERNAL_EVENT_ADD_ROOM_SHAPE ? 25 : _t5 === EXTERNAL_EVENT_ZOOM_IN ? 26 : _t5 === EXTERNAL_EVENT_ZOOM_OUT ? 27 : _t5 === EXTERNAL_EVENT_CENTERING_2D ? 28 : _t5 === EXTERNAL_EVENT_UNDO ? 29 : _t5 === EXTERNAL_EVENT_REDO ? 30 : _t5 === EXTERNAL_EVENT_SET_MOLDING ? 31 : _t5 === EXTERNAL_EVENT_DUPLICATE_ELEMENT ? 33 : _t5 === EXTERNAL_EVENT_DELETE_ELEMENT ? 34 : _t5 === EXTERNAL_EVENT_PROJECT_SETTING ? 35 : _t5 === EXTERNAL_EVENT_UPDATE_ATTRIBUTE ? 44 : _t5 === EXTERNAL_EVENT_UPDATE_PROPERTY ? 44 : _t5 === EXTERNAL_EVENT_REPLACE_CABINET ? 45 : _t5 === EXTERNAL_EVENT_SET_FINISHING ? 47 : _t5 === EXTERNAL_EVENT_SYNC_SCENE ? 48 : 49;
850
+ _t2 = evt === null || evt === void 0 ? void 0 : evt.type;
851
+ _context1.next = _t2 === EXTERNAL_EVENT_LOAD_PROJECT ? 2 : _t2 === EXTERNAL_EVENT_TOGGLE_TO_3D ? 7 : _t2 === EXTERNAL_EVENT_TOGGLE_TO_2D ? 8 : _t2 === EXTERNAL_EVENT_TOGGLE_TO_ELEVATION ? 9 : _t2 === EXTERNAL_EVENT_ADD_WALL ? 10 : _t2 === EXTERNAL_EVENT_ADD_ITEM ? 11 : _t2 === EXTERNAL_EVENT_ADD_HOLE ? 14 : _t2 === EXTERNAL_EVENT_ROTATE_PAN ? 15 : _t2 === EXTERNAL_EVENT_MOVE_PAN ? 15 : _t2 === EXTERNAL_EVENT_NEW_PROJECT ? 16 : _t2 === EXTERNAL_EVENT_CHANGE_DOORSTYLE ? 17 : _t2 === EXTERNAL_EVENT_ADD_ROOM_SHAPE ? 25 : _t2 === EXTERNAL_EVENT_ZOOM_IN ? 26 : _t2 === EXTERNAL_EVENT_ZOOM_OUT ? 27 : _t2 === EXTERNAL_EVENT_CENTERING_2D ? 28 : _t2 === EXTERNAL_EVENT_UNDO ? 29 : _t2 === EXTERNAL_EVENT_REDO ? 30 : _t2 === EXTERNAL_EVENT_SET_MOLDING ? 31 : _t2 === EXTERNAL_EVENT_DUPLICATE_ELEMENT ? 33 : _t2 === EXTERNAL_EVENT_DELETE_ELEMENT ? 34 : _t2 === EXTERNAL_EVENT_PROJECT_SETTING ? 35 : _t2 === EXTERNAL_EVENT_UPDATE_ATTRIBUTE ? 44 : _t2 === EXTERNAL_EVENT_UPDATE_PROPERTY ? 44 : _t2 === EXTERNAL_EVENT_REPLACE_CABINET ? 45 : _t2 === EXTERNAL_EVENT_SET_FINISHING ? 47 : _t2 === EXTERNAL_EVENT_SYNC_SCENE ? 48 : 49;
1231
852
  break;
1232
853
  case 2:
1233
854
  if (!(evt !== null && evt !== void 0 && evt.payload)) {
1234
- _context11.next = 6;
855
+ _context1.next = 6;
1235
856
  break;
1236
857
  }
1237
858
  // prepare item data request
1238
859
  cdsItems = [];
1239
860
  itemKeys = evt !== null && evt !== void 0 && (_evt$payload = evt.payload) !== null && _evt$payload !== void 0 && (_evt$payload = _evt$payload.layers['layer-1']) !== null && _evt$payload !== void 0 && _evt$payload.items ? Object.keys(evt.payload.layers['layer-1'].items) : [];
1240
- _loop6 = /*#__PURE__*/_regeneratorRuntime.mark(function _loop6() {
861
+ _loop3 = /*#__PURE__*/_regeneratorRuntime.mark(function _loop3() {
1241
862
  var _evt$payload2, _it$properties, _it$properties2, _it$properties3, _it$doorStyle2;
1242
863
  var it;
1243
- return _regeneratorRuntime.wrap(function (_context0) {
1244
- while (1) switch (_context0.prev = _context0.next) {
864
+ return _regeneratorRuntime.wrap(function (_context8) {
865
+ while (1) switch (_context8.prev = _context8.next) {
1245
866
  case 0:
1246
867
  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')
1247
868
  if (it !== null && it !== void 0 && (_it$properties = it.properties) !== null && _it$properties !== void 0 && (_it$properties = _it$properties.altitude) !== null && _it$properties !== void 0 && _it$properties.length && it !== null && it !== void 0 && (_it$properties2 = it.properties) !== null && _it$properties2 !== void 0 && (_it$properties2 = _it$properties2.altitude) !== null && _it$properties2 !== void 0 && _it$properties2._unit && it !== null && it !== void 0 && (_it$properties3 = it.properties) !== null && _it$properties3 !== void 0 && (_it$properties3 = _it$properties3.altitude) !== null && _it$properties3 !== void 0 && _it$properties3._length && it.properties.altitude.length !== convert(it.properties.altitude._length).from(it.properties.altitude._unit).to('cm')) {
@@ -1262,20 +883,20 @@ function _handleExternalEvent() {
1262
883
  });
1263
884
  case 1:
1264
885
  case "end":
1265
- return _context0.stop();
886
+ return _context8.stop();
1266
887
  }
1267
- }, _loop6);
888
+ }, _loop3);
1268
889
  });
1269
890
  i = 0;
1270
891
  case 3:
1271
892
  if (!(i < itemKeys.length)) {
1272
- _context11.next = 5;
893
+ _context1.next = 5;
1273
894
  break;
1274
895
  }
1275
- return _context11.delegateYield(_loop6(), "t0", 4);
896
+ return _context1.delegateYield(_loop3(), "t0", 4);
1276
897
  case 4:
1277
898
  i++;
1278
- _context11.next = 3;
899
+ _context1.next = 3;
1279
900
  break;
1280
901
  case 5:
1281
902
  newScene = new Scene(evt === null || evt === void 0 ? void 0 : evt.payload);
@@ -1290,63 +911,63 @@ function _handleExternalEvent() {
1290
911
  cdsItems: cdsItems
1291
912
  }
1292
913
  }, /*#__PURE__*/function () {
1293
- var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee8(result) {
914
+ var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee7(result) {
1294
915
  var rt, _i;
1295
- return _regeneratorRuntime.wrap(function (_context9) {
1296
- while (1) switch (_context9.prev = _context9.next) {
916
+ return _regeneratorRuntime.wrap(function (_context7) {
917
+ while (1) switch (_context7.prev = _context7.next) {
1297
918
  case 0:
1298
919
  rt = mergeSameElements(result === null || result === void 0 ? void 0 : result.elements);
1299
920
  _i = 0;
1300
921
  case 1:
1301
922
  if (!(_i < (rt === null || rt === void 0 ? void 0 : rt.length))) {
1302
- _context9.next = 3;
923
+ _context7.next = 3;
1303
924
  break;
1304
925
  }
1305
- _context9.next = 2;
926
+ _context7.next = 2;
1306
927
  return addItemToCatalog(rt[_i], tempState, props.catalog, props.projectActions);
1307
928
  case 2:
1308
929
  _i++;
1309
- _context9.next = 1;
930
+ _context7.next = 1;
1310
931
  break;
1311
932
  case 3:
1312
933
  props.projectActions.loadProject(evt.payload);
1313
934
  case 4:
1314
935
  case "end":
1315
- return _context9.stop();
936
+ return _context7.stop();
1316
937
  }
1317
- }, _callee8);
938
+ }, _callee7);
1318
939
  }));
1319
- return function (_x1) {
940
+ return function (_x0) {
1320
941
  return _ref3.apply(this, arguments);
1321
942
  };
1322
943
  }());
1323
944
  } else props.projectActions.loadProject(evt.payload);
1324
945
  case 6:
1325
- return _context11.abrupt("continue", 49);
946
+ return _context1.abrupt("continue", 49);
1326
947
  case 7:
1327
948
  props.projectActions.unselectAll();
1328
949
  props.projectActions.setMode(MODE_IDLE_3D);
1329
- return _context11.abrupt("continue", 49);
950
+ return _context1.abrupt("continue", 49);
1330
951
  case 8:
1331
952
  props.projectActions.setMode(MODE_IDLE);
1332
- return _context11.abrupt("continue", 49);
953
+ return _context1.abrupt("continue", 49);
1333
954
  case 9:
1334
955
  sLineCnt = layer.selected.lines.size;
1335
956
  if (sLineCnt > 0) props.projectActions.setMode(MODE_ELEVATION_VIEW);
1336
- return _context11.abrupt("continue", 49);
957
+ return _context1.abrupt("continue", 49);
1337
958
  case 10:
1338
959
  if (state.mode === MODE_IDLE || state.mode === MODE_2D_PAN) props.linesActions.selectToolDrawingLine('wall');else {
1339
960
  props.projectActions.setMode(MODE_IDLE);
1340
961
  props.linesActions.selectToolDrawingLine('wall');
1341
962
  }
1342
- return _context11.abrupt("continue", 49);
963
+ return _context1.abrupt("continue", 49);
1343
964
  case 11:
1344
965
  if (isEmpty(evt === null || evt === void 0 ? void 0 : evt.payload)) {
1345
- _context11.next = 13;
966
+ _context1.next = 13;
1346
967
  break;
1347
968
  }
1348
969
  element = evt.payload;
1349
- _context11.next = 12;
970
+ _context1.next = 12;
1350
971
  return addItemToCatalog(element, state, props.catalog, props.projectActions);
1351
972
  case 12:
1352
973
  // start drawing item
@@ -1370,18 +991,18 @@ function _handleExternalEvent() {
1370
991
  props.projectActions.pushLastSelectedCatalogElementToHistory(element);
1371
992
  props.projectActions.setIsCabinetDrawing(true);
1372
993
  case 13:
1373
- return _context11.abrupt("continue", 49);
994
+ return _context1.abrupt("continue", 49);
1374
995
  case 14:
1375
996
  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);
1376
- return _context11.abrupt("continue", 49);
997
+ return _context1.abrupt("continue", 49);
1377
998
  case 15:
1378
999
  moveAndRotatePan2D3D(evt.type, props, evt.payload, state);
1379
- return _context11.abrupt("continue", 49);
1000
+ return _context1.abrupt("continue", 49);
1380
1001
  case 16:
1381
1002
  defaulTitle = 'Untitle';
1382
1003
  props.projectActions.newProject();
1383
1004
  props.projectActions.rename(defaulTitle);
1384
- return _context11.abrupt("continue", 49);
1005
+ return _context1.abrupt("continue", 49);
1385
1006
  case 17:
1386
1007
  _evt$payload5 = evt.payload, doorStyle = _evt$payload5.doorStyle, itemCDS = _evt$payload5.itemCDS, applyScope = _evt$payload5.applyScope, _evt$payload5$itemIds = _evt$payload5.itemIds, itemIds = _evt$payload5$itemIds === void 0 ? [] : _evt$payload5$itemIds;
1387
1008
  _layerId = state.getIn(['scene', 'selectedLayer']);
@@ -1396,27 +1017,27 @@ function _handleExternalEvent() {
1396
1017
  // itemIds contains item.id (instance IDs)
1397
1018
  idSet = new Set(itemIds);
1398
1019
  }
1399
- _t6 = applyScope;
1400
- _context11.next = _t6 === DOORSTYLE_SCOPE_ALL ? 18 : _t6 === DOORSTYLE_SCOPE_SINGLE ? 19 : _t6 === DOORSTYLE_SCOPE_MULTIPLE ? 19 : 20;
1020
+ _t3 = applyScope;
1021
+ _context1.next = _t3 === DOORSTYLE_SCOPE_ALL ? 18 : _t3 === DOORSTYLE_SCOPE_SINGLE ? 19 : _t3 === DOORSTYLE_SCOPE_MULTIPLE ? 19 : 20;
1401
1022
  break;
1402
1023
  case 18:
1403
1024
  targetItems = Object.values(allItems);
1404
- return _context11.abrupt("continue", 21);
1025
+ return _context1.abrupt("continue", 21);
1405
1026
  case 19:
1406
1027
  targetItems = Object.values(allItems).filter(function (item) {
1407
1028
  var _idSet;
1408
1029
  return (_idSet = idSet) === null || _idSet === void 0 ? void 0 : _idSet.has(item.id);
1409
1030
  });
1410
- return _context11.abrupt("continue", 21);
1031
+ return _context1.abrupt("continue", 21);
1411
1032
  case 20:
1412
- return _context11.abrupt("continue", 21);
1033
+ return _context1.abrupt("continue", 21);
1413
1034
  case 21:
1414
1035
  _cdsItems = [];
1415
- _loop7 = /*#__PURE__*/_regeneratorRuntime.mark(function _loop7() {
1036
+ _loop4 = /*#__PURE__*/_regeneratorRuntime.mark(function _loop4() {
1416
1037
  var _itemCDS$find;
1417
1038
  var item, cdsId;
1418
- return _regeneratorRuntime.wrap(function (_context10) {
1419
- while (1) switch (_context10.prev = _context10.next) {
1039
+ return _regeneratorRuntime.wrap(function (_context0) {
1040
+ while (1) switch (_context0.prev = _context0.next) {
1420
1041
  case 0:
1421
1042
  item = targetItems[_i2];
1422
1043
  cdsId = (_itemCDS$find = itemCDS.find(function (itCDS) {
@@ -1437,20 +1058,20 @@ function _handleExternalEvent() {
1437
1058
  }
1438
1059
  case 1:
1439
1060
  case "end":
1440
- return _context10.stop();
1061
+ return _context0.stop();
1441
1062
  }
1442
- }, _loop7);
1063
+ }, _loop4);
1443
1064
  });
1444
1065
  _i2 = 0;
1445
1066
  case 22:
1446
1067
  if (!(_i2 < targetItems.length)) {
1447
- _context11.next = 24;
1068
+ _context1.next = 24;
1448
1069
  break;
1449
1070
  }
1450
- return _context11.delegateYield(_loop7(), "t1", 23);
1071
+ return _context1.delegateYield(_loop4(), "t1", 23);
1451
1072
  case 23:
1452
1073
  _i2++;
1453
- _context11.next = 22;
1074
+ _context1.next = 22;
1454
1075
  break;
1455
1076
  case 24:
1456
1077
  if (_cdsItems.length > 0) {
@@ -1460,44 +1081,44 @@ function _handleExternalEvent() {
1460
1081
  cdsItems: _cdsItems
1461
1082
  }
1462
1083
  }, /*#__PURE__*/function () {
1463
- var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee9(result) {
1084
+ var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee8(result) {
1464
1085
  var rt, _i3;
1465
- return _regeneratorRuntime.wrap(function (_context1) {
1466
- while (1) switch (_context1.prev = _context1.next) {
1086
+ return _regeneratorRuntime.wrap(function (_context9) {
1087
+ while (1) switch (_context9.prev = _context9.next) {
1467
1088
  case 0:
1468
1089
  rt = mergeSameElements(result === null || result === void 0 ? void 0 : result.elements);
1469
1090
  _i3 = 0;
1470
1091
  case 1:
1471
1092
  if (!(_i3 < (rt === null || rt === void 0 ? void 0 : rt.length))) {
1472
- _context1.next = 3;
1093
+ _context9.next = 3;
1473
1094
  break;
1474
1095
  }
1475
- _context1.next = 2;
1096
+ _context9.next = 2;
1476
1097
  return addItemToCatalog(rt[_i3], state, props.catalog, props.projectActions);
1477
1098
  case 2:
1478
1099
  _i3++;
1479
- _context1.next = 1;
1100
+ _context9.next = 1;
1480
1101
  break;
1481
1102
  case 3:
1482
1103
  props.itemsActions.setDoorStyle(doorStyle, itemCDS, applyScope, itemIds);
1483
1104
  case 4:
1484
1105
  case "end":
1485
- return _context1.stop();
1106
+ return _context9.stop();
1486
1107
  }
1487
- }, _callee9);
1108
+ }, _callee8);
1488
1109
  }));
1489
- return function (_x10) {
1110
+ return function (_x1) {
1490
1111
  return _ref4.apply(this, arguments);
1491
1112
  };
1492
1113
  }());
1493
1114
  } else {
1494
1115
  props.itemsActions.setDoorStyle(doorStyle, itemCDS, applyScope, itemIds);
1495
1116
  }
1496
- return _context11.abrupt("continue", 49);
1117
+ return _context1.abrupt("continue", 49);
1497
1118
  case 25:
1498
1119
  _evt$payload6 = evt.payload, roomShapeType = _evt$payload6.roomShapeType, width = _evt$payload6.width, height = _evt$payload6.height, measurementUnit = _evt$payload6.measurementUnit, _doorStyle = _evt$payload6.doorStyle;
1499
1120
  props.projectActions.createRoomWithShape(roomShapeType, width, height, measurementUnit, _doorStyle);
1500
- return _context11.abrupt("continue", 49);
1121
+ return _context1.abrupt("continue", 49);
1501
1122
  case 26:
1502
1123
  value = state.getIn(['viewer2D']).toJS();
1503
1124
  value.a += 0.1;
@@ -1505,7 +1126,7 @@ function _handleExternalEvent() {
1505
1126
  value.e -= value.SVGWidth * 0.1 / 2;
1506
1127
  value.f -= value.SVGHeight * 0.1 / 2;
1507
1128
  updateViwer2D(value, props.viewer2DActions);
1508
- return _context11.abrupt("continue", 49);
1129
+ return _context1.abrupt("continue", 49);
1509
1130
  case 27:
1510
1131
  _value = state.getIn(['viewer2D']).toJS();
1511
1132
  _value.a -= 0.1;
@@ -1513,62 +1134,62 @@ function _handleExternalEvent() {
1513
1134
  _value.e += _value.SVGWidth * 0.1 / 2;
1514
1135
  _value.f += _value.SVGHeight * 0.1 / 2;
1515
1136
  updateViwer2D(_value, props.viewer2DActions);
1516
- return _context11.abrupt("continue", 49);
1137
+ return _context1.abrupt("continue", 49);
1517
1138
  case 28:
1518
1139
  centering2D(state, props.viewer2DActions);
1519
- return _context11.abrupt("continue", 49);
1140
+ return _context1.abrupt("continue", 49);
1520
1141
  case 29:
1521
1142
  props.projectActions.undo();
1522
- return _context11.abrupt("continue", 49);
1143
+ return _context1.abrupt("continue", 49);
1523
1144
  case 30:
1524
1145
  props.projectActions.redo();
1525
- return _context11.abrupt("continue", 49);
1146
+ return _context1.abrupt("continue", 49);
1526
1147
  case 31:
1527
1148
  _evt$payload7 = evt.payload, moldingInfo = _evt$payload7.moldingInfo, isGlobal = _evt$payload7.isGlobal;
1528
- _context11.next = 32;
1149
+ _context1.next = 32;
1529
1150
  return loadMoldingSvg(moldingInfo);
1530
1151
  case 32:
1531
1152
  props.itemsActions.setMolding(moldingInfo, isGlobal);
1532
- return _context11.abrupt("continue", 49);
1153
+ return _context1.abrupt("continue", 49);
1533
1154
  case 33:
1534
1155
  distElement = getElement(evt.payload, state);
1535
1156
  if (distElement) props.itemsActions.duplicateSelected(distElement, props.onInternalEvent);
1536
- return _context11.abrupt("continue", 49);
1157
+ return _context1.abrupt("continue", 49);
1537
1158
  case 34:
1538
1159
  _distElement = getElement(evt.payload, state);
1539
1160
  if (_distElement) props.projectActions.remove(_distElement);
1540
- return _context11.abrupt("continue", 49);
1161
+ return _context1.abrupt("continue", 49);
1541
1162
  case 35:
1542
1163
  _evt$payload8 = evt.payload, option = _evt$payload8.option, _value2 = _evt$payload8.value;
1543
- _t7 = option;
1544
- _context11.next = _t7 === PROJECT_SETTING_OPTION.CHANGE_MEASUREMENT_UNIT ? 36 : _t7 === PROJECT_SETTING_OPTION.UPDATE_CEIL_HEIGHT ? 37 : _t7 === PROJECT_SETTING_OPTION.CHANGE_WALL_LENGTH_MEASURE ? 38 : _t7 === PROJECT_SETTING_OPTION.CHANGE_BASE_CABINET_MEASURE ? 39 : _t7 === PROJECT_SETTING_OPTION.CHANGE_WALL_CABINET_MEASURE ? 40 : _t7 === PROJECT_SETTING_OPTION.CHANGE_WINDOW_DOOR_MEASURE ? 41 : 42;
1164
+ _t4 = option;
1165
+ _context1.next = _t4 === PROJECT_SETTING_OPTION.CHANGE_MEASUREMENT_UNIT ? 36 : _t4 === PROJECT_SETTING_OPTION.UPDATE_CEIL_HEIGHT ? 37 : _t4 === PROJECT_SETTING_OPTION.CHANGE_WALL_LENGTH_MEASURE ? 38 : _t4 === PROJECT_SETTING_OPTION.CHANGE_BASE_CABINET_MEASURE ? 39 : _t4 === PROJECT_SETTING_OPTION.CHANGE_WALL_CABINET_MEASURE ? 40 : _t4 === PROJECT_SETTING_OPTION.CHANGE_WINDOW_DOOR_MEASURE ? 41 : 42;
1545
1166
  break;
1546
1167
  case 36:
1547
1168
  props.viewer2DActions.updateCeilHeight(convert(layer.ceilHeight).from(layer.unit).to(_value2));
1548
1169
  props.viewer2DActions.updateCeilHeightUnit(_value2);
1549
1170
  props.viewer3DActions.update3DCeilHeightUnit(_value2);
1550
1171
  props.viewer3DActions.update3DCeilHeight(convert(layer.ceilHeight).from(layer.unit).to(_value2));
1551
- return _context11.abrupt("continue", 43);
1172
+ return _context1.abrupt("continue", 43);
1552
1173
  case 37:
1553
1174
  props.viewer2DActions.updateCeilHeight(_value2);
1554
1175
  props.viewer3DActions.update3DCeilHeight(_value2);
1555
- return _context11.abrupt("continue", 43);
1176
+ return _context1.abrupt("continue", 43);
1556
1177
  case 38:
1557
1178
  props.viewer2DActions.changeWallLengthMeasure(_value2);
1558
- return _context11.abrupt("continue", 43);
1179
+ return _context1.abrupt("continue", 43);
1559
1180
  case 39:
1560
1181
  props.viewer2DActions.changeBaseCabinetMeasure(_value2);
1561
- return _context11.abrupt("continue", 43);
1182
+ return _context1.abrupt("continue", 43);
1562
1183
  case 40:
1563
1184
  props.viewer2DActions.changeWallCabinetMeasure(_value2);
1564
- return _context11.abrupt("continue", 43);
1185
+ return _context1.abrupt("continue", 43);
1565
1186
  case 41:
1566
1187
  props.viewer2DActions.changeWindowDoorMeasure(_value2);
1567
- return _context11.abrupt("continue", 43);
1188
+ return _context1.abrupt("continue", 43);
1568
1189
  case 42:
1569
- return _context11.abrupt("continue", 43);
1190
+ return _context1.abrupt("continue", 43);
1570
1191
  case 43:
1571
- return _context11.abrupt("continue", 49);
1192
+ return _context1.abrupt("continue", 49);
1572
1193
  case 44:
1573
1194
  _layerId2 = state.getIn(['scene', 'selectedLayer']);
1574
1195
  _layer = state.getIn(['scene', 'layers', _layerId2]);
@@ -1576,13 +1197,13 @@ function _handleExternalEvent() {
1576
1197
  for (_i4 = 0; _i4 < selectedLines.size; _i4++) (evt === null || evt === void 0 ? void 0 : evt.type) === 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);
1577
1198
  for (_i5 = 0; _i5 < selectedHoles.size; _i5++) (evt === null || evt === void 0 ? void 0 : evt.type) === 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);
1578
1199
  for (_i6 = 0; _i6 < selectedItems.size; _i6++) (evt === null || evt === void 0 ? void 0 : evt.type) === 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);
1579
- return _context11.abrupt("continue", 49);
1200
+ return _context1.abrupt("continue", 49);
1580
1201
  case 45:
1581
1202
  _layerID = state.scene.selectedLayer;
1582
1203
  _layer2 = state.scene.getIn(['layers', _layerID]).toJS();
1583
1204
  orginalItemInfo = evt === null || evt === void 0 || (_evt$payload9 = evt.payload) === null || _evt$payload9 === void 0 ? void 0 : _evt$payload9.orginalItemInfo;
1584
1205
  originalItem = _layer2 === null || _layer2 === void 0 ? void 0 : _layer2.items[orginalItemInfo.id];
1585
- _context11.next = 46;
1206
+ _context1.next = 46;
1586
1207
  return addItemToCatalog(evt.payload.replaceItemInfo, state, props.catalog, props.projectActions);
1587
1208
  case 46:
1588
1209
  originalItemPos = {
@@ -1599,14 +1220,18 @@ function _handleExternalEvent() {
1599
1220
  }
1600
1221
  };
1601
1222
  props.itemsActions.replaceItem(originalItemPos, originalItem, replaceItem);
1602
- return _context11.abrupt("continue", 49);
1223
+ return _context1.abrupt("continue", 49);
1603
1224
  case 47:
1604
1225
  setFinishing(props, state, evt.payload);
1605
- return _context11.abrupt("continue", 49);
1226
+ return _context1.abrupt("continue", 49);
1606
1227
  case 48:
1607
1228
  sceneData = state.scene.toJS(); // get molding data for "ReviewForQuote"
1608
1229
  currentTexture = layer.doorStyle !== null || layer.doorStyle !== undefined ? layer.doorStyle : props.state.doorStyle.toJS();
1609
1230
  sceneData.layers[layerId].moldingData = getMoldingDataOfScene2(layer, props.catalog, currentTexture);
1231
+
1232
+ // get skin panel data
1233
+ sceneData.layers[layerId].skinPanelData = computeSkinPanels(layer);
1234
+
1610
1235
  // send scene object from 3DTool to HostApp using internalEvent
1611
1236
  (_props$onInternalEven3 = props.onInternalEvent) === null || _props$onInternalEven3 === void 0 || _props$onInternalEven3.call(props, {
1612
1237
  type: INTERNAL_EVENT_SYNC_SCENE,
@@ -1614,12 +1239,12 @@ function _handleExternalEvent() {
1614
1239
  scene: sceneData
1615
1240
  }
1616
1241
  });
1617
- return _context11.abrupt("continue", 49);
1242
+ return _context1.abrupt("continue", 49);
1618
1243
  case 49:
1619
1244
  case "end":
1620
- return _context11.stop();
1245
+ return _context1.stop();
1621
1246
  }
1622
- }, _callee0);
1247
+ }, _callee9);
1623
1248
  }));
1624
1249
  return _handleExternalEvent.apply(this, arguments);
1625
1250
  }