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.
- package/es/actions/items-actions.js +3 -1
- package/es/class/item.js +118 -62
- package/es/components/viewer3d/scene-creator.js +19 -5
- package/es/events/external/handleExternalEvent.util.js +29 -4
- package/es/events/external/handlers.changeDoorStyle.js +5 -21
- package/es/events/external/handlers.loadProject.js +9 -3
- package/es/events/external/handlers.molding.js +1 -1
- package/es/reducers/items-reducer.js +1 -1
- package/es/utils/molding.js +8 -99
- package/lib/actions/items-actions.js +3 -1
- package/lib/class/item.js +117 -61
- package/lib/components/viewer3d/scene-creator.js +27 -13
- package/lib/events/external/handleExternalEvent.util.js +30 -4
- package/lib/events/external/handlers.changeDoorStyle.js +6 -22
- package/lib/events/external/handlers.loadProject.js +9 -3
- package/lib/events/external/handlers.molding.js +1 -1
- package/lib/reducers/items-reducer.js +1 -1
- package/lib/utils/molding.js +8 -100
- package/package.json +1 -1
|
@@ -273,10 +273,12 @@ export function setWallColor(texture) {
|
|
|
273
273
|
};
|
|
274
274
|
}
|
|
275
275
|
export function setMolding(texture, isAll) {
|
|
276
|
+
var onInternalEvent = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
276
277
|
return {
|
|
277
278
|
type: SET_MOLDING,
|
|
278
279
|
molding: texture,
|
|
279
|
-
isAll: isAll
|
|
280
|
+
isAll: isAll,
|
|
281
|
+
onInternalEvent: onInternalEvent
|
|
280
282
|
};
|
|
281
283
|
}
|
|
282
284
|
export function updateMolding() {
|
package/es/class/item.js
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
|
+
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
1
2
|
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
2
3
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
3
4
|
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
4
5
|
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
6
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
5
7
|
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; }
|
|
6
8
|
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) { _defineProperty(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; }
|
|
7
9
|
import { convert } from "../utils/convert-units-lite";
|
|
8
10
|
import { Group, Hole, Layer } from "./export";
|
|
9
11
|
import { GeometryUtils, IDBroker, MoldingUtils, NameGenerator } from "../utils/export";
|
|
10
12
|
import { fromJS, Map } from 'immutable';
|
|
11
|
-
import { DOORSTYLE_SCOPE_ALL, DOORSTYLE_SCOPE_MULTIPLE, DOORSTYLE_SCOPE_SINGLE, INSTALLATION_SUFFIX_TYPE, INTERNAL_EVENT_DRAW_ELEMENT, INTERNAL_EVENT_MIRROR_ELEMENT, MODE_DRAGGING_ITEM, MODE_DRAGGING_ITEM_3D, MODE_DRAWING_ITEM, MODE_DRAWING_ITEM_3D, MODE_IDLE, MODE_IDLE_3D, MODE_ROTATING_ITEM, MODE_ROTATING_ITEM_3D, MOLDING_LOCATIONS } from "../constants";
|
|
13
|
+
import { DOORSTYLE_SCOPE_ALL, DOORSTYLE_SCOPE_MULTIPLE, DOORSTYLE_SCOPE_SINGLE, INSTALLATION_SUFFIX_TYPE, INTERNAL_EVENT_DRAW_ELEMENT, INTERNAL_EVENT_ITEMS_CATALOG, INTERNAL_EVENT_MIRROR_ELEMENT, MODE_DRAGGING_ITEM, MODE_DRAGGING_ITEM_3D, MODE_DRAWING_ITEM, MODE_DRAWING_ITEM_3D, MODE_IDLE, MODE_IDLE_3D, MODE_ROTATING_ITEM, MODE_ROTATING_ITEM_3D, MOLDING_LOCATIONS } from "../constants";
|
|
12
14
|
import { debugUtil, updatePayloadOfInternalEvent } from "../utils/helper";
|
|
13
15
|
import { isUndefined } from 'util';
|
|
14
16
|
import { hasMoldingLayout } from "../utils/molding";
|
|
@@ -17,6 +19,8 @@ import { historyPush } from "../utils/history";
|
|
|
17
19
|
import { toJSIfNeeded } from "../shared/objects/immutable";
|
|
18
20
|
import { canMirrorCabinet } from "../shared/domain/cabinet-mirror";
|
|
19
21
|
import { isWarningCabinet } from "../shared/domain/cabinet-warning";
|
|
22
|
+
import { mapFromCCDFToCDS } from "../mappings/external-events/mappers/ccdfToCDSMapper";
|
|
23
|
+
import { prepareMoldingCCDFList } from "../events/external/handleExternalEvent.util";
|
|
20
24
|
var allItemRect;
|
|
21
25
|
var allItemSnap;
|
|
22
26
|
var allLines;
|
|
@@ -126,22 +130,17 @@ var Item = /*#__PURE__*/function () {
|
|
|
126
130
|
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');
|
|
127
131
|
if (refAlt) item = item.setIn(['properties', 'altitude'], refAlt);
|
|
128
132
|
} else {
|
|
129
|
-
var _layer$doorStyle, _temp
|
|
133
|
+
var _layer$doorStyle, _temp;
|
|
130
134
|
var layer = state.getIn(['scene', 'layers', layerID]);
|
|
131
135
|
var temp = (_layer$doorStyle = layer === null || layer === void 0 ? void 0 : layer.doorStyle) !== null && _layer$doorStyle !== void 0 ? _layer$doorStyle : state.doorStyle;
|
|
132
136
|
if (!isEmpty(temp) && Map.isMap(temp)) temp = (_temp = temp) === null || _temp === void 0 ? void 0 : _temp.toJS();
|
|
133
|
-
var cds = (
|
|
134
|
-
|
|
135
|
-
return elem.itemID === ((_state3 = state) === null || _state3 === void 0 || (_state3 = _state3.catalog) === null || _state3 === void 0 ? void 0 : _state3.getIn(['elements', type, 'itemID']));
|
|
136
|
-
})) !== 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) {
|
|
137
|
-
var _state4;
|
|
138
|
-
return elem.itemID === ((_state4 = state) === null || _state4 === void 0 || (_state4 = _state4.catalog) === null || _state4 === void 0 ? void 0 : _state4.getIn(['elements', type, 'itemID']));
|
|
139
|
-
})) !== 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']);
|
|
137
|
+
var cds = mapFromCCDFToCDS([toJSIfNeeded(item.ccdf)], [toJSIfNeeded(item)]);
|
|
138
|
+
temp.cds = cds;
|
|
140
139
|
if (cds) {
|
|
141
|
-
var
|
|
142
|
-
var updatedDoorStyles = _objectSpread(_objectSpread({}, (
|
|
143
|
-
cds:
|
|
144
|
-
cabinet_door_style_id: cds.cabinet_door_style_id
|
|
140
|
+
var _temp2;
|
|
141
|
+
var updatedDoorStyles = _objectSpread(_objectSpread({}, (_temp2 = temp) === null || _temp2 === void 0 ? void 0 : _temp2.doorStyles), {}, {
|
|
142
|
+
cds: cds,
|
|
143
|
+
cabinet_door_style_id: cds[0].cabinet_door_style_id
|
|
145
144
|
});
|
|
146
145
|
item = item.merge({
|
|
147
146
|
doorStyle: fromJS(_objectSpread(_objectSpread({}, temp), {}, {
|
|
@@ -314,7 +313,7 @@ var Item = /*#__PURE__*/function () {
|
|
|
314
313
|
updatedState: state
|
|
315
314
|
};
|
|
316
315
|
var idSet = null;
|
|
317
|
-
if (applyScope === DOORSTYLE_SCOPE_SINGLE) {
|
|
316
|
+
if (applyScope === DOORSTYLE_SCOPE_SINGLE || applyScope === false) {
|
|
318
317
|
var selectedItemIds = state.getIn(['scene', 'layers', layerID, 'selected', 'items']).toJS();
|
|
319
318
|
idSet = new Set(selectedItemIds);
|
|
320
319
|
}
|
|
@@ -334,14 +333,15 @@ var Item = /*#__PURE__*/function () {
|
|
|
334
333
|
layer.items.forEach(function (it) {
|
|
335
334
|
var _idSet2;
|
|
336
335
|
// if (isEmpty(it?.molding)) return;
|
|
337
|
-
var should = applyScope === DOORSTYLE_SCOPE_ALL ? true : (_idSet2 = idSet) === null || _idSet2 === void 0 ? void 0 : _idSet2.has(it.id);
|
|
336
|
+
var should = applyScope === DOORSTYLE_SCOPE_ALL || applyScope === true ? true : (_idSet2 = idSet) === null || _idSet2 === void 0 ? void 0 : _idSet2.has(it.id);
|
|
338
337
|
if (!should) return;
|
|
339
338
|
var itemMoldings = it.molding;
|
|
339
|
+
var itemDoorFinish = it.doorStyle;
|
|
340
340
|
var updatedItemMoldings = [];
|
|
341
341
|
itemMoldings === null || itemMoldings === void 0 || itemMoldings.forEach(function (md) {
|
|
342
342
|
var itemMoldingID = md.itemID;
|
|
343
343
|
var picked = ccdf_list.find(function (c) {
|
|
344
|
-
return (c === null || c === void 0 ? void 0 : c.cabinet_id) && c.cabinet_id === itemMoldingID;
|
|
344
|
+
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);
|
|
345
345
|
});
|
|
346
346
|
if (!picked) return;
|
|
347
347
|
md.ccdf = picked;
|
|
@@ -854,8 +854,8 @@ var Item = /*#__PURE__*/function () {
|
|
|
854
854
|
}, {
|
|
855
855
|
key: "updateDraggingItemChanged",
|
|
856
856
|
value: function updateDraggingItemChanged(state, x, y, layerID, itemID) {
|
|
857
|
-
var
|
|
858
|
-
scene =
|
|
857
|
+
var _state3 = state,
|
|
858
|
+
scene = _state3.scene;
|
|
859
859
|
// let originalX = draggingSupport.get('originalX');
|
|
860
860
|
// let originalY = draggingSupport.get('originalY');
|
|
861
861
|
|
|
@@ -947,9 +947,9 @@ var Item = /*#__PURE__*/function () {
|
|
|
947
947
|
}, {
|
|
948
948
|
key: "updateDraggingItem",
|
|
949
949
|
value: function updateDraggingItem(state, x, y) {
|
|
950
|
-
var
|
|
951
|
-
draggingSupport =
|
|
952
|
-
scene =
|
|
950
|
+
var _state4 = state,
|
|
951
|
+
draggingSupport = _state4.draggingSupport,
|
|
952
|
+
scene = _state4.scene;
|
|
953
953
|
var layerID = draggingSupport.get('layerID');
|
|
954
954
|
var itemID = draggingSupport.get('itemID');
|
|
955
955
|
var startPointX = draggingSupport.get('startPointX');
|
|
@@ -981,9 +981,9 @@ var Item = /*#__PURE__*/function () {
|
|
|
981
981
|
}, {
|
|
982
982
|
key: "updateDraggingItem3DX",
|
|
983
983
|
value: function updateDraggingItem3DX(state, x) {
|
|
984
|
-
var
|
|
985
|
-
draggingSupport =
|
|
986
|
-
scene =
|
|
984
|
+
var _state5 = state,
|
|
985
|
+
draggingSupport = _state5.draggingSupport,
|
|
986
|
+
scene = _state5.scene;
|
|
987
987
|
var layerID = draggingSupport.get('layerID');
|
|
988
988
|
var itemID = draggingSupport.get('itemID');
|
|
989
989
|
var startPointX = draggingSupport.get('startPointX');
|
|
@@ -1003,9 +1003,9 @@ var Item = /*#__PURE__*/function () {
|
|
|
1003
1003
|
}, {
|
|
1004
1004
|
key: "updateDraggingItem3DY",
|
|
1005
1005
|
value: function updateDraggingItem3DY(state, y) {
|
|
1006
|
-
var
|
|
1007
|
-
draggingSupport =
|
|
1008
|
-
scene =
|
|
1006
|
+
var _state6 = state,
|
|
1007
|
+
draggingSupport = _state6.draggingSupport,
|
|
1008
|
+
scene = _state6.scene;
|
|
1009
1009
|
var layerID = draggingSupport.get('layerID');
|
|
1010
1010
|
var itemID = draggingSupport.get('itemID');
|
|
1011
1011
|
var startPointY = draggingSupport.get('startPointY');
|
|
@@ -1086,9 +1086,9 @@ var Item = /*#__PURE__*/function () {
|
|
|
1086
1086
|
}, {
|
|
1087
1087
|
key: "updateRotatingItem",
|
|
1088
1088
|
value: function updateRotatingItem(state, x, y) {
|
|
1089
|
-
var
|
|
1090
|
-
rotatingSupport =
|
|
1091
|
-
scene =
|
|
1089
|
+
var _state7 = state,
|
|
1090
|
+
rotatingSupport = _state7.rotatingSupport,
|
|
1091
|
+
scene = _state7.scene;
|
|
1092
1092
|
var layerID = rotatingSupport.get('layerID');
|
|
1093
1093
|
var itemID = rotatingSupport.get('itemID');
|
|
1094
1094
|
var item = state.getIn(['scene', 'layers', layerID, 'items', itemID]);
|
|
@@ -1171,9 +1171,9 @@ var Item = /*#__PURE__*/function () {
|
|
|
1171
1171
|
}, {
|
|
1172
1172
|
key: "replaceSubmodule",
|
|
1173
1173
|
value: function replaceSubmodule(state, url) {
|
|
1174
|
-
var
|
|
1175
|
-
replacingSupport =
|
|
1176
|
-
scene =
|
|
1174
|
+
var _state8 = state,
|
|
1175
|
+
replacingSupport = _state8.replacingSupport,
|
|
1176
|
+
scene = _state8.scene;
|
|
1177
1177
|
url = 'catalog/texture.png';
|
|
1178
1178
|
var urlData = url.split('/');
|
|
1179
1179
|
var newURL = '';
|
|
@@ -1274,9 +1274,9 @@ var Item = /*#__PURE__*/function () {
|
|
|
1274
1274
|
}, {
|
|
1275
1275
|
key: "animateObject",
|
|
1276
1276
|
value: function animateObject(state, value) {
|
|
1277
|
-
var
|
|
1278
|
-
replacingSupport =
|
|
1279
|
-
scene =
|
|
1277
|
+
var _state9 = state,
|
|
1278
|
+
replacingSupport = _state9.replacingSupport,
|
|
1279
|
+
scene = _state9.scene;
|
|
1280
1280
|
var layerID = replacingSupport.get('layerID');
|
|
1281
1281
|
var itemID = replacingSupport.get('itemID');
|
|
1282
1282
|
var item = state.getIn(['scene', 'layers', layerID, 'items', itemID]);
|
|
@@ -1313,8 +1313,8 @@ var Item = /*#__PURE__*/function () {
|
|
|
1313
1313
|
state = state.merge({
|
|
1314
1314
|
doorStyle: doorStyle
|
|
1315
1315
|
});
|
|
1316
|
-
var
|
|
1317
|
-
scene =
|
|
1316
|
+
var _state0 = state,
|
|
1317
|
+
scene = _state0.scene;
|
|
1318
1318
|
var layerID = scene.get('selectedLayer');
|
|
1319
1319
|
var layers = scene.layers.get(layerID);
|
|
1320
1320
|
var items = layers.items;
|
|
@@ -1523,8 +1523,8 @@ var Item = /*#__PURE__*/function () {
|
|
|
1523
1523
|
}, {
|
|
1524
1524
|
key: "setCounterTop",
|
|
1525
1525
|
value: function setCounterTop(state, counterTop) {
|
|
1526
|
-
var
|
|
1527
|
-
scene =
|
|
1526
|
+
var _state1 = state,
|
|
1527
|
+
scene = _state1.scene;
|
|
1528
1528
|
var layerID = scene.get('selectedLayer');
|
|
1529
1529
|
var layers = scene.layers.get(layerID);
|
|
1530
1530
|
layers = layers.mergeIn(['counterTop'], counterTop);
|
|
@@ -1568,8 +1568,8 @@ var Item = /*#__PURE__*/function () {
|
|
|
1568
1568
|
}, {
|
|
1569
1569
|
key: "setDoorHandle",
|
|
1570
1570
|
value: function setDoorHandle(state, doorHandle) {
|
|
1571
|
-
var
|
|
1572
|
-
scene =
|
|
1571
|
+
var _state10 = state,
|
|
1572
|
+
scene = _state10.scene;
|
|
1573
1573
|
var layerID = scene.get('selectedLayer');
|
|
1574
1574
|
var layer = scene.layers.get(layerID);
|
|
1575
1575
|
layer = layer.mergeIn(['doorHandle'], doorHandle);
|
|
@@ -1593,8 +1593,8 @@ var Item = /*#__PURE__*/function () {
|
|
|
1593
1593
|
}, {
|
|
1594
1594
|
key: "setHandleMaterial",
|
|
1595
1595
|
value: function setHandleMaterial(state, material) {
|
|
1596
|
-
var
|
|
1597
|
-
scene =
|
|
1596
|
+
var _state11 = state,
|
|
1597
|
+
scene = _state11.scene;
|
|
1598
1598
|
var layerID = scene.get('selectedLayer');
|
|
1599
1599
|
var layers = scene.layers.get(layerID);
|
|
1600
1600
|
var items = layers.items;
|
|
@@ -1619,8 +1619,8 @@ var Item = /*#__PURE__*/function () {
|
|
|
1619
1619
|
}, {
|
|
1620
1620
|
key: "setWallColor",
|
|
1621
1621
|
value: function setWallColor(state, wallColor) {
|
|
1622
|
-
var
|
|
1623
|
-
scene =
|
|
1622
|
+
var _state12 = state,
|
|
1623
|
+
scene = _state12.scene;
|
|
1624
1624
|
var layerID = scene.get('selectedLayer');
|
|
1625
1625
|
var layer = scene.layers.get(layerID);
|
|
1626
1626
|
layer = layer.merge({
|
|
@@ -1646,8 +1646,8 @@ var Item = /*#__PURE__*/function () {
|
|
|
1646
1646
|
}, {
|
|
1647
1647
|
key: "setBacksplash",
|
|
1648
1648
|
value: function setBacksplash(state, backsplash) {
|
|
1649
|
-
var
|
|
1650
|
-
scene =
|
|
1649
|
+
var _state13 = state,
|
|
1650
|
+
scene = _state13.scene;
|
|
1651
1651
|
var layerID = scene.get('selectedLayer');
|
|
1652
1652
|
var layer = scene.layers.get(layerID);
|
|
1653
1653
|
var dataJSON = layer.toJS();
|
|
@@ -1675,8 +1675,10 @@ var Item = /*#__PURE__*/function () {
|
|
|
1675
1675
|
}, {
|
|
1676
1676
|
key: "setMolding",
|
|
1677
1677
|
value: function setMolding(state, molding, isAll) {
|
|
1678
|
-
var
|
|
1679
|
-
|
|
1678
|
+
var _this4 = this;
|
|
1679
|
+
var onInternalEvent = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
|
|
1680
|
+
var _state14 = state,
|
|
1681
|
+
scene = _state14.scene;
|
|
1680
1682
|
var layerID = scene.get('selectedLayer');
|
|
1681
1683
|
var layer = scene.layers.get(layerID);
|
|
1682
1684
|
if (isAll) {
|
|
@@ -1758,6 +1760,60 @@ var Item = /*#__PURE__*/function () {
|
|
|
1758
1760
|
});
|
|
1759
1761
|
}
|
|
1760
1762
|
}
|
|
1763
|
+
var layerId = state.getIn(['scene', 'selectedLayer']);
|
|
1764
|
+
var allItems = state.getIn(['scene', 'layers', layerId, 'items']).toJS();
|
|
1765
|
+
var targetItems = [],
|
|
1766
|
+
molding_ccdf_list = [];
|
|
1767
|
+
switch (isAll) {
|
|
1768
|
+
case true:
|
|
1769
|
+
targetItems = Object.values(allItems);
|
|
1770
|
+
break;
|
|
1771
|
+
case false:
|
|
1772
|
+
targetItems = Object.values(allItems.filter(function (item) {
|
|
1773
|
+
var _item$molding;
|
|
1774
|
+
return !isEmpty(item === null || item === void 0 || (_item$molding = item.molding) === null || _item$molding === void 0 ? void 0 : _item$molding.find(function (md) {
|
|
1775
|
+
return md.itemID === molding.itemID;
|
|
1776
|
+
}));
|
|
1777
|
+
}));
|
|
1778
|
+
default:
|
|
1779
|
+
break;
|
|
1780
|
+
}
|
|
1781
|
+
for (var i = 0; i < targetItems.length; i++) {
|
|
1782
|
+
var _item$molding2;
|
|
1783
|
+
var item = targetItems[i];
|
|
1784
|
+
molding_ccdf_list.push.apply(molding_ccdf_list, _toConsumableArray(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) {
|
|
1785
|
+
return md.itemID === molding.itemID;
|
|
1786
|
+
}))));
|
|
1787
|
+
}
|
|
1788
|
+
if (molding_ccdf_list.length > 0) {
|
|
1789
|
+
onInternalEvent === null || onInternalEvent === void 0 || onInternalEvent({
|
|
1790
|
+
type: INTERNAL_EVENT_ITEMS_CATALOG,
|
|
1791
|
+
value: {
|
|
1792
|
+
event_type: 'change_door_style',
|
|
1793
|
+
ccdf_list: [],
|
|
1794
|
+
molding_ccdf_list: molding_ccdf_list
|
|
1795
|
+
}
|
|
1796
|
+
},
|
|
1797
|
+
/*#__PURE__*/
|
|
1798
|
+
// result is ccdf_list
|
|
1799
|
+
function () {
|
|
1800
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(result) {
|
|
1801
|
+
var _this4$setMoldingsCCD, _result$molding_ccdf_;
|
|
1802
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
1803
|
+
while (1) switch (_context.prev = _context.next) {
|
|
1804
|
+
case 0:
|
|
1805
|
+
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;
|
|
1806
|
+
case 1:
|
|
1807
|
+
case "end":
|
|
1808
|
+
return _context.stop();
|
|
1809
|
+
}
|
|
1810
|
+
}, _callee);
|
|
1811
|
+
}));
|
|
1812
|
+
return function (_x) {
|
|
1813
|
+
return _ref.apply(this, arguments);
|
|
1814
|
+
};
|
|
1815
|
+
}());
|
|
1816
|
+
}
|
|
1761
1817
|
state = state.merge({
|
|
1762
1818
|
sceneHistory: historyPush(state.sceneHistory, state.scene)
|
|
1763
1819
|
});
|
|
@@ -1768,8 +1824,8 @@ var Item = /*#__PURE__*/function () {
|
|
|
1768
1824
|
}, {
|
|
1769
1825
|
key: "updateMolding",
|
|
1770
1826
|
value: function updateMolding(state) {
|
|
1771
|
-
var
|
|
1772
|
-
scene =
|
|
1827
|
+
var _state15 = state,
|
|
1828
|
+
scene = _state15.scene;
|
|
1773
1829
|
var layerID = scene.get('selectedLayer');
|
|
1774
1830
|
var layer = scene.layers.get(layerID);
|
|
1775
1831
|
var selectedItem = layer.getIn(['items', layer.selected.toJS().items[0]]);
|
|
@@ -1893,8 +1949,8 @@ var Item = /*#__PURE__*/function () {
|
|
|
1893
1949
|
}, {
|
|
1894
1950
|
key: "setBacksplashVisible",
|
|
1895
1951
|
value: function setBacksplashVisible(state, itemID, backsplashVisible) {
|
|
1896
|
-
var
|
|
1897
|
-
scene =
|
|
1952
|
+
var _state16 = state,
|
|
1953
|
+
scene = _state16.scene;
|
|
1898
1954
|
var layerID = scene.get('selectedLayer');
|
|
1899
1955
|
var layer = scene.layers.get(layerID);
|
|
1900
1956
|
layer = layer.mergeIn(['items', itemID, 'backsplashVisible'], backsplashVisible);
|
|
@@ -1914,8 +1970,8 @@ var Item = /*#__PURE__*/function () {
|
|
|
1914
1970
|
}, {
|
|
1915
1971
|
key: "setApplianceMaterial",
|
|
1916
1972
|
value: function setApplianceMaterial(state, material) {
|
|
1917
|
-
var
|
|
1918
|
-
scene =
|
|
1973
|
+
var _state17 = state,
|
|
1974
|
+
scene = _state17.scene;
|
|
1919
1975
|
var layerID = scene.get('selectedLayer');
|
|
1920
1976
|
var layers = scene.layers.get(layerID);
|
|
1921
1977
|
var items = layers.items;
|
|
@@ -1939,8 +1995,8 @@ var Item = /*#__PURE__*/function () {
|
|
|
1939
1995
|
}, {
|
|
1940
1996
|
key: "setModelling",
|
|
1941
1997
|
value: function setModelling(state, molding) {
|
|
1942
|
-
var
|
|
1943
|
-
scene =
|
|
1998
|
+
var _state18 = state,
|
|
1999
|
+
scene = _state18.scene;
|
|
1944
2000
|
var layerID = scene.get('selectedLayer');
|
|
1945
2001
|
var layers = scene.layers.get(layerID);
|
|
1946
2002
|
var items = layers.items;
|
|
@@ -2050,8 +2106,8 @@ var Item = /*#__PURE__*/function () {
|
|
|
2050
2106
|
}, {
|
|
2051
2107
|
key: "toggleLoadingCabinet",
|
|
2052
2108
|
value: function toggleLoadingCabinet(state) {
|
|
2053
|
-
var
|
|
2054
|
-
scene =
|
|
2109
|
+
var _state19 = state,
|
|
2110
|
+
scene = _state19.scene;
|
|
2055
2111
|
console.log('scene.isLoadingCabinet: ', !scene.isLoadingCabinet);
|
|
2056
2112
|
// scene = scene.set('isLoadingCabinet', !scene.isLoadingCabinet);
|
|
2057
2113
|
// state = state.set('scene', scene);
|
|
@@ -2063,8 +2119,8 @@ var Item = /*#__PURE__*/function () {
|
|
|
2063
2119
|
}, {
|
|
2064
2120
|
key: "endLoading",
|
|
2065
2121
|
value: function endLoading(state) {
|
|
2066
|
-
var
|
|
2067
|
-
scene =
|
|
2122
|
+
var _state20 = state,
|
|
2123
|
+
scene = _state20.scene;
|
|
2068
2124
|
state = state.setIn(['scene', 'loadFlag'], true);
|
|
2069
2125
|
return {
|
|
2070
2126
|
updatedState: state
|
|
@@ -2724,6 +2724,12 @@ function isSingleQuadrilateral(groupCount, pointGroup) {
|
|
|
2724
2724
|
* @param model - molding info that appear in real 3D
|
|
2725
2725
|
*/
|
|
2726
2726
|
function moldingVertices(mPointGroup, mdGeo, MDV, model, svg_width, svg_height, groupCount) {
|
|
2727
|
+
// Guard against bad SVG metadata (missing/zero dimensions) which would produce NaN/Infinity vertices.
|
|
2728
|
+
if (!Number.isFinite(svg_width) || !Number.isFinite(svg_height) || svg_width <= 0 || svg_height <= 0) {
|
|
2729
|
+
mdGeo.setAttribute('position', new Three.BufferAttribute(new Float32Array(), 3));
|
|
2730
|
+
mdGeo.needsUpdate = true;
|
|
2731
|
+
return mdGeo;
|
|
2732
|
+
}
|
|
2727
2733
|
var pointGroup = mPointGroup;
|
|
2728
2734
|
var length = pointGroup.length;
|
|
2729
2735
|
var isSnap = true;
|
|
@@ -2801,15 +2807,19 @@ function moldingVertices(mPointGroup, mdGeo, MDV, model, svg_width, svg_height,
|
|
|
2801
2807
|
}
|
|
2802
2808
|
vecNorm.rotateAround(o, Math.PI / 2 - alpha);
|
|
2803
2809
|
vecNorm.normalize();
|
|
2804
|
-
|
|
2810
|
+
var sinAlpha = Math.sin(alpha);
|
|
2811
|
+
if (Math.abs(sinAlpha) > 1e-6) {
|
|
2812
|
+
vecNorm.multiplyScalar(1 / sinAlpha);
|
|
2813
|
+
}
|
|
2805
2814
|
|
|
2806
2815
|
// Make 3D Points
|
|
2807
2816
|
MDV.forEach(function (p) {
|
|
2808
2817
|
var x = cur.x - vecNorm.x * ((p.x / svg_width - 0.5) * model.length);
|
|
2809
2818
|
var y = (0.5 - p.y / svg_height) * model.width;
|
|
2810
2819
|
var z = -cur.y + vecNorm.y * ((p.x / svg_width - 0.5) * model.length);
|
|
2811
|
-
if (
|
|
2812
|
-
|
|
2820
|
+
if (Number.isFinite(x) && Number.isFinite(y) && Number.isFinite(z)) {
|
|
2821
|
+
verticesArray.push(x, y, z);
|
|
2822
|
+
}
|
|
2813
2823
|
});
|
|
2814
2824
|
});
|
|
2815
2825
|
var mdGeo1 = mdGeo.setAttribute('position', new Three.BufferAttribute(new Float32Array(verticesArray), 3));
|
|
@@ -3250,7 +3260,7 @@ function _addMGMesh(molding, planData, layer, data, svg_width, svg_height, flag)
|
|
|
3250
3260
|
// let layoutType = molding.items[0].layoutpos;
|
|
3251
3261
|
// let visible = molding.items[0];
|
|
3252
3262
|
molding.pointGroups.forEach(function (pointGroup) {
|
|
3253
|
-
var _child$width_unit, _child$height_unit, _child$length_unit;
|
|
3263
|
+
var _child$width_unit, _child$height_unit, _child$length_unit, _geometry2;
|
|
3254
3264
|
var geometry = new Three.BufferGeometry();
|
|
3255
3265
|
var length = data.length; //point array
|
|
3256
3266
|
var widthUnit = child.width_unit === 'inch' ? 'in' : (_child$width_unit = child.width_unit) !== null && _child$width_unit !== void 0 ? _child$width_unit : 'in';
|
|
@@ -3264,6 +3274,10 @@ function _addMGMesh(molding, planData, layer, data, svg_width, svg_height, flag)
|
|
|
3264
3274
|
child.length_unit = 'cm';
|
|
3265
3275
|
geometry.needsUpdate = true;
|
|
3266
3276
|
geometry = moldingVertices(pointGroup, geometry, data, child, svg_width, svg_height, molding.pointGroups.length);
|
|
3277
|
+
// If we failed to generate positions (bad SVG/model data), skip this molding group.
|
|
3278
|
+
if (!((_geometry2 = geometry) !== null && _geometry2 !== void 0 && (_geometry2 = _geometry2.attributes) !== null && _geometry2 !== void 0 && _geometry2.position) || geometry.attributes.position.count < 3) {
|
|
3279
|
+
return;
|
|
3280
|
+
}
|
|
3267
3281
|
var total = geometry.attributes.position.count;
|
|
3268
3282
|
var len = geometry.attributes.position.count / length;
|
|
3269
3283
|
if (!GeometryUtils.samePoints(pointGroup[0], pointGroup[pointGroup.length - 1])) {
|
|
@@ -3644,7 +3658,7 @@ export function updateMoldingGroupArray(MGArray, selItem, planData, layer) {
|
|
|
3644
3658
|
}).toJS()[0] : (_mg$items$4 = mg.items[0]) === null || _mg$items$4 === void 0 || (_mg$items$4 = _mg$items$4.molding) === null || _mg$items$4 === void 0 ? void 0 : _mg$items$4.filter(function (mol) {
|
|
3645
3659
|
return (mol === null || mol === void 0 ? void 0 : mol.location_type) === mg.location_type;
|
|
3646
3660
|
})[0];
|
|
3647
|
-
if (mg.molding === null || mg.molding.itemID !==
|
|
3661
|
+
if (mg.molding === null || mg.molding.itemID !== molding.itemID || mg.lines === null || mg.points === null) {
|
|
3648
3662
|
var _mg$molding;
|
|
3649
3663
|
if (mg.molding !== null && ((_mg$molding = mg.molding) === null || _mg$molding === void 0 ? void 0 : _mg$molding.itemID) !== molding.itemID) {
|
|
3650
3664
|
deleteMGMesh(mg, planData, mode);
|
|
@@ -395,7 +395,7 @@ function _parseTempPlaceholdersFromCabinetPayload() {
|
|
|
395
395
|
}
|
|
396
396
|
});
|
|
397
397
|
tempPlaceholdersData.push({
|
|
398
|
-
id:
|
|
398
|
+
id: el,
|
|
399
399
|
placeholders: tempData,
|
|
400
400
|
structure: cabinetPayload.structure_json.tempPlaceholders[k].structure
|
|
401
401
|
});
|
|
@@ -1027,11 +1027,19 @@ function _loadMoldingSvg() {
|
|
|
1027
1027
|
}
|
|
1028
1028
|
var loader = new SVGLoader();
|
|
1029
1029
|
loader.load(url, function (data) {
|
|
1030
|
-
var _data$xml$viewBox$ani, _data$xml, _data$xml$viewBox$ani2, _data$
|
|
1030
|
+
var _data$xml$viewBox$ani, _data$xml, _data$xml2, _data$xml$viewBox$ani2, _data$xml3, _data$xml4, _data$xml$width$animV, _data$xml5, _data$xml6, _data$xml$height$anim, _data$xml7, _data$xml8, _ref6, _ref7;
|
|
1031
|
+
// Some SVGs omit a viewBox; fall back to width/height to avoid 0 dimensions.
|
|
1032
|
+
// 0/invalid svg_width/svg_height later causes NaN/Infinity vertex positions in 3D molding meshes.
|
|
1033
|
+
var viewBoxWidth = (_data$xml$viewBox$ani = (_data$xml = data.xml) === null || _data$xml === void 0 || (_data$xml = _data$xml.viewBox) === null || _data$xml === void 0 || (_data$xml = _data$xml.animVal) === null || _data$xml === void 0 ? void 0 : _data$xml.width) !== null && _data$xml$viewBox$ani !== void 0 ? _data$xml$viewBox$ani : (_data$xml2 = data.xml) === null || _data$xml2 === void 0 || (_data$xml2 = _data$xml2.viewBox) === null || _data$xml2 === void 0 || (_data$xml2 = _data$xml2.baseVal) === null || _data$xml2 === void 0 ? void 0 : _data$xml2.width;
|
|
1034
|
+
var viewBoxHeight = (_data$xml$viewBox$ani2 = (_data$xml3 = data.xml) === null || _data$xml3 === void 0 || (_data$xml3 = _data$xml3.viewBox) === null || _data$xml3 === void 0 || (_data$xml3 = _data$xml3.animVal) === null || _data$xml3 === void 0 ? void 0 : _data$xml3.height) !== null && _data$xml$viewBox$ani2 !== void 0 ? _data$xml$viewBox$ani2 : (_data$xml4 = data.xml) === null || _data$xml4 === void 0 || (_data$xml4 = _data$xml4.viewBox) === null || _data$xml4 === void 0 || (_data$xml4 = _data$xml4.baseVal) === null || _data$xml4 === void 0 ? void 0 : _data$xml4.height;
|
|
1035
|
+
var attrWidth = (_data$xml$width$animV = (_data$xml5 = data.xml) === null || _data$xml5 === void 0 || (_data$xml5 = _data$xml5.width) === null || _data$xml5 === void 0 || (_data$xml5 = _data$xml5.animVal) === null || _data$xml5 === void 0 ? void 0 : _data$xml5.value) !== null && _data$xml$width$animV !== void 0 ? _data$xml$width$animV : (_data$xml6 = data.xml) === null || _data$xml6 === void 0 || (_data$xml6 = _data$xml6.width) === null || _data$xml6 === void 0 || (_data$xml6 = _data$xml6.baseVal) === null || _data$xml6 === void 0 ? void 0 : _data$xml6.value;
|
|
1036
|
+
var attrHeight = (_data$xml$height$anim = (_data$xml7 = data.xml) === null || _data$xml7 === void 0 || (_data$xml7 = _data$xml7.height) === null || _data$xml7 === void 0 || (_data$xml7 = _data$xml7.animVal) === null || _data$xml7 === void 0 ? void 0 : _data$xml7.value) !== null && _data$xml$height$anim !== void 0 ? _data$xml$height$anim : (_data$xml8 = data.xml) === null || _data$xml8 === void 0 || (_data$xml8 = _data$xml8.height) === null || _data$xml8 === void 0 || (_data$xml8 = _data$xml8.baseVal) === null || _data$xml8 === void 0 ? void 0 : _data$xml8.value;
|
|
1037
|
+
var svg_width = Number((_ref6 = viewBoxWidth !== null && viewBoxWidth !== void 0 ? viewBoxWidth : attrWidth) !== null && _ref6 !== void 0 ? _ref6 : 0);
|
|
1038
|
+
var svg_height = Number((_ref7 = viewBoxHeight !== null && viewBoxHeight !== void 0 ? viewBoxHeight : attrHeight) !== null && _ref7 !== void 0 ? _ref7 : 0);
|
|
1031
1039
|
molding.data = {
|
|
1032
1040
|
paths: data.paths,
|
|
1033
|
-
svg_width:
|
|
1034
|
-
svg_height:
|
|
1041
|
+
svg_width: Number.isFinite(svg_width) ? svg_width : 0,
|
|
1042
|
+
svg_height: Number.isFinite(svg_height) ? svg_height : 0
|
|
1035
1043
|
};
|
|
1036
1044
|
resolve();
|
|
1037
1045
|
}, null, function (error) {
|
|
@@ -1071,4 +1079,21 @@ export function mergeSameElements(projectItemsCatalog) {
|
|
|
1071
1079
|
_loop(i);
|
|
1072
1080
|
}
|
|
1073
1081
|
return result;
|
|
1082
|
+
}
|
|
1083
|
+
export function prepareMoldingCCDFList(doorStyle, moldingData) {
|
|
1084
|
+
var moldingCCDFs = [];
|
|
1085
|
+
for (var i = 0; i < moldingData.length; i++) {
|
|
1086
|
+
var _molding$ccdf$catalog, _molding$ccdf, _molding$ccdf$cabinet, _molding$ccdf2, _doorStyle$id, _molding$long_name;
|
|
1087
|
+
var molding = moldingData[i];
|
|
1088
|
+
moldingCCDFs.push({
|
|
1089
|
+
sizeinfo: molding.sizeinfo,
|
|
1090
|
+
catalog_cabinet_sku: (_molding$ccdf$catalog = molding === null || molding === void 0 || (_molding$ccdf = molding.ccdf) === null || _molding$ccdf === void 0 ? void 0 : _molding$ccdf.catalog_cabinet_sku) !== null && _molding$ccdf$catalog !== void 0 ? _molding$ccdf$catalog : molding.sku_number,
|
|
1091
|
+
cabinet_id: (_molding$ccdf$cabinet = molding === null || molding === void 0 || (_molding$ccdf2 = molding.ccdf) === null || _molding$ccdf2 === void 0 ? void 0 : _molding$ccdf2.cabinet_id) !== null && _molding$ccdf$cabinet !== void 0 ? _molding$ccdf$cabinet : molding.itemID,
|
|
1092
|
+
ccdf: molding.ccdf,
|
|
1093
|
+
target_door_finish_id: (_doorStyle$id = doorStyle === null || doorStyle === void 0 ? void 0 : doorStyle.id) !== null && _doorStyle$id !== void 0 ? _doorStyle$id : null,
|
|
1094
|
+
long_name: (_molding$long_name = molding === null || molding === void 0 ? void 0 : molding.long_name) !== null && _molding$long_name !== void 0 ? _molding$long_name : null,
|
|
1095
|
+
id: molding.itemID
|
|
1096
|
+
});
|
|
1097
|
+
}
|
|
1098
|
+
return moldingCCDFs;
|
|
1074
1099
|
}
|
|
@@ -1,23 +1,7 @@
|
|
|
1
1
|
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
2
2
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
3
|
import { asyncPool } from "../../shared/concurrency/async-pool";
|
|
4
|
-
|
|
5
|
-
var moldingCCDFs = [];
|
|
6
|
-
for (var i = 0; i < moldingData.length; i++) {
|
|
7
|
-
var _molding$ccdf$catalog, _molding$ccdf, _molding$ccdf$cabinet, _molding$ccdf2, _doorStyle$id, _molding$long_name;
|
|
8
|
-
var molding = moldingData[i];
|
|
9
|
-
moldingCCDFs.push({
|
|
10
|
-
sizeinfo: molding.sizeinfo,
|
|
11
|
-
catalog_cabinet_sku: (_molding$ccdf$catalog = molding === null || molding === void 0 || (_molding$ccdf = molding.ccdf) === null || _molding$ccdf === void 0 ? void 0 : _molding$ccdf.catalog_cabinet_sku) !== null && _molding$ccdf$catalog !== void 0 ? _molding$ccdf$catalog : molding.sku_number,
|
|
12
|
-
cabinet_id: (_molding$ccdf$cabinet = molding === null || molding === void 0 || (_molding$ccdf2 = molding.ccdf) === null || _molding$ccdf2 === void 0 ? void 0 : _molding$ccdf2.cabinet_id) !== null && _molding$ccdf$cabinet !== void 0 ? _molding$ccdf$cabinet : molding.itemID,
|
|
13
|
-
ccdf: molding.ccdf,
|
|
14
|
-
target_door_finish_id: (_doorStyle$id = doorStyle === null || doorStyle === void 0 ? void 0 : doorStyle.id) !== null && _doorStyle$id !== void 0 ? _doorStyle$id : null,
|
|
15
|
-
long_name: (_molding$long_name = molding === null || molding === void 0 ? void 0 : molding.long_name) !== null && _molding$long_name !== void 0 ? _molding$long_name : null,
|
|
16
|
-
id: molding.itemID
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
return moldingCCDFs;
|
|
20
|
-
}
|
|
4
|
+
import { prepareMoldingCCDFList } from "./handleExternalEvent.util";
|
|
21
5
|
export function handleChangeDoorStyleEvent(_x, _x2, _x3, _x4, _x5, _x6, _x7, _x8, _x9, _x0, _x1, _x10) {
|
|
22
6
|
return _handleChangeDoorStyleEvent.apply(this, arguments);
|
|
23
7
|
}
|
|
@@ -59,7 +43,7 @@ function _handleChangeDoorStyleEvent() {
|
|
|
59
43
|
case 4:
|
|
60
44
|
ccdf_list = [];
|
|
61
45
|
_loop = /*#__PURE__*/_regeneratorRuntime.mark(function _loop() {
|
|
62
|
-
var item, _item$ccdf$catalog_ca, _item$ccdf, _item$ccdf$cabinet_id, _item$ccdf2, _doorStyle$
|
|
46
|
+
var item, _item$ccdf$catalog_ca, _item$ccdf, _item$ccdf$cabinet_id, _item$ccdf2, _doorStyle$id2, _item$long_name;
|
|
63
47
|
return _regeneratorRuntime.wrap(function (_context2) {
|
|
64
48
|
while (1) switch (_context2.prev = _context2.next) {
|
|
65
49
|
case 0:
|
|
@@ -73,7 +57,7 @@ function _handleChangeDoorStyleEvent() {
|
|
|
73
57
|
catalog_cabinet_sku: (_item$ccdf$catalog_ca = item === null || item === void 0 || (_item$ccdf = item.ccdf) === null || _item$ccdf === void 0 ? void 0 : _item$ccdf.catalog_cabinet_sku) !== null && _item$ccdf$catalog_ca !== void 0 ? _item$ccdf$catalog_ca : item.sku_number,
|
|
74
58
|
cabinet_id: (_item$ccdf$cabinet_id = item === null || item === void 0 || (_item$ccdf2 = item.ccdf) === null || _item$ccdf2 === void 0 ? void 0 : _item$ccdf2.cabinet_id) !== null && _item$ccdf$cabinet_id !== void 0 ? _item$ccdf$cabinet_id : null,
|
|
75
59
|
ccdf: item.ccdf,
|
|
76
|
-
target_door_finish_id: (_doorStyle$
|
|
60
|
+
target_door_finish_id: (_doorStyle$id2 = doorStyle === null || doorStyle === void 0 ? void 0 : doorStyle.id) !== null && _doorStyle$id2 !== void 0 ? _doorStyle$id2 : null,
|
|
77
61
|
long_name: (_item$long_name = item === null || item === void 0 ? void 0 : item.long_name) !== null && _item$long_name !== void 0 ? _item$long_name : null,
|
|
78
62
|
scene_cabinet_id: item.id
|
|
79
63
|
});
|
|
@@ -110,7 +94,7 @@ function _handleChangeDoorStyleEvent() {
|
|
|
110
94
|
// result is ccdf_list
|
|
111
95
|
function () {
|
|
112
96
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(result) {
|
|
113
|
-
var _result$ccdf_list, _doorStyle$
|
|
97
|
+
var _result$ccdf_list, _doorStyle$id, _result$molding_ccdf_;
|
|
114
98
|
var mappedCabinetDefinitionList, rt;
|
|
115
99
|
return _regeneratorRuntime.wrap(function (_context) {
|
|
116
100
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -128,7 +112,7 @@ function _handleChangeDoorStyleEvent() {
|
|
|
128
112
|
// Persist ccdf on affected instances so SYNC includes the latest ccdf.id for each item.
|
|
129
113
|
// IMPORTANT: host response `ccdf_list[]` may not include `door_finish_id`.
|
|
130
114
|
// Use request door_finish_id (doorStyle.id) as the source of truth for door_finish_id.
|
|
131
|
-
props.itemsActions.setItemsCCDF((_result$ccdf_list = result === null || result === void 0 ? void 0 : result.ccdf_list) !== null && _result$ccdf_list !== void 0 ? _result$ccdf_list : [], applyScope, itemIds, (_doorStyle$
|
|
115
|
+
props.itemsActions.setItemsCCDF((_result$ccdf_list = result === null || result === void 0 ? void 0 : result.ccdf_list) !== null && _result$ccdf_list !== void 0 ? _result$ccdf_list : [], applyScope, itemIds, (_doorStyle$id = doorStyle === null || doorStyle === void 0 ? void 0 : doorStyle.id) !== null && _doorStyle$id !== void 0 ? _doorStyle$id : null);
|
|
132
116
|
props.itemsActions.setMoldingsCCDF((_result$molding_ccdf_ = result === null || result === void 0 ? void 0 : result.molding_ccdf_list) !== null && _result$molding_ccdf_ !== void 0 ? _result$molding_ccdf_ : [], applyScope);
|
|
133
117
|
props.itemsActions.setDoorStyle(doorStyle, itemCDS, applyScope, itemIds);
|
|
134
118
|
case 2:
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
+
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
2
3
|
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
3
4
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
4
5
|
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; }
|
|
@@ -7,19 +8,21 @@ import { convert } from "../../utils/convert-units-lite";
|
|
|
7
8
|
import { INTERNAL_EVENT_ITEMS_CATALOG } from "../../constants";
|
|
8
9
|
import { Scene, State } from "../../models";
|
|
9
10
|
import { asyncPool } from "../../shared/concurrency/async-pool";
|
|
11
|
+
import { prepareMoldingCCDFList } from "./handleExternalEvent.util";
|
|
12
|
+
import { isEmpty } from "../../components/viewer2d/utils";
|
|
10
13
|
export function handleLoadProjectEvent(_x, _x2, _x3, _x4, _x5, _x6, _x7, _x8) {
|
|
11
14
|
return _handleLoadProjectEvent.apply(this, arguments);
|
|
12
15
|
}
|
|
13
16
|
function _handleLoadProjectEvent() {
|
|
14
17
|
_handleLoadProjectEvent = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(props, state, evt, mapFromCCDFToCDS, updateProjectWithCDSList, ccdfMapper, mergeSameElements, addItemToCatalog) {
|
|
15
|
-
var layerName, _evt$payload$layers$l, _evt$payload, _state$catalog, ccdf_list, items, newScene, tempState, _props$onInternalEven;
|
|
18
|
+
var layerName, _evt$payload$layers$l, _evt$payload, _state$catalog, ccdf_list, molding_ccdf_list, items, newScene, tempState, _props$onInternalEven;
|
|
16
19
|
return _regeneratorRuntime.wrap(function (_context2) {
|
|
17
20
|
while (1) switch (_context2.prev = _context2.next) {
|
|
18
21
|
case 0:
|
|
19
22
|
layerName = 'layer-1';
|
|
20
23
|
if (evt !== null && evt !== void 0 && evt.payload) {
|
|
21
24
|
// prepare item data request
|
|
22
|
-
ccdf_list = [];
|
|
25
|
+
ccdf_list = [], molding_ccdf_list = [];
|
|
23
26
|
items = (_evt$payload$layers$l = evt === null || evt === void 0 || (_evt$payload = evt.payload) === null || _evt$payload === void 0 || (_evt$payload = _evt$payload.layers[layerName]) === null || _evt$payload === void 0 ? void 0 : _evt$payload.items) !== null && _evt$payload$layers$l !== void 0 ? _evt$payload$layers$l : {};
|
|
24
27
|
Object.keys(items).forEach(function (k) {
|
|
25
28
|
var _it$properties, _it$properties2, _it$properties3;
|
|
@@ -43,6 +46,7 @@ function _handleLoadProjectEvent() {
|
|
|
43
46
|
long_name: (_it$long_name = it === null || it === void 0 ? void 0 : it.long_name) !== null && _it$long_name !== void 0 ? _it$long_name : null,
|
|
44
47
|
scene_cabinet_id: it.id
|
|
45
48
|
});
|
|
49
|
+
if (!isEmpty(it.doorStyle) && !isEmpty(it.molding)) molding_ccdf_list.push.apply(molding_ccdf_list, _toConsumableArray(prepareMoldingCCDFList(it.doorStyle, it.molding)));
|
|
46
50
|
}
|
|
47
51
|
});
|
|
48
52
|
newScene = new Scene(evt === null || evt === void 0 ? void 0 : evt.payload);
|
|
@@ -55,7 +59,8 @@ function _handleLoadProjectEvent() {
|
|
|
55
59
|
type: INTERNAL_EVENT_ITEMS_CATALOG,
|
|
56
60
|
value: {
|
|
57
61
|
event_type: 'load_project',
|
|
58
|
-
ccdf_list: ccdf_list
|
|
62
|
+
ccdf_list: ccdf_list,
|
|
63
|
+
molding_ccdf_list: molding_ccdf_list
|
|
59
64
|
}
|
|
60
65
|
}, /*#__PURE__*/function () {
|
|
61
66
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(result) {
|
|
@@ -99,6 +104,7 @@ function _handleLoadProjectEvent() {
|
|
|
99
104
|
});
|
|
100
105
|
case 1:
|
|
101
106
|
props.projectActions.loadProject(evt.payload);
|
|
107
|
+
props.itemsActions.setMoldingsCCDF(result === null || result === void 0 ? void 0 : result.molding_ccdf_list, 'all');
|
|
102
108
|
case 2:
|
|
103
109
|
case "end":
|
|
104
110
|
return _context.stop();
|
|
@@ -13,7 +13,7 @@ function _handleSetMolding() {
|
|
|
13
13
|
_context.next = 1;
|
|
14
14
|
return loadMoldingSvg(moldingInfo);
|
|
15
15
|
case 1:
|
|
16
|
-
props.itemsActions.setMolding(moldingInfo, isGlobal);
|
|
16
|
+
props.itemsActions.setMolding(moldingInfo, isGlobal, props.onInternalEvent);
|
|
17
17
|
case 2:
|
|
18
18
|
case "end":
|
|
19
19
|
return _context.stop();
|