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
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
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; }
|
|
4
|
+
import actions from "../actions/export";
|
|
5
|
+
export default function consoleDebugger() {
|
|
6
|
+
return function (store, stateExtractor) {
|
|
7
|
+
window.KitchenConfigurator = _objectSpread(_objectSpread({}, actions), {}, {
|
|
8
|
+
getStore: function getStore() {
|
|
9
|
+
return store;
|
|
10
|
+
},
|
|
11
|
+
getState: function getState() {
|
|
12
|
+
return stateExtractor(store.getState());
|
|
13
|
+
},
|
|
14
|
+
"do": function _do(actions) {
|
|
15
|
+
var delay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 300;
|
|
16
|
+
actions = actions.reverse();
|
|
17
|
+
var dispatch = store.dispatch;
|
|
18
|
+
var _dispatchAction = function dispatchAction() {
|
|
19
|
+
console.info("There are other ".concat(actions.length, " actions on stack"));
|
|
20
|
+
if (actions.length === 0) return;
|
|
21
|
+
dispatch(actions.pop());
|
|
22
|
+
if (actions.length === 0) return;
|
|
23
|
+
setTimeout(_dispatchAction, delay);
|
|
24
|
+
};
|
|
25
|
+
setTimeout(_dispatchAction, 0);
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
console.groupCollapsed('KitchenConfigurator');
|
|
29
|
+
console.info('KitchenConfigurator is ready');
|
|
30
|
+
console.info('console.log(KitchenConfigurator)');
|
|
31
|
+
console.log(window.KitchenConfigurator);
|
|
32
|
+
console.groupEnd();
|
|
33
|
+
};
|
|
34
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { MODE_IDLE, MODE_3D_FIRST_PERSON, MODE_3D_VIEW, MODE_SNAPPING, KEYBOARD_BUTTON_CODE, MODE_IDLE_3D, MODE_ROTATING_ITEM_3D, MODE_DRAGGING_ITEM_3D, MODE_DRAWING_ITEM_3D, MODE_DRAWING_ITEM } from "../constants";
|
|
2
|
+
import { rollback, undo, redo, recreate, uncreate, remove, toggleSnap, copyProperties, pasteProperties, shift2doff, shift2don } from "../actions/project-actions";
|
|
3
|
+
export default function keyboard() {
|
|
4
|
+
return function (store, stateExtractor) {
|
|
5
|
+
window.addEventListener('keydown', function (event) {
|
|
6
|
+
var state = stateExtractor(store.getState());
|
|
7
|
+
var mode = state.get('mode');
|
|
8
|
+
switch (event.keyCode) {
|
|
9
|
+
// case KEYBOARD_BUTTON_CODE.BACKSPACE:
|
|
10
|
+
// case KEYBOARD_BUTTON_CODE.DELETE: {
|
|
11
|
+
// if (
|
|
12
|
+
// [
|
|
13
|
+
// MODE_IDLE,
|
|
14
|
+
// MODE_3D_FIRST_PERSON,
|
|
15
|
+
// MODE_3D_VIEW,
|
|
16
|
+
// MODE_IDLE_3D,
|
|
17
|
+
// MODE_ROTATING_ITEM_3D,
|
|
18
|
+
// MODE_DRAGGING_ITEM_3D
|
|
19
|
+
// ].includes(mode)
|
|
20
|
+
// )
|
|
21
|
+
// store.dispatch(remove());
|
|
22
|
+
// break;
|
|
23
|
+
// }
|
|
24
|
+
case KEYBOARD_BUTTON_CODE.ESC:
|
|
25
|
+
{
|
|
26
|
+
store.dispatch(rollback());
|
|
27
|
+
break;
|
|
28
|
+
}
|
|
29
|
+
case KEYBOARD_BUTTON_CODE.Z:
|
|
30
|
+
{
|
|
31
|
+
if (event.getModifierState('Control') || event.getModifierState('Meta')) store.dispatch(undo());
|
|
32
|
+
break;
|
|
33
|
+
}
|
|
34
|
+
case KEYBOARD_BUTTON_CODE.Q:
|
|
35
|
+
{
|
|
36
|
+
if (event.getModifierState('Control') || event.getModifierState('Meta')) store.dispatch(redo());
|
|
37
|
+
break;
|
|
38
|
+
}
|
|
39
|
+
case KEYBOARD_BUTTON_CODE.ALT:
|
|
40
|
+
{
|
|
41
|
+
if (MODE_SNAPPING.includes(mode)) store.dispatch(toggleSnap(state.snapMask.merge({
|
|
42
|
+
SNAP_POINT: false,
|
|
43
|
+
SNAP_LINE: false,
|
|
44
|
+
SNAP_SEGMENT: false,
|
|
45
|
+
SNAP_GRID: false,
|
|
46
|
+
SNAP_GUIDE: false,
|
|
47
|
+
tempSnapConfiguartion: state.snapMask.toJS()
|
|
48
|
+
})));
|
|
49
|
+
break;
|
|
50
|
+
}
|
|
51
|
+
case KEYBOARD_BUTTON_CODE.C:
|
|
52
|
+
{
|
|
53
|
+
var selectedLayer = state.getIn(['scene', 'selectedLayer']);
|
|
54
|
+
var selected = state.getIn(['scene', 'layers', selectedLayer, 'selected']);
|
|
55
|
+
if ((mode === MODE_IDLE || mode === MODE_3D_VIEW) && (selected.holes.size || selected.areas.size || selected.items.size || selected.lines.size)) {
|
|
56
|
+
if (selected.holes.size) {
|
|
57
|
+
var hole = state.getIn(['scene', 'layers', selectedLayer, 'holes', selected.holes.get(0)]);
|
|
58
|
+
store.dispatch(copyProperties(hole.get('properties')));
|
|
59
|
+
} else if (selected.areas.size) {
|
|
60
|
+
var area = state.getIn(['scene', 'layers', selectedLayer, 'areas', selected.areas.get(0)]);
|
|
61
|
+
store.dispatch(copyProperties(area.properties));
|
|
62
|
+
} else if (selected.items.size) {
|
|
63
|
+
var item = state.getIn(['scene', 'layers', selectedLayer, 'items', selected.items.get(0)]);
|
|
64
|
+
store.dispatch(copyProperties(item.properties));
|
|
65
|
+
} else if (selected.lines.size) {
|
|
66
|
+
var line = state.getIn(['scene', 'layers', selectedLayer, 'lines', selected.lines.get(0)]);
|
|
67
|
+
store.dispatch(copyProperties(line.properties));
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
break;
|
|
71
|
+
}
|
|
72
|
+
case KEYBOARD_BUTTON_CODE.V:
|
|
73
|
+
{
|
|
74
|
+
store.dispatch(pasteProperties());
|
|
75
|
+
break;
|
|
76
|
+
}
|
|
77
|
+
case KEYBOARD_BUTTON_CODE.SHIFT:
|
|
78
|
+
{
|
|
79
|
+
if (['TEXTAREA', 'INPUT'].includes(document.activeElement.tagName) === false) {
|
|
80
|
+
if ([MODE_DRAWING_ITEM_3D, MODE_IDLE_3D].includes(mode)) store.dispatch(recreate());else if ([MODE_DRAWING_ITEM, MODE_IDLE].includes(mode)) store.dispatch(shift2doff());
|
|
81
|
+
}
|
|
82
|
+
break;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
window.addEventListener('keyup', function (event) {
|
|
87
|
+
var state = stateExtractor(store.getState());
|
|
88
|
+
var mode = state.get('mode');
|
|
89
|
+
switch (event.keyCode) {
|
|
90
|
+
case KEYBOARD_BUTTON_CODE.ALT:
|
|
91
|
+
{
|
|
92
|
+
if (MODE_SNAPPING.includes(mode)) store.dispatch(toggleSnap(state.snapMask.merge(state.snapMask.get('tempSnapConfiguartion'))));
|
|
93
|
+
break;
|
|
94
|
+
}
|
|
95
|
+
case KEYBOARD_BUTTON_CODE.CTRL:
|
|
96
|
+
{
|
|
97
|
+
// store.dispatch(setAlterateState());
|
|
98
|
+
break;
|
|
99
|
+
}
|
|
100
|
+
case KEYBOARD_BUTTON_CODE.SHIFT:
|
|
101
|
+
{
|
|
102
|
+
if (['TEXTAREA', 'INPUT'].includes(document.activeElement.tagName) === false) {
|
|
103
|
+
if ([MODE_DRAWING_ITEM_3D, MODE_IDLE_3D].includes(mode)) store.dispatch(uncreate());else if ([MODE_DRAWING_ITEM, MODE_IDLE].includes(mode)) store.dispatch(shift2don());
|
|
104
|
+
}
|
|
105
|
+
break;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
};
|
|
110
|
+
}
|
|
@@ -126,6 +126,9 @@ export default function (state, action) {
|
|
|
126
126
|
case SET_IS_CABINET_DRAWING:
|
|
127
127
|
return Project.setIsCabinetDrawing(state, action.isCabinetDrawing).updatedState;
|
|
128
128
|
case CREATE_ROOM_WITH_SHAPE:
|
|
129
|
+
state = state.merge({
|
|
130
|
+
sceneHistory: history.historyPush(state.sceneHistory, state.scene)
|
|
131
|
+
});
|
|
129
132
|
return Project.createRoomWithShape(state, action.roomShapeType, action.width, action.height, action.doorStyle).updatedState;
|
|
130
133
|
default:
|
|
131
134
|
return state;
|
|
@@ -29,8 +29,10 @@ export default function (state, action) {
|
|
|
29
29
|
if (item.type.includes('Light')) {
|
|
30
30
|
var height = item.properties.getIn(['height', '_length']);
|
|
31
31
|
var heightUnit = item.properties.getIn(['height', '_unit']);
|
|
32
|
-
var newAltitude = action.value - convert(height).from(heightUnit).to('in');
|
|
32
|
+
var newAltitude = convert(action.value).from(_layer.unit).to('in') - convert(height).from(heightUnit).to('in');
|
|
33
33
|
item = item.setIn(['properties', 'altitude', '_length'], convert(newAltitude).from('in').to(_layer.unit));
|
|
34
|
+
item = item.setIn(['properties', 'altitude', '_unit'], _layer.unit);
|
|
35
|
+
item = item.setIn(['properties', 'altitude', 'length'], convert(newAltitude).from('in').to('cm'));
|
|
34
36
|
}
|
|
35
37
|
return item;
|
|
36
38
|
});
|
|
@@ -34,8 +34,10 @@ export default function (state, action) {
|
|
|
34
34
|
if (item.type.includes('Light')) {
|
|
35
35
|
var height = item.properties.getIn(['height', '_length']);
|
|
36
36
|
var heightUnit = item.properties.getIn(['height', '_unit']);
|
|
37
|
-
var newAltitude = action.value - convert(height).from(heightUnit).to('in');
|
|
37
|
+
var newAltitude = convert(action.value).from(_layer.unit).to('in') - convert(height).from(heightUnit).to('in');
|
|
38
38
|
item = item.setIn(['properties', 'altitude', '_length'], convert(newAltitude).from('in').to(_layer.unit));
|
|
39
|
+
item = item.setIn(['properties', 'altitude', '_unit'], _layer.unit);
|
|
40
|
+
item = item.setIn(['properties', 'altitude', 'length'], convert(newAltitude).from('in').to('cm'));
|
|
39
41
|
}
|
|
40
42
|
return item;
|
|
41
43
|
});
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
.react-tabs__tab-list {
|
|
2
|
+
border-bottom: 1px solid #aaa;
|
|
3
|
+
margin: 0 0 10px;
|
|
4
|
+
padding: 0;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.react-tabs__tab {
|
|
8
|
+
display: inline-block;
|
|
9
|
+
border: 1px solid transparent;
|
|
10
|
+
border-bottom: none;
|
|
11
|
+
bottom: -1px;
|
|
12
|
+
position: relative;
|
|
13
|
+
list-style: none;
|
|
14
|
+
padding: 6px 12px;
|
|
15
|
+
cursor: pointer;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.react-tabs__tab--selected,
|
|
19
|
+
.react-tabs__tab:focus {
|
|
20
|
+
border-color: #aaa;
|
|
21
|
+
color: #1ca6fc;
|
|
22
|
+
outline: none;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.react-tabs__tab-panel {
|
|
26
|
+
display: none;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.react-tabs__tab-panel--selected {
|
|
30
|
+
display: block;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
@keyframes spin {
|
|
34
|
+
from {
|
|
35
|
+
transform: rotate(0deg);
|
|
36
|
+
}
|
|
37
|
+
to {
|
|
38
|
+
transform: rotate(360deg);
|
|
39
|
+
}
|
|
40
|
+
}
|
package/es/utils/geometry.js
CHANGED
|
@@ -741,9 +741,9 @@ export function getAllItemSpecified(scene, catalog, filter) {
|
|
|
741
741
|
var info = cat === null || cat === void 0 ? void 0 : cat.info;
|
|
742
742
|
var props = item.properties;
|
|
743
743
|
var getSize = function getSize(key) {
|
|
744
|
-
var _props$getIn;
|
|
744
|
+
var _props$getIn, _props$getIn2, _props$getIn3;
|
|
745
745
|
var length = props === null || props === void 0 || (_props$getIn = props.getIn) === null || _props$getIn === void 0 ? void 0 : _props$getIn.call(props, [key, '_length']);
|
|
746
|
-
return length != null ? convert(length).from('in').to(scene.unit) : 0;
|
|
746
|
+
return length != null ? convert(length).from((_props$getIn2 = props === null || props === void 0 || (_props$getIn3 = props.getIn) === null || _props$getIn3 === void 0 ? void 0 : _props$getIn3.call(props, [key, '_unit'])) !== null && _props$getIn2 !== void 0 ? _props$getIn2 : 'in').to(scene.unit) : 0;
|
|
747
747
|
};
|
|
748
748
|
val.size = {
|
|
749
749
|
width: getSize('width'),
|
|
@@ -1873,7 +1873,7 @@ export function getAllHoleRect(scene, val) {
|
|
|
1873
1873
|
layer.lines.forEach(function (line) {
|
|
1874
1874
|
line.holes.forEach(function (holeID) {
|
|
1875
1875
|
var hole = layer.holes.get(holeID);
|
|
1876
|
-
holes.push(hole);
|
|
1876
|
+
if (hole) holes.push(hole);
|
|
1877
1877
|
});
|
|
1878
1878
|
});
|
|
1879
1879
|
var i = 0;
|
|
@@ -2063,20 +2063,20 @@ export function relationshipOfTwoOverlappedLines(srcLine, destLine) {
|
|
|
2063
2063
|
}
|
|
2064
2064
|
export function relationshipOfTwoOverlappedLines2(srcLine, destLine) {
|
|
2065
2065
|
var p1 = {
|
|
2066
|
-
x: srcLine.x1,
|
|
2067
|
-
y: srcLine.y1
|
|
2066
|
+
x: Math.round(srcLine.x1 * 100) / 100,
|
|
2067
|
+
y: Math.round(srcLine.y1 * 100) / 100
|
|
2068
2068
|
};
|
|
2069
2069
|
var p2 = {
|
|
2070
|
-
x: srcLine.x2,
|
|
2071
|
-
y: srcLine.y2
|
|
2070
|
+
x: Math.round(srcLine.x2 * 100) / 100,
|
|
2071
|
+
y: Math.round(srcLine.y2 * 100) / 100
|
|
2072
2072
|
};
|
|
2073
2073
|
var p3 = {
|
|
2074
|
-
x: destLine.x1,
|
|
2075
|
-
y: destLine.y1
|
|
2074
|
+
x: Math.round(destLine.x1 * 100) / 100,
|
|
2075
|
+
y: Math.round(destLine.y1 * 100) / 100
|
|
2076
2076
|
};
|
|
2077
2077
|
var p4 = {
|
|
2078
|
-
x: destLine.x2,
|
|
2079
|
-
y: destLine.y2
|
|
2078
|
+
x: Math.round(destLine.x2 * 100) / 100,
|
|
2079
|
+
y: Math.round(destLine.y2 * 100) / 100
|
|
2080
2080
|
};
|
|
2081
2081
|
var x1 = p1.x,
|
|
2082
2082
|
y1 = p1.y;
|
|
@@ -2105,7 +2105,7 @@ export function relationshipOfTwoOverlappedLines2(srcLine, destLine) {
|
|
|
2105
2105
|
lineSX = _sort4[0],
|
|
2106
2106
|
lineDX = _sort4[1];
|
|
2107
2107
|
var isReversedSrcLineIdx = false;
|
|
2108
|
-
if (lineSX[0].x === line1[0].x && lineSX[0].y === line1[0].y) isReversedSrcLineIdx = true;
|
|
2108
|
+
if (lineSX[0].x === line0[0].x && lineSX[0].y === line0[0].y) isReversedSrcLineIdx = false;else if (lineSX[0].x === line1[0].x && lineSX[0].y === line1[0].y) isReversedSrcLineIdx = true;
|
|
2109
2109
|
var compare0 = comparator(lineSX[0], lineDX[0]);
|
|
2110
2110
|
var compare1 = comparator(lineSX[1], lineDX[0]);
|
|
2111
2111
|
var compare2 = comparator(lineSX[1], lineDX[1]);
|
|
@@ -2450,40 +2450,20 @@ function getCalcRectFromItem2(itemInfo) {
|
|
|
2450
2450
|
var w = itemInfo.size.width / 2;
|
|
2451
2451
|
var h = itemInfo.size.height / 2;
|
|
2452
2452
|
var rotRad = itemInfo.rotRad;
|
|
2453
|
-
var
|
|
2454
|
-
var
|
|
2455
|
-
var
|
|
2456
|
-
var
|
|
2457
|
-
var m2y = y + w * Math.sin(rotRad) + mh * Math.cos(rotRad);
|
|
2453
|
+
var mx = x - w * Math.cos(rotRad);
|
|
2454
|
+
var my = y - w * Math.sin(rotRad);
|
|
2455
|
+
var m2x = x + w * Math.cos(rotRad);
|
|
2456
|
+
var m2y = y + w * Math.sin(rotRad);
|
|
2458
2457
|
var m3x = x - h * Math.sin(rotRad);
|
|
2459
2458
|
var m3y = y + h * Math.cos(rotRad);
|
|
2460
2459
|
var m1x = x + h * Math.sin(rotRad);
|
|
2461
2460
|
var m1y = y - h * Math.cos(rotRad);
|
|
2462
|
-
var x0 = mx + h * Math.sin(rotRad);
|
|
2463
|
-
var y0 = my - h * Math.cos(rotRad);
|
|
2464
|
-
var x3 = mx * 2 - x0;
|
|
2465
|
-
var y3 = my * 2 - y0;
|
|
2466
|
-
var x1 = x * 2 - x3;
|
|
2467
|
-
var y1 = y * 2 - y3;
|
|
2468
|
-
var x2 = x * 2 - x0;
|
|
2469
|
-
var y2 = y * 2 - y0;
|
|
2470
2461
|
return {
|
|
2471
2462
|
rectCenterPoint: [[point(mx, my), 180], [point(m1x, m1y), -90], [point(m2x, m2y), 0], [point(m3x, m3y), 90]]
|
|
2472
2463
|
};
|
|
2473
2464
|
}
|
|
2474
|
-
function getAllItems2(
|
|
2465
|
+
function getAllItems2(curItem, layer) {
|
|
2475
2466
|
var rectarray = [];
|
|
2476
|
-
var currentItem;
|
|
2477
|
-
var selectedItem;
|
|
2478
|
-
if (layer.selected.items.size > 0) {
|
|
2479
|
-
selectedItem = layer.getIn(['items', layer.selected.items.get(0)]);
|
|
2480
|
-
var catid = selectedItem.type;
|
|
2481
|
-
var cat = findCatalogElement(catalog, catid);
|
|
2482
|
-
currentItem = {
|
|
2483
|
-
selectedItem: selectedItem,
|
|
2484
|
-
cat: cat
|
|
2485
|
-
};
|
|
2486
|
-
}
|
|
2487
2467
|
layer.items.forEach(function (item) {
|
|
2488
2468
|
var val = {
|
|
2489
2469
|
pos: {
|
|
@@ -2492,27 +2472,21 @@ function getAllItems2(layer, catalog) {
|
|
|
2492
2472
|
},
|
|
2493
2473
|
rotRad: item.rotation / 180 * Math.PI
|
|
2494
2474
|
};
|
|
2495
|
-
var
|
|
2496
|
-
var
|
|
2497
|
-
var width = convert(item.properties.getIn(['width', '_length'])).from('in').to('cm');
|
|
2498
|
-
var height = convert(item.properties.getIn(['depth', '_length'])).from('in').to('cm');
|
|
2499
|
-
// let width = cat.info.sizeinfo.width;
|
|
2500
|
-
// let height = cat.info.sizeinfo.depth;
|
|
2475
|
+
var width = convert(item.properties.getIn(['width', '_length'])).from(curItem.get('properties').get('width').get('_unit')).to('cm');
|
|
2476
|
+
var height = convert(item.properties.getIn(['depth', '_length'])).from(curItem.get('properties').get('depth').get('_unit')).to('cm');
|
|
2501
2477
|
val.size = {
|
|
2502
2478
|
width: width,
|
|
2503
2479
|
height: height
|
|
2504
2480
|
};
|
|
2505
|
-
var
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
if (!item.selected) {
|
|
2515
|
-
var detectObjectsAtSameAltitudeFlag = layoutpos === 'Base' ? item.properties.getIn(['altitude', '_length']) <= altitude + tempHeight.get('_length') : item.properties.getIn(['altitude', '_length']) + item.properties.getIn(['height', '_length']) >= altitude;
|
|
2481
|
+
var curItemTall = convert(curItem.get('properties').get('height').get('_length')).from(curItem.get('properties').get('height').get('_unit')).to('cm');
|
|
2482
|
+
var zMinCurItem = convert(curItem.get('properties').get('altitude').get('_length')).from(curItem.get('properties').get('altitude').get('_unit')).to('cm');
|
|
2483
|
+
var zMaxCurItem = zMinCurItem + curItemTall;
|
|
2484
|
+
if (curItem.get('id') !== item.id) {
|
|
2485
|
+
var detectObjectsAtSameAltitudeFlag = false;
|
|
2486
|
+
var itemTall = convert(item.properties.getIn(['height', '_length'])).from(item.get('properties').get('height').get('_unit')).to('cm');
|
|
2487
|
+
var zMinItem = convert(item.properties.getIn(['altitude', '_length'])).from(item.get('properties').get('altitude').get('_unit')).to('cm');
|
|
2488
|
+
var zMaxItem = zMinItem + itemTall;
|
|
2489
|
+
if (zMinItem >= zMinCurItem && zMinItem < zMaxCurItem || zMinCurItem >= zMinItem && zMinCurItem < zMaxItem) detectObjectsAtSameAltitudeFlag = true;
|
|
2516
2490
|
if (detectObjectsAtSameAltitudeFlag) {
|
|
2517
2491
|
var x = val.pos.x;
|
|
2518
2492
|
var y = val.pos.y;
|
|
@@ -2544,68 +2518,25 @@ function getAllItems2(layer, catalog) {
|
|
|
2544
2518
|
}
|
|
2545
2519
|
}
|
|
2546
2520
|
});
|
|
2547
|
-
|
|
2548
|
-
// layer.holes.forEach(hole => {
|
|
2549
|
-
// let val = {pos:{x:hole.x, y:hole.y}, rotRad:hole.rotation};
|
|
2550
|
-
// let catid = hole.type;
|
|
2551
|
-
// let cat = catalog.elements[catid];
|
|
2552
|
-
// let width = hole.properties.getIn(['width']).getIn(['length']);
|
|
2553
|
-
// let height = hole.properties.getIn(['height']).getIn(['length']);
|
|
2554
|
-
// val.size = {width, height};
|
|
2555
|
-
// let otherItem = {
|
|
2556
|
-
// hole,
|
|
2557
|
-
// cat
|
|
2558
|
-
// }
|
|
2559
|
-
|
|
2560
|
-
// // if (!GeometryUtils.needSnap(currentItem, otherItem)) {
|
|
2561
|
-
// // return;
|
|
2562
|
-
// // }
|
|
2563
|
-
|
|
2564
|
-
// if (!hole.selected) {
|
|
2565
|
-
// let x = val.pos.x;
|
|
2566
|
-
// let y = val.pos.y;
|
|
2567
|
-
// let rotRad = val.rotRad;
|
|
2568
|
-
// let w = val.size.width / 2;
|
|
2569
|
-
// let mx = x - w * Math.cos(rotRad);
|
|
2570
|
-
// let my = y - w * Math.sin(rotRad);
|
|
2571
|
-
// let kx = x + w * Math.cos(rotRad);
|
|
2572
|
-
// let ky = y + w * Math.sin(rotRad);
|
|
2573
|
-
// let x0 = mx - 10 * Math.sin(rotRad);
|
|
2574
|
-
// let y0 = my + 10 * Math.cos(rotRad);
|
|
2575
|
-
// let x3 = mx + 10 * Math.sin(rotRad);
|
|
2576
|
-
// let y3 = my - 10 * Math.cos(rotRad);
|
|
2577
|
-
// let x1 = kx - 10 * Math.sin(rotRad);
|
|
2578
|
-
// let y1 = ky + 10 * Math.cos(rotRad);
|
|
2579
|
-
// let x2 = kx + 10 * Math.sin(rotRad);
|
|
2580
|
-
// let y2 = ky - 10 * Math.cos(rotRad);
|
|
2581
|
-
// rectarray.push({'rect':[point(x0,y0), point(x1,y1) ,point(x0,y0), point(x1,y1)]});
|
|
2582
|
-
// rectarray.push({'rect':[point(x1,y1), point(x2,y2), point(x1,y1), point(x2,y2)]}); // right
|
|
2583
|
-
// rectarray.push({'rect':[point(x2,y2), point(x3,y3), point(x2,y2), point(x3,y3)]}); // front
|
|
2584
|
-
// rectarray.push({'rect':[point(x3,y3), point(x0,y0), point(x3,y3), point(x0,y0)]}); // left
|
|
2585
|
-
// }
|
|
2586
|
-
// });
|
|
2587
2521
|
return {
|
|
2588
2522
|
others: rectarray
|
|
2589
2523
|
};
|
|
2590
2524
|
}
|
|
2591
|
-
export function calcDistancesFromItemToWalls(
|
|
2592
|
-
if (isEmpty(
|
|
2593
|
-
var x =
|
|
2594
|
-
var y =
|
|
2595
|
-
var rotRad =
|
|
2525
|
+
export function calcDistancesFromItemToWalls(curItem, layer) {
|
|
2526
|
+
if (isEmpty(curItem)) return [];
|
|
2527
|
+
var x = curItem.get('x');
|
|
2528
|
+
var y = curItem.get('y');
|
|
2529
|
+
var rotRad = curItem.get('rotation') / 180 * Math.PI;
|
|
2596
2530
|
var width, height;
|
|
2597
|
-
if (
|
|
2598
|
-
width = convert(
|
|
2599
|
-
height = convert(
|
|
2531
|
+
if (curItem.get('properties').get('width') || curItem.get('properties').get('depth')) {
|
|
2532
|
+
width = convert(curItem.get('properties').get('width').get('_length')).from(curItem.get('properties').get('width').get('_unit')).to('cm');
|
|
2533
|
+
height = convert(curItem.get('properties').get('depth').get('_length')).from(curItem.get('properties').get('depth').get('_unit')).to('cm');
|
|
2600
2534
|
} else {
|
|
2601
|
-
width = convert(
|
|
2602
|
-
height = convert(
|
|
2535
|
+
width = convert(curItem.info.sizeinfo.width).from('in').to('cm');
|
|
2536
|
+
height = convert(curItem.info.sizeinfo.depth).from('in').to('cm');
|
|
2603
2537
|
}
|
|
2604
|
-
var
|
|
2605
|
-
var center_x = x;
|
|
2538
|
+
var center_x = x; // middle of front line of cabinet rect
|
|
2606
2539
|
var center_y = y;
|
|
2607
|
-
var center_x1 = x - center_h * Math.sin(rotRad);
|
|
2608
|
-
var center_y1 = y + center_h * Math.cos(rotRad);
|
|
2609
2540
|
var PointArray = [];
|
|
2610
2541
|
var itemInfo = {
|
|
2611
2542
|
pos: {
|
|
@@ -2619,24 +2550,37 @@ export function calcDistancesFromItemToWalls(attributesFormData, layer, catalog)
|
|
|
2619
2550
|
height: height
|
|
2620
2551
|
};
|
|
2621
2552
|
var curiteminfo = getCalcRectFromItem2(itemInfo);
|
|
2622
|
-
var allItemRect = getAllItems2(
|
|
2623
|
-
var allLines = getAllLines(layer);
|
|
2624
|
-
var allLineRects = buildRectFromLines(layer, allLines);
|
|
2625
|
-
var allRect = allLineRects.concat(allItemRect.others);
|
|
2626
|
-
|
|
2627
|
-
|
|
2553
|
+
var allItemRect = getAllItems2(curItem, layer); // get all item edge rects
|
|
2554
|
+
var allLines = getAllLines(layer); // get all wall lines
|
|
2555
|
+
var allLineRects = buildRectFromLines(layer, allLines); // make line rects from wall lines
|
|
2556
|
+
var allRect = allLineRects.concat(allItemRect.others); // item edges + wall lines
|
|
2557
|
+
var _loop = function _loop(i) {
|
|
2558
|
+
// [rectCenterPoint] has four middle points of cabinet rect edges
|
|
2559
|
+
var centerpoint = curiteminfo.rectCenterPoint[i];
|
|
2560
|
+
var comparelength = []; // distance array from rectCenterPoint[i] to other lines(walls, other cabinet rect edges)
|
|
2628
2561
|
var a;
|
|
2629
|
-
var RectLineFuction;
|
|
2630
|
-
|
|
2562
|
+
var RectLineFuction = linePassingThroughTwoPoints(centerpoint[0].x, centerpoint[0].y, center_x, center_y); // normal line of cabinet rect edge
|
|
2563
|
+
|
|
2631
2564
|
allRect.forEach(function (linerect) {
|
|
2565
|
+
// calc distance to all other lines
|
|
2632
2566
|
var p0 = clone_point(linerect.rect[2]);
|
|
2633
2567
|
var p1 = clone_point(linerect.rect[3]);
|
|
2634
|
-
var lineFunction = {};
|
|
2568
|
+
var lineFunction = {}; // other line function
|
|
2635
2569
|
if (p0.x !== p1.x || p0.y !== p1.y) lineFunction = linePassingThroughTwoPoints(p0.x, p0.y, p1.x, p1.y);
|
|
2570
|
+
// intersection between normal line and other line
|
|
2636
2571
|
var coordinatePoint = twoLinesIntersection(lineFunction.a, lineFunction.b, lineFunction.c, RectLineFuction.a, RectLineFuction.b, RectLineFuction.c);
|
|
2637
2572
|
if (coordinatePoint !== undefined) {
|
|
2638
|
-
if (
|
|
2639
|
-
|
|
2573
|
+
if (
|
|
2574
|
+
// intersection point is on the other line
|
|
2575
|
+
pointsDistance(p0.x, p0.y, p1.x, p1.y) > pointsDistance(p0.x, p0.y, coordinatePoint.x, coordinatePoint.y) && pointsDistance(p0.x, p0.y, p1.x, p1.y) > pointsDistance(p1.x, p1.y, coordinatePoint.x, coordinatePoint.y)) {
|
|
2576
|
+
// check the intersection point is outside direction of edge
|
|
2577
|
+
var isOutside = true;
|
|
2578
|
+
for (var j = 0; j < curiteminfo.rectCenterPoint.length; j++) {
|
|
2579
|
+
if (j === i) continue;
|
|
2580
|
+
var otherCenterPoint = curiteminfo.rectCenterPoint[j];
|
|
2581
|
+
if (isPointOnLineSegment(centerpoint[0].x, centerpoint[0].y, coordinatePoint.x, coordinatePoint.y, otherCenterPoint[0].x, otherCenterPoint[0].y)) isOutside = false;
|
|
2582
|
+
}
|
|
2583
|
+
if (isOutside && pointsDistance(coordinatePoint.x, coordinatePoint.y, center_x, center_y) > pointsDistance(centerpoint[0].x, centerpoint[0].y, coordinatePoint.x, coordinatePoint.y)) {
|
|
2640
2584
|
comparelength.push(pointsDistance(centerpoint[0].x, centerpoint[0].y, coordinatePoint.x, coordinatePoint.y));
|
|
2641
2585
|
a = Math.min.apply(null, comparelength);
|
|
2642
2586
|
}
|
|
@@ -2644,7 +2588,21 @@ export function calcDistancesFromItemToWalls(attributesFormData, layer, catalog)
|
|
|
2644
2588
|
}
|
|
2645
2589
|
});
|
|
2646
2590
|
PointArray.push([a, centerpoint[1]]);
|
|
2591
|
+
};
|
|
2592
|
+
for (var i = 0; i < curiteminfo.rectCenterPoint.length; i++) {
|
|
2593
|
+
_loop(i);
|
|
2594
|
+
}
|
|
2595
|
+
PointArray.forEach(function (pointElement, index) {
|
|
2596
|
+
if (pointElement[0] == undefined) PointArray[index][0] = 0;
|
|
2647
2597
|
});
|
|
2598
|
+
var cnt = 0;
|
|
2599
|
+
PointArray.forEach(function (pointElement) {
|
|
2600
|
+
if (pointElement[0] == 0) cnt++;
|
|
2601
|
+
});
|
|
2602
|
+
if (cnt == 4 || cnt == 3) {
|
|
2603
|
+
PointArray[0][0] = 100;
|
|
2604
|
+
PointArray[1][0] = 100;
|
|
2605
|
+
}
|
|
2648
2606
|
return {
|
|
2649
2607
|
PointArray: PointArray
|
|
2650
2608
|
};
|
package/es/utils/helper.js
CHANGED
|
@@ -5,10 +5,11 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
5
5
|
import { HDRCubeTextureLoader } from 'three/examples/jsm/loaders/HDRCubeTextureLoader.js';
|
|
6
6
|
import { ANIMATE_OBJECT_OPEN_DOOR_ROTATION_UNIT, ANIMATE_STEP_MAX, DECIMAL_PLACES_2, HDR_URLS, MAX_ZOOM_IN_SCALE, MODE_ELEVATION_VIEW, ZOOM_VARIABLE } from "../constants";
|
|
7
7
|
import * as Three from 'three';
|
|
8
|
-
import { returnReplaceableDeepSearchType } from "./../components/viewer2d/utils";
|
|
8
|
+
import { isWarningItem, returnReplaceableDeepSearchType } from "./../components/viewer2d/utils";
|
|
9
9
|
import { convert } from "./convert-units-lite";
|
|
10
10
|
import { formatNumber } from "./math";
|
|
11
11
|
import AWS from 'aws-sdk';
|
|
12
|
+
import { GeometryUtils, MoldingUtils } from "./export";
|
|
12
13
|
var s3 = new AWS.S3({
|
|
13
14
|
accessKeyId: process.env.REACT_APP_AWS_ID,
|
|
14
15
|
secretAccessKey: process.env.REACT_APP_AWS_SECRET
|
|
@@ -396,4 +397,40 @@ export function centering2D(state) {
|
|
|
396
397
|
});
|
|
397
398
|
if (viewer2DActions) updateViwer2D(viewer, viewer2DActions);
|
|
398
399
|
return state;
|
|
400
|
+
}
|
|
401
|
+
export function updatePayloadOfInternalEvent(currentObject, layer, catalog) {
|
|
402
|
+
var pointArray = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
|
|
403
|
+
if (isEmpty(currentObject)) return null;
|
|
404
|
+
var updatedPayload = currentObject.toJS();
|
|
405
|
+
if (isEmpty(layer) || isEmpty(catalog)) return updatedPayload;
|
|
406
|
+
if ((currentObject === null || currentObject === void 0 ? void 0 : currentObject.prototype) === 'lines') {
|
|
407
|
+
// caculating length of selected line//
|
|
408
|
+
var v_a = layer.vertices.get(currentObject.vertices.get(0));
|
|
409
|
+
var v_b = layer.vertices.get(currentObject.vertices.get(1));
|
|
410
|
+
var distance = GeometryUtils.pointsDistance(v_a.x, v_a.y, v_b.x, v_b.y);
|
|
411
|
+
var _length = convert(distance).from('cm').to(layer.unit);
|
|
412
|
+
updatedPayload.length = _length;
|
|
413
|
+
//////////////////////////////////////
|
|
414
|
+
} else if ((currentObject === null || currentObject === void 0 ? void 0 : currentObject.prototype) === 'items') {
|
|
415
|
+
var _catalog$elements$cur;
|
|
416
|
+
// check this cabinet has warning box
|
|
417
|
+
updatedPayload.isWarning = isWarningItem(currentObject);
|
|
418
|
+
// check this item is available molding
|
|
419
|
+
updatedPayload.isMoldingAvailable = MoldingUtils.isEnableItemForMolding(layer, currentObject);
|
|
420
|
+
// check this item is snapped to wall
|
|
421
|
+
updatedPayload.isAttachedWall = MoldingUtils.isAttachedWall(layer, currentObject);
|
|
422
|
+
// update distArray
|
|
423
|
+
if (pointArray) updatedPayload.distArray = pointArray;
|
|
424
|
+
|
|
425
|
+
// update sku_number using sku_array
|
|
426
|
+
var currentDoorColorId = currentObject.getIn(['doorStyle', 'id']);
|
|
427
|
+
var skuArray = catalog === null || catalog === void 0 || (_catalog$elements$cur = catalog.elements[currentObject.get('name')]) === null || _catalog$elements$cur === void 0 || (_catalog$elements$cur = _catalog$elements$cur.obj) === null || _catalog$elements$cur === void 0 ? void 0 : _catalog$elements$cur.skuArray;
|
|
428
|
+
var correctSKU = skuArray === null || skuArray === void 0 ? void 0 : skuArray.find(function (sku) {
|
|
429
|
+
return sku.door_color_id === currentDoorColorId;
|
|
430
|
+
});
|
|
431
|
+
if (correctSKU) {
|
|
432
|
+
updatedPayload.sku_number = correctSKU.sku;
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
return updatedPayload;
|
|
399
436
|
}
|