kitchen-simulator 4.0.0-queuedEvents → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/LiteKitchenConfigurator.js +141 -288
- package/es/LiteRenderer.js +159 -398
- package/es/actions/items-actions.js +10 -6
- package/es/actions/lines-actions.js +3 -1
- package/es/actions/project-actions.js +15 -5
- package/es/assets/img/svg/bottombar/elevation.svg +12 -5
- package/es/catalog/areas/area/planner-element.js +10 -5
- package/es/catalog/catalog.js +1 -4
- package/es/catalog/factories/area-factory-3d.js +2 -1
- package/es/catalog/factories/wall-factory-3d.js +2 -2
- package/es/catalog/factories/wall-factory.js +8 -8
- package/es/catalog/lines/wall/planner-element.js +18 -9
- package/es/catalog/utils/exporter.js +7 -3
- package/es/catalog/utils/item-loader.js +24 -14
- package/es/catalog/utils/mtl-loader.js +2 -2
- package/es/catalog/utils/obj-loader.js +2 -2
- package/es/class/hole.js +0 -2
- package/es/class/item.js +183 -184
- package/es/class/line.js +11 -3
- package/es/class/project.js +165 -48
- package/es/components/content.js +19 -6
- package/es/components/viewer2d/grids/grid-streak.js +1 -1
- package/es/components/viewer2d/item.js +84 -51
- package/es/components/viewer2d/line.js +315 -243
- package/es/components/viewer2d/ruler.js +20 -38
- package/es/components/viewer2d/rulerDist.js +48 -78
- package/es/components/viewer2d/utils.js +6 -0
- package/es/components/viewer2d/viewer2d.js +298 -220
- package/es/components/viewer3d/front3D.js +3 -2
- package/es/components/viewer3d/libs/mtl-loader.js +2 -2
- package/es/components/viewer3d/libs/obj-loader.js +2 -2
- package/es/components/viewer3d/libs/orbit-controls.js +3 -4
- package/es/components/viewer3d/libs/pointer-lock-controls.js +6 -7
- package/es/components/viewer3d/scene-creator.js +51 -15
- package/es/components/viewer3d/viewer3d.js +121 -82
- package/es/constants.js +111 -3
- package/es/devLiteRenderer.js +688 -31
- package/es/index.js +567 -87
- package/es/models.js +9 -5
- package/es/plugins/SVGLoader.js +7 -5
- package/es/plugins/console-debugger.js +0 -2
- package/es/plugins/keyboard.js +15 -6
- package/es/reducers/items-reducer.js +5 -5
- package/es/reducers/lines-reducer.js +1 -1
- package/es/reducers/project-reducer.js +5 -3
- package/es/shared-style.js +4 -4
- package/es/utils/geometry.js +163 -2
- package/es/utils/get-edges-of-subgraphs.js +1 -1
- package/es/utils/graph-cycles.js +1 -1
- package/es/utils/graph.js +1 -1
- package/es/utils/helper.js +105 -3
- package/es/utils/isolate-event-handler.js +1542 -164
- package/es/utils/molding.js +461 -11
- package/lib/LiteKitchenConfigurator.js +141 -289
- package/lib/LiteRenderer.js +159 -399
- package/lib/actions/items-actions.js +10 -6
- package/lib/actions/lines-actions.js +3 -1
- package/lib/actions/project-actions.js +15 -4
- package/lib/assets/img/svg/bottombar/elevation.svg +12 -5
- package/lib/catalog/areas/area/planner-element.js +11 -5
- package/lib/catalog/catalog.js +1 -4
- package/lib/catalog/factories/area-factory-3d.js +2 -1
- package/lib/catalog/factories/wall-factory-3d.js +2 -2
- package/lib/catalog/factories/wall-factory.js +8 -8
- package/lib/catalog/lines/wall/planner-element.js +19 -9
- package/lib/catalog/utils/exporter.js +7 -3
- package/lib/catalog/utils/item-loader.js +24 -14
- package/lib/catalog/utils/mtl-loader.js +9 -2
- package/lib/catalog/utils/obj-loader.js +10 -2
- package/lib/class/hole.js +0 -2
- package/lib/class/item.js +180 -181
- package/lib/class/line.js +9 -1
- package/lib/class/project.js +164 -47
- package/lib/components/content.js +19 -6
- package/lib/components/viewer2d/grids/grid-streak.js +1 -1
- package/lib/components/viewer2d/item.js +83 -50
- package/lib/components/viewer2d/line.js +315 -242
- package/lib/components/viewer2d/ruler.js +19 -37
- package/lib/components/viewer2d/rulerDist.js +48 -78
- package/lib/components/viewer2d/utils.js +7 -0
- package/lib/components/viewer2d/viewer2d.js +296 -219
- package/lib/components/viewer3d/front3D.js +3 -2
- package/lib/components/viewer3d/libs/mtl-loader.js +9 -2
- package/lib/components/viewer3d/libs/obj-loader.js +9 -2
- package/lib/components/viewer3d/libs/orbit-controls.js +11 -5
- package/lib/components/viewer3d/libs/pointer-lock-controls.js +13 -7
- package/lib/components/viewer3d/scene-creator.js +49 -13
- package/lib/components/viewer3d/viewer3d.js +119 -80
- package/lib/constants.js +116 -7
- package/lib/devLiteRenderer.js +687 -30
- package/lib/index.js +567 -87
- package/lib/models.js +9 -5
- package/lib/plugins/SVGLoader.js +7 -5
- package/lib/plugins/console-debugger.js +0 -2
- package/lib/plugins/keyboard.js +15 -6
- package/lib/reducers/items-reducer.js +5 -5
- package/lib/reducers/lines-reducer.js +1 -1
- package/lib/reducers/project-reducer.js +4 -2
- package/lib/shared-style.js +4 -4
- package/lib/utils/geometry.js +164 -2
- package/lib/utils/get-edges-of-subgraphs.js +6 -1
- package/lib/utils/graph-cycles.js +7 -8
- package/lib/utils/graph.js +6 -1
- package/lib/utils/helper.js +108 -2
- package/lib/utils/isolate-event-handler.js +1538 -159
- package/lib/utils/molding.js +463 -9
- package/package.json +1 -1
- package/es/assets/Window.hdr +0 -2100
- package/es/assets/img/1.jpg +0 -0
- package/lib/assets/Window.hdr +0 -2100
- package/lib/assets/img/1.jpg +0 -0
package/lib/models.js
CHANGED
|
@@ -45,16 +45,16 @@ var DefaultGrids = exports.DefaultGrids = new _immutable.Map({
|
|
|
45
45
|
id: 'h1',
|
|
46
46
|
type: 'horizontal-streak',
|
|
47
47
|
properties: {
|
|
48
|
-
step: 30
|
|
49
|
-
colors: ['
|
|
48
|
+
step: 30,
|
|
49
|
+
colors: ['rgb(115, 125, 153)']
|
|
50
50
|
}
|
|
51
51
|
}),
|
|
52
52
|
v1: new Grid({
|
|
53
53
|
id: 'v1',
|
|
54
54
|
type: 'vertical-streak',
|
|
55
55
|
properties: {
|
|
56
|
-
step: 30
|
|
57
|
-
colors: ['
|
|
56
|
+
step: 30,
|
|
57
|
+
colors: ['rgb(229, 233, 245)']
|
|
58
58
|
}
|
|
59
59
|
})
|
|
60
60
|
});
|
|
@@ -206,6 +206,8 @@ var Item = exports.Item = /*#__PURE__*/function (_Record7) {
|
|
|
206
206
|
uri: ''
|
|
207
207
|
},
|
|
208
208
|
molding: [],
|
|
209
|
+
isInitialPos: false,
|
|
210
|
+
//current {x,y} is the initial position from host?
|
|
209
211
|
backsplashVisible: false,
|
|
210
212
|
applianceMaterial: {
|
|
211
213
|
roughness: 0.4,
|
|
@@ -345,7 +347,9 @@ var CatalogElement = exports.CatalogElement = /*#__PURE__*/function (_Record1) {
|
|
|
345
347
|
info: new _immutable.Map(),
|
|
346
348
|
properties: new _immutable.Map(),
|
|
347
349
|
obj: new _immutable.Map(),
|
|
348
|
-
type: ''
|
|
350
|
+
type: '',
|
|
351
|
+
cds: new _immutable.Map(),
|
|
352
|
+
structure_json: {}
|
|
349
353
|
}, 'CatalogElement'));
|
|
350
354
|
var Catalog = exports.Catalog = /*#__PURE__*/function (_Record10) {
|
|
351
355
|
function Catalog() {
|
package/lib/plugins/SVGLoader.js
CHANGED
|
@@ -85,11 +85,13 @@ SVGLoader.prototype = Object.assign(Object.create(_three.Loader.prototype), {
|
|
|
85
85
|
case 'use':
|
|
86
86
|
style = parseStyle(node, style);
|
|
87
87
|
var usedNodeId = node.href.baseVal.substring(1);
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
88
|
+
if (node.viewportElement.getElementById(usedNodeId)) {
|
|
89
|
+
var usedNode = node.viewportElement.getElementById(usedNodeId);
|
|
90
|
+
if (usedNode) {
|
|
91
|
+
parseNode(usedNode, style);
|
|
92
|
+
} else {
|
|
93
|
+
console.warn("SVGLoader: 'use node' references non-existent node id: " + usedNodeId);
|
|
94
|
+
}
|
|
93
95
|
}
|
|
94
96
|
break;
|
|
95
97
|
default:
|
|
@@ -34,8 +34,6 @@ function consoleDebugger() {
|
|
|
34
34
|
});
|
|
35
35
|
console.groupCollapsed('KitchenConfigurator');
|
|
36
36
|
console.info('KitchenConfigurator is ready');
|
|
37
|
-
console.info('console.log(KitchenConfigurator)');
|
|
38
|
-
console.log(window.KitchenConfigurator);
|
|
39
37
|
console.groupEnd();
|
|
40
38
|
};
|
|
41
39
|
}
|
package/lib/plugins/keyboard.js
CHANGED
|
@@ -12,12 +12,21 @@ function keyboard() {
|
|
|
12
12
|
var state = stateExtractor(store.getState());
|
|
13
13
|
var mode = state.get('mode');
|
|
14
14
|
switch (event.keyCode) {
|
|
15
|
-
case
|
|
16
|
-
case
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
// case KEYBOARD_BUTTON_CODE.BACKSPACE:
|
|
16
|
+
// case KEYBOARD_BUTTON_CODE.DELETE: {
|
|
17
|
+
// if (
|
|
18
|
+
// [
|
|
19
|
+
// MODE_IDLE,
|
|
20
|
+
// MODE_3D_FIRST_PERSON,
|
|
21
|
+
// MODE_3D_VIEW,
|
|
22
|
+
// MODE_IDLE_3D,
|
|
23
|
+
// MODE_ROTATING_ITEM_3D,
|
|
24
|
+
// MODE_DRAGGING_ITEM_3D
|
|
25
|
+
// ].includes(mode)
|
|
26
|
+
// )
|
|
27
|
+
// store.dispatch(remove());
|
|
28
|
+
// break;
|
|
29
|
+
// }
|
|
21
30
|
case _constants.KEYBOARD_BUTTON_CODE.ESC:
|
|
22
31
|
{
|
|
23
32
|
store.dispatch((0, _projectActions.rollback)());
|
|
@@ -20,7 +20,7 @@ function _default(state, action) {
|
|
|
20
20
|
case _constants.EDIT_WIDTH:
|
|
21
21
|
return _export.Item.editWidth(state, action.newWidth, action.layerID, action.itemID).updatedState;
|
|
22
22
|
case _constants.DUPLICATE_SELECTED:
|
|
23
|
-
return _export.Item.duplicateSelected(state, action.currentObject).updatedState;
|
|
23
|
+
return _export.Item.duplicateSelected(state, action.currentObject, action.onInternalEvent).updatedState;
|
|
24
24
|
case _constants.END_CREATING_CABINET:
|
|
25
25
|
return _export.Item.endCreatingCabinet(state).updatedState;
|
|
26
26
|
case _constants.UPDATE_POPUP_OPEN:
|
|
@@ -31,11 +31,11 @@ function _default(state, action) {
|
|
|
31
31
|
state = state.merge({
|
|
32
32
|
sceneHistory: _export2.history.historyPush(state.sceneHistory, state.scene)
|
|
33
33
|
});
|
|
34
|
-
return _export.Item.selectToolDrawingItem(state, action.sceneComponentType
|
|
34
|
+
return _export.Item.selectToolDrawingItem(state, action.sceneComponentType).updatedState;
|
|
35
35
|
case _constants.REPLACE_ITEM:
|
|
36
36
|
return _export.Item.replaceItem(state, action.selectedPos, action.currentObject, action.selectedObject).updatedState;
|
|
37
37
|
case _constants.UPDATE_DRAWING_ITEM:
|
|
38
|
-
return _export.Item.updateDrawingItem(state, action.layerID, action.x, action.y).updatedState;
|
|
38
|
+
return _export.Item.updateDrawingItem(state, action.layerID, action.x, action.y, action.isInitialPos).updatedState;
|
|
39
39
|
case _constants.END_DRAWING_ITEM:
|
|
40
40
|
state = state.merge({
|
|
41
41
|
sceneHistory: _export2.history.historyPush(state.sceneHistory, state.scene)
|
|
@@ -108,7 +108,7 @@ function _default(state, action) {
|
|
|
108
108
|
case _constants.SELECT_TOOL_DRAWING_ITEM_3D:
|
|
109
109
|
return _export.Item.selectToolDrawingItem3D(state, action.sceneComponentType).updatedState;
|
|
110
110
|
case _constants.SET_DOOR_STYLE:
|
|
111
|
-
return _export.Item.setDoorStyle(state, action.doorStyle, action.isAll).updatedState;
|
|
111
|
+
return _export.Item.setDoorStyle(state, action.doorStyle, action.itemCDS, action.isAll).updatedState;
|
|
112
112
|
case _constants.SET_HANDLE_MATERIAL:
|
|
113
113
|
return _export.Item.setHandleMaterial(state, action.material).updatedState;
|
|
114
114
|
case _constants.SET_DOOR_HANDLE:
|
|
@@ -133,7 +133,7 @@ function _default(state, action) {
|
|
|
133
133
|
case _constants.SET_APPLIANCE_MATERIAL:
|
|
134
134
|
return _export.Item.setApplianceMaterial(state, action.material).updatedState;
|
|
135
135
|
case _constants.SET_INITIAL_DOOR_STYLE:
|
|
136
|
-
return _export.Item.setInitialDoorStyle(state, action.doorStyle
|
|
136
|
+
return _export.Item.setInitialDoorStyle(state, action.doorStyle).updatedState;
|
|
137
137
|
case _constants.UPDATE_ITEM_POSITION:
|
|
138
138
|
return _export.Item.updateItemPosition(state, action.layerID, action.itemID, action.pos).updatedState;
|
|
139
139
|
// case SET_MOVE_STATUS:
|
|
@@ -19,7 +19,7 @@ function _default(state, action) {
|
|
|
19
19
|
state = state.merge({
|
|
20
20
|
sceneHistory: _export2.history.historyPush(state.sceneHistory, state.scene)
|
|
21
21
|
});
|
|
22
|
-
return _export.Line.beginDrawingLine(state, action.layerID, action.x, action.y).updatedState;
|
|
22
|
+
return _export.Line.beginDrawingLine(state, action.layerID, action.x, action.y, action.onInternalEvent).updatedState;
|
|
23
23
|
case _constants.UPDATE_DRAWING_LINE:
|
|
24
24
|
return _export.Line.updateDrawingLine(state, action.x, action.y, action.relatedLines).updatedState;
|
|
25
25
|
case _constants.STOP_DRAWING_LINE:
|
|
@@ -12,7 +12,7 @@ function _default(state, action) {
|
|
|
12
12
|
case _constants.NEW_PROJECT:
|
|
13
13
|
return _export2.Project.newProject(state).updatedState;
|
|
14
14
|
case _constants.LOAD_PROJECT:
|
|
15
|
-
return _export2.Project.loadProject(state, action.sceneJSON
|
|
15
|
+
return _export2.Project.loadProject(state, action.sceneJSON).updatedState;
|
|
16
16
|
case _constants.OPEN_CATALOG:
|
|
17
17
|
return _export2.Project.openCatalog(state).updatedState;
|
|
18
18
|
case _constants.CHANGE_CATALOG_PAGE:
|
|
@@ -49,7 +49,7 @@ function _default(state, action) {
|
|
|
49
49
|
state = state.merge({
|
|
50
50
|
sceneHistory: _export.history.historyPush(state.sceneHistory, state.scene)
|
|
51
51
|
});
|
|
52
|
-
return _export2.Project.remove(state).updatedState;
|
|
52
|
+
return _export2.Project.remove(state, action.delObject).updatedState;
|
|
53
53
|
case _constants.UNDO:
|
|
54
54
|
return _export2.Project.undo(state).updatedState;
|
|
55
55
|
case _constants.REDO:
|
|
@@ -131,6 +131,8 @@ function _default(state, action) {
|
|
|
131
131
|
return _export2.Project.setIsHelp(state, action.isHelp).updatedState;
|
|
132
132
|
case _constants.SET_IS_CABINET_DRAWING:
|
|
133
133
|
return _export2.Project.setIsCabinetDrawing(state, action.isCabinetDrawing).updatedState;
|
|
134
|
+
case _constants.CREATE_ROOM_WITH_SHAPE:
|
|
135
|
+
return _export2.Project.createRoomWithShape(state, action.roomShapeType, action.width, action.height, action.doorStyle).updatedState;
|
|
134
136
|
default:
|
|
135
137
|
return state;
|
|
136
138
|
}
|
package/lib/shared-style.js
CHANGED
|
@@ -60,13 +60,13 @@ var AREA_MESH_COLOR = exports.AREA_MESH_COLOR = {
|
|
|
60
60
|
unselected: 'rgb(221,221,255)'
|
|
61
61
|
};
|
|
62
62
|
var INTERIOR_LINE = exports.INTERIOR_LINE = {
|
|
63
|
-
|
|
64
|
-
|
|
63
|
+
selected: '#6E1EA8',
|
|
64
|
+
unselected: ' #455A64'
|
|
65
65
|
};
|
|
66
66
|
var LINE_MESH_COLOR = exports.LINE_MESH_COLOR = {
|
|
67
|
-
selected: '#
|
|
67
|
+
selected: '#6E1EA8',
|
|
68
68
|
unselected: 'rgb(135,145,171)'
|
|
69
69
|
};
|
|
70
70
|
var LINE_MESH = exports.LINE_MESH = {
|
|
71
|
-
selected: '#
|
|
71
|
+
selected: '#6E1EA8'
|
|
72
72
|
};
|
package/lib/utils/geometry.js
CHANGED
|
@@ -14,6 +14,7 @@ exports.angleBetweenTwoPoints = angleBetweenTwoPoints;
|
|
|
14
14
|
exports.angleBetweenTwoPointsAndOrigin = angleBetweenTwoPointsAndOrigin;
|
|
15
15
|
exports.buildRectFromLines = buildRectFromLines;
|
|
16
16
|
exports.calcCreateSnap = calcCreateSnap;
|
|
17
|
+
exports.calcDistancesFromItemToWalls = calcDistancesFromItemToWalls;
|
|
17
18
|
exports.calcSnap = calcSnap;
|
|
18
19
|
exports.calcSnap1 = calcSnap1;
|
|
19
20
|
exports.calcSnap2 = calcSnap2;
|
|
@@ -1972,7 +1973,7 @@ function getAllHoleRect(scene, val) {
|
|
|
1972
1973
|
layer.lines.forEach(function (line) {
|
|
1973
1974
|
line.holes.forEach(function (holeID) {
|
|
1974
1975
|
var hole = layer.holes.get(holeID);
|
|
1975
|
-
holes.push(hole);
|
|
1976
|
+
if (hole) holes.push(hole);
|
|
1976
1977
|
});
|
|
1977
1978
|
});
|
|
1978
1979
|
var i = 0;
|
|
@@ -2204,7 +2205,7 @@ function relationshipOfTwoOverlappedLines2(srcLine, destLine) {
|
|
|
2204
2205
|
lineSX = _sort4[0],
|
|
2205
2206
|
lineDX = _sort4[1];
|
|
2206
2207
|
var isReversedSrcLineIdx = false;
|
|
2207
|
-
if (lineSX[0].x === line1[0].x && lineSX[0].y === line1[0].y) isReversedSrcLineIdx = true;
|
|
2208
|
+
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;
|
|
2208
2209
|
var compare0 = comparator(lineSX[0], lineDX[0]);
|
|
2209
2210
|
var compare1 = comparator(lineSX[1], lineDX[0]);
|
|
2210
2211
|
var compare2 = comparator(lineSX[1], lineDX[1]);
|
|
@@ -2542,4 +2543,165 @@ function validRect(itemRect, rects) {
|
|
|
2542
2543
|
return rects.every(function (rect) {
|
|
2543
2544
|
return !intersectRect(rect.rect, updatedItemRect.rect);
|
|
2544
2545
|
});
|
|
2546
|
+
}
|
|
2547
|
+
function getCalcRectFromItem2(itemInfo) {
|
|
2548
|
+
var x = itemInfo.pos.x;
|
|
2549
|
+
var y = itemInfo.pos.y;
|
|
2550
|
+
var w = itemInfo.size.width / 2;
|
|
2551
|
+
var h = itemInfo.size.height / 2;
|
|
2552
|
+
var rotRad = itemInfo.rotRad;
|
|
2553
|
+
var mh = 3 * h / 4;
|
|
2554
|
+
var mx = x - w * Math.cos(rotRad) - mh * Math.sin(rotRad);
|
|
2555
|
+
var my = y - w * Math.sin(rotRad) + mh * Math.cos(rotRad);
|
|
2556
|
+
var m2x = x + w * Math.cos(rotRad) - mh * Math.sin(rotRad);
|
|
2557
|
+
var m2y = y + w * Math.sin(rotRad) + mh * Math.cos(rotRad);
|
|
2558
|
+
var m3x = x - h * Math.sin(rotRad);
|
|
2559
|
+
var m3y = y + h * Math.cos(rotRad);
|
|
2560
|
+
var m1x = x + h * Math.sin(rotRad);
|
|
2561
|
+
var m1y = y - h * Math.cos(rotRad);
|
|
2562
|
+
return {
|
|
2563
|
+
rectCenterPoint: [[point(mx, my), 180], [point(m1x, m1y), -90], [point(m2x, m2y), 0], [point(m3x, m3y), 90]]
|
|
2564
|
+
};
|
|
2565
|
+
}
|
|
2566
|
+
function getAllItems2(curItem, layer) {
|
|
2567
|
+
var rectarray = [];
|
|
2568
|
+
var tempHeight = curItem.get('properties').get('depth');
|
|
2569
|
+
layer.items.forEach(function (item) {
|
|
2570
|
+
var val = {
|
|
2571
|
+
pos: {
|
|
2572
|
+
x: item.x,
|
|
2573
|
+
y: item.y
|
|
2574
|
+
},
|
|
2575
|
+
rotRad: item.rotation / 180 * Math.PI
|
|
2576
|
+
};
|
|
2577
|
+
var width = (0, _convertUnitsLite.convert)(item.properties.getIn(['width', '_length'])).from('in').to('cm');
|
|
2578
|
+
var height = (0, _convertUnitsLite.convert)(item.properties.getIn(['depth', '_length'])).from('in').to('cm');
|
|
2579
|
+
val.size = {
|
|
2580
|
+
width: width,
|
|
2581
|
+
height: height
|
|
2582
|
+
};
|
|
2583
|
+
if (curItem.get('id') !== item.id) {
|
|
2584
|
+
var detectObjectsAtSameAltitudeFlag = curItem.get('layoutpos') === 'Base' ? item.properties.getIn(['altitude', '_length']) <= curItem.get('properties').getIn(['altitude', '_length']) + tempHeight.get('_length') : item.properties.getIn(['altitude', '_length']) + item.properties.getIn(['height', '_length']) >= curItem.get('properties').getIn(['altitude', '_length']);
|
|
2585
|
+
if (detectObjectsAtSameAltitudeFlag) {
|
|
2586
|
+
var x = val.pos.x;
|
|
2587
|
+
var y = val.pos.y;
|
|
2588
|
+
var rotRad = val.rotRad;
|
|
2589
|
+
var w = val.size.width / 2;
|
|
2590
|
+
var h = val.size.height / 2;
|
|
2591
|
+
var mx = x - w * Math.cos(rotRad);
|
|
2592
|
+
var my = y - w * Math.sin(rotRad);
|
|
2593
|
+
var x0 = mx + h * Math.sin(rotRad);
|
|
2594
|
+
var y0 = my - h * Math.cos(rotRad);
|
|
2595
|
+
var x3 = mx * 2 - x0;
|
|
2596
|
+
var y3 = my * 2 - y0;
|
|
2597
|
+
var x1 = x * 2 - x3;
|
|
2598
|
+
var y1 = y * 2 - y3;
|
|
2599
|
+
var x2 = x * 2 - x0;
|
|
2600
|
+
var y2 = y * 2 - y0;
|
|
2601
|
+
rectarray.push({
|
|
2602
|
+
rect: [point(x0, y0), point(x1, y1), point(x0, y0), point(x1, y1)]
|
|
2603
|
+
});
|
|
2604
|
+
rectarray.push({
|
|
2605
|
+
rect: [point(x1, y1), point(x2, y2), point(x1, y1), point(x2, y2)]
|
|
2606
|
+
});
|
|
2607
|
+
rectarray.push({
|
|
2608
|
+
rect: [point(x2, y2), point(x3, y3), point(x2, y2), point(x3, y3)]
|
|
2609
|
+
});
|
|
2610
|
+
rectarray.push({
|
|
2611
|
+
rect: [point(x3, y3), point(x0, y0), point(x3, y3), point(x0, y0)]
|
|
2612
|
+
});
|
|
2613
|
+
}
|
|
2614
|
+
}
|
|
2615
|
+
});
|
|
2616
|
+
return {
|
|
2617
|
+
others: rectarray
|
|
2618
|
+
};
|
|
2619
|
+
}
|
|
2620
|
+
function calcDistancesFromItemToWalls(curItem, layer) {
|
|
2621
|
+
if ((0, _helper.isEmpty)(curItem)) return [];
|
|
2622
|
+
var x = curItem.get('x');
|
|
2623
|
+
var y = curItem.get('y');
|
|
2624
|
+
var rotRad = curItem.get('rotation') / 180 * Math.PI;
|
|
2625
|
+
var width, height;
|
|
2626
|
+
if (curItem.get('properties').get('width') || curItem.get('properties').get('depth')) {
|
|
2627
|
+
width = (0, _convertUnitsLite.convert)(curItem.get('properties').get('width').get('_length')).from(curItem.get('properties').get('width').get('_unit')).to('cm');
|
|
2628
|
+
height = (0, _convertUnitsLite.convert)(curItem.get('properties').get('depth').get('_length')).from(curItem.get('properties').get('depth').get('_unit')).to('cm');
|
|
2629
|
+
} else {
|
|
2630
|
+
width = (0, _convertUnitsLite.convert)(curItem.info.sizeinfo.width).from('in').to('cm');
|
|
2631
|
+
height = (0, _convertUnitsLite.convert)(curItem.info.sizeinfo.depth).from('in').to('cm');
|
|
2632
|
+
}
|
|
2633
|
+
var center_h = 3 * height / 8;
|
|
2634
|
+
var center_x = x; // middle of front line of cabinet rect
|
|
2635
|
+
var center_y = y;
|
|
2636
|
+
var center_x1 = x - center_h * Math.sin(rotRad); // center point of cabinet rect
|
|
2637
|
+
var center_y1 = y + center_h * Math.cos(rotRad);
|
|
2638
|
+
var PointArray = [];
|
|
2639
|
+
var itemInfo = {
|
|
2640
|
+
pos: {
|
|
2641
|
+
x: x,
|
|
2642
|
+
y: y
|
|
2643
|
+
},
|
|
2644
|
+
rotRad: rotRad
|
|
2645
|
+
};
|
|
2646
|
+
itemInfo.size = {
|
|
2647
|
+
width: width,
|
|
2648
|
+
height: height
|
|
2649
|
+
};
|
|
2650
|
+
var curiteminfo = getCalcRectFromItem2(itemInfo);
|
|
2651
|
+
var allItemRect = getAllItems2(curItem, layer);
|
|
2652
|
+
var allLines = getAllLines(layer);
|
|
2653
|
+
var allLineRects = buildRectFromLines(layer, allLines);
|
|
2654
|
+
var allRect = allLineRects.concat(allItemRect.others);
|
|
2655
|
+
var _loop = function _loop(i) {
|
|
2656
|
+
// [rectCenterPoint] has four middle points of cabinet rect edges
|
|
2657
|
+
var centerpoint = curiteminfo.rectCenterPoint[i];
|
|
2658
|
+
var comparelength = []; // distance array from rectCenterPoint[i] to other lines(walls, other cabinet rect edges)
|
|
2659
|
+
var a;
|
|
2660
|
+
var RectLineFuction; // normal line of cabinet rect edge
|
|
2661
|
+
if (centerpoint[1] === 180 || centerpoint[1] === 0) RectLineFuction = linePassingThroughTwoPoints(centerpoint[0].x, centerpoint[0].y, center_x1, center_y1);else RectLineFuction = linePassingThroughTwoPoints(centerpoint[0].x, centerpoint[0].y, center_x, center_y);
|
|
2662
|
+
allRect.forEach(function (linerect) {
|
|
2663
|
+
// calc distance to all other lines
|
|
2664
|
+
var p0 = clone_point(linerect.rect[2]);
|
|
2665
|
+
var p1 = clone_point(linerect.rect[3]);
|
|
2666
|
+
var lineFunction = {}; // other line function
|
|
2667
|
+
if (p0.x !== p1.x || p0.y !== p1.y) lineFunction = linePassingThroughTwoPoints(p0.x, p0.y, p1.x, p1.y);
|
|
2668
|
+
// intersection between normal line and other line
|
|
2669
|
+
var coordinatePoint = twoLinesIntersection(lineFunction.a, lineFunction.b, lineFunction.c, RectLineFuction.a, RectLineFuction.b, RectLineFuction.c);
|
|
2670
|
+
if (coordinatePoint !== undefined) {
|
|
2671
|
+
if (
|
|
2672
|
+
// intersection point is on the other line
|
|
2673
|
+
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)) {
|
|
2674
|
+
// check the intersection point is outside direction of edge
|
|
2675
|
+
var isOutside = true;
|
|
2676
|
+
for (var j = 0; j < curiteminfo.rectCenterPoint.length; j++) {
|
|
2677
|
+
if (j === i) continue;
|
|
2678
|
+
var otherCenterPoint = curiteminfo.rectCenterPoint[j];
|
|
2679
|
+
if (isPointOnLineSegment(centerpoint[0].x, centerpoint[0].y, coordinatePoint.x, coordinatePoint.y, otherCenterPoint[0].x, otherCenterPoint[0].y)) isOutside = false;
|
|
2680
|
+
}
|
|
2681
|
+
if (isOutside && pointsDistance(coordinatePoint.x, coordinatePoint.y, center_x, center_y) > pointsDistance(centerpoint[0].x, centerpoint[0].y, coordinatePoint.x, coordinatePoint.y)) {
|
|
2682
|
+
comparelength.push(pointsDistance(centerpoint[0].x, centerpoint[0].y, coordinatePoint.x, coordinatePoint.y));
|
|
2683
|
+
a = Math.min.apply(null, comparelength);
|
|
2684
|
+
}
|
|
2685
|
+
}
|
|
2686
|
+
}
|
|
2687
|
+
});
|
|
2688
|
+
PointArray.push([a, centerpoint[1]]);
|
|
2689
|
+
};
|
|
2690
|
+
for (var i = 0; i < curiteminfo.rectCenterPoint.length; i++) {
|
|
2691
|
+
_loop(i);
|
|
2692
|
+
}
|
|
2693
|
+
PointArray.forEach(function (pointElement, index) {
|
|
2694
|
+
if (pointElement[0] == undefined) PointArray[index][0] = 0;
|
|
2695
|
+
});
|
|
2696
|
+
var cnt = 0;
|
|
2697
|
+
PointArray.forEach(function (pointElement) {
|
|
2698
|
+
if (pointElement[0] == 0) cnt++;
|
|
2699
|
+
});
|
|
2700
|
+
if (cnt == 4 || cnt == 3) {
|
|
2701
|
+
PointArray[0][0] = 100;
|
|
2702
|
+
PointArray[1][0] = 100;
|
|
2703
|
+
}
|
|
2704
|
+
return {
|
|
2705
|
+
PointArray: PointArray
|
|
2706
|
+
};
|
|
2545
2707
|
}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
3
7
|
function getEdgesOfSubgraphs(subgraphs, graph) {
|
|
4
8
|
var edges = [];
|
|
5
9
|
subgraphs.forEach(function (component) {
|
|
@@ -25,4 +29,5 @@ function getVerticesFromBiconnectedComponent(component) {
|
|
|
25
29
|
});
|
|
26
30
|
return vertices;
|
|
27
31
|
}
|
|
28
|
-
|
|
32
|
+
var _default = exports["default"] = getEdgesOfSubgraphs;
|
|
33
|
+
module.exports = exports.default;
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
3
7
|
/**
|
|
4
8
|
* UTILS
|
|
5
9
|
*/
|
|
@@ -204,15 +208,12 @@ function find_inner_cycles(V, EV) {
|
|
|
204
208
|
}
|
|
205
209
|
|
|
206
210
|
// export default find_inner_cycles;
|
|
207
|
-
|
|
208
|
-
|
|
211
|
+
var _default = exports["default"] = find_inner_cycles;
|
|
209
212
|
/**
|
|
210
213
|
* DATA
|
|
211
214
|
*/
|
|
212
|
-
|
|
213
215
|
// let V = [[0.5774, 1.0], [1.0, 1.0], [1.1547, 0.0], [1.0, 0.0], [0.0, 0.0], [0.0, 0.732], [1.0, 0.1547], [0.732, 0.0], [1.0491, 0.183], [-0.317, 0.549], [1.0, 0.268], [0.183, -0.3169], [0.5491, 1.049], [0.4642, 1.0], [0.0, -0.4226], [0.0, 1.0]]
|
|
214
216
|
// let EV = [[0, 1], [2, 3], [5, 4], [7, 6], [2, 8], [3, 6], [4, 9], [0, 10], [9, 5], [8, 10], [7, 11], [12, 13], [6, 8], [6, 10], [4, 7], [4, 11], [4, 14], [5, 15], [11, 14], [0, 12], [13, 15], [0, 13], [1, 10], [3, 7], [5, 13]]
|
|
215
|
-
|
|
216
217
|
// let V = [[0,0],[10,0],[10,10],[0,10], [100,100],[110,100],[110,110],[100,110], [5,0], [5,10]]
|
|
217
218
|
// let V = [[0,0.5],[12,-0.7],[14,14],[-2,10], [103,106],[117,98],[96,112],[104,109], [5.5,0.8], [4.8,10.5]]
|
|
218
219
|
// let EV = [[3,9],[9,2],[2,1],[1,8],[8,0],[0,3],[8,9]] // IT WORKS
|
|
@@ -221,14 +222,11 @@ module.exports = find_inner_cycles;
|
|
|
221
222
|
// let EV = [[2,3],[1,2],[0,1],[3,0]] // IT WORKS
|
|
222
223
|
// let EV = [[2,3],[1,2],[0,1],[3,0],[6,7],[5,6],[4,5],[7,4]] // IT WORKS
|
|
223
224
|
// let EV = [[3,2],[2,1],[1,0],[0,3],[7,6],[6,5],[5,4],[4,7]] // IT WORKS
|
|
224
|
-
|
|
225
225
|
// let V = [[2,5],[5,6],[10,6.8],[23,8],[9.6,11.3],[20,15],[25,16],[29,18],[30,22],[4,11],[6,10],[24,25],[18,20],[27,7]]
|
|
226
226
|
// let EV = [[0,1],[10,0],[9,10],[9,1],[1,2],[4,2],[3,13],[2,3],[4,5],[5,6],[6,7],[12,5],[12,11],[11,6],[11,8],[7,8],[9,4]]
|
|
227
|
-
|
|
228
227
|
/**
|
|
229
228
|
* MAIN
|
|
230
229
|
*/
|
|
231
|
-
|
|
232
230
|
// let cycles_data = find_inner_cycles(V, EV)
|
|
233
231
|
// console.log('############## OUTPUT')
|
|
234
232
|
// console.log('EDGES:')
|
|
@@ -237,4 +235,5 @@ module.exports = find_inner_cycles;
|
|
|
237
235
|
// console.log('VERTICES:')
|
|
238
236
|
// console.log(cycles_data.v_cycles)
|
|
239
237
|
// console.log('\n')
|
|
240
|
-
// console.log(cycles_data.ev_mapping.every(m => m.color === 2))
|
|
238
|
+
// console.log(cycles_data.ev_mapping.every(m => m.color === 2))
|
|
239
|
+
module.exports = exports.default;
|
package/lib/utils/graph.js
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports["default"] = void 0;
|
|
4
8
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
5
9
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
6
10
|
//JS porting of this code http://www.geeksforgeeks.org/biconnected-components/
|
|
@@ -145,4 +149,5 @@ var Graph = /*#__PURE__*/function () {
|
|
|
145
149
|
}
|
|
146
150
|
}]);
|
|
147
151
|
}();
|
|
148
|
-
|
|
152
|
+
var _default = exports["default"] = Graph;
|
|
153
|
+
module.exports = exports.default;
|
package/lib/utils/helper.js
CHANGED
|
@@ -8,6 +8,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
8
8
|
exports.animateDoor = void 0;
|
|
9
9
|
exports.applyEdges = applyEdges;
|
|
10
10
|
exports.base64Decode = void 0;
|
|
11
|
+
exports.centering2D = centering2D;
|
|
12
|
+
exports.compareSVGRect = void 0;
|
|
11
13
|
exports.debugUtil = debugUtil;
|
|
12
14
|
exports.getSignedUrl = exports.getPathInfo = exports.getPath = void 0;
|
|
13
15
|
exports.handleCamRect = handleCamRect;
|
|
@@ -21,6 +23,8 @@ exports.replaceMeshesWithLineSegments = replaceMeshesWithLineSegments;
|
|
|
21
23
|
exports.textureCube = void 0;
|
|
22
24
|
exports.toPlainObject = toPlainObject;
|
|
23
25
|
exports.translateDrawer = void 0;
|
|
26
|
+
exports.updatePayloadOfInternalEvent = updatePayloadOfInternalEvent;
|
|
27
|
+
exports.updateViwer2D = void 0;
|
|
24
28
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
25
29
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
26
30
|
var _HDRCubeTextureLoader = require("three/examples/jsm/loaders/HDRCubeTextureLoader.js");
|
|
@@ -29,11 +33,12 @@ var Three = _interopRequireWildcard(require("three"));
|
|
|
29
33
|
var _utils = require("./../components/viewer2d/utils");
|
|
30
34
|
var _convertUnitsLite = require("./convert-units-lite");
|
|
31
35
|
var _math = require("./math");
|
|
36
|
+
var _awsSdk = _interopRequireDefault(require("aws-sdk"));
|
|
37
|
+
var _export = require("./export");
|
|
32
38
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof3(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
33
39
|
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; }
|
|
34
40
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
35
|
-
var
|
|
36
|
-
var s3 = new AWS.S3({
|
|
41
|
+
var s3 = new _awsSdk["default"].S3({
|
|
37
42
|
accessKeyId: process.env.REACT_APP_AWS_ID,
|
|
38
43
|
secretAccessKey: process.env.REACT_APP_AWS_SECRET
|
|
39
44
|
});
|
|
@@ -355,4 +360,105 @@ function isImmutable(maybeImmutable) {
|
|
|
355
360
|
}
|
|
356
361
|
function debugUtil() {
|
|
357
362
|
return new Date();
|
|
363
|
+
}
|
|
364
|
+
var compareSVGRect = exports.compareSVGRect = function compareSVGRect(value) {
|
|
365
|
+
return value.e <= 10 && value.e + value.a * value.SVGWidth + 10 >= value.viewerWidth && value.f <= 80 && value.f + value.d * value.SVGHeight + 10 >= value.viewerHeight ? true : false;
|
|
366
|
+
};
|
|
367
|
+
var updateViwer2D = exports.updateViwer2D = function updateViwer2D(value) {
|
|
368
|
+
var viewer2DActions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
369
|
+
var _zoomValue = parseInt((value.a - 0.5) / _constants.ZOOM_VARIABLE);
|
|
370
|
+
if (_zoomValue > _constants.MAX_ZOOM_IN_SCALE) return;
|
|
371
|
+
if (_zoomValue < 0 || Number.isNaN(_zoomValue)) return;
|
|
372
|
+
|
|
373
|
+
// modify e, f to fit to SVG
|
|
374
|
+
while (!(value.e <= 10)) {
|
|
375
|
+
value.e -= 0.1;
|
|
376
|
+
}
|
|
377
|
+
while (!(value.e + value.a * value.SVGWidth + 10 >= value.viewerWidth)) {
|
|
378
|
+
value.e += 0.1;
|
|
379
|
+
}
|
|
380
|
+
while (!(value.f <= 80)) {
|
|
381
|
+
value.f -= 0.1;
|
|
382
|
+
}
|
|
383
|
+
while (!(value.f + value.a * value.SVGHeight + 10 >= value.viewerHeight)) {
|
|
384
|
+
value.f += 0.1;
|
|
385
|
+
}
|
|
386
|
+
if (viewer2DActions && compareSVGRect(value)) viewer2DActions.updateCameraView(value);
|
|
387
|
+
};
|
|
388
|
+
function centering2D(state) {
|
|
389
|
+
var viewer2DActions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
390
|
+
// calculate the bounding box of all elements in plan
|
|
391
|
+
var layer = state.scene.getIn(['layers', state.scene.selectedLayer]);
|
|
392
|
+
var bb = {
|
|
393
|
+
minX: Infinity,
|
|
394
|
+
maxX: -Infinity,
|
|
395
|
+
minY: Infinity,
|
|
396
|
+
maxY: -Infinity
|
|
397
|
+
};
|
|
398
|
+
bb = layer.vertices.reduce(function (pre, cur) {
|
|
399
|
+
pre.minX = Math.min(pre.minX, cur.x);
|
|
400
|
+
pre.maxX = Math.max(pre.maxX, cur.x);
|
|
401
|
+
pre.minY = Math.min(pre.minY, cur.y);
|
|
402
|
+
pre.maxY = Math.max(pre.maxY, cur.y);
|
|
403
|
+
return pre;
|
|
404
|
+
}, bb);
|
|
405
|
+
var w = bb.maxX - bb.minX;
|
|
406
|
+
var h = bb.maxY - bb.minY;
|
|
407
|
+
|
|
408
|
+
// calc scale and offset to fit view
|
|
409
|
+
var viewer = state.getIn(['viewer2D']).toJS();
|
|
410
|
+
if (w != 0 && Math.abs(w) != Infinity && h != 0 && Math.abs(h) != Infinity) {
|
|
411
|
+
// elements are exist && bounding box size > 0
|
|
412
|
+
viewer.a = viewer.viewerHeight < h ? viewer.viewerHeight / h : viewer.viewerHeight / h * 3 / 5 / _constants.ZOOM_VARIABLE > _constants.MAX_ZOOM_IN_SCALE ? viewer.viewerHeight / h * _constants.MAX_ZOOM_IN_SCALE / (viewer.viewerHeight / h / _constants.ZOOM_VARIABLE) : viewer.viewerHeight / h * 3 / 5;
|
|
413
|
+
viewer.d = viewer.a;
|
|
414
|
+
viewer.e = (viewer.viewerWidth - (bb.maxX + bb.minX) * viewer.a) / 2;
|
|
415
|
+
viewer.f = (viewer.viewerHeight - (bb.maxY + bb.minY) * viewer.a) / 2;
|
|
416
|
+
} else {
|
|
417
|
+
// there is no any element && bounding box size == 0
|
|
418
|
+
viewer.e = viewer.viewerWidth / 2 - viewer.SVGWidth / 2;
|
|
419
|
+
viewer.f = viewer.viewerHeight / 2 - viewer.SVGHeight / 2;
|
|
420
|
+
viewer.a = 0.99;
|
|
421
|
+
viewer.d = 0.99;
|
|
422
|
+
}
|
|
423
|
+
state = state.merge({
|
|
424
|
+
viewer2D: viewer
|
|
425
|
+
});
|
|
426
|
+
if (viewer2DActions) updateViwer2D(viewer, viewer2DActions);
|
|
427
|
+
return state;
|
|
428
|
+
}
|
|
429
|
+
function updatePayloadOfInternalEvent(currentObject, layer, catalog) {
|
|
430
|
+
var pointArray = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
|
|
431
|
+
if (isEmpty(currentObject)) return null;
|
|
432
|
+
var updatedPayload = currentObject.toJS();
|
|
433
|
+
if (isEmpty(layer) || isEmpty(catalog)) return updatedPayload;
|
|
434
|
+
if ((currentObject === null || currentObject === void 0 ? void 0 : currentObject.prototype) === 'lines') {
|
|
435
|
+
// caculating length of selected line//
|
|
436
|
+
var v_a = layer.vertices.get(currentObject.vertices.get(0));
|
|
437
|
+
var v_b = layer.vertices.get(currentObject.vertices.get(1));
|
|
438
|
+
var distance = _export.GeometryUtils.pointsDistance(v_a.x, v_a.y, v_b.x, v_b.y);
|
|
439
|
+
var _length = (0, _convertUnitsLite.convert)(distance).from('cm').to(layer.unit);
|
|
440
|
+
updatedPayload.length = _length;
|
|
441
|
+
//////////////////////////////////////
|
|
442
|
+
} else if ((currentObject === null || currentObject === void 0 ? void 0 : currentObject.prototype) === 'items') {
|
|
443
|
+
var _catalog$elements$cur;
|
|
444
|
+
// check this cabinet has warning box
|
|
445
|
+
updatedPayload.isWarning = (0, _utils.isWarningItem)(currentObject);
|
|
446
|
+
// check this item is available molding
|
|
447
|
+
updatedPayload.isMoldingAvailable = _export.MoldingUtils.isEnableItemForMolding(layer, currentObject);
|
|
448
|
+
// check this item is snapped to wall
|
|
449
|
+
updatedPayload.isAttachedWall = _export.MoldingUtils.isAttachedWall(layer, currentObject);
|
|
450
|
+
// update distArray
|
|
451
|
+
if (pointArray) updatedPayload.distArray = pointArray;
|
|
452
|
+
|
|
453
|
+
// update sku_number using sku_array
|
|
454
|
+
var currentDoorColorId = currentObject.getIn(['doorStyle', 'id']);
|
|
455
|
+
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;
|
|
456
|
+
var correctSKU = skuArray === null || skuArray === void 0 ? void 0 : skuArray.find(function (sku) {
|
|
457
|
+
return sku.door_color_id === currentDoorColorId;
|
|
458
|
+
});
|
|
459
|
+
if (correctSKU) {
|
|
460
|
+
updatedPayload.sku_number = correctSKU.sku;
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
return updatedPayload;
|
|
358
464
|
}
|