kitchen-simulator 11.10.0 → 11.11.0
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.
|
@@ -524,8 +524,8 @@ export function addItemToCatalog(_x4, _x5, _x6, _x7) {
|
|
|
524
524
|
// Get attributs of current selected element
|
|
525
525
|
function _addItemToCatalog() {
|
|
526
526
|
_addItemToCatalog = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5(element, state, catalogInstance, projectActions) {
|
|
527
|
-
var _elementJs, _elementJs3;
|
|
528
|
-
var elementJs, outlineSVGData, _state$getIn,
|
|
527
|
+
var _elementJs, _elementJs$structure_, _elementJs$structure_2, _elementJs$structure_3, _elementJs$structure_4, _elementJs3;
|
|
528
|
+
var elementJs, outlineSVGData, _state$getIn, cds, _cds$find, _elementJs2, currentCdsId, cdsIdx, ttph, updatedStructureJson, catalogElements, catalogElementKeys, catalogItem, k, _catalogElements$cata, tempPlaceholderArray, _catalogItem$structur, newTempPlaceholderArray, mergedTempPlaceholder;
|
|
529
529
|
return _regeneratorRuntime.wrap(function (_context5) {
|
|
530
530
|
while (1) switch (_context5.prev = _context5.next) {
|
|
531
531
|
case 0:
|
|
@@ -540,27 +540,25 @@ function _addItemToCatalog() {
|
|
|
540
540
|
return loadSVGsByItem(elementJs);
|
|
541
541
|
case 2:
|
|
542
542
|
outlineSVGData = _context5.sent;
|
|
543
|
-
if (
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
elementJs.structure_json.tempPlaceholders[0] = elementJs.structure_json.tempPlaceholders[cdsIdx];
|
|
559
|
-
elementJs.structure_json.tempPlaceholders[cdsIdx] = ttph;
|
|
543
|
+
if (((_elementJs = elementJs) === null || _elementJs === void 0 ? void 0 : _elementJs.type) === 'cabinet') {
|
|
544
|
+
// move the tempPlaceholder of current door style to first of tempPlaceholders array
|
|
545
|
+
cds = (_state$getIn = state.getIn(['scene', 'layers', 'layer-1', 'doorStyle'])) === null || _state$getIn === void 0 ? void 0 : _state$getIn.cds;
|
|
546
|
+
if (cds) {
|
|
547
|
+
currentCdsId = (_cds$find = cds.find(function (c) {
|
|
548
|
+
return c.itemID === elementJs.itemID;
|
|
549
|
+
})) === null || _cds$find === void 0 ? void 0 : _cds$find.cabinet_door_style_id;
|
|
550
|
+
cdsIdx = (_elementJs2 = elementJs) === null || _elementJs2 === void 0 || (_elementJs2 = _elementJs2.structure_json) === null || _elementJs2 === void 0 || (_elementJs2 = _elementJs2.tempPlaceholders) === null || _elementJs2 === void 0 ? void 0 : _elementJs2.findIndex(function (tph) {
|
|
551
|
+
return tph.id === currentCdsId;
|
|
552
|
+
}); // swap
|
|
553
|
+
if (currentCdsId && cdsIdx >= 0) {
|
|
554
|
+
ttph = elementJs.structure_json.tempPlaceholders[0];
|
|
555
|
+
elementJs.structure_json.tempPlaceholders[0] = elementJs.structure_json.tempPlaceholders[cdsIdx];
|
|
556
|
+
elementJs.structure_json.tempPlaceholders[cdsIdx] = ttph;
|
|
557
|
+
}
|
|
560
558
|
}
|
|
561
559
|
}
|
|
562
560
|
// make placeholders of element and tempPlaceholder
|
|
563
|
-
updatedStructureJson = _objectSpread(_objectSpread({}, elementJs.structure_json), (_elementJs$
|
|
561
|
+
updatedStructureJson = (_elementJs$structure_ = elementJs.structure_json) !== null && _elementJs$structure_ !== void 0 && _elementJs$structure_.tempPlaceholders ? _objectSpread(_objectSpread({}, elementJs.structure_json), (_elementJs$structure_2 = (_elementJs$structure_3 = elementJs.structure_json) === null || _elementJs$structure_3 === void 0 || (_elementJs$structure_3 = _elementJs$structure_3.tempPlaceholders[0]) === null || _elementJs$structure_3 === void 0 ? void 0 : _elementJs$structure_3.structure) !== null && _elementJs$structure_2 !== void 0 ? _elementJs$structure_2 : {}) : _objectSpread({}, elementJs.structure_json);
|
|
564
562
|
elementJs.structure_json = updatedStructureJson;
|
|
565
563
|
elementJs = _objectSpread(_objectSpread({}, elementJs), {}, {
|
|
566
564
|
cds: {
|
|
@@ -568,7 +566,7 @@ function _addItemToCatalog() {
|
|
|
568
566
|
itemID: elementJs.itemID
|
|
569
567
|
}
|
|
570
568
|
});
|
|
571
|
-
if (isEmpty((_elementJs$
|
|
569
|
+
if (isEmpty((_elementJs$structure_4 = elementJs.structure_json) === null || _elementJs$structure_4 === void 0 ? void 0 : _elementJs$structure_4.tempPlaceholders)) {
|
|
572
570
|
_context5.next = 4;
|
|
573
571
|
break;
|
|
574
572
|
}
|
|
@@ -69,9 +69,9 @@ export function ccdfMapper(ccdf_list, layer) {
|
|
|
69
69
|
});
|
|
70
70
|
}
|
|
71
71
|
// make structure_json
|
|
72
|
-
structure_json = {
|
|
72
|
+
if (cd.category === 'cabinet') structure_json = {
|
|
73
73
|
tempPlaceholders: tempPlaceholders
|
|
74
|
-
};
|
|
74
|
+
};else structure_json = structure;
|
|
75
75
|
// make cabinet definition using structure_json and catalog
|
|
76
76
|
cabinetDefinition = {
|
|
77
77
|
type: cd.category,
|
|
@@ -535,8 +535,8 @@ function addItemToCatalog(_x4, _x5, _x6, _x7) {
|
|
|
535
535
|
} // Get attributs of current selected element
|
|
536
536
|
function _addItemToCatalog() {
|
|
537
537
|
_addItemToCatalog = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee5(element, state, catalogInstance, projectActions) {
|
|
538
|
-
var _elementJs, _elementJs3;
|
|
539
|
-
var elementJs, outlineSVGData, _state$getIn,
|
|
538
|
+
var _elementJs, _elementJs$structure_, _elementJs$structure_2, _elementJs$structure_3, _elementJs$structure_4, _elementJs3;
|
|
539
|
+
var elementJs, outlineSVGData, _state$getIn, cds, _cds$find, _elementJs2, currentCdsId, cdsIdx, ttph, updatedStructureJson, catalogElements, catalogElementKeys, catalogItem, k, _catalogElements$cata, tempPlaceholderArray, _catalogItem$structur, newTempPlaceholderArray, mergedTempPlaceholder;
|
|
540
540
|
return _regenerator["default"].wrap(function (_context5) {
|
|
541
541
|
while (1) switch (_context5.prev = _context5.next) {
|
|
542
542
|
case 0:
|
|
@@ -551,27 +551,25 @@ function _addItemToCatalog() {
|
|
|
551
551
|
return loadSVGsByItem(elementJs);
|
|
552
552
|
case 2:
|
|
553
553
|
outlineSVGData = _context5.sent;
|
|
554
|
-
if (
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
elementJs.structure_json.tempPlaceholders[0] = elementJs.structure_json.tempPlaceholders[cdsIdx];
|
|
570
|
-
elementJs.structure_json.tempPlaceholders[cdsIdx] = ttph;
|
|
554
|
+
if (((_elementJs = elementJs) === null || _elementJs === void 0 ? void 0 : _elementJs.type) === 'cabinet') {
|
|
555
|
+
// move the tempPlaceholder of current door style to first of tempPlaceholders array
|
|
556
|
+
cds = (_state$getIn = state.getIn(['scene', 'layers', 'layer-1', 'doorStyle'])) === null || _state$getIn === void 0 ? void 0 : _state$getIn.cds;
|
|
557
|
+
if (cds) {
|
|
558
|
+
currentCdsId = (_cds$find = cds.find(function (c) {
|
|
559
|
+
return c.itemID === elementJs.itemID;
|
|
560
|
+
})) === null || _cds$find === void 0 ? void 0 : _cds$find.cabinet_door_style_id;
|
|
561
|
+
cdsIdx = (_elementJs2 = elementJs) === null || _elementJs2 === void 0 || (_elementJs2 = _elementJs2.structure_json) === null || _elementJs2 === void 0 || (_elementJs2 = _elementJs2.tempPlaceholders) === null || _elementJs2 === void 0 ? void 0 : _elementJs2.findIndex(function (tph) {
|
|
562
|
+
return tph.id === currentCdsId;
|
|
563
|
+
}); // swap
|
|
564
|
+
if (currentCdsId && cdsIdx >= 0) {
|
|
565
|
+
ttph = elementJs.structure_json.tempPlaceholders[0];
|
|
566
|
+
elementJs.structure_json.tempPlaceholders[0] = elementJs.structure_json.tempPlaceholders[cdsIdx];
|
|
567
|
+
elementJs.structure_json.tempPlaceholders[cdsIdx] = ttph;
|
|
568
|
+
}
|
|
571
569
|
}
|
|
572
570
|
}
|
|
573
571
|
// make placeholders of element and tempPlaceholder
|
|
574
|
-
updatedStructureJson = _objectSpread(_objectSpread({}, elementJs.structure_json), (_elementJs$
|
|
572
|
+
updatedStructureJson = (_elementJs$structure_ = elementJs.structure_json) !== null && _elementJs$structure_ !== void 0 && _elementJs$structure_.tempPlaceholders ? _objectSpread(_objectSpread({}, elementJs.structure_json), (_elementJs$structure_2 = (_elementJs$structure_3 = elementJs.structure_json) === null || _elementJs$structure_3 === void 0 || (_elementJs$structure_3 = _elementJs$structure_3.tempPlaceholders[0]) === null || _elementJs$structure_3 === void 0 ? void 0 : _elementJs$structure_3.structure) !== null && _elementJs$structure_2 !== void 0 ? _elementJs$structure_2 : {}) : _objectSpread({}, elementJs.structure_json);
|
|
575
573
|
elementJs.structure_json = updatedStructureJson;
|
|
576
574
|
elementJs = _objectSpread(_objectSpread({}, elementJs), {}, {
|
|
577
575
|
cds: {
|
|
@@ -579,7 +577,7 @@ function _addItemToCatalog() {
|
|
|
579
577
|
itemID: elementJs.itemID
|
|
580
578
|
}
|
|
581
579
|
});
|
|
582
|
-
if ((0, _helper.isEmpty)((_elementJs$
|
|
580
|
+
if ((0, _helper.isEmpty)((_elementJs$structure_4 = elementJs.structure_json) === null || _elementJs$structure_4 === void 0 ? void 0 : _elementJs$structure_4.tempPlaceholders)) {
|
|
583
581
|
_context5.next = 4;
|
|
584
582
|
break;
|
|
585
583
|
}
|
|
@@ -76,9 +76,9 @@ function ccdfMapper(ccdf_list, layer) {
|
|
|
76
76
|
});
|
|
77
77
|
}
|
|
78
78
|
// make structure_json
|
|
79
|
-
structure_json = {
|
|
79
|
+
if (cd.category === 'cabinet') structure_json = {
|
|
80
80
|
tempPlaceholders: tempPlaceholders
|
|
81
|
-
};
|
|
81
|
+
};else structure_json = structure;
|
|
82
82
|
// make cabinet definition using structure_json and catalog
|
|
83
83
|
cabinetDefinition = {
|
|
84
84
|
type: cd.category,
|