kitchen-simulator 5.0.0-new-api → 5.0.0-new-api.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/LiteKitchenConfigurator.js +1 -1
- package/es/assets/Window.hdr +2100 -0
- package/es/assets/img/default/maple.jpg +0 -0
- package/es/assets/img/default/steel.jpg +0 -0
- package/es/catalog/catalog.js +0 -2
- package/es/catalog/utils/exporter.js +2 -0
- package/es/class/area.js +0 -1
- package/es/class/export.js +1 -3
- package/es/components/content.js +1 -3
- package/es/components/style/export.js +2 -28
- package/es/components/viewer2d/line.js +2 -2
- package/es/components/viewer2d/viewer2d.js +0 -1
- package/es/components/viewer3d/front3D.js +1 -2
- package/es/components/viewer3d/pointer-lock-navigation.js +0 -90
- package/es/components/viewer3d/scene-creator.js +7 -5
- package/es/components/viewer3d/three-memory-cleaner.js +0 -14
- package/es/components/viewer3d/viewer3d.js +1 -1
- package/es/constants.js +3 -3
- package/es/devLiteRenderer.js +119 -61
- package/es/events/external/handleExternalEvent.js +140 -0
- package/es/{utils/isolate-event-handler.js → events/external/handleExternalEvent.util.js} +17 -563
- package/es/events/external/handlers.addItem.js +47 -0
- package/es/events/external/handlers.changeDoorStyle.js +131 -0
- package/es/events/external/handlers.elementOps.js +8 -0
- package/es/events/external/handlers.finishing.js +26 -0
- package/es/events/external/handlers.hole.js +4 -0
- package/es/events/external/handlers.loadProject.js +117 -0
- package/es/events/external/handlers.molding.js +24 -0
- package/es/events/external/handlers.projectLifecycle.js +11 -0
- package/es/events/external/handlers.projectSettings.js +32 -0
- package/es/events/external/handlers.replaceCabinet.js +41 -0
- package/es/events/external/handlers.roomShape.js +8 -0
- package/es/events/external/handlers.syncScene.js +21 -0
- package/es/events/external/handlers.updateSelectedElements.js +11 -0
- package/es/events/external/handlers.viewMode.js +11 -0
- package/es/events/external/handlers.viewerNavigation.js +108 -0
- package/es/events/external/handlers.wall.js +7 -0
- package/es/mappings/external-events/mappers/ccdfMapper.js +2 -2
- package/es/mappings/external-events/mappers/changeDoorStyleMapper.js +1 -29
- package/es/plugins/keyboard.js +1 -1
- package/es/reducers/export.js +2 -4
- package/es/reducers/items-reducer.js +1 -1
- package/es/reducers/project-reducer.js +1 -1
- package/es/reducers/reducer.js +2 -3
- package/es/shared/objects/immutable.js +3 -0
- package/es/utils/geometry.js +276 -74
- package/es/utils/history.js +2 -2
- package/es/utils/molding.js +6 -20
- package/lib/LiteKitchenConfigurator.js +2 -2
- package/lib/assets/Window.hdr +2100 -0
- package/lib/assets/img/default/maple.jpg +0 -0
- package/lib/assets/img/default/steel.jpg +0 -0
- package/lib/catalog/catalog.js +0 -2
- package/lib/catalog/utils/exporter.js +2 -0
- package/lib/class/area.js +0 -1
- package/lib/class/export.js +0 -8
- package/lib/components/content.js +1 -3
- package/lib/components/style/export.js +1 -105
- package/lib/components/viewer2d/line.js +1 -1
- package/lib/components/viewer2d/viewer2d.js +0 -1
- package/lib/components/viewer3d/front3D.js +1 -2
- package/lib/components/viewer3d/pointer-lock-navigation.js +0 -90
- package/lib/components/viewer3d/scene-creator.js +7 -5
- package/lib/components/viewer3d/three-memory-cleaner.js +0 -14
- package/lib/constants.js +8 -8
- package/lib/devLiteRenderer.js +118 -60
- package/lib/events/external/handleExternalEvent.js +147 -0
- package/lib/{utils/isolate-event-handler.js → events/external/handleExternalEvent.util.js} +14 -557
- package/lib/events/external/handlers.addItem.js +54 -0
- package/lib/events/external/handlers.changeDoorStyle.js +138 -0
- package/lib/events/external/handlers.elementOps.js +15 -0
- package/lib/events/external/handlers.finishing.js +32 -0
- package/lib/events/external/handlers.hole.js +10 -0
- package/lib/events/external/handlers.loadProject.js +124 -0
- package/lib/events/external/handlers.molding.js +31 -0
- package/lib/events/external/handlers.projectLifecycle.js +19 -0
- package/lib/events/external/handlers.projectSettings.js +38 -0
- package/lib/events/external/handlers.replaceCabinet.js +48 -0
- package/lib/events/external/handlers.roomShape.js +14 -0
- package/lib/events/external/handlers.syncScene.js +27 -0
- package/lib/events/external/handlers.updateSelectedElements.js +17 -0
- package/lib/events/external/handlers.viewMode.js +19 -0
- package/lib/events/external/handlers.viewerNavigation.js +117 -0
- package/lib/events/external/handlers.wall.js +13 -0
- package/lib/mappings/external-events/mappers/ccdfMapper.js +2 -2
- package/lib/mappings/external-events/mappers/changeDoorStyleMapper.js +1 -29
- package/lib/reducers/export.js +1 -9
- package/lib/reducers/reducer.js +0 -1
- package/lib/shared/objects/immutable.js +9 -0
- package/lib/utils/geometry.js +276 -74
- package/lib/utils/history.js +1 -1
- package/lib/utils/molding.js +6 -20
- package/package.json +1 -1
- package/es/assets/gltf/door_closet.bin +0 -0
- package/es/assets/gltf/door_closet.fbx +0 -0
- package/es/assets/gltf/door_exterior.bin +0 -0
- package/es/assets/gltf/door_exterior.fbx +0 -0
- package/es/assets/gltf/door_interior.bin +0 -0
- package/es/assets/gltf/door_interior.fbx +0 -0
- package/es/assets/gltf/door_sliding.bin +0 -0
- package/es/assets/gltf/door_sliding.fbx +0 -0
- package/es/assets/img/png/helper/video_preview_3d.png +0 -0
- package/es/assets/img/png/helper/video_preview_start.png +0 -0
- package/es/assets/img/svg/color/Brown.svg +0 -9
- package/es/assets/img/svg/color/Dark.svg +0 -9
- package/es/assets/img/svg/color/Light.svg +0 -9
- package/es/assets/img/svg/color/Medium.svg +0 -9
- package/es/assets/img/svg/color/Unfinished.svg +0 -9
- package/es/catalog/lines/wall/textures/bricks-normal2.jpg +0 -0
- package/es/catalog/lines/wall/textures/bricks3.jpg +0 -0
- package/es/catalog/properties/export.js +0 -21
- package/es/catalog/properties/property-checkbox.js +0 -68
- package/es/catalog/properties/property-color.js +0 -39
- package/es/catalog/properties/property-enum.js +0 -50
- package/es/catalog/properties/property-hidden.js +0 -19
- package/es/catalog/properties/property-lenght-measure.js +0 -100
- package/es/catalog/properties/property-length-measure.js +0 -84
- package/es/catalog/properties/property-length-measure_hole.js +0 -100
- package/es/catalog/properties/property-number.js +0 -48
- package/es/catalog/properties/property-read-only.js +0 -26
- package/es/catalog/properties/property-string.js +0 -48
- package/es/catalog/properties/property-toggle.js +0 -39
- package/es/catalog/properties/shared-property-style.js +0 -14
- package/es/catalog/utils/FuseUtils.js +0 -79
- package/es/class/FuseUtils.js +0 -79
- package/es/components/style/button.js +0 -106
- package/es/components/style/cancel-button.js +0 -21
- package/es/components/style/content-container.js +0 -30
- package/es/components/style/content-title.js +0 -25
- package/es/components/style/delete-button.js +0 -24
- package/es/components/style/form-block.js +0 -20
- package/es/components/style/form-color-input.js +0 -26
- package/es/components/style/form-label.js +0 -22
- package/es/components/style/form-number-input_2.js +0 -200
- package/es/components/style/form-select.js +0 -19
- package/es/components/style/form-slider.js +0 -60
- package/es/components/style/form-text-input.js +0 -69
- package/es/reducers/user-reducer.js +0 -41
- package/es/styles/export.js +0 -5
- package/es/styles/tabs.css +0 -40
- package/lib/assets/gltf/door_closet.bin +0 -0
- package/lib/assets/gltf/door_closet.fbx +0 -0
- package/lib/assets/gltf/door_exterior.bin +0 -0
- package/lib/assets/gltf/door_exterior.fbx +0 -0
- package/lib/assets/gltf/door_interior.bin +0 -0
- package/lib/assets/gltf/door_interior.fbx +0 -0
- package/lib/assets/gltf/door_sliding.bin +0 -0
- package/lib/assets/gltf/door_sliding.fbx +0 -0
- package/lib/assets/img/png/helper/video_preview_3d.png +0 -0
- package/lib/assets/img/png/helper/video_preview_start.png +0 -0
- package/lib/assets/img/svg/color/Brown.svg +0 -9
- package/lib/assets/img/svg/color/Dark.svg +0 -9
- package/lib/assets/img/svg/color/Light.svg +0 -9
- package/lib/assets/img/svg/color/Medium.svg +0 -9
- package/lib/assets/img/svg/color/Unfinished.svg +0 -9
- package/lib/catalog/lines/wall/textures/bricks-normal2.jpg +0 -0
- package/lib/catalog/lines/wall/textures/bricks3.jpg +0 -0
- package/lib/catalog/properties/export.js +0 -81
- package/lib/catalog/properties/property-checkbox.js +0 -76
- package/lib/catalog/properties/property-color.js +0 -47
- package/lib/catalog/properties/property-enum.js +0 -58
- package/lib/catalog/properties/property-hidden.js +0 -27
- package/lib/catalog/properties/property-lenght-measure.js +0 -108
- package/lib/catalog/properties/property-length-measure.js +0 -92
- package/lib/catalog/properties/property-length-measure_hole.js +0 -108
- package/lib/catalog/properties/property-number.js +0 -56
- package/lib/catalog/properties/property-read-only.js +0 -34
- package/lib/catalog/properties/property-string.js +0 -56
- package/lib/catalog/properties/property-toggle.js +0 -47
- package/lib/catalog/properties/shared-property-style.js +0 -21
- package/lib/catalog/utils/FuseUtils.js +0 -87
- package/lib/class/FuseUtils.js +0 -87
- package/lib/components/style/button.js +0 -115
- package/lib/components/style/cancel-button.js +0 -29
- package/lib/components/style/content-container.js +0 -38
- package/lib/components/style/content-title.js +0 -35
- package/lib/components/style/delete-button.js +0 -34
- package/lib/components/style/form-block.js +0 -28
- package/lib/components/style/form-color-input.js +0 -34
- package/lib/components/style/form-label.js +0 -30
- package/lib/components/style/form-number-input_2.js +0 -209
- package/lib/components/style/form-select.js +0 -29
- package/lib/components/style/form-slider.js +0 -68
- package/lib/components/style/form-text-input.js +0 -78
- package/lib/reducers/user-reducer.js +0 -48
- package/lib/styles/export.js +0 -13
- package/lib/styles/tabs.css +0 -40
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
2
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
|
+
export function handleAddItemEvent(_x, _x2, _x3, _x4, _x5, _x6) {
|
|
4
|
+
return _handleAddItemEvent.apply(this, arguments);
|
|
5
|
+
}
|
|
6
|
+
function _handleAddItemEvent() {
|
|
7
|
+
_handleAddItemEvent = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(props, state, payload, addItemToCatalog, isEmpty, ARRAY_3D_MODES) {
|
|
8
|
+
var element, _state$viewer2D, _payload$initialPosit, mouseX, mouseY, v2d, vPosX, vPosY, layerID;
|
|
9
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
10
|
+
while (1) switch (_context.prev = _context.next) {
|
|
11
|
+
case 0:
|
|
12
|
+
if (isEmpty(payload)) {
|
|
13
|
+
_context.next = 2;
|
|
14
|
+
break;
|
|
15
|
+
}
|
|
16
|
+
element = payload;
|
|
17
|
+
_context.next = 1;
|
|
18
|
+
return addItemToCatalog(element, state, props.catalog, props.projectActions);
|
|
19
|
+
case 1:
|
|
20
|
+
// start drawing item
|
|
21
|
+
if (ARRAY_3D_MODES.includes(state.mode)) {
|
|
22
|
+
// in 3d view
|
|
23
|
+
props.itemsActions.selectToolDrawingItem3D(element.name);
|
|
24
|
+
} else {
|
|
25
|
+
// in 2d view
|
|
26
|
+
// create cabinet
|
|
27
|
+
props.itemsActions.selectToolDrawingItem(element.name);
|
|
28
|
+
// mapping the initial position of client coord to viewer2D coord
|
|
29
|
+
_payload$initialPosit = payload.initialPosition, mouseX = _payload$initialPosit.mouseX, mouseY = _payload$initialPosit.mouseY;
|
|
30
|
+
v2d = (_state$viewer2D = state.viewer2D) === null || _state$viewer2D === void 0 ? void 0 : _state$viewer2D.toJS();
|
|
31
|
+
if (mouseX && mouseY && v2d) {
|
|
32
|
+
vPosX = (mouseX - v2d.e) / v2d.a;
|
|
33
|
+
vPosY = (mouseY - v2d.f) / v2d.d;
|
|
34
|
+
layerID = state.scene.selectedLayer; // move cabinet to initial position
|
|
35
|
+
props.itemsActions.updateDrawingItem(layerID, vPosX, -vPosY + state.scene.height, true);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
props.projectActions.pushLastSelectedCatalogElementToHistory(element);
|
|
39
|
+
props.projectActions.setIsCabinetDrawing(true);
|
|
40
|
+
case 2:
|
|
41
|
+
case "end":
|
|
42
|
+
return _context.stop();
|
|
43
|
+
}
|
|
44
|
+
}, _callee);
|
|
45
|
+
}));
|
|
46
|
+
return _handleAddItemEvent.apply(this, arguments);
|
|
47
|
+
}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
2
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
|
+
export function handleChangeDoorStyleEvent(_x, _x2, _x3, _x4, _x5, _x6, _x7, _x8, _x9, _x0, _x1, _x10) {
|
|
4
|
+
return _handleChangeDoorStyleEvent.apply(this, arguments);
|
|
5
|
+
}
|
|
6
|
+
function _handleChangeDoorStyleEvent() {
|
|
7
|
+
_handleChangeDoorStyleEvent = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(props, state, layer, payload, DOORSTYLE_SCOPE_SINGLE, DOORSTYLE_SCOPE_MULTIPLE, DOORSTYLE_SCOPE_ALL, INTERNAL_EVENT_ITEMS_CATALOG, mapFromCCDFToCDS, ccdfMapper, mergeSameElements, addItemToCatalog) {
|
|
8
|
+
var doorStyle, applyScope, _payload$itemIds, itemIds, itemCDS, layerId, allItems, targetItems, idSet, selectedItemIds, ccdf_list, _loop, i, _props$onInternalEven, _t;
|
|
9
|
+
return _regeneratorRuntime.wrap(function (_context3) {
|
|
10
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
11
|
+
case 0:
|
|
12
|
+
doorStyle = payload.doorStyle, applyScope = payload.applyScope, _payload$itemIds = payload.itemIds, itemIds = _payload$itemIds === void 0 ? [] : _payload$itemIds;
|
|
13
|
+
itemCDS = [];
|
|
14
|
+
layerId = state.getIn(['scene', 'selectedLayer']);
|
|
15
|
+
allItems = state.getIn(['scene', 'layers', layerId, 'items']).toJS();
|
|
16
|
+
targetItems = []; // Prepare idSet for SINGLE or MULTIPLE
|
|
17
|
+
idSet = null;
|
|
18
|
+
if (applyScope === DOORSTYLE_SCOPE_SINGLE) {
|
|
19
|
+
selectedItemIds = state.getIn(['scene', 'layers', layerId, 'selected', 'items']).toJS();
|
|
20
|
+
idSet = new Set(selectedItemIds);
|
|
21
|
+
}
|
|
22
|
+
if (applyScope === DOORSTYLE_SCOPE_MULTIPLE) {
|
|
23
|
+
// itemIds contains item.id (instance IDs)
|
|
24
|
+
idSet = new Set(itemIds);
|
|
25
|
+
}
|
|
26
|
+
_t = applyScope;
|
|
27
|
+
_context3.next = _t === DOORSTYLE_SCOPE_ALL ? 1 : _t === DOORSTYLE_SCOPE_SINGLE ? 2 : _t === DOORSTYLE_SCOPE_MULTIPLE ? 2 : 3;
|
|
28
|
+
break;
|
|
29
|
+
case 1:
|
|
30
|
+
targetItems = Object.values(allItems);
|
|
31
|
+
return _context3.abrupt("continue", 4);
|
|
32
|
+
case 2:
|
|
33
|
+
targetItems = Object.values(allItems).filter(function (item) {
|
|
34
|
+
var _idSet;
|
|
35
|
+
return (_idSet = idSet) === null || _idSet === void 0 ? void 0 : _idSet.has(item.id);
|
|
36
|
+
});
|
|
37
|
+
return _context3.abrupt("continue", 4);
|
|
38
|
+
case 3:
|
|
39
|
+
return _context3.abrupt("continue", 4);
|
|
40
|
+
case 4:
|
|
41
|
+
ccdf_list = [];
|
|
42
|
+
_loop = /*#__PURE__*/_regeneratorRuntime.mark(function _loop() {
|
|
43
|
+
var item;
|
|
44
|
+
return _regeneratorRuntime.wrap(function (_context2) {
|
|
45
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
46
|
+
case 0:
|
|
47
|
+
item = targetItems[i];
|
|
48
|
+
if (!ccdf_list.some(function (v) {
|
|
49
|
+
return item.itemID === v.itemID && item.name === v.name && doorStyle.id === v.doorFinishId;
|
|
50
|
+
})) {
|
|
51
|
+
ccdf_list.push({
|
|
52
|
+
itemID: item.itemID,
|
|
53
|
+
prototype: item.prototype,
|
|
54
|
+
category: item.category,
|
|
55
|
+
name: item.name,
|
|
56
|
+
type: item.type,
|
|
57
|
+
sku_number: item.sku_number,
|
|
58
|
+
doorFinishId: doorStyle.id
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
case 1:
|
|
62
|
+
case "end":
|
|
63
|
+
return _context2.stop();
|
|
64
|
+
}
|
|
65
|
+
}, _loop);
|
|
66
|
+
});
|
|
67
|
+
i = 0;
|
|
68
|
+
case 5:
|
|
69
|
+
if (!(i < targetItems.length)) {
|
|
70
|
+
_context3.next = 7;
|
|
71
|
+
break;
|
|
72
|
+
}
|
|
73
|
+
return _context3.delegateYield(_loop(), "t0", 6);
|
|
74
|
+
case 6:
|
|
75
|
+
i++;
|
|
76
|
+
_context3.next = 5;
|
|
77
|
+
break;
|
|
78
|
+
case 7:
|
|
79
|
+
if (ccdf_list.length > 0) {
|
|
80
|
+
(_props$onInternalEven = props.onInternalEvent) === null || _props$onInternalEven === void 0 || _props$onInternalEven.call(props, {
|
|
81
|
+
type: INTERNAL_EVENT_ITEMS_CATALOG,
|
|
82
|
+
value: {
|
|
83
|
+
ccdf_list: ccdf_list
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
/*#__PURE__*/
|
|
87
|
+
// result is ccdf_list
|
|
88
|
+
function () {
|
|
89
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(result) {
|
|
90
|
+
var mappedCabinetDefinitionList, rt, _i;
|
|
91
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
92
|
+
while (1) switch (_context.prev = _context.next) {
|
|
93
|
+
case 0:
|
|
94
|
+
itemCDS = mapFromCCDFToCDS(result === null || result === void 0 ? void 0 : result.ccdf_list);
|
|
95
|
+
mappedCabinetDefinitionList = ccdfMapper(result.ccdf_list, layer); // result: ccdf_list
|
|
96
|
+
rt = mergeSameElements(mappedCabinetDefinitionList);
|
|
97
|
+
_i = 0;
|
|
98
|
+
case 1:
|
|
99
|
+
if (!(_i < (rt === null || rt === void 0 ? void 0 : rt.length))) {
|
|
100
|
+
_context.next = 3;
|
|
101
|
+
break;
|
|
102
|
+
}
|
|
103
|
+
_context.next = 2;
|
|
104
|
+
return addItemToCatalog(rt[_i], state, props.catalog, props.projectActions);
|
|
105
|
+
case 2:
|
|
106
|
+
_i++;
|
|
107
|
+
_context.next = 1;
|
|
108
|
+
break;
|
|
109
|
+
case 3:
|
|
110
|
+
props.itemsActions.setDoorStyle(doorStyle, itemCDS, applyScope, itemIds);
|
|
111
|
+
case 4:
|
|
112
|
+
case "end":
|
|
113
|
+
return _context.stop();
|
|
114
|
+
}
|
|
115
|
+
}, _callee);
|
|
116
|
+
}));
|
|
117
|
+
return function (_x11) {
|
|
118
|
+
return _ref.apply(this, arguments);
|
|
119
|
+
};
|
|
120
|
+
}());
|
|
121
|
+
} else {
|
|
122
|
+
props.itemsActions.setDoorStyle(doorStyle, itemCDS, applyScope, itemIds);
|
|
123
|
+
}
|
|
124
|
+
case 8:
|
|
125
|
+
case "end":
|
|
126
|
+
return _context3.stop();
|
|
127
|
+
}
|
|
128
|
+
}, _callee2);
|
|
129
|
+
}));
|
|
130
|
+
return _handleChangeDoorStyleEvent.apply(this, arguments);
|
|
131
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export function handleDuplicateElement(props, getElement, payload, state) {
|
|
2
|
+
var distElement = getElement(payload, state);
|
|
3
|
+
if (distElement) props.itemsActions.duplicateSelected(distElement, props.onInternalEvent);
|
|
4
|
+
}
|
|
5
|
+
export function handleDeleteElement(props, getElement, payload, state) {
|
|
6
|
+
var distElement = getElement(payload, state);
|
|
7
|
+
if (distElement) props.projectActions.remove(distElement);
|
|
8
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { FINISHING_TYPE, MODE_ELEVATION_VIEW } from "../../constants";
|
|
2
|
+
export function handleSetFinishing(props, state, payload) {
|
|
3
|
+
switch (payload.category) {
|
|
4
|
+
case FINISHING_TYPE.WALL_COLOR:
|
|
5
|
+
if (state.mode !== MODE_ELEVATION_VIEW) props.itemsActions.setWallColor(payload.color);
|
|
6
|
+
break;
|
|
7
|
+
case FINISHING_TYPE.COUNTER_TOP:
|
|
8
|
+
props.itemsActions.setCounterTop({
|
|
9
|
+
uri: payload.texture
|
|
10
|
+
});
|
|
11
|
+
break;
|
|
12
|
+
case FINISHING_TYPE.FLOOR_STYLE:
|
|
13
|
+
if (state.mode !== MODE_ELEVATION_VIEW) props.areaActions.setFloorStyles({
|
|
14
|
+
uri: payload.texture
|
|
15
|
+
});
|
|
16
|
+
break;
|
|
17
|
+
case FINISHING_TYPE.BACKSPLASH:
|
|
18
|
+
if (state.mode !== MODE_ELEVATION_VIEW) props.itemsActions.setBacksplash({
|
|
19
|
+
uri: payload.texture
|
|
20
|
+
});
|
|
21
|
+
break;
|
|
22
|
+
case FINISHING_TYPE.DOOR_HANDLE:
|
|
23
|
+
props.itemsActions.setDoorHandle(payload.gltf);
|
|
24
|
+
break;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { ARRAY_3D_MODES } from "../../constants";
|
|
2
|
+
export function handleAddHole(props, state, payload) {
|
|
3
|
+
ARRAY_3D_MODES.includes(state.mode) ? props.holesActions.selectToolDrawingHole3D(payload === null || payload === void 0 ? void 0 : payload.holeName) : props.holesActions.selectToolDrawingHole(payload === null || payload === void 0 ? void 0 : payload.holeName);
|
|
4
|
+
}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
2
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
|
+
import { convert } from "../../utils/convert-units-lite";
|
|
4
|
+
import { INTERNAL_EVENT_ITEMS_CATALOG } from "../../constants";
|
|
5
|
+
import { Scene, State } from "../../models";
|
|
6
|
+
export function handleLoadProjectEvent(_x, _x2, _x3, _x4, _x5, _x6, _x7, _x8) {
|
|
7
|
+
return _handleLoadProjectEvent.apply(this, arguments);
|
|
8
|
+
}
|
|
9
|
+
function _handleLoadProjectEvent() {
|
|
10
|
+
_handleLoadProjectEvent = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(props, state, evt, mapFromCCDFToCDS, updateProjectWithCDSList, ccdfMapper, mergeSameElements, addItemToCatalog) {
|
|
11
|
+
var _evt$payload, _state$catalog, cdsItems, itemKeys, _loop, i, newScene, tempState, _props$onInternalEven;
|
|
12
|
+
return _regeneratorRuntime.wrap(function (_context3) {
|
|
13
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
14
|
+
case 0:
|
|
15
|
+
if (!(evt !== null && evt !== void 0 && evt.payload)) {
|
|
16
|
+
_context3.next = 4;
|
|
17
|
+
break;
|
|
18
|
+
}
|
|
19
|
+
// prepare item data request
|
|
20
|
+
cdsItems = [];
|
|
21
|
+
itemKeys = evt !== null && evt !== void 0 && (_evt$payload = evt.payload) !== null && _evt$payload !== void 0 && (_evt$payload = _evt$payload.layers['layer-1']) !== null && _evt$payload !== void 0 && _evt$payload.items ? Object.keys(evt.payload.layers['layer-1'].items) : [];
|
|
22
|
+
_loop = /*#__PURE__*/_regeneratorRuntime.mark(function _loop() {
|
|
23
|
+
var _evt$payload3, _it$properties, _it$properties2, _it$properties3, _it$doorStyle2;
|
|
24
|
+
var it;
|
|
25
|
+
return _regeneratorRuntime.wrap(function (_context2) {
|
|
26
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
27
|
+
case 0:
|
|
28
|
+
it = evt === null || evt === void 0 || (_evt$payload3 = evt.payload) === null || _evt$payload3 === void 0 || (_evt$payload3 = _evt$payload3.layers['layer-1']) === null || _evt$payload3 === void 0 ? void 0 : _evt$payload3.items[itemKeys[i]]; //////// check altitude of item property and change length from _length (convert length from 'in' fo 'cm')
|
|
29
|
+
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')) {
|
|
30
|
+
it.properties.altitude.length = convert(it.properties.altitude._length).from(it.properties.altitude._unit).to('cm');
|
|
31
|
+
}
|
|
32
|
+
/////////
|
|
33
|
+
if (!cdsItems.some(function (v) {
|
|
34
|
+
var _it$doorStyle;
|
|
35
|
+
return it.itemID === v.itemID && it.name === v.name && ((_it$doorStyle = it.doorStyle) === null || _it$doorStyle === void 0 ? void 0 : _it$doorStyle.id) === v.dfId;
|
|
36
|
+
})) cdsItems.push({
|
|
37
|
+
itemID: it.itemID,
|
|
38
|
+
prototype: it.prototype,
|
|
39
|
+
category: it.category,
|
|
40
|
+
name: it.name,
|
|
41
|
+
type: it.type,
|
|
42
|
+
sku_number: it.sku_number,
|
|
43
|
+
dfId: (_it$doorStyle2 = it.doorStyle) === null || _it$doorStyle2 === void 0 ? void 0 : _it$doorStyle2.id
|
|
44
|
+
});
|
|
45
|
+
case 1:
|
|
46
|
+
case "end":
|
|
47
|
+
return _context2.stop();
|
|
48
|
+
}
|
|
49
|
+
}, _loop);
|
|
50
|
+
});
|
|
51
|
+
i = 0;
|
|
52
|
+
case 1:
|
|
53
|
+
if (!(i < itemKeys.length)) {
|
|
54
|
+
_context3.next = 3;
|
|
55
|
+
break;
|
|
56
|
+
}
|
|
57
|
+
return _context3.delegateYield(_loop(), "t0", 2);
|
|
58
|
+
case 2:
|
|
59
|
+
i++;
|
|
60
|
+
_context3.next = 1;
|
|
61
|
+
break;
|
|
62
|
+
case 3:
|
|
63
|
+
newScene = new Scene(evt === null || evt === void 0 ? void 0 : evt.payload);
|
|
64
|
+
tempState = new State({
|
|
65
|
+
scene: newScene.toJS(),
|
|
66
|
+
catalog: (_state$catalog = state.catalog) === null || _state$catalog === void 0 ? void 0 : _state$catalog.toJS()
|
|
67
|
+
}); // request item catalog data to host app
|
|
68
|
+
if (cdsItems.length > 0) {
|
|
69
|
+
(_props$onInternalEven = props.onInternalEvent) === null || _props$onInternalEven === void 0 || _props$onInternalEven.call(props, {
|
|
70
|
+
type: INTERNAL_EVENT_ITEMS_CATALOG,
|
|
71
|
+
value: {
|
|
72
|
+
cdsItems: cdsItems
|
|
73
|
+
}
|
|
74
|
+
}, /*#__PURE__*/function () {
|
|
75
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(result) {
|
|
76
|
+
var _evt$payload2;
|
|
77
|
+
var cdsList, cabinetDefinitionList, rt, _i;
|
|
78
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
79
|
+
while (1) switch (_context.prev = _context.next) {
|
|
80
|
+
case 0:
|
|
81
|
+
cdsList = mapFromCCDFToCDS(result === null || result === void 0 ? void 0 : result.ccdf_list);
|
|
82
|
+
evt.payload = updateProjectWithCDSList(evt.payload, cdsList);
|
|
83
|
+
cabinetDefinitionList = ccdfMapper(result === null || result === void 0 ? void 0 : result.ccdf_list, evt === null || evt === void 0 || (_evt$payload2 = evt.payload) === null || _evt$payload2 === void 0 ? void 0 : _evt$payload2.layers['layer-1']);
|
|
84
|
+
rt = mergeSameElements(cabinetDefinitionList);
|
|
85
|
+
_i = 0;
|
|
86
|
+
case 1:
|
|
87
|
+
if (!(_i < (rt === null || rt === void 0 ? void 0 : rt.length))) {
|
|
88
|
+
_context.next = 3;
|
|
89
|
+
break;
|
|
90
|
+
}
|
|
91
|
+
_context.next = 2;
|
|
92
|
+
return addItemToCatalog(rt[_i], tempState, props.catalog, props.projectActions);
|
|
93
|
+
case 2:
|
|
94
|
+
_i++;
|
|
95
|
+
_context.next = 1;
|
|
96
|
+
break;
|
|
97
|
+
case 3:
|
|
98
|
+
props.projectActions.loadProject(evt.payload);
|
|
99
|
+
case 4:
|
|
100
|
+
case "end":
|
|
101
|
+
return _context.stop();
|
|
102
|
+
}
|
|
103
|
+
}, _callee);
|
|
104
|
+
}));
|
|
105
|
+
return function (_x9) {
|
|
106
|
+
return _ref.apply(this, arguments);
|
|
107
|
+
};
|
|
108
|
+
}());
|
|
109
|
+
} else props.projectActions.loadProject(evt.payload);
|
|
110
|
+
case 4:
|
|
111
|
+
case "end":
|
|
112
|
+
return _context3.stop();
|
|
113
|
+
}
|
|
114
|
+
}, _callee2);
|
|
115
|
+
}));
|
|
116
|
+
return _handleLoadProjectEvent.apply(this, arguments);
|
|
117
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
2
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
|
+
export function handleSetMolding(_x, _x2, _x3) {
|
|
4
|
+
return _handleSetMolding.apply(this, arguments);
|
|
5
|
+
}
|
|
6
|
+
function _handleSetMolding() {
|
|
7
|
+
_handleSetMolding = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(props, loadMoldingSvg, payload) {
|
|
8
|
+
var moldingInfo, isGlobal;
|
|
9
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
10
|
+
while (1) switch (_context.prev = _context.next) {
|
|
11
|
+
case 0:
|
|
12
|
+
moldingInfo = payload.moldingInfo, isGlobal = payload.isGlobal;
|
|
13
|
+
_context.next = 1;
|
|
14
|
+
return loadMoldingSvg(moldingInfo);
|
|
15
|
+
case 1:
|
|
16
|
+
props.itemsActions.setMolding(moldingInfo, isGlobal);
|
|
17
|
+
case 2:
|
|
18
|
+
case "end":
|
|
19
|
+
return _context.stop();
|
|
20
|
+
}
|
|
21
|
+
}, _callee);
|
|
22
|
+
}));
|
|
23
|
+
return _handleSetMolding.apply(this, arguments);
|
|
24
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export function handleNewProject(props) {
|
|
2
|
+
var defaulTitle = 'Untitle';
|
|
3
|
+
props.projectActions.newProject();
|
|
4
|
+
props.projectActions.rename(defaulTitle);
|
|
5
|
+
}
|
|
6
|
+
export function handleUndo(props) {
|
|
7
|
+
props.projectActions.undo();
|
|
8
|
+
}
|
|
9
|
+
export function handleRedo(props) {
|
|
10
|
+
props.projectActions.redo();
|
|
11
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { PROJECT_SETTING_OPTION } from "../../constants";
|
|
2
|
+
import { convert } from "../../utils/convert-units-lite";
|
|
3
|
+
export function handleProjectSetting(props, payload, layer) {
|
|
4
|
+
var option = payload.option,
|
|
5
|
+
value = payload.value;
|
|
6
|
+
switch (option) {
|
|
7
|
+
case PROJECT_SETTING_OPTION.CHANGE_MEASUREMENT_UNIT:
|
|
8
|
+
props.viewer2DActions.updateCeilHeight(convert(layer.ceilHeight).from(layer.unit).to(value));
|
|
9
|
+
props.viewer2DActions.updateCeilHeightUnit(value);
|
|
10
|
+
props.viewer3DActions.update3DCeilHeightUnit(value);
|
|
11
|
+
props.viewer3DActions.update3DCeilHeight(convert(layer.ceilHeight).from(layer.unit).to(value));
|
|
12
|
+
break;
|
|
13
|
+
case PROJECT_SETTING_OPTION.UPDATE_CEIL_HEIGHT:
|
|
14
|
+
props.viewer2DActions.updateCeilHeight(value);
|
|
15
|
+
props.viewer3DActions.update3DCeilHeight(value);
|
|
16
|
+
break;
|
|
17
|
+
case PROJECT_SETTING_OPTION.CHANGE_WALL_LENGTH_MEASURE:
|
|
18
|
+
props.viewer2DActions.changeWallLengthMeasure(value);
|
|
19
|
+
break;
|
|
20
|
+
case PROJECT_SETTING_OPTION.CHANGE_BASE_CABINET_MEASURE:
|
|
21
|
+
props.viewer2DActions.changeBaseCabinetMeasure(value);
|
|
22
|
+
break;
|
|
23
|
+
case PROJECT_SETTING_OPTION.CHANGE_WALL_CABINET_MEASURE:
|
|
24
|
+
props.viewer2DActions.changeWallCabinetMeasure(value);
|
|
25
|
+
break;
|
|
26
|
+
case PROJECT_SETTING_OPTION.CHANGE_WINDOW_DOOR_MEASURE:
|
|
27
|
+
props.viewer2DActions.changeWindowDoorMeasure(value);
|
|
28
|
+
break;
|
|
29
|
+
default:
|
|
30
|
+
break;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
2
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
|
+
export function handleReplaceCabinet(_x, _x2, _x3, _x4) {
|
|
4
|
+
return _handleReplaceCabinet.apply(this, arguments);
|
|
5
|
+
}
|
|
6
|
+
function _handleReplaceCabinet() {
|
|
7
|
+
_handleReplaceCabinet = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(props, addItemToCatalog, payload, state) {
|
|
8
|
+
var _payload$replaceItemI, _payload$replaceItemI2, _payload$replaceItemI3;
|
|
9
|
+
var layerID, layer, orginalItemInfo, originalItem, originalItemPos, replaceItem;
|
|
10
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
11
|
+
while (1) switch (_context.prev = _context.next) {
|
|
12
|
+
case 0:
|
|
13
|
+
layerID = state.scene.selectedLayer;
|
|
14
|
+
layer = state.scene.getIn(['layers', layerID]).toJS();
|
|
15
|
+
orginalItemInfo = payload === null || payload === void 0 ? void 0 : payload.orginalItemInfo;
|
|
16
|
+
originalItem = layer === null || layer === void 0 ? void 0 : layer.items[orginalItemInfo.id];
|
|
17
|
+
_context.next = 1;
|
|
18
|
+
return addItemToCatalog(payload.replaceItemInfo, state, props.catalog, props.projectActions);
|
|
19
|
+
case 1:
|
|
20
|
+
originalItemPos = {
|
|
21
|
+
rotation: originalItem.rotation,
|
|
22
|
+
selectedItemId: originalItem.id,
|
|
23
|
+
x: originalItem.x,
|
|
24
|
+
y: originalItem.y
|
|
25
|
+
};
|
|
26
|
+
replaceItem = {
|
|
27
|
+
name: payload === null || payload === void 0 || (_payload$replaceItemI = payload.replaceItemInfo) === null || _payload$replaceItemI === void 0 ? void 0 : _payload$replaceItemI.name,
|
|
28
|
+
info: {
|
|
29
|
+
width: payload === null || payload === void 0 || (_payload$replaceItemI2 = payload.replaceItemInfo) === null || _payload$replaceItemI2 === void 0 || (_payload$replaceItemI2 = _payload$replaceItemI2.sizeinfo) === null || _payload$replaceItemI2 === void 0 ? void 0 : _payload$replaceItemI2.width,
|
|
30
|
+
height: payload === null || payload === void 0 || (_payload$replaceItemI3 = payload.replaceItemInfo) === null || _payload$replaceItemI3 === void 0 || (_payload$replaceItemI3 = _payload$replaceItemI3.sizeinfo) === null || _payload$replaceItemI3 === void 0 ? void 0 : _payload$replaceItemI3.height
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
props.itemsActions.replaceItem(originalItemPos, originalItem, replaceItem);
|
|
34
|
+
case 2:
|
|
35
|
+
case "end":
|
|
36
|
+
return _context.stop();
|
|
37
|
+
}
|
|
38
|
+
}, _callee);
|
|
39
|
+
}));
|
|
40
|
+
return _handleReplaceCabinet.apply(this, arguments);
|
|
41
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export function handleAddRoomShape(props, payload) {
|
|
2
|
+
var roomShapeType = payload.roomShapeType,
|
|
3
|
+
width = payload.width,
|
|
4
|
+
height = payload.height,
|
|
5
|
+
measurementUnit = payload.measurementUnit,
|
|
6
|
+
doorStyle = payload.doorStyle;
|
|
7
|
+
props.projectActions.createRoomWithShape(roomShapeType, width, height, measurementUnit, doorStyle);
|
|
8
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export function handleSyncScene(props, state, layer, layerId, getMoldingDataOfScene2, computeSkinPanels, DEFAULT_MOLDING_PIECE_LENGTH, INTERNAL_EVENT_SYNC_SCENE) {
|
|
2
|
+
var _layer$doorStyle, _props$configData$mol, _props$configData, _props$configData$ski, _props$configData2, _props$onInternalEven;
|
|
3
|
+
var sceneData = state.scene.toJS();
|
|
4
|
+
// get molding data for "ReviewForQuote"
|
|
5
|
+
var currentTexture = (_layer$doorStyle = layer === null || layer === void 0 ? void 0 : layer.doorStyle) !== null && _layer$doorStyle !== void 0 ? _layer$doorStyle : props.state.doorStyle;
|
|
6
|
+
if (currentTexture && currentTexture.toJS) currentTexture = currentTexture.toJS();
|
|
7
|
+
var moldingPieceLength = (_props$configData$mol = props === null || props === void 0 || (_props$configData = props.configData) === null || _props$configData === void 0 ? void 0 : _props$configData.moldingPieceLength) !== null && _props$configData$mol !== void 0 ? _props$configData$mol : DEFAULT_MOLDING_PIECE_LENGTH;
|
|
8
|
+
sceneData.layers[layerId].moldingData = getMoldingDataOfScene2(layer, props.catalog, currentTexture, moldingPieceLength);
|
|
9
|
+
|
|
10
|
+
// get skin panel data
|
|
11
|
+
var skinPanelExclusionSKUs = (_props$configData$ski = props === null || props === void 0 || (_props$configData2 = props.configData) === null || _props$configData2 === void 0 ? void 0 : _props$configData2.skinPanelExclusionSKUs) !== null && _props$configData$ski !== void 0 ? _props$configData$ski : [];
|
|
12
|
+
sceneData.layers[layerId].skinPanelData = computeSkinPanels(layer, skinPanelExclusionSKUs, props.catalog);
|
|
13
|
+
|
|
14
|
+
// send scene object from 3DTool to HostApp using internalEvent
|
|
15
|
+
(_props$onInternalEven = props.onInternalEvent) === null || _props$onInternalEven === void 0 || _props$onInternalEven.call(props, {
|
|
16
|
+
type: INTERNAL_EVENT_SYNC_SCENE,
|
|
17
|
+
value: {
|
|
18
|
+
scene: sceneData
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export function handleUpdateSelectedElementsEvent(props, state, evt, EXTERNAL_EVENT_UPDATE_ATTRIBUTE, updateAttributeOfSelectedElement, updatePropertyOfSelectedElement) {
|
|
2
|
+
var layerId = state.getIn(['scene', 'selectedLayer']);
|
|
3
|
+
var layer = state.getIn(['scene', 'layers', layerId]);
|
|
4
|
+
var _layer$getIn = layer.getIn(['selected']),
|
|
5
|
+
selectedLines = _layer$getIn.lines,
|
|
6
|
+
selectedHoles = _layer$getIn.holes,
|
|
7
|
+
selectedItems = _layer$getIn.items;
|
|
8
|
+
for (var i = 0; i < selectedLines.size; i++) (evt === null || evt === void 0 ? void 0 : evt.type) === EXTERNAL_EVENT_UPDATE_ATTRIBUTE ? updateAttributeOfSelectedElement(layer.getIn(['lines', selectedLines.get(i)]), evt.payload, state, layer, props.catalog, props.projectActions, evt.callback) : updatePropertyOfSelectedElement(layer.getIn(['lines', selectedLines.get(i)]), evt.payload, props.catalog, props.projectActions, evt.callback);
|
|
9
|
+
for (var _i = 0; _i < selectedHoles.size; _i++) (evt === null || evt === void 0 ? void 0 : evt.type) === EXTERNAL_EVENT_UPDATE_ATTRIBUTE ? updateAttributeOfSelectedElement(layer.getIn(['holes', selectedHoles.get(_i)]), evt.payload, state, layer, props.catalog, props.projectActions, evt.callback) : updatePropertyOfSelectedElement(layer.getIn(['holes', selectedHoles.get(_i)]), evt.payload, props.catalog, props.projectActions, evt.callback);
|
|
10
|
+
for (var _i2 = 0; _i2 < selectedItems.size; _i2++) (evt === null || evt === void 0 ? void 0 : evt.type) === EXTERNAL_EVENT_UPDATE_ATTRIBUTE ? updateAttributeOfSelectedElement(layer.getIn(['items', selectedItems.get(_i2)]), evt.payload, state, layer, props.catalog, props.projectActions, evt.callback) : updatePropertyOfSelectedElement(layer.getIn(['items', selectedItems.get(_i2)]), evt.payload, props.catalog, props.projectActions, evt.callback);
|
|
11
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export function handleToggleTo3D(props, MODE_IDLE_3D_CONST) {
|
|
2
|
+
props.projectActions.unselectAll();
|
|
3
|
+
props.projectActions.setMode(MODE_IDLE_3D_CONST);
|
|
4
|
+
}
|
|
5
|
+
export function handleToggleTo2D(props, MODE_IDLE_CONST) {
|
|
6
|
+
props.projectActions.setMode(MODE_IDLE_CONST);
|
|
7
|
+
}
|
|
8
|
+
export function handleToggleToElevation(props, layer, MODE_ELEVATION_VIEW_CONST) {
|
|
9
|
+
var sLineCnt = layer.selected.lines.size;
|
|
10
|
+
if (sLineCnt > 0) props.projectActions.setMode(MODE_ELEVATION_VIEW_CONST);
|
|
11
|
+
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { EXTERNAL_EVENT_MOVE_PAN, EXTERNAL_EVENT_ROTATE_PAN, MODE_IDLE, MODE_IDLE_3D, TOP, BOTTOM, LEFT, RIGHT } from "../../constants";
|
|
2
|
+
import { centering2D, updateViwer2D } from "../../utils/helper";
|
|
3
|
+
export function handleMoveAndRotatePan2D3D(eventType, props, payload, state) {
|
|
4
|
+
if (eventType === EXTERNAL_EVENT_MOVE_PAN) {
|
|
5
|
+
var moveType = payload.moveType,
|
|
6
|
+
moveValue = payload.moveValue;
|
|
7
|
+
var value = state.getIn(['viewer2D']).toJS();
|
|
8
|
+
if (state.mode === MODE_IDLE) {
|
|
9
|
+
switch (moveType) {
|
|
10
|
+
case TOP:
|
|
11
|
+
value.f -= moveValue;
|
|
12
|
+
break;
|
|
13
|
+
case BOTTOM:
|
|
14
|
+
value.f += moveValue;
|
|
15
|
+
break;
|
|
16
|
+
case RIGHT:
|
|
17
|
+
value.e += moveValue;
|
|
18
|
+
break;
|
|
19
|
+
case LEFT:
|
|
20
|
+
value.e -= moveValue;
|
|
21
|
+
break;
|
|
22
|
+
}
|
|
23
|
+
updateViwer2D(value, props.viewer2DActions);
|
|
24
|
+
} else if (state.mode === MODE_IDLE_3D) {
|
|
25
|
+
switch (moveType) {
|
|
26
|
+
case TOP:
|
|
27
|
+
window.interval = setTimeout(function () {
|
|
28
|
+
window.tDKeyDown({
|
|
29
|
+
keyCode: 38
|
|
30
|
+
});
|
|
31
|
+
}, 50);
|
|
32
|
+
break;
|
|
33
|
+
case BOTTOM:
|
|
34
|
+
window.interval = setTimeout(function () {
|
|
35
|
+
window.tDKeyDown({
|
|
36
|
+
keyCode: 40
|
|
37
|
+
});
|
|
38
|
+
}, 50);
|
|
39
|
+
break;
|
|
40
|
+
case RIGHT:
|
|
41
|
+
window.interval = setTimeout(function () {
|
|
42
|
+
window.tDKeyDown({
|
|
43
|
+
keyCode: 37
|
|
44
|
+
});
|
|
45
|
+
}, 50);
|
|
46
|
+
break;
|
|
47
|
+
case LEFT:
|
|
48
|
+
window.interval = setTimeout(function () {
|
|
49
|
+
window.tDKeyDown({
|
|
50
|
+
keyCode: 39
|
|
51
|
+
});
|
|
52
|
+
}, 50);
|
|
53
|
+
break;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
} else if (eventType === EXTERNAL_EVENT_ROTATE_PAN) {
|
|
57
|
+
var rotateType = payload.rotateType;
|
|
58
|
+
switch (rotateType) {
|
|
59
|
+
case TOP:
|
|
60
|
+
window.interval = setTimeout(function () {
|
|
61
|
+
window.SPKeyDown({
|
|
62
|
+
keyCode: 87
|
|
63
|
+
});
|
|
64
|
+
}, 50);
|
|
65
|
+
break;
|
|
66
|
+
case BOTTOM:
|
|
67
|
+
window.interval = setTimeout(function () {
|
|
68
|
+
window.SPKeyDown({
|
|
69
|
+
keyCode: 83
|
|
70
|
+
});
|
|
71
|
+
}, 50);
|
|
72
|
+
break;
|
|
73
|
+
case RIGHT:
|
|
74
|
+
window.interval = setTimeout(function () {
|
|
75
|
+
window.SPKeyDown({
|
|
76
|
+
keyCode: 68
|
|
77
|
+
});
|
|
78
|
+
}, 50);
|
|
79
|
+
break;
|
|
80
|
+
case LEFT:
|
|
81
|
+
window.interval = setTimeout(function () {
|
|
82
|
+
window.SPKeyDown({
|
|
83
|
+
keyCode: 65
|
|
84
|
+
});
|
|
85
|
+
}, 50);
|
|
86
|
+
break;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
export function handleZoomIn(props, state) {
|
|
91
|
+
var value = state.getIn(['viewer2D']).toJS();
|
|
92
|
+
value.a += 0.1;
|
|
93
|
+
value.d += 0.1;
|
|
94
|
+
value.e -= value.SVGWidth * 0.1 / 2;
|
|
95
|
+
value.f -= value.SVGHeight * 0.1 / 2;
|
|
96
|
+
updateViwer2D(value, props.viewer2DActions);
|
|
97
|
+
}
|
|
98
|
+
export function handleZoomOut(props, state) {
|
|
99
|
+
var value = state.getIn(['viewer2D']).toJS();
|
|
100
|
+
value.a -= 0.1;
|
|
101
|
+
value.d -= 0.1;
|
|
102
|
+
value.e += value.SVGWidth * 0.1 / 2;
|
|
103
|
+
value.f += value.SVGHeight * 0.1 / 2;
|
|
104
|
+
updateViwer2D(value, props.viewer2DActions);
|
|
105
|
+
}
|
|
106
|
+
export function handleCentering2D(props, state) {
|
|
107
|
+
centering2D(state, props.viewer2DActions);
|
|
108
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { MODE_2D_PAN, MODE_IDLE } from "../../constants";
|
|
2
|
+
export function handleAddWall(props, state) {
|
|
3
|
+
if (state.mode === MODE_IDLE || state.mode === MODE_2D_PAN) props.linesActions.selectToolDrawingLine('wall');else {
|
|
4
|
+
props.projectActions.setMode(MODE_IDLE);
|
|
5
|
+
props.linesActions.selectToolDrawingLine('wall');
|
|
6
|
+
}
|
|
7
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
2
2
|
import { isEmpty } from "../../../components/viewer2d/utils";
|
|
3
|
-
import {
|
|
3
|
+
import { toJSIfNeeded } from "../../../shared/objects/immutable";
|
|
4
4
|
export function ccdfMapper(ccdf_list, layer) {
|
|
5
5
|
// This function make cabinet definition using ccdf, layer's item information and catalog
|
|
6
6
|
// console.log(ccdf_list, catalog);
|
|
@@ -11,7 +11,7 @@ export function ccdfMapper(ccdf_list, layer) {
|
|
|
11
11
|
var cdfId;
|
|
12
12
|
var structure_json = {};
|
|
13
13
|
var cabinetDefinition = {};
|
|
14
|
-
var layerJS =
|
|
14
|
+
var layerJS = toJSIfNeeded(layer);
|
|
15
15
|
ccdf_list === null || ccdf_list === void 0 || ccdf_list.forEach(function (ccdf) {
|
|
16
16
|
var itemKeys = Object.keys(layerJS.items);
|
|
17
17
|
var correctItemId = '';
|