kitchen-simulator 4.1.1-react-18 → 4.1.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.
- package/README.md +3 -0
- package/es/AppContext.js +1 -1
- package/es/LiteKitchenConfigurator.js +162 -111
- package/es/LiteRenderer.js +161 -129
- package/es/actions/export.js +25 -12
- package/es/assets/gltf/door_sliding.bin +0 -0
- package/es/assets/img/svg/bottombar/elevation.svg +12 -5
- package/es/catalog/catalog.js +21 -5
- package/es/catalog/factories/area-factory-3d.js +17 -17
- package/es/catalog/factories/wall-factory.js +1 -1
- package/es/catalog/holes/window-clear/planner-element.js +2 -2
- package/es/catalog/properties/export.js +21 -0
- package/es/catalog/properties/property-checkbox.js +68 -0
- package/es/catalog/properties/property-color.js +39 -0
- package/es/catalog/properties/property-enum.js +50 -0
- package/es/catalog/properties/property-hidden.js +19 -0
- package/es/catalog/properties/property-lenght-measure.js +100 -0
- package/es/catalog/properties/property-length-measure.js +84 -0
- package/es/catalog/properties/property-length-measure_hole.js +100 -0
- package/es/catalog/properties/property-number.js +48 -0
- package/es/catalog/properties/property-read-only.js +26 -0
- package/es/catalog/properties/property-string.js +48 -0
- package/es/catalog/properties/property-toggle.js +39 -0
- package/es/catalog/properties/shared-property-style.js +14 -0
- package/es/catalog/utils/exporter.js +24 -11
- package/es/catalog/utils/item-loader.js +222 -213
- package/es/class/hole.js +0 -2
- package/es/class/item.js +89 -70
- package/es/class/layer.js +1 -1
- package/es/class/line.js +4 -8
- package/es/class/project.js +97 -80
- package/es/components/content.js +5 -93
- package/es/components/export.js +4 -6
- package/es/components/style/button.js +106 -0
- package/es/components/style/cancel-button.js +21 -0
- package/es/components/style/content-container.js +30 -0
- package/es/components/style/content-title.js +25 -0
- package/es/components/style/delete-button.js +24 -0
- package/es/components/style/export.js +28 -2
- package/es/components/style/form-block.js +20 -0
- package/es/components/style/form-color-input.js +26 -0
- package/es/components/style/form-label.js +22 -0
- package/es/components/style/form-number-input.js +29 -27
- package/es/components/style/form-number-input_2.js +200 -0
- package/es/components/style/form-select.js +19 -0
- package/es/components/style/form-slider.js +60 -0
- package/es/components/style/form-submit-button.js +25 -0
- package/es/components/style/form-text-input.js +69 -0
- package/es/components/viewer2d/grids/grid-streak.js +1 -1
- package/es/components/viewer2d/group.js +5 -4
- package/es/components/viewer2d/item.js +155 -359
- package/es/components/viewer2d/layer.js +1 -1
- package/es/components/viewer2d/line.js +22 -52
- package/es/components/viewer2d/ruler.js +16 -11
- package/es/components/viewer2d/rulerDist.js +38 -51
- package/es/components/viewer2d/rulerX.js +4 -2
- package/es/components/viewer2d/rulerY.js +3 -0
- package/es/components/viewer2d/scene.js +17 -12
- package/es/components/viewer2d/state.js +1 -1
- package/es/components/viewer2d/utils.js +2 -2
- package/es/components/viewer2d/vertex.js +3 -2
- package/es/components/viewer2d/viewer2d.js +56 -87
- package/es/components/viewer3d/ruler-utils/scene3D.js +1 -1
- package/es/components/viewer3d/scene-creator.js +255 -58
- package/es/components/viewer3d/viewer3d-first-person.js +24 -26
- package/es/components/viewer3d/viewer3d.js +103 -124
- package/es/constants.js +7 -2
- package/es/devLiteRenderer.js +491 -150
- package/es/index.js +588 -23
- package/es/models.js +13 -8
- package/es/plugins/SVGLoader.js +1414 -0
- package/es/plugins/console-debugger.js +34 -0
- package/es/plugins/export.js +7 -0
- package/es/plugins/keyboard.js +110 -0
- package/es/reducers/project-reducer.js +3 -0
- package/es/reducers/viewer2d-reducer.js +3 -1
- package/es/reducers/viewer3d-reducer.js +3 -1
- package/es/styles/export.js +5 -0
- package/es/styles/tabs.css +40 -0
- package/es/utils/geometry.js +77 -119
- package/es/utils/helper.js +38 -1
- package/es/utils/isolate-event-handler.js +827 -607
- package/es/utils/molding.js +459 -11
- package/es/utils/ruler.js +58 -0
- package/lib/AppContext.js +1 -1
- package/lib/LiteKitchenConfigurator.js +161 -111
- package/lib/LiteRenderer.js +160 -129
- package/lib/actions/export.js +35 -39
- package/lib/assets/gltf/door_sliding.bin +0 -0
- package/lib/assets/img/svg/bottombar/elevation.svg +12 -5
- package/lib/catalog/catalog.js +20 -4
- package/lib/catalog/factories/area-factory-3d.js +14 -14
- package/lib/catalog/factories/wall-factory.js +1 -1
- package/lib/catalog/holes/window-clear/planner-element.js +2 -2
- package/lib/catalog/properties/export.js +81 -0
- package/lib/catalog/properties/property-checkbox.js +76 -0
- package/lib/catalog/properties/property-color.js +47 -0
- package/lib/catalog/properties/property-enum.js +58 -0
- package/lib/catalog/properties/property-hidden.js +27 -0
- package/lib/catalog/properties/property-lenght-measure.js +108 -0
- package/lib/catalog/properties/property-length-measure.js +92 -0
- package/lib/catalog/properties/property-length-measure_hole.js +108 -0
- package/lib/catalog/properties/property-number.js +56 -0
- package/lib/catalog/properties/property-read-only.js +34 -0
- package/lib/catalog/properties/property-string.js +56 -0
- package/lib/catalog/properties/property-toggle.js +47 -0
- package/lib/catalog/properties/shared-property-style.js +21 -0
- package/lib/catalog/utils/exporter.js +24 -11
- package/lib/catalog/utils/item-loader.js +219 -210
- package/lib/class/hole.js +0 -2
- package/lib/class/item.js +87 -68
- package/lib/class/layer.js +1 -1
- package/lib/class/line.js +3 -7
- package/lib/class/project.js +97 -80
- package/lib/components/content.js +5 -93
- package/lib/components/export.js +6 -26
- package/lib/components/style/button.js +115 -0
- package/lib/components/style/cancel-button.js +29 -0
- package/lib/components/style/content-container.js +38 -0
- package/lib/components/style/content-title.js +35 -0
- package/lib/components/style/delete-button.js +34 -0
- package/lib/components/style/export.js +105 -1
- package/lib/components/style/form-block.js +28 -0
- package/lib/components/style/form-color-input.js +34 -0
- package/lib/components/style/form-label.js +30 -0
- package/lib/components/style/form-number-input.js +29 -27
- package/lib/components/style/form-number-input_2.js +209 -0
- package/lib/components/style/form-select.js +29 -0
- package/lib/components/style/form-slider.js +68 -0
- package/lib/components/style/form-submit-button.js +35 -0
- package/lib/components/style/form-text-input.js +78 -0
- package/lib/components/viewer2d/grids/grid-streak.js +1 -1
- package/lib/components/viewer2d/group.js +5 -4
- package/lib/components/viewer2d/item.js +152 -356
- package/lib/components/viewer2d/layer.js +1 -1
- package/lib/components/viewer2d/line.js +22 -52
- package/lib/components/viewer2d/ruler.js +15 -10
- package/lib/components/viewer2d/rulerDist.js +38 -51
- package/lib/components/viewer2d/rulerX.js +4 -2
- package/lib/components/viewer2d/rulerY.js +3 -0
- package/lib/components/viewer2d/scene.js +17 -12
- package/lib/components/viewer2d/state.js +1 -1
- package/lib/components/viewer2d/utils.js +2 -2
- package/lib/components/viewer2d/vertex.js +3 -2
- package/lib/components/viewer2d/viewer2d.js +54 -84
- package/lib/components/viewer3d/ruler-utils/scene3D.js +1 -1
- package/lib/components/viewer3d/scene-creator.js +252 -55
- package/lib/components/viewer3d/viewer3d-first-person.js +24 -26
- package/lib/components/viewer3d/viewer3d.js +100 -120
- package/lib/constants.js +12 -7
- package/lib/devLiteRenderer.js +489 -148
- package/lib/index.js +590 -23
- package/lib/models.js +13 -8
- package/lib/plugins/SVGLoader.js +1419 -0
- package/lib/plugins/console-debugger.js +42 -0
- package/lib/plugins/export.js +25 -0
- package/lib/plugins/keyboard.js +117 -0
- package/lib/reducers/project-reducer.js +3 -0
- package/lib/reducers/viewer2d-reducer.js +3 -1
- package/lib/reducers/viewer3d-reducer.js +3 -1
- package/lib/styles/export.js +13 -0
- package/lib/styles/tabs.css +40 -0
- package/lib/utils/geometry.js +77 -119
- package/lib/utils/helper.js +40 -1
- package/lib/utils/isolate-event-handler.js +827 -606
- package/lib/utils/molding.js +460 -9
- package/lib/utils/ruler.js +63 -0
- package/package.json +20 -15
- package/es/mocks/appliancePayload.json +0 -27
- package/es/mocks/cabinetPayload.json +0 -1914
- package/es/mocks/cabinetPayload2.json +0 -76
- package/es/mocks/dataBundle2.json +0 -4
- package/es/mocks/distancePayload.json +0 -6
- package/es/mocks/doorStylePayload2.json +0 -84
- package/es/mocks/furnishingPayload.json +0 -23
- package/es/mocks/itemCDSPayload.json +0 -27
- package/es/mocks/lightingPayload.json +0 -23
- package/es/mocks/mockProps.json +0 -43
- package/es/mocks/mockProps2.json +0 -9
- package/es/mocks/moldingPayload.json +0 -19
- package/es/mocks/projectItemsCatalog.json +0 -133
- package/es/mocks/rectangleShape.json +0 -238
- package/es/mocks/replaceCabinetPayload.json +0 -81
- package/es/mocks/roomShapePayload.json +0 -5
- package/es/useAppContext.js +0 -8
- package/lib/mocks/appliancePayload.json +0 -27
- package/lib/mocks/cabinetPayload.json +0 -1914
- package/lib/mocks/cabinetPayload2.json +0 -76
- package/lib/mocks/dataBundle2.json +0 -4
- package/lib/mocks/distancePayload.json +0 -6
- package/lib/mocks/doorStylePayload2.json +0 -84
- package/lib/mocks/furnishingPayload.json +0 -23
- package/lib/mocks/itemCDSPayload.json +0 -27
- package/lib/mocks/lightingPayload.json +0 -23
- package/lib/mocks/mockProps.json +0 -43
- package/lib/mocks/mockProps2.json +0 -9
- package/lib/mocks/moldingPayload.json +0 -19
- package/lib/mocks/projectItemsCatalog.json +0 -133
- package/lib/mocks/rectangleShape.json +0 -238
- package/lib/mocks/replaceCabinetPayload.json +0 -81
- package/lib/mocks/roomShapePayload.json +0 -5
- package/lib/useAppContext.js +0 -16
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
1
2
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
3
|
import _typeof from "@babel/runtime/helpers/esm/typeof";
|
|
3
4
|
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
@@ -5,7 +6,7 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
|
|
|
5
6
|
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; }
|
|
6
7
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
7
8
|
import { Map } from 'immutable';
|
|
8
|
-
import { EXTERNAL_EVENT_ADD_WALL, EXTERNAL_EVENT_TOGGLE_TO_3D, EXTERNAL_EVENT_TOGGLE_TO_2D, EXTERNAL_EVENT_TOGGLE_TO_ELEVATION, EXTERNAL_EVENT_MOVE_PAN, MODE_IDLE, MODE_2D_PAN, EXTERNAL_EVENT_ADD_ITEM, ARRAY_3D_MODES, MODE_IDLE_3D, MODE_ELEVATION_VIEW, MODE_DRAWING_LINE, TOP, BOTTOM, LEFT, RIGHT, EXTERNAL_EVENT_NEW_PROJECT, EXTERNAL_EVENT_CHANGE_DOORSTYLE, EXTERNAL_EVENT_ADD_ROOM_SHAPE, EXTERNAL_EVENT_ZOOM_IN, EXTERNAL_EVENT_ZOOM_OUT, EXTERNAL_EVENT_UNDO, EXTERNAL_EVENT_REDO, EXTERNAL_EVENT_SET_MOLDING, EXTERNAL_EVENT_PROJECT_SETTING, PROJECT_SETTING_OPTION, EXTERNAL_EVENT_SYNC_SCENE, INTERNAL_EVENT_SYNC_SCENE, EXTERNAL_EVENT_UPDATE_ATTRIBUTE, ATT_ITEM_POS, ATT_LINE_LENGTH, ATT_VERTEXT_ONE, ATT_VERTEXT_TWO, ATT_HOLE_OFFSET_A, ATT_HOLE_OFFSET_B, UNIT_CENTIMETER, UNIT_INCH, EXTERNAL_EVENT_UPDATE_PROPERTY, PROP_FLIP_DOOR_HANDLE, PROP_OPEN_DOORS, EXTERNAL_EVENT_LOAD_PROJECT, INTERNAL_EVENT_ITEMS_CATALOG, EXTERNAL_EVENT_ADD_HOLE, EXTERNAL_EVENT_CENTERING_2D, EXTERNAL_EVENT_DUPLICATE_ELEMENT, EXTERNAL_EVENT_DELETE_ELEMENT, ELEMENT_HOLE, ELEMENT_ITEM, ELEMENT_LINE, EXTERNAL_EVENT_REPLACE_CABINET, FINISHING_TYPE, EXTERNAL_EVENT_SET_FINISHING } from "../constants";
|
|
9
|
+
import { EXTERNAL_EVENT_ADD_WALL, EXTERNAL_EVENT_TOGGLE_TO_3D, EXTERNAL_EVENT_TOGGLE_TO_2D, EXTERNAL_EVENT_TOGGLE_TO_ELEVATION, EXTERNAL_EVENT_MOVE_PAN, MODE_IDLE, MODE_2D_PAN, EXTERNAL_EVENT_ADD_ITEM, ARRAY_3D_MODES, MODE_IDLE_3D, MODE_ELEVATION_VIEW, MODE_DRAWING_LINE, TOP, BOTTOM, LEFT, RIGHT, EXTERNAL_EVENT_NEW_PROJECT, EXTERNAL_EVENT_CHANGE_DOORSTYLE, EXTERNAL_EVENT_ADD_ROOM_SHAPE, EXTERNAL_EVENT_ZOOM_IN, EXTERNAL_EVENT_ZOOM_OUT, EXTERNAL_EVENT_UNDO, EXTERNAL_EVENT_REDO, EXTERNAL_EVENT_SET_MOLDING, EXTERNAL_EVENT_PROJECT_SETTING, PROJECT_SETTING_OPTION, EXTERNAL_EVENT_SYNC_SCENE, INTERNAL_EVENT_SYNC_SCENE, EXTERNAL_EVENT_UPDATE_ATTRIBUTE, ATT_ITEM_POS, ATT_LINE_LENGTH, ATT_VERTEXT_ONE, ATT_VERTEXT_TWO, ATT_HOLE_OFFSET_A, ATT_HOLE_OFFSET_B, UNIT_CENTIMETER, UNIT_INCH, EXTERNAL_EVENT_UPDATE_PROPERTY, PROP_FLIP_DOOR_HANDLE, PROP_OPEN_DOORS, EXTERNAL_EVENT_LOAD_PROJECT, INTERNAL_EVENT_ITEMS_CATALOG, EXTERNAL_EVENT_ADD_HOLE, EXTERNAL_EVENT_CENTERING_2D, EXTERNAL_EVENT_DUPLICATE_ELEMENT, EXTERNAL_EVENT_DELETE_ELEMENT, ELEMENT_HOLE, ELEMENT_ITEM, ELEMENT_LINE, EXTERNAL_EVENT_REPLACE_CABINET, FINISHING_TYPE, EXTERNAL_EVENT_SET_FINISHING, EXTERNAL_EVENT_ROTATE_PAN } from "../constants";
|
|
9
10
|
import { isEmpty, updateViwer2D, centering2D } from "./helper";
|
|
10
11
|
import exporter from "../catalog/utils/exporter";
|
|
11
12
|
import { render2DItem, render3DItem, render3DApplianceItem, render3DLightingItem } from "../catalog/utils/item-loader";
|
|
@@ -13,35 +14,66 @@ import { convert } from "./convert-units-lite";
|
|
|
13
14
|
import { GeometryUtils, MathUtils } from "./export";
|
|
14
15
|
import { returnReplaceableDeepSearchType } from "../components/viewer2d/utils";
|
|
15
16
|
import { SVGLoader } from 'three/addons/loaders/SVGLoader';
|
|
17
|
+
import { getMoldingDataOfScene2 } from "./molding";
|
|
18
|
+
import { Scene, State } from "../models";
|
|
16
19
|
var PRECISION = 2;
|
|
20
|
+
|
|
21
|
+
// ---- compatibility: supports old + optimized props shapes ----
|
|
22
|
+
export function getPlannerStateFromProps(props) {
|
|
23
|
+
var _props$state;
|
|
24
|
+
// New optimized path
|
|
25
|
+
if (props !== null && props !== void 0 && props.extractedState) return props.extractedState;
|
|
26
|
+
|
|
27
|
+
// Old path
|
|
28
|
+
if (props !== null && props !== void 0 && (_props$state = props.state) !== null && _props$state !== void 0 && _props$state.get) {
|
|
29
|
+
var kc = props.state.get('KitchenConfigurator');
|
|
30
|
+
if (kc) return kc;
|
|
31
|
+
}
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// ---- caches: avoid re-fetch/re-parse costs (no behavior change) ----
|
|
36
|
+
var __jsonCache = new Map(); // url -> Promise<any>
|
|
37
|
+
var __svgCache = new Map(); // url -> Promise<svgData|null>
|
|
17
38
|
function loadJSON(_x) {
|
|
18
39
|
return _loadJSON.apply(this, arguments);
|
|
19
40
|
}
|
|
20
41
|
/********Parse TempPlaceholder from cabinetPayloadData **************/
|
|
21
42
|
function _loadJSON() {
|
|
22
|
-
_loadJSON = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function
|
|
23
|
-
|
|
24
|
-
|
|
43
|
+
_loadJSON = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(path) {
|
|
44
|
+
var p;
|
|
45
|
+
return _regeneratorRuntime.wrap(function (_context3) {
|
|
46
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
25
47
|
case 0:
|
|
26
|
-
|
|
48
|
+
if (path) {
|
|
49
|
+
_context3.next = 1;
|
|
50
|
+
break;
|
|
51
|
+
}
|
|
52
|
+
return _context3.abrupt("return", null);
|
|
53
|
+
case 1:
|
|
54
|
+
if (!__jsonCache.has(path)) {
|
|
55
|
+
_context3.next = 2;
|
|
56
|
+
break;
|
|
57
|
+
}
|
|
58
|
+
return _context3.abrupt("return", __jsonCache.get(path));
|
|
59
|
+
case 2:
|
|
60
|
+
p = new Promise(function (resolve, reject) {
|
|
27
61
|
var xhr = new XMLHttpRequest();
|
|
28
62
|
xhr.onreadystatechange = function () {
|
|
29
63
|
if (xhr.readyState === XMLHttpRequest.DONE) {
|
|
30
|
-
if (xhr.status === 200)
|
|
31
|
-
resolve(JSON.parse(xhr.responseText));
|
|
32
|
-
} else {
|
|
33
|
-
reject(xhr);
|
|
34
|
-
}
|
|
64
|
+
if (xhr.status === 200) resolve(JSON.parse(xhr.responseText));else reject(xhr);
|
|
35
65
|
}
|
|
36
66
|
};
|
|
37
67
|
xhr.open('GET', path, true);
|
|
38
68
|
xhr.send();
|
|
39
|
-
})
|
|
40
|
-
|
|
69
|
+
});
|
|
70
|
+
__jsonCache.set(path, p);
|
|
71
|
+
return _context3.abrupt("return", p);
|
|
72
|
+
case 3:
|
|
41
73
|
case "end":
|
|
42
|
-
return
|
|
74
|
+
return _context3.stop();
|
|
43
75
|
}
|
|
44
|
-
},
|
|
76
|
+
}, _callee3);
|
|
45
77
|
}));
|
|
46
78
|
return _loadJSON.apply(this, arguments);
|
|
47
79
|
}
|
|
@@ -50,10 +82,10 @@ function parseTempPlaceholdersFromCabinetPayload(_x2) {
|
|
|
50
82
|
}
|
|
51
83
|
/***** Update cabinetPayloadData with updatedTempPlaceholders *****/
|
|
52
84
|
function _parseTempPlaceholdersFromCabinetPayload() {
|
|
53
|
-
_parseTempPlaceholdersFromCabinetPayload = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function
|
|
54
|
-
var link, keys, temp, i, _cabinetPayload$struc, _cabinetPayload$struc2,
|
|
55
|
-
return _regeneratorRuntime.wrap(function (
|
|
56
|
-
while (1) switch (
|
|
85
|
+
_parseTempPlaceholdersFromCabinetPayload = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4(cabinetPayload) {
|
|
86
|
+
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;
|
|
87
|
+
return _regeneratorRuntime.wrap(function (_context5) {
|
|
88
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
57
89
|
case 0:
|
|
58
90
|
link = '';
|
|
59
91
|
keys = Object.keys(cabinetPayload.structure_json);
|
|
@@ -61,335 +93,358 @@ function _parseTempPlaceholdersFromCabinetPayload() {
|
|
|
61
93
|
i = 0;
|
|
62
94
|
case 1:
|
|
63
95
|
if (!(i < keys.length)) {
|
|
64
|
-
|
|
96
|
+
_context5.next = 4;
|
|
65
97
|
break;
|
|
66
98
|
}
|
|
67
99
|
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'))) {
|
|
68
|
-
|
|
100
|
+
_context5.next = 3;
|
|
69
101
|
break;
|
|
70
102
|
}
|
|
71
103
|
link = cabinetPayload.structure_json[keys[i]];
|
|
72
104
|
_t2 = temp;
|
|
73
105
|
_t3 = keys[i];
|
|
74
|
-
|
|
106
|
+
_context5.next = 2;
|
|
75
107
|
return loadJSON(link);
|
|
76
108
|
case 2:
|
|
77
|
-
_t4 =
|
|
109
|
+
_t4 = _context5.sent;
|
|
78
110
|
_t2.push.call(_t2, {
|
|
79
111
|
name: _t3,
|
|
80
112
|
data: _t4
|
|
81
113
|
});
|
|
82
114
|
case 3:
|
|
83
115
|
i++;
|
|
84
|
-
|
|
116
|
+
_context5.next = 1;
|
|
85
117
|
break;
|
|
86
118
|
case 4:
|
|
87
|
-
el = cabinetPayload.structure_json.tempPlaceholders[0].id;
|
|
88
119
|
tempPlaceholdersData = [];
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
});
|
|
108
|
-
if (tempPlaceholders.length > 0) {
|
|
109
|
-
if (t.name === 'base') {
|
|
110
|
-
tempPlaceholders.map(function (element) {
|
|
111
|
-
var sink_match = element.name.match(/\d_(sink_[^LR12]*)(_[LR12])?$/);
|
|
112
|
-
if (sink_match && sink_match.length >= 2) {
|
|
113
|
-
var _process$env$API_URL, _cabinetPayload$struc3;
|
|
114
|
-
tempData['sink'] = tempData['sink'] || [];
|
|
115
|
-
tempData['sink'].push(element.name);
|
|
116
|
-
var sink_url = (_process$env$API_URL = process.env.API_URL) !== null && _process$env$API_URL !== void 0 ? _process$env$API_URL :
|
|
117
|
-
// server url from 3DTool env
|
|
118
|
-
import.meta.env.VITE_APP_API_URL + // server url from Host env
|
|
119
|
-
"/uploads/assets/default/".concat(sink_match[1], ".gltf");
|
|
120
|
-
if (cabinetPayload !== null && cabinetPayload !== void 0 && (_cabinetPayload$struc3 = cabinetPayload.structure_json) !== null && _cabinetPayload$struc3 !== void 0 && (_cabinetPayload$struc3 = _cabinetPayload$struc3.tempPlaceholders[0]) !== null && _cabinetPayload$struc3 !== void 0 && _cabinetPayload$struc3.structure) cabinetPayload.structure_json.tempPlaceholders[0].structure.sink = sink_url;
|
|
121
|
-
} else if (temp.some(function (felement) {
|
|
122
|
-
return felement.name.includes('base_drawer');
|
|
123
|
-
}) && element.name.includes('interior_drawer')) {
|
|
124
|
-
var objCnt = temp.filter(function (felement) {
|
|
125
|
-
return felement.name.includes('base_drawer') && !felement.name.includes('_door');
|
|
126
|
-
}).length;
|
|
127
|
-
var phCnt = tempPlaceholders.filter(function (felement) {
|
|
128
|
-
return felement.name.includes('interior');
|
|
129
|
-
}).length;
|
|
130
|
-
drawerPHs = phCnt;
|
|
131
|
-
if (objCnt === 1 || phCnt % objCnt !== 0) {
|
|
132
|
-
if (tempData['base_drawer_1'] === undefined) {
|
|
133
|
-
tempData['base_drawer_1'] = [];
|
|
134
|
-
}
|
|
135
|
-
tempData['base_drawer_1'].push(element.name);
|
|
136
|
-
drawerKey++;
|
|
137
|
-
} else if (objCnt > 1 && phCnt % objCnt === 0) {
|
|
138
|
-
if (tempData['base_drawer_' + (drawerKey % objCnt + 1)] === undefined) {
|
|
139
|
-
tempData['base_drawer_' + (drawerKey % objCnt + 1)] = [];
|
|
140
|
-
}
|
|
141
|
-
tempData['base_drawer_' + (drawerKey % objCnt + 1)].push(element.name);
|
|
142
|
-
drawerKey++;
|
|
143
|
-
}
|
|
144
|
-
} else if (temp.some(function (felement) {
|
|
145
|
-
return felement.name.includes('base_door');
|
|
146
|
-
}) && !element.name.includes('interior_drawer') && !element.name.includes('drawer') && element.name.includes('door')) {
|
|
147
|
-
var _objCnt = temp.filter(function (felement) {
|
|
148
|
-
return felement.name.includes('base_door');
|
|
149
|
-
}).length;
|
|
150
|
-
var _phCnt = tempPlaceholders.filter(function (felement) {
|
|
151
|
-
return !felement.name.includes('interior') && !felement.name.includes('drawer') && felement.name.includes('door');
|
|
152
|
-
}).length;
|
|
153
|
-
doorPHs = _phCnt;
|
|
154
|
-
if (_objCnt === 1 || _phCnt % _objCnt !== 0) {
|
|
155
|
-
if (tempData['base_door_1'] === undefined) {
|
|
156
|
-
tempData['base_door_1'] = [];
|
|
157
|
-
}
|
|
158
|
-
tempData['base_door_1'].push(element.name);
|
|
159
|
-
doorKey++;
|
|
160
|
-
} else if (_objCnt > 1) {
|
|
161
|
-
if (tempData['base_door_' + (doorKey % _objCnt + 1)] === undefined) {
|
|
162
|
-
tempData['base_door_' + (doorKey % _objCnt + 1)] = [];
|
|
163
|
-
}
|
|
164
|
-
tempData['base_door_' + (doorKey % _objCnt + 1)].push(element.name);
|
|
165
|
-
doorKey++;
|
|
166
|
-
}
|
|
167
|
-
} else if (temp.some(function (felement) {
|
|
168
|
-
return felement.name.includes('base_fixed_drawer_door');
|
|
169
|
-
}) && element.name.includes('_drawer_door_fixed')) {
|
|
170
|
-
var _objCnt2 = temp.filter(function (felement) {
|
|
171
|
-
return felement.name.includes('base_fixed_drawer_door');
|
|
172
|
-
}).length;
|
|
173
|
-
var _phCnt2 = tempPlaceholders.filter(function (felement) {
|
|
174
|
-
return felement.name.includes('_drawer_door_fixed');
|
|
175
|
-
}).length;
|
|
176
|
-
fixedPHs = _phCnt2;
|
|
177
|
-
if (_objCnt2 === 1 || _phCnt2 % _objCnt2 !== 0) {
|
|
178
|
-
if (tempData['base_fixed_drawer_door_1'] === undefined) {
|
|
179
|
-
tempData['base_fixed_drawer_door_1'] = [];
|
|
180
|
-
}
|
|
181
|
-
tempData['base_fixed_drawer_door_1'].push(element.name);
|
|
182
|
-
fixedKey++;
|
|
183
|
-
} else if (_objCnt2 > 1) {
|
|
184
|
-
if (tempData['base_fixed_drawer_door_' + (fixedKey % _objCnt2 + 1)] === undefined) {
|
|
185
|
-
tempData['base_fixed_drawer_door_' + (fixedKey % _objCnt2 + 1)] = [];
|
|
186
|
-
}
|
|
187
|
-
tempData['base_fixed_drawer_door_' + (fixedKey % _objCnt2 + 1)].push(element.name);
|
|
188
|
-
fixedKey++;
|
|
120
|
+
_loop3 = /*#__PURE__*/_regeneratorRuntime.mark(function _loop3(k) {
|
|
121
|
+
var el;
|
|
122
|
+
return _regeneratorRuntime.wrap(function (_context4) {
|
|
123
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
124
|
+
case 0:
|
|
125
|
+
el = cabinetPayload.structure_json.tempPlaceholders[k].id;
|
|
126
|
+
tempData = {};
|
|
127
|
+
doorKey = 0;
|
|
128
|
+
drawerKey = 0;
|
|
129
|
+
fixedKey = 0;
|
|
130
|
+
doorPHs = 0;
|
|
131
|
+
drawerPHs = 0;
|
|
132
|
+
has_single_door = false;
|
|
133
|
+
fixedPHs = 0;
|
|
134
|
+
temp.forEach(function (t, index) {
|
|
135
|
+
var nodes = t.data.nodes;
|
|
136
|
+
if (nodes === undefined) {
|
|
137
|
+
nodes = [];
|
|
189
138
|
}
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
} else if (t.name.includes('base_drawer') && !t.name.includes('_door')) {
|
|
193
|
-
var objCnt = temp.filter(function (felement) {
|
|
194
|
-
return felement.name.includes('base_drawer') && !felement.name.includes('_door');
|
|
195
|
-
}).length;
|
|
196
|
-
if (objCnt === 1 || drawerPHs % objCnt !== 0) {
|
|
197
|
-
if (tempData['base_drawer_door_1'] === undefined) tempData['base_drawer_door_1'] = [];
|
|
198
|
-
//get drawer door handle placeholders
|
|
199
|
-
var ph_temp = temp.find(function (felement) {
|
|
200
|
-
return felement.name === 'base_drawer_door_1';
|
|
201
|
-
});
|
|
202
|
-
if (ph_temp != undefined) {
|
|
203
|
-
var ph_drawer_door_handle = ph_temp.data.nodes;
|
|
204
|
-
ph_drawer_door_handle = ph_drawer_door_handle.filter(function (element) {
|
|
205
|
-
return element.name.startsWith('ph_') && element.name.includes('handle');
|
|
139
|
+
var tempPlaceholders = nodes.filter(function (element) {
|
|
140
|
+
return element.name.startsWith('ph_');
|
|
206
141
|
});
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
return el === 'base_drawer_door_1/' + tempPlaceholders[0].name;
|
|
210
|
-
})) {
|
|
211
|
-
tempData['base_drawer_door_1'].push('base_drawer_1/' + tempPlaceholders[0].name);
|
|
212
|
-
//add drawer door handle placeholders
|
|
213
|
-
if (tempData['drawer_door_handle_1'] === undefined) tempData['drawer_door_handle_1'] = [];
|
|
214
|
-
if (ph_drawer_door_handle.length > 0) tempData['drawer_door_handle_1'].push('base_drawer_door_1/' + ph_drawer_door_handle[0].name);
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
} else if (objCnt > 1 && drawerPHs > 0 && drawerPHs % objCnt === 0) {
|
|
219
|
-
if (tempData['base_drawer_door' + t.name.slice(-2)] === undefined) tempData['base_drawer_door' + t.name.slice(-2)] = [];
|
|
220
|
-
//get drawer door handle placeholders
|
|
221
|
-
var ph_temp = temp.find(function (felement) {
|
|
222
|
-
return felement.name === 'base_drawer_door' + t.name.slice(-2);
|
|
223
|
-
});
|
|
224
|
-
if (ph_temp != undefined) {
|
|
225
|
-
var ph_drawer_door_handle = ph_temp.data.nodes;
|
|
226
|
-
ph_drawer_door_handle = ph_drawer_door_handle.filter(function (element) {
|
|
227
|
-
return element.name.startsWith('ph_') && element.name.includes('handle');
|
|
142
|
+
tempPlaceholders.sort(function (a, b) {
|
|
143
|
+
return a.name > b.name ? 1 : -1;
|
|
228
144
|
});
|
|
229
|
-
tempPlaceholders.
|
|
230
|
-
if (
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
145
|
+
if (tempPlaceholders.length > 0) {
|
|
146
|
+
if (t.name === 'base') {
|
|
147
|
+
tempPlaceholders.map(function (element) {
|
|
148
|
+
var sink_match = element.name.match(/\d_(sink_[^LR12]*)(_[LR12])?$/);
|
|
149
|
+
if (sink_match && sink_match.length >= 2) {
|
|
150
|
+
var _process$env$API_URL, _cabinetPayload$struc4;
|
|
151
|
+
tempData['sink'] = tempData['sink'] || [];
|
|
152
|
+
tempData['sink'].push(element.name);
|
|
153
|
+
var sink_url = (_process$env$API_URL = process.env.API_URL) !== null && _process$env$API_URL !== void 0 ? _process$env$API_URL :
|
|
154
|
+
// server url from 3DTool env
|
|
155
|
+
import.meta.env.VITE_APP_API_URL + // server url from Host env
|
|
156
|
+
"/uploads/assets/default/".concat(sink_match[1], ".gltf");
|
|
157
|
+
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;
|
|
158
|
+
} else if (temp.some(function (felement) {
|
|
159
|
+
return felement.name.includes('base_drawer');
|
|
160
|
+
}) && element.name.includes('interior_drawer')) {
|
|
161
|
+
var objCnt = temp.filter(function (felement) {
|
|
162
|
+
return felement.name.includes('base_drawer') && !felement.name.includes('_door');
|
|
163
|
+
}).length;
|
|
164
|
+
var phCnt = tempPlaceholders.filter(function (felement) {
|
|
165
|
+
return felement.name.includes('interior');
|
|
166
|
+
}).length;
|
|
167
|
+
drawerPHs = phCnt;
|
|
168
|
+
if (objCnt === 1 || phCnt % objCnt !== 0) {
|
|
169
|
+
if (tempData['base_drawer_1'] === undefined) {
|
|
170
|
+
tempData['base_drawer_1'] = [];
|
|
171
|
+
}
|
|
172
|
+
tempData['base_drawer_1'].push(element.name);
|
|
173
|
+
drawerKey++;
|
|
174
|
+
} else if (objCnt > 1 && phCnt % objCnt === 0) {
|
|
175
|
+
if (tempData['base_drawer_' + (drawerKey % objCnt + 1)] === undefined) {
|
|
176
|
+
tempData['base_drawer_' + (drawerKey % objCnt + 1)] = [];
|
|
177
|
+
}
|
|
178
|
+
tempData['base_drawer_' + (drawerKey % objCnt + 1)].push(element.name);
|
|
179
|
+
drawerKey++;
|
|
180
|
+
}
|
|
181
|
+
} else if (temp.some(function (felement) {
|
|
182
|
+
return felement.name.includes('base_door');
|
|
183
|
+
}) && !element.name.includes('interior_drawer') && !element.name.includes('drawer') && element.name.includes('door')) {
|
|
184
|
+
var _objCnt = temp.filter(function (felement) {
|
|
185
|
+
return felement.name.includes('base_door');
|
|
186
|
+
}).length;
|
|
187
|
+
var _phCnt = tempPlaceholders.filter(function (felement) {
|
|
188
|
+
return !felement.name.includes('interior') && !felement.name.includes('drawer') && felement.name.includes('door');
|
|
189
|
+
}).length;
|
|
190
|
+
doorPHs = _phCnt;
|
|
191
|
+
if (_objCnt === 1 || _phCnt % _objCnt !== 0) {
|
|
192
|
+
if (tempData['base_door_1'] === undefined) {
|
|
193
|
+
tempData['base_door_1'] = [];
|
|
194
|
+
}
|
|
195
|
+
tempData['base_door_1'].push(element.name);
|
|
196
|
+
doorKey++;
|
|
197
|
+
} else if (_objCnt > 1) {
|
|
198
|
+
if (tempData['base_door_' + (doorKey % _objCnt + 1)] === undefined) {
|
|
199
|
+
tempData['base_door_' + (doorKey % _objCnt + 1)] = [];
|
|
200
|
+
}
|
|
201
|
+
tempData['base_door_' + (doorKey % _objCnt + 1)].push(element.name);
|
|
202
|
+
doorKey++;
|
|
203
|
+
}
|
|
204
|
+
} else if (temp.some(function (felement) {
|
|
205
|
+
return felement.name.includes('base_fixed_drawer_door');
|
|
206
|
+
}) && element.name.includes('_drawer_door_fixed')) {
|
|
207
|
+
var _objCnt2 = temp.filter(function (felement) {
|
|
208
|
+
return felement.name.includes('base_fixed_drawer_door');
|
|
209
|
+
}).length;
|
|
210
|
+
var _phCnt2 = tempPlaceholders.filter(function (felement) {
|
|
211
|
+
return felement.name.includes('_drawer_door_fixed');
|
|
212
|
+
}).length;
|
|
213
|
+
fixedPHs = _phCnt2;
|
|
214
|
+
if (_objCnt2 === 1 || _phCnt2 % _objCnt2 !== 0) {
|
|
215
|
+
if (tempData['base_fixed_drawer_door_1'] === undefined) {
|
|
216
|
+
tempData['base_fixed_drawer_door_1'] = [];
|
|
217
|
+
}
|
|
218
|
+
tempData['base_fixed_drawer_door_1'].push(element.name);
|
|
219
|
+
fixedKey++;
|
|
220
|
+
} else if (_objCnt2 > 1) {
|
|
221
|
+
if (tempData['base_fixed_drawer_door_' + (fixedKey % _objCnt2 + 1)] === undefined) {
|
|
222
|
+
tempData['base_fixed_drawer_door_' + (fixedKey % _objCnt2 + 1)] = [];
|
|
223
|
+
}
|
|
224
|
+
tempData['base_fixed_drawer_door_' + (fixedKey % _objCnt2 + 1)].push(element.name);
|
|
225
|
+
fixedKey++;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
});
|
|
229
|
+
} else if (t.name.includes('base_drawer') && !t.name.includes('_door')) {
|
|
230
|
+
var objCnt = temp.filter(function (felement) {
|
|
231
|
+
return felement.name.includes('base_drawer') && !felement.name.includes('_door');
|
|
232
|
+
}).length;
|
|
233
|
+
if (objCnt === 1 || drawerPHs % objCnt !== 0) {
|
|
234
|
+
if (tempData['base_drawer_door_1'] === undefined) tempData['base_drawer_door_1'] = [];
|
|
235
|
+
//get drawer door handle placeholders
|
|
236
|
+
var ph_temp = temp.find(function (felement) {
|
|
237
|
+
return felement.name === 'base_drawer_door_1';
|
|
238
|
+
});
|
|
239
|
+
if (ph_temp != undefined) {
|
|
240
|
+
var ph_drawer_door_handle = ph_temp.data.nodes;
|
|
241
|
+
ph_drawer_door_handle = ph_drawer_door_handle.filter(function (element) {
|
|
242
|
+
return element.name.startsWith('ph_') && element.name.includes('handle');
|
|
243
|
+
});
|
|
244
|
+
for (var w = 0; w < drawerPHs; w++) {
|
|
245
|
+
if (!tempData['base_drawer_door_1'].some(function (el) {
|
|
246
|
+
return el === 'base_drawer_door_1/' + tempPlaceholders[0].name;
|
|
247
|
+
})) {
|
|
248
|
+
tempData['base_drawer_door_1'].push('base_drawer_1/' + tempPlaceholders[0].name);
|
|
249
|
+
//add drawer door handle placeholders
|
|
250
|
+
if (tempData['drawer_door_handle_1'] === undefined) tempData['drawer_door_handle_1'] = [];
|
|
251
|
+
if (ph_drawer_door_handle.length > 0) tempData['drawer_door_handle_1'].push('base_drawer_door_1/' + ph_drawer_door_handle[0].name);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
} else if (objCnt > 1 && drawerPHs > 0 && drawerPHs % objCnt === 0) {
|
|
256
|
+
if (tempData['base_drawer_door' + t.name.slice(-2)] === undefined) tempData['base_drawer_door' + t.name.slice(-2)] = [];
|
|
257
|
+
//get drawer door handle placeholders
|
|
258
|
+
var ph_temp = temp.find(function (felement) {
|
|
259
|
+
return felement.name === 'base_drawer_door' + t.name.slice(-2);
|
|
260
|
+
});
|
|
261
|
+
if (ph_temp != undefined) {
|
|
262
|
+
var ph_drawer_door_handle = ph_temp.data.nodes;
|
|
263
|
+
ph_drawer_door_handle = ph_drawer_door_handle.filter(function (element) {
|
|
264
|
+
return element.name.startsWith('ph_') && element.name.includes('handle');
|
|
265
|
+
});
|
|
266
|
+
tempPlaceholders.forEach(function (element) {
|
|
267
|
+
if (!tempData['base_drawer_door' + t.name.slice(-2)].some(function (el) {
|
|
268
|
+
return el === t.name + '/' + element.name;
|
|
269
|
+
})) {
|
|
270
|
+
tempData['base_drawer_door' + t.name.slice(-2)].push(t.name + '/' + element.name);
|
|
271
|
+
//add drawer door handle placeholders
|
|
272
|
+
if (tempData['drawer_door_handle' + t.name.slice(-2)] === undefined) tempData['drawer_door_handle' + t.name.slice(-2)] = [];
|
|
273
|
+
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);
|
|
274
|
+
}
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
} else if (t.name.includes('base_door')) {
|
|
279
|
+
var _objCnt3 = temp.filter(function (felement) {
|
|
280
|
+
return felement.name.includes('base_door');
|
|
281
|
+
}).length;
|
|
282
|
+
tempPlaceholders = tempPlaceholders.filter(function (el) {
|
|
283
|
+
return el.name.includes('handle');
|
|
284
|
+
});
|
|
285
|
+
if (tempPlaceholders.length > 0) if (_objCnt3 === 1 || doorPHs % _objCnt3 !== 0) {
|
|
286
|
+
if (tempData['door_handle_1'] === undefined) {
|
|
287
|
+
tempData['door_handle_1'] = [];
|
|
288
|
+
}
|
|
289
|
+
var _loop4 = function _loop4() {
|
|
290
|
+
var phname = tempPlaceholders[0].name;
|
|
291
|
+
var newph = undefined;
|
|
292
|
+
if (tempData['base_door_1'][_w].isLeftPlaceholder()) {
|
|
293
|
+
newph = tempPlaceholders.find(function (el) {
|
|
294
|
+
return el.name.isRightPlaceholder();
|
|
295
|
+
});
|
|
296
|
+
}
|
|
297
|
+
if (tempData['base_door_1'][_w].isRightPlaceholder()) {
|
|
298
|
+
newph = tempPlaceholders.find(function (el) {
|
|
299
|
+
return el.name.isLeftPlaceholder();
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
if (newph != undefined) {
|
|
303
|
+
phname = newph.name;
|
|
304
|
+
}
|
|
305
|
+
if (doorPHs === 1 && tempPlaceholders.find(function (el) {
|
|
306
|
+
return el.name.isLeftPlaceholder();
|
|
307
|
+
}) != undefined && tempPlaceholders.find(function (el) {
|
|
308
|
+
return el.name.isRightPlaceholder();
|
|
309
|
+
}) != undefined) {
|
|
310
|
+
has_single_door = true;
|
|
311
|
+
}
|
|
312
|
+
if (!tempData['door_handle_1'].some(function (el) {
|
|
313
|
+
return el === 'door_handle_1/' + phname;
|
|
314
|
+
})) {
|
|
315
|
+
tempData['door_handle_1'].push('base_door_1/' + phname);
|
|
316
|
+
}
|
|
317
|
+
};
|
|
318
|
+
for (var _w = 0; _w < doorPHs; _w++) {
|
|
319
|
+
_loop4();
|
|
320
|
+
}
|
|
321
|
+
} else if (_objCnt3 > 1 && doorPHs > 0 && doorPHs % _objCnt3 === 0) {
|
|
322
|
+
if (tempData['door_handle' + t.name.slice(-2)] === undefined) tempData['door_handle' + t.name.slice(-2)] = [];
|
|
323
|
+
var phname = tempPlaceholders[0].name;
|
|
324
|
+
var newph = undefined;
|
|
325
|
+
var blAdd = true;
|
|
326
|
+
if (cabinetPayload.is_corner) {
|
|
327
|
+
if (tempData['base_door' + t.name.slice(-2)][0].isLeftPlaceholder()) {
|
|
328
|
+
newph = tempPlaceholders.find(function (el) {
|
|
329
|
+
return el.name.isLeftPlaceholder();
|
|
330
|
+
});
|
|
331
|
+
} else {
|
|
332
|
+
blAdd = false;
|
|
333
|
+
}
|
|
334
|
+
} else {
|
|
335
|
+
if (tempData['base_door' + t.name.slice(-2)][0].isLeftPlaceholder()) {
|
|
336
|
+
newph = tempPlaceholders.find(function (el) {
|
|
337
|
+
return el.name.isRightPlaceholder();
|
|
338
|
+
});
|
|
339
|
+
}
|
|
340
|
+
if (tempData['base_door' + t.name.slice(-2)][0].isRightPlaceholder()) {
|
|
341
|
+
newph = tempPlaceholders.find(function (el) {
|
|
342
|
+
return el.name.isLeftPlaceholder();
|
|
343
|
+
});
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
if (blAdd) {
|
|
347
|
+
if (newph != undefined) {
|
|
348
|
+
phname = newph.name;
|
|
349
|
+
}
|
|
350
|
+
if (!tempData['door_handle' + t.name.slice(-2)].some(function (el) {
|
|
351
|
+
return el === t.name + '/' + phname;
|
|
352
|
+
})) {
|
|
353
|
+
tempData['door_handle' + t.name.slice(-2)].push(t.name + '/' + phname);
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
} else if (t.name.includes('base_fixed_drawer_door')) {
|
|
358
|
+
var _objCnt4 = temp.filter(function (felement) {
|
|
359
|
+
return felement.name.includes('base_fixed_drawer_door');
|
|
360
|
+
}).length;
|
|
361
|
+
tempPlaceholders = tempPlaceholders.filter(function (el) {
|
|
362
|
+
return el.name.includes('handle');
|
|
363
|
+
});
|
|
364
|
+
if (tempPlaceholders.length > 0) if (_objCnt4 === 1 || fixedPHs % _objCnt4 !== 0) {
|
|
365
|
+
if (tempData['fixed_drawer_door_handle_1'] === undefined) tempData['fixed_drawer_door_handle_1'] = [];
|
|
366
|
+
var _loop5 = function _loop5() {
|
|
367
|
+
var phname = tempPlaceholders[0].name;
|
|
368
|
+
var newph = undefined;
|
|
369
|
+
if (tempData['base_fixed_drawer_door_1'][_w2].isLeftPlaceholder()) {
|
|
370
|
+
newph = tempPlaceholders.find(function (el) {
|
|
371
|
+
return el.name.isRightPlaceholder();
|
|
372
|
+
});
|
|
373
|
+
}
|
|
374
|
+
if (tempData['base_fixed_drawer_door_1'][_w2].isRightPlaceholder()) {
|
|
375
|
+
newph = tempPlaceholders.find(function (el) {
|
|
376
|
+
return el.name.isLeftPlaceholder();
|
|
377
|
+
});
|
|
378
|
+
}
|
|
379
|
+
if (newph != undefined) {
|
|
380
|
+
phname = newph.name;
|
|
381
|
+
}
|
|
382
|
+
if (!tempData['fixed_drawer_door_handle_1'].some(function (el) {
|
|
383
|
+
return el === 'fixed_drawer_door_handle_1/' + phname;
|
|
384
|
+
})) {
|
|
385
|
+
tempData['fixed_drawer_door_handle_1'].push('base_fixed_drawer_door_1/' + phname);
|
|
386
|
+
}
|
|
387
|
+
};
|
|
388
|
+
for (var _w2 = 0; _w2 < fixedPHs; _w2++) {
|
|
389
|
+
_loop5();
|
|
390
|
+
}
|
|
391
|
+
} else if (_objCnt4 > 1 && fixedPHs > 0 && fixedPHs % _objCnt4 === 0) {
|
|
392
|
+
if (tempData['fixed_drawer_door_handle' + t.name.slice(-2)] === undefined) {
|
|
393
|
+
tempData['fixed_drawer_door_handle' + t.name.slice(-2)] = [];
|
|
394
|
+
}
|
|
395
|
+
var _phname = tempPlaceholders[0].name;
|
|
396
|
+
var _newph = undefined;
|
|
397
|
+
if (tempData['base_fixed_drawer_door' + t.name.slice(-2)][0].isLeftPlaceholder()) {
|
|
398
|
+
_newph = tempPlaceholders.find(function (el) {
|
|
399
|
+
return el.name.isRightPlaceholder();
|
|
400
|
+
});
|
|
401
|
+
}
|
|
402
|
+
if (tempData['base_fixed_drawer_door' + t.name.slice(-2)][0].isRightPlaceholder()) {
|
|
403
|
+
_newph = tempPlaceholders.find(function (el) {
|
|
404
|
+
return el.name.isLeftPlaceholder();
|
|
405
|
+
});
|
|
406
|
+
}
|
|
407
|
+
if (_newph != undefined) {
|
|
408
|
+
_phname = _newph.name;
|
|
409
|
+
}
|
|
410
|
+
if (!tempData['fixed_drawer_door_handle' + t.name.slice(-2)].some(function (el) {
|
|
411
|
+
return el === t.name + '/' + _phname;
|
|
412
|
+
})) {
|
|
413
|
+
tempData['fixed_drawer_door_handle' + t.name.slice(-2)].push(t.name + '/' + _phname);
|
|
414
|
+
}
|
|
415
|
+
}
|
|
237
416
|
}
|
|
238
|
-
});
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
} else if (t.name.includes('base_door')) {
|
|
242
|
-
var _objCnt3 = temp.filter(function (felement) {
|
|
243
|
-
return felement.name.includes('base_door');
|
|
244
|
-
}).length;
|
|
245
|
-
tempPlaceholders = tempPlaceholders.filter(function (el) {
|
|
246
|
-
return el.name.includes('handle');
|
|
247
|
-
});
|
|
248
|
-
if (tempPlaceholders.length > 0) if (_objCnt3 === 1 || doorPHs % _objCnt3 !== 0) {
|
|
249
|
-
if (tempData['door_handle_1'] === undefined) {
|
|
250
|
-
tempData['door_handle_1'] = [];
|
|
251
|
-
}
|
|
252
|
-
var _loop = function _loop() {
|
|
253
|
-
var phname = tempPlaceholders[0].name;
|
|
254
|
-
var newph = undefined;
|
|
255
|
-
if (tempData['base_door_1'][_w].isLeftPlaceholder()) {
|
|
256
|
-
newph = tempPlaceholders.find(function (el) {
|
|
257
|
-
return el.name.isRightPlaceholder();
|
|
258
|
-
});
|
|
259
|
-
}
|
|
260
|
-
if (tempData['base_door_1'][_w].isRightPlaceholder()) {
|
|
261
|
-
newph = tempPlaceholders.find(function (el) {
|
|
262
|
-
return el.name.isLeftPlaceholder();
|
|
263
|
-
});
|
|
264
|
-
}
|
|
265
|
-
if (newph != undefined) {
|
|
266
|
-
phname = newph.name;
|
|
267
|
-
}
|
|
268
|
-
if (doorPHs === 1 && tempPlaceholders.find(function (el) {
|
|
269
|
-
return el.name.isLeftPlaceholder();
|
|
270
|
-
}) != undefined && tempPlaceholders.find(function (el) {
|
|
271
|
-
return el.name.isRightPlaceholder();
|
|
272
|
-
}) != undefined) {
|
|
273
|
-
has_single_door = true;
|
|
274
|
-
}
|
|
275
|
-
if (!tempData['door_handle_1'].some(function (el) {
|
|
276
|
-
return el === 'door_handle_1/' + phname;
|
|
277
|
-
})) {
|
|
278
|
-
tempData['door_handle_1'].push('base_door_1/' + phname);
|
|
279
417
|
}
|
|
280
|
-
};
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
if (cabinetPayload.is_corner) {
|
|
290
|
-
if (tempData['base_door' + t.name.slice(-2)][0].isLeftPlaceholder()) {
|
|
291
|
-
newph = tempPlaceholders.find(function (el) {
|
|
292
|
-
return el.name.isLeftPlaceholder();
|
|
293
|
-
});
|
|
294
|
-
} else {
|
|
295
|
-
blAdd = false;
|
|
296
|
-
}
|
|
297
|
-
} else {
|
|
298
|
-
if (tempData['base_door' + t.name.slice(-2)][0].isLeftPlaceholder()) {
|
|
299
|
-
newph = tempPlaceholders.find(function (el) {
|
|
300
|
-
return el.name.isRightPlaceholder();
|
|
301
|
-
});
|
|
302
|
-
}
|
|
303
|
-
if (tempData['base_door' + t.name.slice(-2)][0].isRightPlaceholder()) {
|
|
304
|
-
newph = tempPlaceholders.find(function (el) {
|
|
305
|
-
return el.name.isLeftPlaceholder();
|
|
306
|
-
});
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
if (blAdd) {
|
|
310
|
-
if (newph != undefined) {
|
|
311
|
-
phname = newph.name;
|
|
312
|
-
}
|
|
313
|
-
if (!tempData['door_handle' + t.name.slice(-2)].some(function (el) {
|
|
314
|
-
return el === t.name + '/' + phname;
|
|
315
|
-
})) {
|
|
316
|
-
tempData['door_handle' + t.name.slice(-2)].push(t.name + '/' + phname);
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
}
|
|
320
|
-
} else if (t.name.includes('base_fixed_drawer_door')) {
|
|
321
|
-
var _objCnt4 = temp.filter(function (felement) {
|
|
322
|
-
return felement.name.includes('base_fixed_drawer_door');
|
|
323
|
-
}).length;
|
|
324
|
-
tempPlaceholders = tempPlaceholders.filter(function (el) {
|
|
325
|
-
return el.name.includes('handle');
|
|
326
|
-
});
|
|
327
|
-
if (tempPlaceholders.length > 0) if (_objCnt4 === 1 || fixedPHs % _objCnt4 !== 0) {
|
|
328
|
-
if (tempData['fixed_drawer_door_handle_1'] === undefined) tempData['fixed_drawer_door_handle_1'] = [];
|
|
329
|
-
var _loop2 = function _loop2() {
|
|
330
|
-
var phname = tempPlaceholders[0].name;
|
|
331
|
-
var newph = undefined;
|
|
332
|
-
if (tempData['base_fixed_drawer_door_1'][_w2].isLeftPlaceholder()) {
|
|
333
|
-
newph = tempPlaceholders.find(function (el) {
|
|
334
|
-
return el.name.isRightPlaceholder();
|
|
335
|
-
});
|
|
336
|
-
}
|
|
337
|
-
if (tempData['base_fixed_drawer_door_1'][_w2].isRightPlaceholder()) {
|
|
338
|
-
newph = tempPlaceholders.find(function (el) {
|
|
339
|
-
return el.name.isLeftPlaceholder();
|
|
340
|
-
});
|
|
341
|
-
}
|
|
342
|
-
if (newph != undefined) {
|
|
343
|
-
phname = newph.name;
|
|
344
|
-
}
|
|
345
|
-
if (!tempData['fixed_drawer_door_handle_1'].some(function (el) {
|
|
346
|
-
return el === 'fixed_drawer_door_handle_1/' + phname;
|
|
347
|
-
})) {
|
|
348
|
-
tempData['fixed_drawer_door_handle_1'].push('base_fixed_drawer_door_1/' + phname);
|
|
349
|
-
}
|
|
350
|
-
};
|
|
351
|
-
for (var _w2 = 0; _w2 < fixedPHs; _w2++) {
|
|
352
|
-
_loop2();
|
|
353
|
-
}
|
|
354
|
-
} else if (_objCnt4 > 1 && fixedPHs > 0 && fixedPHs % _objCnt4 === 0) {
|
|
355
|
-
if (tempData['fixed_drawer_door_handle' + t.name.slice(-2)] === undefined) {
|
|
356
|
-
tempData['fixed_drawer_door_handle' + t.name.slice(-2)] = [];
|
|
357
|
-
}
|
|
358
|
-
var _phname = tempPlaceholders[0].name;
|
|
359
|
-
var _newph = undefined;
|
|
360
|
-
if (tempData['base_fixed_drawer_door' + t.name.slice(-2)][0].isLeftPlaceholder()) {
|
|
361
|
-
_newph = tempPlaceholders.find(function (el) {
|
|
362
|
-
return el.name.isRightPlaceholder();
|
|
363
|
-
});
|
|
364
|
-
}
|
|
365
|
-
if (tempData['base_fixed_drawer_door' + t.name.slice(-2)][0].isRightPlaceholder()) {
|
|
366
|
-
_newph = tempPlaceholders.find(function (el) {
|
|
367
|
-
return el.name.isLeftPlaceholder();
|
|
368
|
-
});
|
|
369
|
-
}
|
|
370
|
-
if (_newph != undefined) {
|
|
371
|
-
_phname = _newph.name;
|
|
372
|
-
}
|
|
373
|
-
if (!tempData['fixed_drawer_door_handle' + t.name.slice(-2)].some(function (el) {
|
|
374
|
-
return el === t.name + '/' + _phname;
|
|
375
|
-
})) {
|
|
376
|
-
tempData['fixed_drawer_door_handle' + t.name.slice(-2)].push(t.name + '/' + _phname);
|
|
377
|
-
}
|
|
378
|
-
}
|
|
418
|
+
});
|
|
419
|
+
tempPlaceholdersData.push({
|
|
420
|
+
id: parseInt(el, 10),
|
|
421
|
+
placeholders: tempData,
|
|
422
|
+
structure: cabinetPayload.structure_json.tempPlaceholders[k].structure
|
|
423
|
+
});
|
|
424
|
+
case 1:
|
|
425
|
+
case "end":
|
|
426
|
+
return _context4.stop();
|
|
379
427
|
}
|
|
380
|
-
}
|
|
381
|
-
});
|
|
382
|
-
tempPlaceholdersData.push({
|
|
383
|
-
id: parseInt(el, 10),
|
|
384
|
-
placeholders: tempData,
|
|
385
|
-
structure: cabinetPayload.structure_json.tempPlaceholders[0].structure
|
|
428
|
+
}, _loop3);
|
|
386
429
|
});
|
|
387
|
-
|
|
430
|
+
k = 0;
|
|
388
431
|
case 5:
|
|
432
|
+
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))) {
|
|
433
|
+
_context5.next = 7;
|
|
434
|
+
break;
|
|
435
|
+
}
|
|
436
|
+
return _context5.delegateYield(_loop3(k), "t0", 6);
|
|
437
|
+
case 6:
|
|
438
|
+
k++;
|
|
439
|
+
_context5.next = 5;
|
|
440
|
+
break;
|
|
441
|
+
case 7:
|
|
442
|
+
return _context5.abrupt("return", tempPlaceholdersData);
|
|
443
|
+
case 8:
|
|
389
444
|
case "end":
|
|
390
|
-
return
|
|
445
|
+
return _context5.stop();
|
|
391
446
|
}
|
|
392
|
-
},
|
|
447
|
+
}, _callee4);
|
|
393
448
|
}));
|
|
394
449
|
return _parseTempPlaceholdersFromCabinetPayload.apply(this, arguments);
|
|
395
450
|
}
|
|
@@ -397,79 +452,102 @@ function updateCabinetPayload(_x3) {
|
|
|
397
452
|
return _updateCabinetPayload.apply(this, arguments);
|
|
398
453
|
}
|
|
399
454
|
function _updateCabinetPayload() {
|
|
400
|
-
_updateCabinetPayload = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function
|
|
401
|
-
var
|
|
402
|
-
return _regeneratorRuntime.wrap(function (
|
|
403
|
-
while (1) switch (
|
|
455
|
+
_updateCabinetPayload = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5(cabinetPayload) {
|
|
456
|
+
var cabinetPayloadKeys, i, _cabinetPayload$cabin, _cabinetPayload$cabin2;
|
|
457
|
+
return _regeneratorRuntime.wrap(function (_context6) {
|
|
458
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
404
459
|
case 0:
|
|
405
|
-
tempPlaceholders = [];
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
tempPlaceholders = _context4.sent;
|
|
460
|
+
// let tempPlaceholders = [];
|
|
461
|
+
// tempPlaceholders = await parseTempPlaceholdersFromCabinetPayload(
|
|
462
|
+
// cabinetPayload
|
|
463
|
+
// );
|
|
410
464
|
cabinetPayloadKeys = Object.keys(cabinetPayload);
|
|
411
465
|
for (i = 0; i < cabinetPayloadKeys.length; i++) {
|
|
412
466
|
if (cabinetPayloadKeys[i] === 'structure_json') {
|
|
413
|
-
cabinetPayload[cabinetPayloadKeys[i]]['placeholders'] = tempPlaceholders[0].placeholders;
|
|
414
|
-
|
|
467
|
+
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 : [];
|
|
468
|
+
|
|
469
|
+
// cabinetPayload[cabinetPayloadKeys[i]]['placeholders'] =
|
|
470
|
+
// tempPlaceholders[0].placeholders;
|
|
471
|
+
// cabinetPayload[cabinetPayloadKeys[i]]['tempPlaceholders'] =
|
|
472
|
+
// tempPlaceholders;
|
|
415
473
|
}
|
|
416
474
|
}
|
|
417
|
-
return
|
|
418
|
-
case
|
|
475
|
+
return _context6.abrupt("return", cabinetPayload);
|
|
476
|
+
case 1:
|
|
419
477
|
case "end":
|
|
420
|
-
return
|
|
478
|
+
return _context6.stop();
|
|
421
479
|
}
|
|
422
|
-
},
|
|
480
|
+
}, _callee5);
|
|
423
481
|
}));
|
|
424
482
|
return _updateCabinetPayload.apply(this, arguments);
|
|
425
483
|
}
|
|
426
484
|
var loadSVGsByItem = /*#__PURE__*/function () {
|
|
427
|
-
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function
|
|
428
|
-
var
|
|
429
|
-
return _regeneratorRuntime.wrap(function (
|
|
430
|
-
while (1) switch (
|
|
485
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(item) {
|
|
486
|
+
var url, p;
|
|
487
|
+
return _regeneratorRuntime.wrap(function (_context2) {
|
|
488
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
431
489
|
case 0:
|
|
432
|
-
if (item.outline) {
|
|
433
|
-
|
|
490
|
+
if (item !== null && item !== void 0 && item.outline) {
|
|
491
|
+
_context2.next = 1;
|
|
434
492
|
break;
|
|
435
493
|
}
|
|
436
|
-
return
|
|
494
|
+
return _context2.abrupt("return", null);
|
|
437
495
|
case 1:
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
cache: 'no-store'
|
|
442
|
-
});
|
|
443
|
-
case 2:
|
|
444
|
-
response = _context.sent;
|
|
445
|
-
_context.next = 3;
|
|
446
|
-
return response.text();
|
|
447
|
-
case 3:
|
|
448
|
-
svgText = _context.sent;
|
|
449
|
-
loader = new SVGLoader();
|
|
450
|
-
parsed = loader.parse(svgText);
|
|
451
|
-
if (!isEmpty(parsed.paths)) {
|
|
452
|
-
_context.next = 4;
|
|
496
|
+
url = item.outline;
|
|
497
|
+
if (!__svgCache.has(url)) {
|
|
498
|
+
_context2.next = 2;
|
|
453
499
|
break;
|
|
454
500
|
}
|
|
455
|
-
return
|
|
456
|
-
case
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
501
|
+
return _context2.abrupt("return", __svgCache.get(url));
|
|
502
|
+
case 2:
|
|
503
|
+
p = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
504
|
+
var _parsed$xml$viewBox, _parsed$xml$viewBox2, response, svgText, loader, parsed, _t;
|
|
505
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
506
|
+
while (1) switch (_context.prev = _context.next) {
|
|
507
|
+
case 0:
|
|
508
|
+
_context.prev = 0;
|
|
509
|
+
_context.next = 1;
|
|
510
|
+
return fetch(url, {
|
|
511
|
+
cache: 'force-cache'
|
|
512
|
+
});
|
|
513
|
+
case 1:
|
|
514
|
+
response = _context.sent;
|
|
515
|
+
_context.next = 2;
|
|
516
|
+
return response.text();
|
|
517
|
+
case 2:
|
|
518
|
+
svgText = _context.sent;
|
|
519
|
+
loader = new SVGLoader();
|
|
520
|
+
parsed = loader.parse(svgText);
|
|
521
|
+
if (!isEmpty(parsed.paths)) {
|
|
522
|
+
_context.next = 3;
|
|
523
|
+
break;
|
|
524
|
+
}
|
|
525
|
+
return _context.abrupt("return", null);
|
|
526
|
+
case 3:
|
|
527
|
+
return _context.abrupt("return", {
|
|
528
|
+
paths: parsed.paths,
|
|
529
|
+
svgWidth: parseFloat(parsed.xml.getAttribute('width')) || ((_parsed$xml$viewBox = parsed.xml.viewBox) === null || _parsed$xml$viewBox === void 0 || (_parsed$xml$viewBox = _parsed$xml$viewBox.animVal) === null || _parsed$xml$viewBox === void 0 ? void 0 : _parsed$xml$viewBox.width) || 0,
|
|
530
|
+
svgHeight: parseFloat(parsed.xml.getAttribute('height')) || ((_parsed$xml$viewBox2 = parsed.xml.viewBox) === null || _parsed$xml$viewBox2 === void 0 || (_parsed$xml$viewBox2 = _parsed$xml$viewBox2.animVal) === null || _parsed$xml$viewBox2 === void 0 ? void 0 : _parsed$xml$viewBox2.height) || 0,
|
|
531
|
+
reverse: !parseFloat(parsed.xml.getAttribute('height'))
|
|
532
|
+
});
|
|
533
|
+
case 4:
|
|
534
|
+
_context.prev = 4;
|
|
535
|
+
_t = _context["catch"](0);
|
|
536
|
+
console.error('Failed to load SVG:', url, _t);
|
|
537
|
+
return _context.abrupt("return", null);
|
|
538
|
+
case 5:
|
|
539
|
+
case "end":
|
|
540
|
+
return _context.stop();
|
|
541
|
+
}
|
|
542
|
+
}, _callee, null, [[0, 4]]);
|
|
543
|
+
}))();
|
|
544
|
+
__svgCache.set(url, p);
|
|
545
|
+
return _context2.abrupt("return", p);
|
|
546
|
+
case 3:
|
|
469
547
|
case "end":
|
|
470
|
-
return
|
|
548
|
+
return _context2.stop();
|
|
471
549
|
}
|
|
472
|
-
},
|
|
550
|
+
}, _callee2);
|
|
473
551
|
}));
|
|
474
552
|
return function loadSVGsByItem(_x4) {
|
|
475
553
|
return _ref.apply(this, arguments);
|
|
@@ -479,64 +557,121 @@ function addItemToCatalog(_x5, _x6, _x7, _x8) {
|
|
|
479
557
|
return _addItemToCatalog.apply(this, arguments);
|
|
480
558
|
} // Get attributs of current selected element
|
|
481
559
|
function _addItemToCatalog() {
|
|
482
|
-
_addItemToCatalog = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function
|
|
483
|
-
var
|
|
484
|
-
var elementJs,
|
|
485
|
-
return _regeneratorRuntime.wrap(function (
|
|
486
|
-
while (1) switch (
|
|
560
|
+
_addItemToCatalog = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee6(element, state, catalogInstance, projectActions) {
|
|
561
|
+
var _elementJs, _elementJs3;
|
|
562
|
+
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;
|
|
563
|
+
return _regeneratorRuntime.wrap(function (_context7) {
|
|
564
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
487
565
|
case 0:
|
|
488
|
-
if (!isEmpty(
|
|
489
|
-
|
|
566
|
+
if (!isEmpty(element === null || element === void 0 ? void 0 : element.name)) {
|
|
567
|
+
_context7.next = 1;
|
|
490
568
|
break;
|
|
491
569
|
}
|
|
492
|
-
return
|
|
570
|
+
return _context7.abrupt("return");
|
|
493
571
|
case 1:
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
return loadSVGsByItem(element);
|
|
572
|
+
// clone element
|
|
573
|
+
elementJs = Object.assign({}, element); // if (isEmpty(catalog?.elements[element.name])) {
|
|
574
|
+
_context7.next = 2;
|
|
575
|
+
return loadSVGsByItem(elementJs);
|
|
499
576
|
case 2:
|
|
500
|
-
outlineSVGData =
|
|
501
|
-
if (!(((
|
|
502
|
-
|
|
577
|
+
outlineSVGData = _context7.sent;
|
|
578
|
+
if (!(((_elementJs = elementJs) === null || _elementJs === void 0 ? void 0 : _elementJs.type) === 'cabinet')) {
|
|
579
|
+
_context7.next = 4;
|
|
503
580
|
break;
|
|
504
581
|
}
|
|
582
|
+
// move the tempPlaceholder of current door style to first of tempPlaceholders array
|
|
583
|
+
cds = (_state$getIn = state.getIn(['scene', 'layers', 'layer-1', 'doorStyle'])) === null || _state$getIn === void 0 ? void 0 : _state$getIn.cds;
|
|
584
|
+
if (cds) {
|
|
585
|
+
currentCdsId = (_cds$find = cds.find(function (c) {
|
|
586
|
+
return c.itemID === elementJs.itemID;
|
|
587
|
+
})) === null || _cds$find === void 0 ? void 0 : _cds$find.cabinet_door_style_id;
|
|
588
|
+
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) {
|
|
589
|
+
return tph.id === currentCdsId;
|
|
590
|
+
}); // swap
|
|
591
|
+
if (currentCdsId && cdsIdx >= 0) {
|
|
592
|
+
ttph = elementJs.structure_json.tempPlaceholders[0];
|
|
593
|
+
elementJs.structure_json.tempPlaceholders[0] = elementJs.structure_json.tempPlaceholders[cdsIdx];
|
|
594
|
+
elementJs.structure_json.tempPlaceholders[cdsIdx] = ttph;
|
|
595
|
+
}
|
|
596
|
+
}
|
|
505
597
|
// make placeholders of element and tempPlaceholder
|
|
506
|
-
updatedStructureJson = _objectSpread(_objectSpread({},
|
|
507
|
-
|
|
508
|
-
|
|
598
|
+
updatedStructureJson = _objectSpread(_objectSpread({}, elementJs.structure_json), (_elementJs$structure_ = (_elementJs$structure_2 = elementJs.structure_json) === null || _elementJs$structure_2 === void 0 || (_elementJs$structure_2 = _elementJs$structure_2.tempPlaceholders[0]) === null || _elementJs$structure_2 === void 0 ? void 0 : _elementJs$structure_2.structure) !== null && _elementJs$structure_ !== void 0 ? _elementJs$structure_ : {});
|
|
599
|
+
elementJs.structure_json = updatedStructureJson;
|
|
600
|
+
elementJs = _objectSpread(_objectSpread({}, elementJs), {}, {
|
|
509
601
|
cds: {
|
|
510
|
-
data: [_objectSpread({},
|
|
511
|
-
itemID:
|
|
602
|
+
data: [_objectSpread({}, elementJs.customer_property)],
|
|
603
|
+
itemID: elementJs.itemID
|
|
512
604
|
}
|
|
513
605
|
});
|
|
514
|
-
if (isEmpty((
|
|
515
|
-
|
|
606
|
+
if (isEmpty((_elementJs$structure_3 = elementJs.structure_json) === null || _elementJs$structure_3 === void 0 ? void 0 : _elementJs$structure_3.tempPlaceholders)) {
|
|
607
|
+
_context7.next = 4;
|
|
516
608
|
break;
|
|
517
609
|
}
|
|
518
|
-
|
|
519
|
-
return updateCabinetPayload(
|
|
610
|
+
_context7.next = 3;
|
|
611
|
+
return updateCabinetPayload(elementJs);
|
|
520
612
|
case 3:
|
|
521
|
-
elementJs =
|
|
613
|
+
elementJs = _context7.sent;
|
|
522
614
|
case 4:
|
|
523
615
|
elementJs = _objectSpread(_objectSpread({}, elementJs), {}, {
|
|
524
616
|
outlineSVGData: outlineSVGData,
|
|
525
|
-
type:
|
|
617
|
+
type: elementJs.type,
|
|
526
618
|
render2DItem: render2DItem
|
|
527
619
|
});
|
|
528
|
-
if (
|
|
620
|
+
if (elementJs.type === 'appliance' || elementJs.type === 'furnishing') elementJs.render3DItem = render3DApplianceItem;else if (elementJs.type === 'lighting') elementJs.render3DItem = render3DLightingItem;else elementJs.render3DItem = render3DItem;
|
|
621
|
+
|
|
622
|
+
/***** join new tempPlaceholder to the old element - start *****/
|
|
623
|
+
// get catalog item by itemID
|
|
624
|
+
catalogElements = state.getIn(['catalog', 'elements']).toJS();
|
|
625
|
+
catalogElementKeys = Object.keys(catalogElements);
|
|
626
|
+
catalogItem = null;
|
|
627
|
+
k = 0;
|
|
628
|
+
case 5:
|
|
629
|
+
if (!(k < catalogElementKeys.length)) {
|
|
630
|
+
_context7.next = 7;
|
|
631
|
+
break;
|
|
632
|
+
}
|
|
633
|
+
if (!(((_catalogElements$cata = catalogElements[catalogElementKeys[k]]) === null || _catalogElements$cata === void 0 ? void 0 : _catalogElements$cata.itemID) === elementJs.itemID)) {
|
|
634
|
+
_context7.next = 6;
|
|
635
|
+
break;
|
|
636
|
+
}
|
|
637
|
+
catalogItem = catalogElements[catalogElementKeys[k]];
|
|
638
|
+
return _context7.abrupt("continue", 7);
|
|
639
|
+
case 6:
|
|
640
|
+
k++;
|
|
641
|
+
_context7.next = 5;
|
|
642
|
+
break;
|
|
643
|
+
case 7:
|
|
644
|
+
// get old tempPlaceholder array from catalog item
|
|
645
|
+
tempPlaceholderArray = null;
|
|
646
|
+
if (!isEmpty(catalogItem)) {
|
|
647
|
+
tempPlaceholderArray = (_catalogItem$structur = catalogItem.structure_json) === null || _catalogItem$structur === void 0 ? void 0 : _catalogItem$structur.tempPlaceholders;
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
// join new tempPlaceholder array to old one
|
|
651
|
+
newTempPlaceholderArray = [];
|
|
652
|
+
(_elementJs3 = elementJs) === null || _elementJs3 === void 0 || (_elementJs3 = _elementJs3.structure_json) === null || _elementJs3 === void 0 || (_elementJs3 = _elementJs3.tempPlaceholders) === null || _elementJs3 === void 0 || _elementJs3.forEach(function (tph) {
|
|
653
|
+
var _tempPlaceholderArray;
|
|
654
|
+
if (!((_tempPlaceholderArray = tempPlaceholderArray) !== null && _tempPlaceholderArray !== void 0 && _tempPlaceholderArray.some(function (otph) {
|
|
655
|
+
return otph.id === tph.id;
|
|
656
|
+
}))) newTempPlaceholderArray.push(tph);
|
|
657
|
+
});
|
|
658
|
+
mergedTempPlaceholder = null;
|
|
659
|
+
if (isEmpty(tempPlaceholderArray)) mergedTempPlaceholder = newTempPlaceholderArray;else if (isEmpty(newTempPlaceholderArray)) mergedTempPlaceholder = tempPlaceholderArray;else mergedTempPlaceholder = [].concat(_toConsumableArray(tempPlaceholderArray), newTempPlaceholderArray);
|
|
660
|
+
|
|
661
|
+
// rplace new array to the elementJS
|
|
662
|
+
if (!isEmpty(mergedTempPlaceholder)) elementJs.structure_json.tempPlaceholders = mergedTempPlaceholder;
|
|
663
|
+
/***** join new tempPlaceholder to the old element - end *****/
|
|
664
|
+
|
|
529
665
|
elementJs = exporter(elementJs);
|
|
530
666
|
if (catalogInstance !== null && catalogInstance !== void 0 && catalogInstance.validateElement(elementJs)) {
|
|
531
667
|
catalogInstance.registerElement(elementJs);
|
|
532
668
|
projectActions.addElementToCatalog(elementJs);
|
|
533
669
|
}
|
|
534
|
-
|
|
535
|
-
case 5:
|
|
670
|
+
case 8:
|
|
536
671
|
case "end":
|
|
537
|
-
return
|
|
672
|
+
return _context7.stop();
|
|
538
673
|
}
|
|
539
|
-
},
|
|
674
|
+
}, _callee6);
|
|
540
675
|
}));
|
|
541
676
|
return _addItemToCatalog.apply(this, arguments);
|
|
542
677
|
}
|
|
@@ -669,6 +804,8 @@ function initPropData(element, catalog) {
|
|
|
669
804
|
function updateAttributeOfSelectedElement(element, attrPayload, state, layer, catalog, projectActions) {
|
|
670
805
|
var _attributesFormData;
|
|
671
806
|
var callback = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : null;
|
|
807
|
+
var layerID = state.scene.selectedLayer;
|
|
808
|
+
var layerUnit = state.getIn(['scene', 'layers', layerID, 'unit']);
|
|
672
809
|
var attributesFormData = initAttrData(element, layer, state);
|
|
673
810
|
var value = attrPayload.value;
|
|
674
811
|
var attributeName = attrPayload.attributeName;
|
|
@@ -676,28 +813,8 @@ function updateAttributeOfSelectedElement(element, attrPayload, state, layer, ca
|
|
|
676
813
|
if (attributeName === ATT_ITEM_POS) {
|
|
677
814
|
// calculate the new position of movement
|
|
678
815
|
var rotRad = (value.directionAng + element.rotation) / 180 * Math.PI;
|
|
679
|
-
var newX = element.x + convert((value.oldDistance - value.newDistance) * Math.cos(rotRad)).from(
|
|
680
|
-
var newY = element.y + convert((value.oldDistance - value.newDistance) * Math.sin(rotRad)).from(
|
|
681
|
-
// const reversedDirection =
|
|
682
|
-
// value.directionAng === LEFT_DIST_ANG
|
|
683
|
-
// ? RIGHT_DIST_ANG
|
|
684
|
-
// : value.directionAng === RIGHT_DIST_ANG
|
|
685
|
-
// ? LEFT_DIST_ANG
|
|
686
|
-
// : value.directionAng === BACK_DIST_ANG
|
|
687
|
-
// ? FRONT_DIST_ANG
|
|
688
|
-
// : BACK_DIST_ANG;
|
|
689
|
-
// let dist = convert(
|
|
690
|
-
// element.distArray?.find(v => v[1] === reversedDirection)
|
|
691
|
-
// ? element.distArray?.find(v => v[1] === reversedDirection)[0]
|
|
692
|
-
// : 0
|
|
693
|
-
// )
|
|
694
|
-
// .from('cm')
|
|
695
|
-
// .to('in');
|
|
696
|
-
// if (dist + (value.oldDistance - value.newDistance) <= 0 || value.newDistance < 0) {
|
|
697
|
-
// // confirm "The item will be placed outside the floor plan. Are you sure?"
|
|
698
|
-
// setPopupOpen(true);
|
|
699
|
-
// return;
|
|
700
|
-
// }
|
|
816
|
+
var newX = element.x + convert((value.oldDistance - value.newDistance) * Math.cos(rotRad)).from(layerUnit).to('cm');
|
|
817
|
+
var newY = element.y + convert((value.oldDistance - value.newDistance) * Math.sin(rotRad)).from(layerUnit).to('cm');
|
|
701
818
|
value = {
|
|
702
819
|
x: newX,
|
|
703
820
|
y: newY
|
|
@@ -706,8 +823,8 @@ function updateAttributeOfSelectedElement(element, attrPayload, state, layer, ca
|
|
|
706
823
|
var att = attributesFormData.has(attributeName) ? attributesFormData.get(attributeName) : element[attributeName];
|
|
707
824
|
if (att) value = att.merge({
|
|
708
825
|
_length: value,
|
|
709
|
-
_unit:
|
|
710
|
-
length: convert(value).from(
|
|
826
|
+
_unit: layerUnit,
|
|
827
|
+
length: convert(value).from(layerUnit).to(UNIT_CENTIMETER)
|
|
711
828
|
});
|
|
712
829
|
}
|
|
713
830
|
// make the new attrivutes
|
|
@@ -721,11 +838,11 @@ function updateAttributeOfSelectedElement(element, attrPayload, state, layer, ca
|
|
|
721
838
|
attributesFormData = attributesFormData.set('y', yVal);
|
|
722
839
|
} else {
|
|
723
840
|
attributesFormData = attributesFormData.set(attributeName, value);
|
|
724
|
-
// update the distances from wall
|
|
725
|
-
var _GeometryUtils$calcDi = GeometryUtils.calcDistancesFromItemToWalls(attributesFormData, layer, catalog),
|
|
726
|
-
PointArray = _GeometryUtils$calcDi.PointArray;
|
|
727
|
-
attributesFormData = attributesFormData.set('distArray', PointArray);
|
|
728
841
|
}
|
|
842
|
+
// update the distances from wall
|
|
843
|
+
var _GeometryUtils$calcDi = GeometryUtils.calcDistancesFromItemToWalls(attributesFormData, layer),
|
|
844
|
+
PointArray = _GeometryUtils$calcDi.PointArray;
|
|
845
|
+
attributesFormData = attributesFormData.set('distArray', PointArray);
|
|
729
846
|
break;
|
|
730
847
|
}
|
|
731
848
|
case 'lines':
|
|
@@ -942,11 +1059,11 @@ function loadMoldingSvg(_x1) {
|
|
|
942
1059
|
return _loadMoldingSvg.apply(this, arguments);
|
|
943
1060
|
}
|
|
944
1061
|
function _loadMoldingSvg() {
|
|
945
|
-
_loadMoldingSvg = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function
|
|
946
|
-
return _regeneratorRuntime.wrap(function (
|
|
947
|
-
while (1) switch (
|
|
1062
|
+
_loadMoldingSvg = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee7(molding) {
|
|
1063
|
+
return _regeneratorRuntime.wrap(function (_context8) {
|
|
1064
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
948
1065
|
case 0:
|
|
949
|
-
return
|
|
1066
|
+
return _context8.abrupt("return", new Promise(function (resolve, reject) {
|
|
950
1067
|
var url = molding === null || molding === void 0 ? void 0 : molding.shape_svg;
|
|
951
1068
|
if (!url) {
|
|
952
1069
|
// Skip if no SVG URL available
|
|
@@ -968,9 +1085,9 @@ function _loadMoldingSvg() {
|
|
|
968
1085
|
}));
|
|
969
1086
|
case 1:
|
|
970
1087
|
case "end":
|
|
971
|
-
return
|
|
1088
|
+
return _context8.stop();
|
|
972
1089
|
}
|
|
973
|
-
},
|
|
1090
|
+
}, _callee7);
|
|
974
1091
|
}));
|
|
975
1092
|
return _loadMoldingSvg.apply(this, arguments);
|
|
976
1093
|
}
|
|
@@ -999,86 +1116,161 @@ function setFinishing(props, state, payload) {
|
|
|
999
1116
|
break;
|
|
1000
1117
|
}
|
|
1001
1118
|
}
|
|
1002
|
-
function
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1119
|
+
function moveAndRotatePan2D3D(eventType, props, payload, state) {
|
|
1120
|
+
if (eventType === EXTERNAL_EVENT_MOVE_PAN) {
|
|
1121
|
+
var moveType = payload.moveType,
|
|
1122
|
+
moveValue = payload.moveValue;
|
|
1123
|
+
var value = state.getIn(['viewer2D']).toJS();
|
|
1124
|
+
if (state.mode === MODE_IDLE) {
|
|
1125
|
+
switch (moveType) {
|
|
1126
|
+
case TOP:
|
|
1127
|
+
value.f -= moveValue;
|
|
1128
|
+
break;
|
|
1129
|
+
case BOTTOM:
|
|
1130
|
+
value.f += moveValue;
|
|
1131
|
+
break;
|
|
1132
|
+
case RIGHT:
|
|
1133
|
+
value.e += moveValue;
|
|
1134
|
+
break;
|
|
1135
|
+
case LEFT:
|
|
1136
|
+
value.e -= moveValue;
|
|
1137
|
+
break;
|
|
1138
|
+
}
|
|
1139
|
+
updateViwer2D(value, props.viewer2DActions);
|
|
1140
|
+
} else if (state.mode === MODE_IDLE_3D) {
|
|
1141
|
+
switch (moveType) {
|
|
1142
|
+
case TOP:
|
|
1143
|
+
window.interval = setTimeout(function () {
|
|
1144
|
+
window.tDKeyDown({
|
|
1145
|
+
keyCode: 38
|
|
1146
|
+
});
|
|
1147
|
+
}, 50);
|
|
1148
|
+
break;
|
|
1149
|
+
case BOTTOM:
|
|
1150
|
+
window.interval = setTimeout(function () {
|
|
1151
|
+
window.tDKeyDown({
|
|
1152
|
+
keyCode: 40
|
|
1153
|
+
});
|
|
1154
|
+
}, 50);
|
|
1155
|
+
break;
|
|
1156
|
+
case RIGHT:
|
|
1157
|
+
window.interval = setTimeout(function () {
|
|
1158
|
+
window.tDKeyDown({
|
|
1159
|
+
keyCode: 37
|
|
1160
|
+
});
|
|
1161
|
+
}, 50);
|
|
1162
|
+
break;
|
|
1163
|
+
case LEFT:
|
|
1164
|
+
window.interval = setTimeout(function () {
|
|
1165
|
+
window.tDKeyDown({
|
|
1166
|
+
keyCode: 39
|
|
1167
|
+
});
|
|
1168
|
+
}, 50);
|
|
1169
|
+
break;
|
|
1170
|
+
}
|
|
1020
1171
|
}
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
switch (
|
|
1172
|
+
} else if (eventType === EXTERNAL_EVENT_ROTATE_PAN) {
|
|
1173
|
+
var rotateType = payload.rotateType;
|
|
1174
|
+
switch (rotateType) {
|
|
1024
1175
|
case TOP:
|
|
1025
1176
|
window.interval = setTimeout(function () {
|
|
1026
|
-
window.
|
|
1027
|
-
keyCode:
|
|
1177
|
+
window.SPKeyDown({
|
|
1178
|
+
keyCode: 87
|
|
1028
1179
|
});
|
|
1029
1180
|
}, 50);
|
|
1030
1181
|
break;
|
|
1031
1182
|
case BOTTOM:
|
|
1032
1183
|
window.interval = setTimeout(function () {
|
|
1033
|
-
window.
|
|
1034
|
-
keyCode:
|
|
1184
|
+
window.SPKeyDown({
|
|
1185
|
+
keyCode: 83
|
|
1035
1186
|
});
|
|
1036
1187
|
}, 50);
|
|
1037
1188
|
break;
|
|
1038
1189
|
case RIGHT:
|
|
1039
1190
|
window.interval = setTimeout(function () {
|
|
1040
|
-
window.
|
|
1041
|
-
keyCode:
|
|
1191
|
+
window.SPKeyDown({
|
|
1192
|
+
keyCode: 68
|
|
1042
1193
|
});
|
|
1043
1194
|
}, 50);
|
|
1044
1195
|
break;
|
|
1045
1196
|
case LEFT:
|
|
1046
1197
|
window.interval = setTimeout(function () {
|
|
1047
|
-
window.
|
|
1048
|
-
keyCode:
|
|
1198
|
+
window.SPKeyDown({
|
|
1199
|
+
keyCode: 65
|
|
1049
1200
|
});
|
|
1050
1201
|
}, 50);
|
|
1051
1202
|
break;
|
|
1052
1203
|
}
|
|
1053
1204
|
}
|
|
1054
1205
|
}
|
|
1206
|
+
function mergeSameElements(projectItemsCatalog) {
|
|
1207
|
+
var result = [];
|
|
1208
|
+
var _loop = function _loop(i) {
|
|
1209
|
+
var idx = result.findIndex(function (v) {
|
|
1210
|
+
return v.itemID === projectItemsCatalog[i].itemID;
|
|
1211
|
+
});
|
|
1212
|
+
if (idx < 0) result.push(projectItemsCatalog[i]);else {
|
|
1213
|
+
var _loop2 = function _loop2(j) {
|
|
1214
|
+
var _result$idx$structure, _result$idx$structure2;
|
|
1215
|
+
var idx2 = (_result$idx$structure = result[idx].structure_json) === null || _result$idx$structure === void 0 || (_result$idx$structure = _result$idx$structure.tempPlaceholders) === null || _result$idx$structure === void 0 ? void 0 : _result$idx$structure.findIndex(function (v) {
|
|
1216
|
+
return v.id === projectItemsCatalog[i].structure_json.tempPlaceholders[j].id;
|
|
1217
|
+
});
|
|
1218
|
+
if (idx2 < 0) (_result$idx$structure2 = result[idx].structure_json) === null || _result$idx$structure2 === void 0 || (_result$idx$structure2 = _result$idx$structure2.tempPlaceholders) === null || _result$idx$structure2 === void 0 || _result$idx$structure2.push(projectItemsCatalog[i].structure_json.tempPlaceholders[j]);else result[idx].structure_json.tempPlaceholders[idx2] = projectItemsCatalog[i].structure_json.tempPlaceholders[j];
|
|
1219
|
+
};
|
|
1220
|
+
for (var j = 0; j < ((_projectItemsCatalog$ = projectItemsCatalog[i].structure_json) === null || _projectItemsCatalog$ === void 0 || (_projectItemsCatalog$ = _projectItemsCatalog$.tempPlaceholders) === null || _projectItemsCatalog$ === void 0 ? void 0 : _projectItemsCatalog$.length); j++) {
|
|
1221
|
+
var _projectItemsCatalog$;
|
|
1222
|
+
_loop2(j);
|
|
1223
|
+
}
|
|
1224
|
+
}
|
|
1225
|
+
};
|
|
1226
|
+
for (var i = 0; i < (projectItemsCatalog === null || projectItemsCatalog === void 0 ? void 0 : projectItemsCatalog.length); i++) {
|
|
1227
|
+
_loop(i);
|
|
1228
|
+
}
|
|
1229
|
+
return result;
|
|
1230
|
+
}
|
|
1055
1231
|
export function handleExternalEvent(_x10) {
|
|
1056
1232
|
return _handleExternalEvent.apply(this, arguments);
|
|
1057
1233
|
}
|
|
1058
1234
|
function _handleExternalEvent() {
|
|
1059
|
-
_handleExternalEvent = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function
|
|
1235
|
+
_handleExternalEvent = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee0(props) {
|
|
1060
1236
|
var _evt$payload3, _evt$payload4;
|
|
1061
|
-
var evt, state, _evt$payload, cdsItems, itemKeys,
|
|
1062
|
-
return _regeneratorRuntime.wrap(function (
|
|
1063
|
-
while (1) switch (
|
|
1237
|
+
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, _Object$keys, _evt$payload5, doorStyle, itemCDS, isAll, _layerId, _cdsItems, allItems, selectedItemId, _itemKeys, _loop7, _i2, _props$onInternalEven2, _evt$payload6, roomShapeType, width, height, _doorStyle, value, _value, _evt$payload7, moldingInfo, isGlobal, distElement, _distElement, _evt$payload8, option, _value2, _layerId2, _layer, _layer$getIn, selectedLines, selectedHoles, selectedItems, _i4, _i5, _i6, _evt$payload9, _evt$payload0, _evt$payload1, _evt$payload10, _layerID, _layer2, orginalItemInfo, originalItem, originalItemPos, replaceItem, _props$onInternalEven3, sceneData, currentTexture, _t5, _t6;
|
|
1238
|
+
return _regeneratorRuntime.wrap(function (_context11) {
|
|
1239
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
1064
1240
|
case 0:
|
|
1065
|
-
// console.log('***external event****', props);
|
|
1241
|
+
// console.log('***external event****', props.externalEvent);
|
|
1066
1242
|
evt = props.externalEvent;
|
|
1067
|
-
state = props
|
|
1243
|
+
state = getPlannerStateFromProps(props);
|
|
1244
|
+
if (state) {
|
|
1245
|
+
_context11.next = 1;
|
|
1246
|
+
break;
|
|
1247
|
+
}
|
|
1248
|
+
return _context11.abrupt("return");
|
|
1249
|
+
case 1:
|
|
1250
|
+
layerId = state.getIn(['scene', 'selectedLayer']);
|
|
1251
|
+
layer = state.getIn(['scene', 'layers', layerId]);
|
|
1068
1252
|
_t5 = evt === null || evt === void 0 ? void 0 : evt.type;
|
|
1069
|
-
|
|
1253
|
+
_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 ? 21 : _t5 === EXTERNAL_EVENT_ZOOM_IN ? 22 : _t5 === EXTERNAL_EVENT_ZOOM_OUT ? 23 : _t5 === EXTERNAL_EVENT_CENTERING_2D ? 24 : _t5 === EXTERNAL_EVENT_UNDO ? 25 : _t5 === EXTERNAL_EVENT_REDO ? 26 : _t5 === EXTERNAL_EVENT_SET_MOLDING ? 27 : _t5 === EXTERNAL_EVENT_DUPLICATE_ELEMENT ? 29 : _t5 === EXTERNAL_EVENT_DELETE_ELEMENT ? 30 : _t5 === EXTERNAL_EVENT_PROJECT_SETTING ? 31 : _t5 === EXTERNAL_EVENT_UPDATE_ATTRIBUTE ? 40 : _t5 === EXTERNAL_EVENT_UPDATE_PROPERTY ? 40 : _t5 === EXTERNAL_EVENT_REPLACE_CABINET ? 41 : _t5 === EXTERNAL_EVENT_SET_FINISHING ? 43 : _t5 === EXTERNAL_EVENT_SYNC_SCENE ? 44 : 45;
|
|
1070
1254
|
break;
|
|
1071
|
-
case
|
|
1255
|
+
case 2:
|
|
1256
|
+
if (!(evt !== null && evt !== void 0 && evt.payload)) {
|
|
1257
|
+
_context11.next = 6;
|
|
1258
|
+
break;
|
|
1259
|
+
}
|
|
1072
1260
|
// prepare item data request
|
|
1073
1261
|
cdsItems = [];
|
|
1074
1262
|
itemKeys = Object.keys(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 ? void 0 : _evt$payload.items) || [];
|
|
1075
|
-
|
|
1076
|
-
var _evt$payload2, _it$doorStyle2;
|
|
1263
|
+
_loop6 = /*#__PURE__*/_regeneratorRuntime.mark(function _loop6() {
|
|
1264
|
+
var _evt$payload2, _it$properties, _it$properties2, _it$properties3, _it$doorStyle2;
|
|
1077
1265
|
var it;
|
|
1078
|
-
return _regeneratorRuntime.wrap(function (
|
|
1079
|
-
while (1) switch (
|
|
1266
|
+
return _regeneratorRuntime.wrap(function (_context0) {
|
|
1267
|
+
while (1) switch (_context0.prev = _context0.next) {
|
|
1080
1268
|
case 0:
|
|
1081
|
-
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]];
|
|
1269
|
+
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')
|
|
1270
|
+
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')) {
|
|
1271
|
+
it.properties.altitude.length = convert(it.properties.altitude._length).from(it.properties.altitude._unit).to('cm');
|
|
1272
|
+
}
|
|
1273
|
+
/////////
|
|
1082
1274
|
if (!cdsItems.some(function (v) {
|
|
1083
1275
|
var _it$doorStyle;
|
|
1084
1276
|
return it.itemID === v.itemID && it.name === v.name && ((_it$doorStyle = it.doorStyle) === null || _it$doorStyle === void 0 || (_it$doorStyle = _it$doorStyle.doorStyles) === null || _it$doorStyle === void 0 ? void 0 : _it$doorStyle.cabinet_door_style_id) === v.cdsId;
|
|
@@ -1093,23 +1285,27 @@ function _handleExternalEvent() {
|
|
|
1093
1285
|
});
|
|
1094
1286
|
case 1:
|
|
1095
1287
|
case "end":
|
|
1096
|
-
return
|
|
1288
|
+
return _context0.stop();
|
|
1097
1289
|
}
|
|
1098
|
-
},
|
|
1290
|
+
}, _loop6);
|
|
1099
1291
|
});
|
|
1100
1292
|
i = 0;
|
|
1101
|
-
case
|
|
1293
|
+
case 3:
|
|
1102
1294
|
if (!(i < itemKeys.length)) {
|
|
1103
|
-
|
|
1295
|
+
_context11.next = 5;
|
|
1104
1296
|
break;
|
|
1105
1297
|
}
|
|
1106
|
-
return
|
|
1107
|
-
case
|
|
1298
|
+
return _context11.delegateYield(_loop6(), "t0", 4);
|
|
1299
|
+
case 4:
|
|
1108
1300
|
i++;
|
|
1109
|
-
|
|
1301
|
+
_context11.next = 3;
|
|
1110
1302
|
break;
|
|
1111
|
-
case
|
|
1112
|
-
|
|
1303
|
+
case 5:
|
|
1304
|
+
newScene = new Scene(evt === null || evt === void 0 ? void 0 : evt.payload);
|
|
1305
|
+
tempState = new State({
|
|
1306
|
+
scene: newScene.toJS(),
|
|
1307
|
+
catalog: (_state$catalog = state.catalog) === null || _state$catalog === void 0 ? void 0 : _state$catalog.toJS()
|
|
1308
|
+
}); // request item catalog data to host app
|
|
1113
1309
|
if (cdsItems.length > 0) {
|
|
1114
1310
|
(_props$onInternalEven = props.onInternalEvent) === null || _props$onInternalEven === void 0 || _props$onInternalEven.call(props, {
|
|
1115
1311
|
type: INTERNAL_EVENT_ITEMS_CATALOG,
|
|
@@ -1117,62 +1313,65 @@ function _handleExternalEvent() {
|
|
|
1117
1313
|
cdsItems: cdsItems
|
|
1118
1314
|
}
|
|
1119
1315
|
}, /*#__PURE__*/function () {
|
|
1120
|
-
var
|
|
1121
|
-
var
|
|
1122
|
-
return _regeneratorRuntime.wrap(function (
|
|
1123
|
-
while (1) switch (
|
|
1316
|
+
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee8(result) {
|
|
1317
|
+
var rt, _i;
|
|
1318
|
+
return _regeneratorRuntime.wrap(function (_context9) {
|
|
1319
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
1124
1320
|
case 0:
|
|
1321
|
+
rt = mergeSameElements(result === null || result === void 0 ? void 0 : result.elements);
|
|
1125
1322
|
_i = 0;
|
|
1126
1323
|
case 1:
|
|
1127
|
-
if (!(_i < (
|
|
1128
|
-
|
|
1324
|
+
if (!(_i < (rt === null || rt === void 0 ? void 0 : rt.length))) {
|
|
1325
|
+
_context9.next = 3;
|
|
1129
1326
|
break;
|
|
1130
1327
|
}
|
|
1131
|
-
|
|
1132
|
-
return addItemToCatalog(
|
|
1328
|
+
_context9.next = 2;
|
|
1329
|
+
return addItemToCatalog(rt[_i], tempState, props.catalog, props.projectActions);
|
|
1133
1330
|
case 2:
|
|
1134
1331
|
_i++;
|
|
1135
|
-
|
|
1332
|
+
_context9.next = 1;
|
|
1136
1333
|
break;
|
|
1137
1334
|
case 3:
|
|
1138
1335
|
props.projectActions.loadProject(evt.payload);
|
|
1139
1336
|
case 4:
|
|
1140
1337
|
case "end":
|
|
1141
|
-
return
|
|
1338
|
+
return _context9.stop();
|
|
1142
1339
|
}
|
|
1143
|
-
},
|
|
1340
|
+
}, _callee8);
|
|
1144
1341
|
}));
|
|
1145
1342
|
return function (_x11) {
|
|
1146
|
-
return
|
|
1343
|
+
return _ref3.apply(this, arguments);
|
|
1147
1344
|
};
|
|
1148
1345
|
}());
|
|
1149
|
-
}
|
|
1150
|
-
return _context1.abrupt("continue", 35);
|
|
1151
|
-
case 5:
|
|
1152
|
-
props.projectActions.setMode(MODE_IDLE_3D);
|
|
1153
|
-
return _context1.abrupt("continue", 35);
|
|
1346
|
+
} else props.projectActions.loadProject(evt.payload);
|
|
1154
1347
|
case 6:
|
|
1155
|
-
|
|
1156
|
-
return _context1.abrupt("continue", 35);
|
|
1348
|
+
return _context11.abrupt("continue", 45);
|
|
1157
1349
|
case 7:
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
return
|
|
1350
|
+
props.projectActions.unselectAll();
|
|
1351
|
+
props.projectActions.setMode(MODE_IDLE_3D);
|
|
1352
|
+
return _context11.abrupt("continue", 45);
|
|
1161
1353
|
case 8:
|
|
1354
|
+
props.projectActions.setMode(MODE_IDLE);
|
|
1355
|
+
return _context11.abrupt("continue", 45);
|
|
1356
|
+
case 9:
|
|
1357
|
+
sLineCnt = layer.selected.lines.size;
|
|
1358
|
+
if (sLineCnt > 0) props.projectActions.setMode(MODE_ELEVATION_VIEW);
|
|
1359
|
+
return _context11.abrupt("continue", 45);
|
|
1360
|
+
case 10:
|
|
1162
1361
|
if (state.mode === MODE_IDLE || state.mode === MODE_2D_PAN) props.linesActions.selectToolDrawingLine('wall');else {
|
|
1163
1362
|
props.projectActions.setMode(MODE_IDLE);
|
|
1164
1363
|
props.linesActions.selectToolDrawingLine('wall');
|
|
1165
1364
|
}
|
|
1166
|
-
return
|
|
1167
|
-
case
|
|
1365
|
+
return _context11.abrupt("continue", 45);
|
|
1366
|
+
case 11:
|
|
1168
1367
|
if (isEmpty(evt === null || evt === void 0 ? void 0 : evt.payload)) {
|
|
1169
|
-
|
|
1368
|
+
_context11.next = 13;
|
|
1170
1369
|
break;
|
|
1171
1370
|
}
|
|
1172
1371
|
element = evt.payload;
|
|
1173
|
-
|
|
1372
|
+
_context11.next = 12;
|
|
1174
1373
|
return addItemToCatalog(element, state, props.catalog, props.projectActions);
|
|
1175
|
-
case
|
|
1374
|
+
case 12:
|
|
1176
1375
|
// start drawing item
|
|
1177
1376
|
if (ARRAY_3D_MODES.includes(state.mode)) {
|
|
1178
1377
|
// in 3d view
|
|
@@ -1193,38 +1392,38 @@ function _handleExternalEvent() {
|
|
|
1193
1392
|
}
|
|
1194
1393
|
props.projectActions.pushLastSelectedCatalogElementToHistory(element);
|
|
1195
1394
|
props.projectActions.setIsCabinetDrawing(true);
|
|
1196
|
-
case 11:
|
|
1197
|
-
return _context1.abrupt("continue", 35);
|
|
1198
|
-
case 12:
|
|
1199
|
-
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);
|
|
1200
|
-
return _context1.abrupt("continue", 35);
|
|
1201
1395
|
case 13:
|
|
1202
|
-
|
|
1203
|
-
return _context1.abrupt("continue", 35);
|
|
1396
|
+
return _context11.abrupt("continue", 45);
|
|
1204
1397
|
case 14:
|
|
1398
|
+
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);
|
|
1399
|
+
return _context11.abrupt("continue", 45);
|
|
1400
|
+
case 15:
|
|
1401
|
+
moveAndRotatePan2D3D(evt.type, props, evt.payload, state);
|
|
1402
|
+
return _context11.abrupt("continue", 45);
|
|
1403
|
+
case 16:
|
|
1205
1404
|
defaulTitle = 'Untitle';
|
|
1206
1405
|
props.projectActions.newProject();
|
|
1207
1406
|
props.projectActions.rename(defaulTitle);
|
|
1208
|
-
return
|
|
1209
|
-
case
|
|
1407
|
+
return _context11.abrupt("continue", 45);
|
|
1408
|
+
case 17:
|
|
1210
1409
|
_evt$payload5 = evt.payload, doorStyle = _evt$payload5.doorStyle, itemCDS = _evt$payload5.itemCDS, isAll = _evt$payload5.isAll; // prepare item data request
|
|
1211
|
-
|
|
1410
|
+
_layerId = state.getIn(['scene', 'selectedLayer']);
|
|
1212
1411
|
_cdsItems = [];
|
|
1213
|
-
allItems = state.getIn(['scene', 'layers',
|
|
1214
|
-
selectedItemId = state.getIn(['scene', 'layers',
|
|
1412
|
+
allItems = state.getIn(['scene', 'layers', _layerId, 'items']).toJS();
|
|
1413
|
+
selectedItemId = state.getIn(['scene', 'layers', _layerId]).selected.items.toJS()[0];
|
|
1215
1414
|
_itemKeys = isAll ? (_Object$keys = Object.keys(allItems)) !== null && _Object$keys !== void 0 ? _Object$keys : [] : [selectedItemId];
|
|
1216
|
-
|
|
1415
|
+
_loop7 = /*#__PURE__*/_regeneratorRuntime.mark(function _loop7() {
|
|
1217
1416
|
var _itemCDS$find;
|
|
1218
1417
|
var item, cdsId;
|
|
1219
|
-
return _regeneratorRuntime.wrap(function (
|
|
1220
|
-
while (1) switch (
|
|
1418
|
+
return _regeneratorRuntime.wrap(function (_context10) {
|
|
1419
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
1221
1420
|
case 0:
|
|
1222
1421
|
item = allItems[_itemKeys[_i2]];
|
|
1223
1422
|
cdsId = (_itemCDS$find = itemCDS.find(function (itCDS) {
|
|
1224
1423
|
return itCDS.itemID === item.itemID;
|
|
1225
1424
|
})) === null || _itemCDS$find === void 0 ? void 0 : _itemCDS$find.cabinet_door_style_id;
|
|
1226
1425
|
if (cdsId && !_cdsItems.some(function (v) {
|
|
1227
|
-
return
|
|
1426
|
+
return item.itemID === v.itemID && item.name === v.name && cdsId === v.cdsId;
|
|
1228
1427
|
})) _cdsItems.push({
|
|
1229
1428
|
itemID: item.itemID,
|
|
1230
1429
|
prototype: item.prototype,
|
|
@@ -1236,22 +1435,22 @@ function _handleExternalEvent() {
|
|
|
1236
1435
|
});
|
|
1237
1436
|
case 1:
|
|
1238
1437
|
case "end":
|
|
1239
|
-
return
|
|
1438
|
+
return _context10.stop();
|
|
1240
1439
|
}
|
|
1241
|
-
},
|
|
1440
|
+
}, _loop7);
|
|
1242
1441
|
});
|
|
1243
1442
|
_i2 = 0;
|
|
1244
|
-
case
|
|
1443
|
+
case 18:
|
|
1245
1444
|
if (!(_i2 < _itemKeys.length)) {
|
|
1246
|
-
|
|
1445
|
+
_context11.next = 20;
|
|
1247
1446
|
break;
|
|
1248
1447
|
}
|
|
1249
|
-
return
|
|
1250
|
-
case
|
|
1448
|
+
return _context11.delegateYield(_loop7(), "t1", 19);
|
|
1449
|
+
case 19:
|
|
1251
1450
|
_i2++;
|
|
1252
|
-
|
|
1451
|
+
_context11.next = 18;
|
|
1253
1452
|
break;
|
|
1254
|
-
case
|
|
1453
|
+
case 20:
|
|
1255
1454
|
// request item catalog data to host app
|
|
1256
1455
|
if (_cdsItems.length > 0) {
|
|
1257
1456
|
(_props$onInternalEven2 = props.onInternalEvent) === null || _props$onInternalEven2 === void 0 || _props$onInternalEven2.call(props, {
|
|
@@ -1260,112 +1459,129 @@ function _handleExternalEvent() {
|
|
|
1260
1459
|
cdsItems: _cdsItems
|
|
1261
1460
|
}
|
|
1262
1461
|
}, /*#__PURE__*/function () {
|
|
1263
|
-
var
|
|
1264
|
-
var
|
|
1265
|
-
return _regeneratorRuntime.wrap(function (
|
|
1266
|
-
while (1) switch (
|
|
1462
|
+
var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee9(result) {
|
|
1463
|
+
var rt, _i3;
|
|
1464
|
+
return _regeneratorRuntime.wrap(function (_context1) {
|
|
1465
|
+
while (1) switch (_context1.prev = _context1.next) {
|
|
1267
1466
|
case 0:
|
|
1467
|
+
rt = mergeSameElements(result === null || result === void 0 ? void 0 : result.elements);
|
|
1268
1468
|
_i3 = 0;
|
|
1269
1469
|
case 1:
|
|
1270
|
-
if (!(_i3 < (
|
|
1271
|
-
|
|
1470
|
+
if (!(_i3 < (rt === null || rt === void 0 ? void 0 : rt.length))) {
|
|
1471
|
+
_context1.next = 3;
|
|
1272
1472
|
break;
|
|
1273
1473
|
}
|
|
1274
|
-
|
|
1275
|
-
return addItemToCatalog(
|
|
1474
|
+
_context1.next = 2;
|
|
1475
|
+
return addItemToCatalog(rt[_i3], state, props.catalog, props.projectActions);
|
|
1276
1476
|
case 2:
|
|
1277
1477
|
_i3++;
|
|
1278
|
-
|
|
1478
|
+
_context1.next = 1;
|
|
1279
1479
|
break;
|
|
1280
1480
|
case 3:
|
|
1281
1481
|
props.itemsActions.setDoorStyle(doorStyle, itemCDS, isAll);
|
|
1282
1482
|
case 4:
|
|
1283
1483
|
case "end":
|
|
1284
|
-
return
|
|
1484
|
+
return _context1.stop();
|
|
1285
1485
|
}
|
|
1286
|
-
},
|
|
1486
|
+
}, _callee9);
|
|
1287
1487
|
}));
|
|
1288
1488
|
return function (_x12) {
|
|
1289
|
-
return
|
|
1489
|
+
return _ref4.apply(this, arguments);
|
|
1290
1490
|
};
|
|
1291
1491
|
}());
|
|
1292
1492
|
} else props.itemsActions.setDoorStyle(doorStyle, itemCDS, isAll);
|
|
1293
|
-
return
|
|
1294
|
-
case
|
|
1493
|
+
return _context11.abrupt("continue", 45);
|
|
1494
|
+
case 21:
|
|
1295
1495
|
_evt$payload6 = evt.payload, roomShapeType = _evt$payload6.roomShapeType, width = _evt$payload6.width, height = _evt$payload6.height, _doorStyle = _evt$payload6.doorStyle;
|
|
1296
1496
|
props.projectActions.createRoomWithShape(roomShapeType, width, height, _doorStyle);
|
|
1297
|
-
return
|
|
1298
|
-
case
|
|
1497
|
+
return _context11.abrupt("continue", 45);
|
|
1498
|
+
case 22:
|
|
1299
1499
|
value = state.getIn(['viewer2D']).toJS();
|
|
1300
1500
|
value.a += 0.1;
|
|
1301
1501
|
value.d += 0.1;
|
|
1302
1502
|
value.e -= value.SVGWidth * 0.1 / 2;
|
|
1303
1503
|
value.f -= value.SVGHeight * 0.1 / 2;
|
|
1304
1504
|
updateViwer2D(value, props.viewer2DActions);
|
|
1305
|
-
return
|
|
1306
|
-
case
|
|
1505
|
+
return _context11.abrupt("continue", 45);
|
|
1506
|
+
case 23:
|
|
1307
1507
|
_value = state.getIn(['viewer2D']).toJS();
|
|
1308
1508
|
_value.a -= 0.1;
|
|
1309
1509
|
_value.d -= 0.1;
|
|
1310
1510
|
_value.e += _value.SVGWidth * 0.1 / 2;
|
|
1311
1511
|
_value.f += _value.SVGHeight * 0.1 / 2;
|
|
1312
1512
|
updateViwer2D(_value, props.viewer2DActions);
|
|
1313
|
-
return
|
|
1314
|
-
case
|
|
1513
|
+
return _context11.abrupt("continue", 45);
|
|
1514
|
+
case 24:
|
|
1315
1515
|
centering2D(state, props.viewer2DActions);
|
|
1316
|
-
return
|
|
1317
|
-
case
|
|
1516
|
+
return _context11.abrupt("continue", 45);
|
|
1517
|
+
case 25:
|
|
1318
1518
|
props.projectActions.undo();
|
|
1319
|
-
return
|
|
1320
|
-
case
|
|
1519
|
+
return _context11.abrupt("continue", 45);
|
|
1520
|
+
case 26:
|
|
1321
1521
|
props.projectActions.redo();
|
|
1322
|
-
return
|
|
1323
|
-
case
|
|
1522
|
+
return _context11.abrupt("continue", 45);
|
|
1523
|
+
case 27:
|
|
1324
1524
|
_evt$payload7 = evt.payload, moldingInfo = _evt$payload7.moldingInfo, isGlobal = _evt$payload7.isGlobal;
|
|
1325
|
-
|
|
1525
|
+
_context11.next = 28;
|
|
1326
1526
|
return loadMoldingSvg(moldingInfo);
|
|
1327
|
-
case
|
|
1527
|
+
case 28:
|
|
1328
1528
|
props.itemsActions.setMolding(moldingInfo, isGlobal);
|
|
1329
|
-
return
|
|
1330
|
-
case
|
|
1529
|
+
return _context11.abrupt("continue", 45);
|
|
1530
|
+
case 29:
|
|
1331
1531
|
distElement = getElement(evt.payload, state);
|
|
1332
1532
|
if (distElement) props.itemsActions.duplicateSelected(distElement, props.onInternalEvent);
|
|
1333
|
-
return
|
|
1334
|
-
case
|
|
1533
|
+
return _context11.abrupt("continue", 45);
|
|
1534
|
+
case 30:
|
|
1335
1535
|
_distElement = getElement(evt.payload, state);
|
|
1336
1536
|
if (_distElement) props.projectActions.remove(_distElement);
|
|
1337
|
-
return
|
|
1338
|
-
case 29:
|
|
1339
|
-
_evt$payload8 = evt.payload, option = _evt$payload8.option, _value2 = _evt$payload8.value;
|
|
1340
|
-
if (option === PROJECT_SETTING_OPTION.UPDATE_CEIL_HEIGHT) {
|
|
1341
|
-
props.viewer2DActions.updateCeilHeight(_value2);
|
|
1342
|
-
props.viewer3DActions.update3DCeilHeight(_value2);
|
|
1343
|
-
} else if (option === PROJECT_SETTING_OPTION.CHANGE_WALL_LENGTH_MEASURE) {
|
|
1344
|
-
props.viewer2DActions.changeWallLengthMeasure(_value2);
|
|
1345
|
-
} else if (option === PROJECT_SETTING_OPTION.CHANGE_BASE_CABINET_MEASURE) {
|
|
1346
|
-
props.viewer2DActions.changeBaseCabinetMeasure(_value2);
|
|
1347
|
-
} else if (option === PROJECT_SETTING_OPTION.CHANGE_WALL_CABINET_MEASURE) {
|
|
1348
|
-
props.viewer2DActions.changeWallCabinetMeasure(_value2);
|
|
1349
|
-
} else if (option === PROJECT_SETTING_OPTION.CHANGE_WINDOW_DOOR_MEASURE) {
|
|
1350
|
-
props.viewer2DActions.changeWindowDoorMeasure(_value2);
|
|
1351
|
-
}
|
|
1352
|
-
return _context1.abrupt("continue", 35);
|
|
1353
|
-
case 30:
|
|
1354
|
-
_layerId = state.getIn(['scene', 'selectedLayer']);
|
|
1355
|
-
layer = state.getIn(['scene', 'layers', _layerId]);
|
|
1356
|
-
_layer$getIn = layer.getIn(['selected']), selectedLines = _layer$getIn.lines, selectedHoles = _layer$getIn.holes, selectedItems = _layer$getIn.items;
|
|
1357
|
-
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);
|
|
1358
|
-
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);
|
|
1359
|
-
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);
|
|
1360
|
-
return _context1.abrupt("continue", 35);
|
|
1537
|
+
return _context11.abrupt("continue", 45);
|
|
1361
1538
|
case 31:
|
|
1539
|
+
_evt$payload8 = evt.payload, option = _evt$payload8.option, _value2 = _evt$payload8.value;
|
|
1540
|
+
_t6 = option;
|
|
1541
|
+
_context11.next = _t6 === PROJECT_SETTING_OPTION.CHANGE_MEASUREMENT_UNIT ? 32 : _t6 === PROJECT_SETTING_OPTION.UPDATE_CEIL_HEIGHT ? 33 : _t6 === PROJECT_SETTING_OPTION.CHANGE_WALL_LENGTH_MEASURE ? 34 : _t6 === PROJECT_SETTING_OPTION.CHANGE_BASE_CABINET_MEASURE ? 35 : _t6 === PROJECT_SETTING_OPTION.CHANGE_WALL_CABINET_MEASURE ? 36 : _t6 === PROJECT_SETTING_OPTION.CHANGE_WINDOW_DOOR_MEASURE ? 37 : 38;
|
|
1542
|
+
break;
|
|
1543
|
+
case 32:
|
|
1544
|
+
props.viewer2DActions.updateCeilHeight(convert(layer.ceilHeight).from(layer.unit).to(_value2));
|
|
1545
|
+
props.viewer2DActions.updateCeilHeightUnit(_value2);
|
|
1546
|
+
props.viewer3DActions.update3DCeilHeightUnit(_value2);
|
|
1547
|
+
props.viewer3DActions.update3DCeilHeight(convert(layer.ceilHeight).from(layer.unit).to(_value2));
|
|
1548
|
+
return _context11.abrupt("continue", 39);
|
|
1549
|
+
case 33:
|
|
1550
|
+
props.viewer2DActions.updateCeilHeight(_value2);
|
|
1551
|
+
props.viewer3DActions.update3DCeilHeight(_value2);
|
|
1552
|
+
return _context11.abrupt("continue", 39);
|
|
1553
|
+
case 34:
|
|
1554
|
+
props.viewer2DActions.changeWallLengthMeasure(_value2);
|
|
1555
|
+
return _context11.abrupt("continue", 39);
|
|
1556
|
+
case 35:
|
|
1557
|
+
props.viewer2DActions.changeBaseCabinetMeasure(_value2);
|
|
1558
|
+
return _context11.abrupt("continue", 39);
|
|
1559
|
+
case 36:
|
|
1560
|
+
props.viewer2DActions.changeWallCabinetMeasure(_value2);
|
|
1561
|
+
return _context11.abrupt("continue", 39);
|
|
1562
|
+
case 37:
|
|
1563
|
+
props.viewer2DActions.changeWindowDoorMeasure(_value2);
|
|
1564
|
+
return _context11.abrupt("continue", 39);
|
|
1565
|
+
case 38:
|
|
1566
|
+
return _context11.abrupt("continue", 39);
|
|
1567
|
+
case 39:
|
|
1568
|
+
return _context11.abrupt("continue", 45);
|
|
1569
|
+
case 40:
|
|
1570
|
+
_layerId2 = state.getIn(['scene', 'selectedLayer']);
|
|
1571
|
+
_layer = state.getIn(['scene', 'layers', _layerId2]);
|
|
1572
|
+
_layer$getIn = _layer.getIn(['selected']), selectedLines = _layer$getIn.lines, selectedHoles = _layer$getIn.holes, selectedItems = _layer$getIn.items;
|
|
1573
|
+
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);
|
|
1574
|
+
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);
|
|
1575
|
+
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);
|
|
1576
|
+
return _context11.abrupt("continue", 45);
|
|
1577
|
+
case 41:
|
|
1362
1578
|
_layerID = state.scene.selectedLayer;
|
|
1363
|
-
|
|
1579
|
+
_layer2 = state.scene.getIn(['layers', _layerID]).toJS();
|
|
1364
1580
|
orginalItemInfo = evt === null || evt === void 0 || (_evt$payload9 = evt.payload) === null || _evt$payload9 === void 0 ? void 0 : _evt$payload9.orginalItemInfo;
|
|
1365
|
-
originalItem =
|
|
1366
|
-
|
|
1581
|
+
originalItem = _layer2 === null || _layer2 === void 0 ? void 0 : _layer2.items[orginalItemInfo.id];
|
|
1582
|
+
_context11.next = 42;
|
|
1367
1583
|
return addItemToCatalog(evt.payload.replaceItemInfo, state, props.catalog, props.projectActions);
|
|
1368
|
-
case
|
|
1584
|
+
case 42:
|
|
1369
1585
|
originalItemPos = {
|
|
1370
1586
|
rotation: originalItem.rotation,
|
|
1371
1587
|
selectedItemId: originalItem.id,
|
|
@@ -1380,23 +1596,27 @@ function _handleExternalEvent() {
|
|
|
1380
1596
|
}
|
|
1381
1597
|
};
|
|
1382
1598
|
props.itemsActions.replaceItem(originalItemPos, originalItem, replaceItem);
|
|
1383
|
-
return
|
|
1384
|
-
case
|
|
1599
|
+
return _context11.abrupt("continue", 45);
|
|
1600
|
+
case 43:
|
|
1385
1601
|
setFinishing(props, state, evt.payload);
|
|
1386
|
-
|
|
1602
|
+
return _context11.abrupt("continue", 45);
|
|
1603
|
+
case 44:
|
|
1604
|
+
sceneData = state.scene.toJS(); // get molding data for "ReviewForQuote"
|
|
1605
|
+
currentTexture = layer.doorStyle !== null || layer.doorStyle !== undefined ? layer.doorStyle : props.state.doorStyle.toJS();
|
|
1606
|
+
sceneData.layers[layerId].moldingData = getMoldingDataOfScene2(layer, props.catalog, currentTexture);
|
|
1387
1607
|
// send scene object from 3DTool to HostApp using internalEvent
|
|
1388
1608
|
(_props$onInternalEven3 = props.onInternalEvent) === null || _props$onInternalEven3 === void 0 || _props$onInternalEven3.call(props, {
|
|
1389
1609
|
type: INTERNAL_EVENT_SYNC_SCENE,
|
|
1390
1610
|
value: {
|
|
1391
|
-
scene:
|
|
1611
|
+
scene: sceneData
|
|
1392
1612
|
}
|
|
1393
1613
|
});
|
|
1394
|
-
return
|
|
1395
|
-
case
|
|
1614
|
+
return _context11.abrupt("continue", 45);
|
|
1615
|
+
case 45:
|
|
1396
1616
|
case "end":
|
|
1397
|
-
return
|
|
1617
|
+
return _context11.stop();
|
|
1398
1618
|
}
|
|
1399
|
-
},
|
|
1619
|
+
}, _callee0);
|
|
1400
1620
|
}));
|
|
1401
1621
|
return _handleExternalEvent.apply(this, arguments);
|
|
1402
1622
|
}
|