kitchen-simulator 11.36.0 → 11.38.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.
@@ -109,7 +109,7 @@ export default function (state, action) {
109
109
  state = stateHistoryPush(state).updatedState;
110
110
  return Item.setCounterTop(state, action.counterTop).updatedState;
111
111
  case SET_MOLDING:
112
- return Item.setMolding(state, action.molding, action.isAll).updatedState;
112
+ return Item.setMolding(state, action.molding, action.isAll, action.onInternalEvent).updatedState;
113
113
  case UPDATE_MOLDING:
114
114
  return Item.updateMolding(state).updatedState;
115
115
  case SET_WALL_COLOR:
@@ -699,97 +699,6 @@ function getTrimmedContourLineSegs(lineSegs, otherLines, cnt) {
699
699
  return [];
700
700
  }
701
701
  }
702
- export function getLinesFromItems(moldingGroup, layer, catalog) {
703
- var allLineRects = GeometryUtils.buildRectFromLines(layer, GeometryUtils.getAllLines(layer));
704
- var items = _toConsumableArray(moldingGroup.items);
705
- var MGlines = getLinesOfItem(items[0], allLineRects, catalog);
706
- items = sortItemsByDistance(items, items[0]);
707
- var _loop7 = function _loop7() {
708
- var itemLines = getLinesOfItem(items[i], allLineRects, catalog);
709
- var temp_MGLines = [];
710
- MGlines.forEach(function (line) {
711
- var idx = itemLines.findIndex(function (itemLine) {
712
- return isLinesOverlapped(line, itemLine);
713
- });
714
- var curItemLine = itemLines[idx];
715
- if (idx > -1) {
716
- if (!(GeometryUtils.samePoints(line[0], curItemLine[0]) && GeometryUtils.samePoints(line[1], curItemLine[1]) || GeometryUtils.samePoints(line[0], curItemLine[1]) && GeometryUtils.samePoints(line[1], curItemLine[0]))) {
717
- var MGLine = mergeOverlappedLines(line, curItemLine);
718
- temp_MGLines.push(MGLine);
719
- }
720
- itemLines.splice(idx, 1);
721
- } else {
722
- temp_MGLines.push(line);
723
- }
724
- });
725
- itemLines.forEach(function (itemLine) {
726
- return temp_MGLines.push(itemLine);
727
- });
728
- MGlines = [].concat(temp_MGLines);
729
- };
730
- for (var i = 1; i < items.length; i++) {
731
- _loop7();
732
- }
733
- // return MGlines;
734
- var snapped_other_items = layer.items.toArray().filter(function (item) {
735
- if (items.some(function (it) {
736
- return item.id === it.id;
737
- })) return false;
738
- return isItemSnappedGroup(item, items);
739
- });
740
- snapped_other_items.forEach(function (item) {
741
- var itemAltitude = item.properties.get('altitude').get('_length');
742
- var itemAltitudeUnit = item.properties.get('altitude').get('_unit');
743
- itemAltitude = convert(itemAltitude).from(itemAltitudeUnit).to('cm');
744
- var itemHeight = item.properties.get('height').get('_length');
745
- var itemHeightUnit = item.properties.get('height').get('_unit');
746
- itemHeight = convert(itemHeight).from(itemHeightUnit).to('cm');
747
- var mgroupAltitude = items[0].properties.get('altitude').get('_length');
748
- var mgroupAltitudeUnit = items[0].properties.get('altitude').get('_unit');
749
- mgroupAltitude = convert(mgroupAltitude).from(mgroupAltitudeUnit).to('cm');
750
- var mgroupHeight = items[0].properties.get('height').get('_length');
751
- var mgroupHeightUnit = items[0].properties.get('height').get('_unit');
752
- mgroupHeight = convert(mgroupHeight).from(mgroupHeightUnit).to('cm');
753
- var flag = false;
754
- switch (moldingGroup.location_type) {
755
- case TOP_MOLDING_LOCATION:
756
- flag = itemAltitude + itemHeight > mgroupAltitude + mgroupHeight;
757
- break;
758
- case MIDDLE_MOLDING_LOCATION:
759
- flag = true;
760
- break;
761
- case BOTTOM_MOLDING_LOCATION:
762
- flag = itemAltitude < mgroupAltitude;
763
- break;
764
- }
765
- if (item.category !== 'cabinet' || ![BASE_CABINET_LAYOUTPOS, WALL_CABINET_LAYOUTPOS, TALL_CABINET_LAYOUTPOS].includes(item.layoutpos)) flag = true;
766
- if (flag) {
767
- var itemLines = getLinesOfItem(item, allLineRects, catalog);
768
- var temp_MGLines = [];
769
- MGlines.forEach(function (mgl) {
770
- var idx = itemLines.findIndex(function (itl) {
771
- return isLinesOverlapped(mgl, itl);
772
- });
773
- var curITL = itemLines[idx];
774
- if (idx > -1) {
775
- if (getDelta(mgl[0], mgl[1], curITL[1], curITL[0]) < EPSILON || getDelta(mgl[0], mgl[1], curITL[0], curITL[1]) < EPSILON) {
776
- if (GeometryUtils.verticesDistance(mgl[0], mgl[1]) > GeometryUtils.verticesDistance(curITL[0], curITL[1])) {
777
- var MGLine = mergeOverlappedLines(mgl, curITL);
778
- temp_MGLines.push(MGLine);
779
- }
780
- itemLines.splice(idx, 1);
781
- } else {
782
- temp_MGLines.push(mgl);
783
- }
784
- } else {
785
- temp_MGLines.push(mgl);
786
- }
787
- });
788
- MGlines = [].concat(temp_MGLines);
789
- }
790
- });
791
- return MGlines;
792
- }
793
702
  function getMDPoints(newMD) {
794
703
  if (newMD.lines.length < 1) return _objectSpread(_objectSpread({}, newMD), {}, {
795
704
  pointGroups: []
@@ -839,7 +748,7 @@ function getMDPoints(newMD) {
839
748
  var pointGroups = [[]];
840
749
  var flag = 1;
841
750
  var i = 0;
842
- var _loop8 = function _loop8() {
751
+ var _loop7 = function _loop7() {
843
752
  if (pointGroups[i].length === 0) {
844
753
  pointGroups[i].push(new Three.Vector2(MDlines[0][0].x - cPos.x, MDlines[0][0].y - cPos.y), new Three.Vector2(MDlines[0][1].x - cPos.x, MDlines[0][1].y - cPos.y));
845
754
  MDlines.splice(0, 1);
@@ -904,7 +813,7 @@ function getMDPoints(newMD) {
904
813
  }
905
814
  };
906
815
  while (MDlines.length !== 0) {
907
- _loop8();
816
+ _loop7();
908
817
  }
909
818
  var z = newMD.items[0].properties.get('altitude').get('_length');
910
819
  var zUnit = newMD.items[0].properties.get('altitude').get('_unit') || 'cm';
@@ -1014,14 +923,14 @@ export function getMoldingDataOfScene2(layer, catalog, doorStyle, moldingPieceLe
1014
923
  // filter the real molding line segments
1015
924
  var removeLineIds = []; // remove the line that fully overlapped to other line
1016
925
  var newLines = []; // new countour line segment that except the overlapped part
1017
- var _loop9 = function _loop9(i) {
926
+ var _loop8 = function _loop8(i) {
1018
927
  var srcLine = {
1019
928
  x1: moldingLines[i].line[0].x,
1020
929
  y1: moldingLines[i].line[0].y,
1021
930
  x2: moldingLines[i].line[1].x,
1022
931
  y2: moldingLines[i].line[1].y
1023
932
  };
1024
- var _loop1 = function _loop1(_j) {
933
+ var _loop0 = function _loop0(_j) {
1025
934
  if (i === _j) return 0; // continue
1026
935
  if (Math.abs(moldingLines[i].z - moldingLines[_j].z) > EPSILON) return 0; // continue
1027
936
  var destLine = {
@@ -1056,13 +965,13 @@ export function getMoldingDataOfScene2(layer, catalog, doorStyle, moldingPieceLe
1056
965
  },
1057
966
  _ret4;
1058
967
  for (var _j = 0; _j < moldingLines.length; _j++) {
1059
- _ret4 = _loop1(_j);
968
+ _ret4 = _loop0(_j);
1060
969
  if (_ret4 === 0) continue;
1061
970
  if (_ret4 === 1) break;
1062
971
  }
1063
972
  };
1064
973
  for (var i = 0; i < moldingLines.length; i++) {
1065
- _loop9(i);
974
+ _loop8(i);
1066
975
  }
1067
976
  moldingLines = moldingLines.filter(function (line, idx) {
1068
977
  return !removeLineIds.some(function (id) {
@@ -1093,7 +1002,7 @@ export function getMoldingDataOfScene2(layer, catalog, doorStyle, moldingPieceLe
1093
1002
  // console.log('moldingLines: ', moldingLines);
1094
1003
 
1095
1004
  // make molding data with grouping molding & doorStyle
1096
- var _loop0 = function _loop0() {
1005
+ var _loop9 = function _loop9() {
1097
1006
  var ml = moldingLines[k];
1098
1007
  var mlLength = ml.molding.name === TOE_KICK_MOLDING ? ml.inchWidth : convert(GeometryUtils.verticesDistance(ml.line[0], ml.line[1])).from('cm').to('in');
1099
1008
  var idx = moldingData.findIndex(function (v) {
@@ -1110,7 +1019,7 @@ export function getMoldingDataOfScene2(layer, catalog, doorStyle, moldingPieceLe
1110
1019
  }
1111
1020
  };
1112
1021
  for (var k = 0; k < moldingLines.length; k++) {
1113
- _loop0();
1022
+ _loop9();
1114
1023
  }
1115
1024
  // console.log('moldingData: ', moldingData);
1116
1025
 
@@ -326,10 +326,12 @@ function setWallColor(texture) {
326
326
  };
327
327
  }
328
328
  function setMolding(texture, isAll) {
329
+ var onInternalEvent = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
329
330
  return {
330
331
  type: _constants.SET_MOLDING,
331
332
  molding: texture,
332
- isAll: isAll
333
+ isAll: isAll,
334
+ onInternalEvent: onInternalEvent
333
335
  };
334
336
  }
335
337
  function updateMolding() {
package/lib/class/item.js CHANGED
@@ -5,6 +5,8 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports["default"] = void 0;
8
+ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
9
+ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
8
10
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
9
11
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
10
12
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
@@ -22,6 +24,8 @@ var _history = require("../utils/history");
22
24
  var _immutable2 = require("../shared/objects/immutable");
23
25
  var _cabinetMirror = require("../shared/domain/cabinet-mirror");
24
26
  var _cabinetWarning = require("../shared/domain/cabinet-warning");
27
+ var _ccdfToCDSMapper = require("../mappings/external-events/mappers/ccdfToCDSMapper");
28
+ var _handleExternalEvent = require("../events/external/handleExternalEvent.util");
25
29
  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; }
26
30
  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; }
27
31
  var allItemRect;
@@ -133,22 +137,17 @@ var Item = exports["default"] = /*#__PURE__*/function () {
133
137
  var refAlt = refItem === null || refItem === void 0 || (_refItem$properties = refItem.properties) === null || _refItem$properties === void 0 || (_refItem$properties$g = _refItem$properties.get) === null || _refItem$properties$g === void 0 ? void 0 : _refItem$properties$g.call(_refItem$properties, 'altitude');
134
138
  if (refAlt) item = item.setIn(['properties', 'altitude'], refAlt);
135
139
  } else {
136
- var _layer$doorStyle, _temp, _ref, _temp$doorStyles$cds$, _temp2, _temp3, _state5;
140
+ var _layer$doorStyle, _temp;
137
141
  var layer = state.getIn(['scene', 'layers', layerID]);
138
142
  var temp = (_layer$doorStyle = layer === null || layer === void 0 ? void 0 : layer.doorStyle) !== null && _layer$doorStyle !== void 0 ? _layer$doorStyle : state.doorStyle;
139
143
  if (!(0, _utils.isEmpty)(temp) && _immutable.Map.isMap(temp)) temp = (_temp = temp) === null || _temp === void 0 ? void 0 : _temp.toJS();
140
- var cds = (_ref = (_temp$doorStyles$cds$ = (_temp2 = temp) === null || _temp2 === void 0 || (_temp2 = _temp2.doorStyles) === null || _temp2 === void 0 || (_temp2 = _temp2.cds) === null || _temp2 === void 0 ? void 0 : _temp2.find(function (elem) {
141
- var _state3;
142
- return elem.itemID === ((_state3 = state) === null || _state3 === void 0 || (_state3 = _state3.catalog) === null || _state3 === void 0 ? void 0 : _state3.getIn(['elements', type, 'itemID']));
143
- })) !== null && _temp$doorStyles$cds$ !== void 0 ? _temp$doorStyles$cds$ : (_temp3 = temp) === null || _temp3 === void 0 || (_temp3 = _temp3.cds) === null || _temp3 === void 0 ? void 0 : _temp3.find(function (elem) {
144
- var _state4;
145
- return elem.itemID === ((_state4 = state) === null || _state4 === void 0 || (_state4 = _state4.catalog) === null || _state4 === void 0 ? void 0 : _state4.getIn(['elements', type, 'itemID']));
146
- })) !== null && _ref !== void 0 ? _ref : (_state5 = state) === null || _state5 === void 0 || (_state5 = _state5.catalog) === null || _state5 === void 0 ? void 0 : _state5.getIn(['elements', type, 'cds']);
144
+ var cds = (0, _ccdfToCDSMapper.mapFromCCDFToCDS)([(0, _immutable2.toJSIfNeeded)(item.ccdf)], [(0, _immutable2.toJSIfNeeded)(item)]);
145
+ temp.cds = cds;
147
146
  if (cds) {
148
- var _temp4;
149
- var updatedDoorStyles = _objectSpread(_objectSpread({}, (_temp4 = temp) === null || _temp4 === void 0 ? void 0 : _temp4.doorStyles), {}, {
150
- cds: [cds],
151
- cabinet_door_style_id: cds.cabinet_door_style_id
147
+ var _temp2;
148
+ var updatedDoorStyles = _objectSpread(_objectSpread({}, (_temp2 = temp) === null || _temp2 === void 0 ? void 0 : _temp2.doorStyles), {}, {
149
+ cds: cds,
150
+ cabinet_door_style_id: cds[0].cabinet_door_style_id
152
151
  });
153
152
  item = item.merge({
154
153
  doorStyle: (0, _immutable.fromJS)(_objectSpread(_objectSpread({}, temp), {}, {
@@ -321,7 +320,7 @@ var Item = exports["default"] = /*#__PURE__*/function () {
321
320
  updatedState: state
322
321
  };
323
322
  var idSet = null;
324
- if (applyScope === _constants.DOORSTYLE_SCOPE_SINGLE) {
323
+ if (applyScope === _constants.DOORSTYLE_SCOPE_SINGLE || applyScope === false) {
325
324
  var selectedItemIds = state.getIn(['scene', 'layers', layerID, 'selected', 'items']).toJS();
326
325
  idSet = new Set(selectedItemIds);
327
326
  }
@@ -341,14 +340,15 @@ var Item = exports["default"] = /*#__PURE__*/function () {
341
340
  layer.items.forEach(function (it) {
342
341
  var _idSet2;
343
342
  // if (isEmpty(it?.molding)) return;
344
- var should = applyScope === _constants.DOORSTYLE_SCOPE_ALL ? true : (_idSet2 = idSet) === null || _idSet2 === void 0 ? void 0 : _idSet2.has(it.id);
343
+ var should = applyScope === _constants.DOORSTYLE_SCOPE_ALL || applyScope === true ? true : (_idSet2 = idSet) === null || _idSet2 === void 0 ? void 0 : _idSet2.has(it.id);
345
344
  if (!should) return;
346
345
  var itemMoldings = it.molding;
346
+ var itemDoorFinish = it.doorStyle;
347
347
  var updatedItemMoldings = [];
348
348
  itemMoldings === null || itemMoldings === void 0 || itemMoldings.forEach(function (md) {
349
349
  var itemMoldingID = md.itemID;
350
350
  var picked = ccdf_list.find(function (c) {
351
- return (c === null || c === void 0 ? void 0 : c.cabinet_id) && c.cabinet_id === itemMoldingID;
351
+ return (c === null || c === void 0 ? void 0 : c.cabinet_id) && (c === null || c === void 0 ? void 0 : c.door_finish_id) && c.cabinet_id === itemMoldingID && c.door_finish_id === (itemDoorFinish === null || itemDoorFinish === void 0 ? void 0 : itemDoorFinish.id);
352
352
  });
353
353
  if (!picked) return;
354
354
  md.ccdf = picked;
@@ -861,8 +861,8 @@ var Item = exports["default"] = /*#__PURE__*/function () {
861
861
  }, {
862
862
  key: "updateDraggingItemChanged",
863
863
  value: function updateDraggingItemChanged(state, x, y, layerID, itemID) {
864
- var _state6 = state,
865
- scene = _state6.scene;
864
+ var _state3 = state,
865
+ scene = _state3.scene;
866
866
  // let originalX = draggingSupport.get('originalX');
867
867
  // let originalY = draggingSupport.get('originalY');
868
868
 
@@ -954,9 +954,9 @@ var Item = exports["default"] = /*#__PURE__*/function () {
954
954
  }, {
955
955
  key: "updateDraggingItem",
956
956
  value: function updateDraggingItem(state, x, y) {
957
- var _state7 = state,
958
- draggingSupport = _state7.draggingSupport,
959
- scene = _state7.scene;
957
+ var _state4 = state,
958
+ draggingSupport = _state4.draggingSupport,
959
+ scene = _state4.scene;
960
960
  var layerID = draggingSupport.get('layerID');
961
961
  var itemID = draggingSupport.get('itemID');
962
962
  var startPointX = draggingSupport.get('startPointX');
@@ -988,9 +988,9 @@ var Item = exports["default"] = /*#__PURE__*/function () {
988
988
  }, {
989
989
  key: "updateDraggingItem3DX",
990
990
  value: function updateDraggingItem3DX(state, x) {
991
- var _state8 = state,
992
- draggingSupport = _state8.draggingSupport,
993
- scene = _state8.scene;
991
+ var _state5 = state,
992
+ draggingSupport = _state5.draggingSupport,
993
+ scene = _state5.scene;
994
994
  var layerID = draggingSupport.get('layerID');
995
995
  var itemID = draggingSupport.get('itemID');
996
996
  var startPointX = draggingSupport.get('startPointX');
@@ -1010,9 +1010,9 @@ var Item = exports["default"] = /*#__PURE__*/function () {
1010
1010
  }, {
1011
1011
  key: "updateDraggingItem3DY",
1012
1012
  value: function updateDraggingItem3DY(state, y) {
1013
- var _state9 = state,
1014
- draggingSupport = _state9.draggingSupport,
1015
- scene = _state9.scene;
1013
+ var _state6 = state,
1014
+ draggingSupport = _state6.draggingSupport,
1015
+ scene = _state6.scene;
1016
1016
  var layerID = draggingSupport.get('layerID');
1017
1017
  var itemID = draggingSupport.get('itemID');
1018
1018
  var startPointY = draggingSupport.get('startPointY');
@@ -1093,9 +1093,9 @@ var Item = exports["default"] = /*#__PURE__*/function () {
1093
1093
  }, {
1094
1094
  key: "updateRotatingItem",
1095
1095
  value: function updateRotatingItem(state, x, y) {
1096
- var _state0 = state,
1097
- rotatingSupport = _state0.rotatingSupport,
1098
- scene = _state0.scene;
1096
+ var _state7 = state,
1097
+ rotatingSupport = _state7.rotatingSupport,
1098
+ scene = _state7.scene;
1099
1099
  var layerID = rotatingSupport.get('layerID');
1100
1100
  var itemID = rotatingSupport.get('itemID');
1101
1101
  var item = state.getIn(['scene', 'layers', layerID, 'items', itemID]);
@@ -1178,9 +1178,9 @@ var Item = exports["default"] = /*#__PURE__*/function () {
1178
1178
  }, {
1179
1179
  key: "replaceSubmodule",
1180
1180
  value: function replaceSubmodule(state, url) {
1181
- var _state1 = state,
1182
- replacingSupport = _state1.replacingSupport,
1183
- scene = _state1.scene;
1181
+ var _state8 = state,
1182
+ replacingSupport = _state8.replacingSupport,
1183
+ scene = _state8.scene;
1184
1184
  url = 'catalog/texture.png';
1185
1185
  var urlData = url.split('/');
1186
1186
  var newURL = '';
@@ -1281,9 +1281,9 @@ var Item = exports["default"] = /*#__PURE__*/function () {
1281
1281
  }, {
1282
1282
  key: "animateObject",
1283
1283
  value: function animateObject(state, value) {
1284
- var _state10 = state,
1285
- replacingSupport = _state10.replacingSupport,
1286
- scene = _state10.scene;
1284
+ var _state9 = state,
1285
+ replacingSupport = _state9.replacingSupport,
1286
+ scene = _state9.scene;
1287
1287
  var layerID = replacingSupport.get('layerID');
1288
1288
  var itemID = replacingSupport.get('itemID');
1289
1289
  var item = state.getIn(['scene', 'layers', layerID, 'items', itemID]);
@@ -1320,8 +1320,8 @@ var Item = exports["default"] = /*#__PURE__*/function () {
1320
1320
  state = state.merge({
1321
1321
  doorStyle: doorStyle
1322
1322
  });
1323
- var _state11 = state,
1324
- scene = _state11.scene;
1323
+ var _state0 = state,
1324
+ scene = _state0.scene;
1325
1325
  var layerID = scene.get('selectedLayer');
1326
1326
  var layers = scene.layers.get(layerID);
1327
1327
  var items = layers.items;
@@ -1530,8 +1530,8 @@ var Item = exports["default"] = /*#__PURE__*/function () {
1530
1530
  }, {
1531
1531
  key: "setCounterTop",
1532
1532
  value: function setCounterTop(state, counterTop) {
1533
- var _state12 = state,
1534
- scene = _state12.scene;
1533
+ var _state1 = state,
1534
+ scene = _state1.scene;
1535
1535
  var layerID = scene.get('selectedLayer');
1536
1536
  var layers = scene.layers.get(layerID);
1537
1537
  layers = layers.mergeIn(['counterTop'], counterTop);
@@ -1575,8 +1575,8 @@ var Item = exports["default"] = /*#__PURE__*/function () {
1575
1575
  }, {
1576
1576
  key: "setDoorHandle",
1577
1577
  value: function setDoorHandle(state, doorHandle) {
1578
- var _state13 = state,
1579
- scene = _state13.scene;
1578
+ var _state10 = state,
1579
+ scene = _state10.scene;
1580
1580
  var layerID = scene.get('selectedLayer');
1581
1581
  var layer = scene.layers.get(layerID);
1582
1582
  layer = layer.mergeIn(['doorHandle'], doorHandle);
@@ -1600,8 +1600,8 @@ var Item = exports["default"] = /*#__PURE__*/function () {
1600
1600
  }, {
1601
1601
  key: "setHandleMaterial",
1602
1602
  value: function setHandleMaterial(state, material) {
1603
- var _state14 = state,
1604
- scene = _state14.scene;
1603
+ var _state11 = state,
1604
+ scene = _state11.scene;
1605
1605
  var layerID = scene.get('selectedLayer');
1606
1606
  var layers = scene.layers.get(layerID);
1607
1607
  var items = layers.items;
@@ -1626,8 +1626,8 @@ var Item = exports["default"] = /*#__PURE__*/function () {
1626
1626
  }, {
1627
1627
  key: "setWallColor",
1628
1628
  value: function setWallColor(state, wallColor) {
1629
- var _state15 = state,
1630
- scene = _state15.scene;
1629
+ var _state12 = state,
1630
+ scene = _state12.scene;
1631
1631
  var layerID = scene.get('selectedLayer');
1632
1632
  var layer = scene.layers.get(layerID);
1633
1633
  layer = layer.merge({
@@ -1653,8 +1653,8 @@ var Item = exports["default"] = /*#__PURE__*/function () {
1653
1653
  }, {
1654
1654
  key: "setBacksplash",
1655
1655
  value: function setBacksplash(state, backsplash) {
1656
- var _state16 = state,
1657
- scene = _state16.scene;
1656
+ var _state13 = state,
1657
+ scene = _state13.scene;
1658
1658
  var layerID = scene.get('selectedLayer');
1659
1659
  var layer = scene.layers.get(layerID);
1660
1660
  var dataJSON = layer.toJS();
@@ -1682,8 +1682,10 @@ var Item = exports["default"] = /*#__PURE__*/function () {
1682
1682
  }, {
1683
1683
  key: "setMolding",
1684
1684
  value: function setMolding(state, molding, isAll) {
1685
- var _state17 = state,
1686
- scene = _state17.scene;
1685
+ var _this4 = this;
1686
+ var onInternalEvent = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
1687
+ var _state14 = state,
1688
+ scene = _state14.scene;
1687
1689
  var layerID = scene.get('selectedLayer');
1688
1690
  var layer = scene.layers.get(layerID);
1689
1691
  if (isAll) {
@@ -1765,6 +1767,60 @@ var Item = exports["default"] = /*#__PURE__*/function () {
1765
1767
  });
1766
1768
  }
1767
1769
  }
1770
+ var layerId = state.getIn(['scene', 'selectedLayer']);
1771
+ var allItems = state.getIn(['scene', 'layers', layerId, 'items']).toJS();
1772
+ var targetItems = [],
1773
+ molding_ccdf_list = [];
1774
+ switch (isAll) {
1775
+ case true:
1776
+ targetItems = Object.values(allItems);
1777
+ break;
1778
+ case false:
1779
+ targetItems = Object.values(allItems.filter(function (item) {
1780
+ var _item$molding;
1781
+ return !(0, _utils.isEmpty)(item === null || item === void 0 || (_item$molding = item.molding) === null || _item$molding === void 0 ? void 0 : _item$molding.find(function (md) {
1782
+ return md.itemID === molding.itemID;
1783
+ }));
1784
+ }));
1785
+ default:
1786
+ break;
1787
+ }
1788
+ for (var i = 0; i < targetItems.length; i++) {
1789
+ var _item$molding2;
1790
+ var item = targetItems[i];
1791
+ molding_ccdf_list.push.apply(molding_ccdf_list, (0, _toConsumableArray2["default"])((0, _handleExternalEvent.prepareMoldingCCDFList)(item === null || item === void 0 ? void 0 : item.doorStyle, item === null || item === void 0 || (_item$molding2 = item.molding) === null || _item$molding2 === void 0 ? void 0 : _item$molding2.filter(function (md) {
1792
+ return md.itemID === molding.itemID;
1793
+ }))));
1794
+ }
1795
+ if (molding_ccdf_list.length > 0) {
1796
+ onInternalEvent === null || onInternalEvent === void 0 || onInternalEvent({
1797
+ type: _constants.INTERNAL_EVENT_ITEMS_CATALOG,
1798
+ value: {
1799
+ event_type: 'change_door_style',
1800
+ ccdf_list: [],
1801
+ molding_ccdf_list: molding_ccdf_list
1802
+ }
1803
+ },
1804
+ /*#__PURE__*/
1805
+ // result is ccdf_list
1806
+ function () {
1807
+ var _ref = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee(result) {
1808
+ var _this4$setMoldingsCCD, _result$molding_ccdf_;
1809
+ return _regenerator["default"].wrap(function (_context) {
1810
+ while (1) switch (_context.prev = _context.next) {
1811
+ case 0:
1812
+ state = (_this4$setMoldingsCCD = _this4.setMoldingsCCDF(state, (_result$molding_ccdf_ = result === null || result === void 0 ? void 0 : result.molding_ccdf_list) !== null && _result$molding_ccdf_ !== void 0 ? _result$molding_ccdf_ : [], isAll)) === null || _this4$setMoldingsCCD === void 0 ? void 0 : _this4$setMoldingsCCD.updatedState;
1813
+ case 1:
1814
+ case "end":
1815
+ return _context.stop();
1816
+ }
1817
+ }, _callee);
1818
+ }));
1819
+ return function (_x) {
1820
+ return _ref.apply(this, arguments);
1821
+ };
1822
+ }());
1823
+ }
1768
1824
  state = state.merge({
1769
1825
  sceneHistory: (0, _history.historyPush)(state.sceneHistory, state.scene)
1770
1826
  });
@@ -1775,8 +1831,8 @@ var Item = exports["default"] = /*#__PURE__*/function () {
1775
1831
  }, {
1776
1832
  key: "updateMolding",
1777
1833
  value: function updateMolding(state) {
1778
- var _state18 = state,
1779
- scene = _state18.scene;
1834
+ var _state15 = state,
1835
+ scene = _state15.scene;
1780
1836
  var layerID = scene.get('selectedLayer');
1781
1837
  var layer = scene.layers.get(layerID);
1782
1838
  var selectedItem = layer.getIn(['items', layer.selected.toJS().items[0]]);
@@ -1900,8 +1956,8 @@ var Item = exports["default"] = /*#__PURE__*/function () {
1900
1956
  }, {
1901
1957
  key: "setBacksplashVisible",
1902
1958
  value: function setBacksplashVisible(state, itemID, backsplashVisible) {
1903
- var _state19 = state,
1904
- scene = _state19.scene;
1959
+ var _state16 = state,
1960
+ scene = _state16.scene;
1905
1961
  var layerID = scene.get('selectedLayer');
1906
1962
  var layer = scene.layers.get(layerID);
1907
1963
  layer = layer.mergeIn(['items', itemID, 'backsplashVisible'], backsplashVisible);
@@ -1921,8 +1977,8 @@ var Item = exports["default"] = /*#__PURE__*/function () {
1921
1977
  }, {
1922
1978
  key: "setApplianceMaterial",
1923
1979
  value: function setApplianceMaterial(state, material) {
1924
- var _state20 = state,
1925
- scene = _state20.scene;
1980
+ var _state17 = state,
1981
+ scene = _state17.scene;
1926
1982
  var layerID = scene.get('selectedLayer');
1927
1983
  var layers = scene.layers.get(layerID);
1928
1984
  var items = layers.items;
@@ -1946,8 +2002,8 @@ var Item = exports["default"] = /*#__PURE__*/function () {
1946
2002
  }, {
1947
2003
  key: "setModelling",
1948
2004
  value: function setModelling(state, molding) {
1949
- var _state21 = state,
1950
- scene = _state21.scene;
2005
+ var _state18 = state,
2006
+ scene = _state18.scene;
1951
2007
  var layerID = scene.get('selectedLayer');
1952
2008
  var layers = scene.layers.get(layerID);
1953
2009
  var items = layers.items;
@@ -2057,8 +2113,8 @@ var Item = exports["default"] = /*#__PURE__*/function () {
2057
2113
  }, {
2058
2114
  key: "toggleLoadingCabinet",
2059
2115
  value: function toggleLoadingCabinet(state) {
2060
- var _state22 = state,
2061
- scene = _state22.scene;
2116
+ var _state19 = state,
2117
+ scene = _state19.scene;
2062
2118
  console.log('scene.isLoadingCabinet: ', !scene.isLoadingCabinet);
2063
2119
  // scene = scene.set('isLoadingCabinet', !scene.isLoadingCabinet);
2064
2120
  // state = state.set('scene', scene);
@@ -2070,8 +2126,8 @@ var Item = exports["default"] = /*#__PURE__*/function () {
2070
2126
  }, {
2071
2127
  key: "endLoading",
2072
2128
  value: function endLoading(state) {
2073
- var _state23 = state,
2074
- scene = _state23.scene;
2129
+ var _state20 = state,
2130
+ scene = _state20.scene;
2075
2131
  state = state.setIn(['scene', 'loadFlag'], true);
2076
2132
  return {
2077
2133
  updatedState: state