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,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.handleAddWall = handleAddWall;
|
|
7
|
+
var _constants = require("../../constants");
|
|
8
|
+
function handleAddWall(props, state) {
|
|
9
|
+
if (state.mode === _constants.MODE_IDLE || state.mode === _constants.MODE_2D_PAN) props.linesActions.selectToolDrawingLine('wall');else {
|
|
10
|
+
props.projectActions.setMode(_constants.MODE_IDLE);
|
|
11
|
+
props.linesActions.selectToolDrawingLine('wall');
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -7,7 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.ccdfMapper = ccdfMapper;
|
|
8
8
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
9
9
|
var _utils = require("../../../components/viewer2d/utils");
|
|
10
|
-
var _immutable = require("immutable");
|
|
10
|
+
var _immutable = require("../../../shared/objects/immutable");
|
|
11
11
|
function ccdfMapper(ccdf_list, layer) {
|
|
12
12
|
// This function make cabinet definition using ccdf, layer's item information and catalog
|
|
13
13
|
// console.log(ccdf_list, catalog);
|
|
@@ -18,7 +18,7 @@ function ccdfMapper(ccdf_list, layer) {
|
|
|
18
18
|
var cdfId;
|
|
19
19
|
var structure_json = {};
|
|
20
20
|
var cabinetDefinition = {};
|
|
21
|
-
var layerJS = _immutable.
|
|
21
|
+
var layerJS = (0, _immutable.toJSIfNeeded)(layer);
|
|
22
22
|
ccdf_list === null || ccdf_list === void 0 || ccdf_list.forEach(function (ccdf) {
|
|
23
23
|
var itemKeys = Object.keys(layerJS.items);
|
|
24
24
|
var correctItemId = '';
|
|
@@ -11,7 +11,7 @@ var _helper = require("../../../utils/helper");
|
|
|
11
11
|
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; }
|
|
12
12
|
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; }
|
|
13
13
|
function mapChangeDoorStyleEvent(evt, state) {
|
|
14
|
-
var _evt$payload, _layer$toJS
|
|
14
|
+
var _evt$payload, _layer$toJS;
|
|
15
15
|
if ((0, _helper.isEmpty)(evt)) return null;
|
|
16
16
|
var targetDoorStyle = evt === null || evt === void 0 || (_evt$payload = evt.payload) === null || _evt$payload === void 0 ? void 0 : _evt$payload.doorStyle;
|
|
17
17
|
if ((0, _helper.isEmpty)(targetDoorStyle)) return evt;
|
|
@@ -40,33 +40,5 @@ function mapChangeDoorStyleEvent(evt, state) {
|
|
|
40
40
|
evt.payload.doorStyle = _objectSpread(_objectSpread({}, targetDoorStyle), {}, {
|
|
41
41
|
doorStyles: doorStyles
|
|
42
42
|
});
|
|
43
|
-
// make itemCDS using assets3d
|
|
44
|
-
var itemCDS = [];
|
|
45
|
-
var itemCDSData = {};
|
|
46
|
-
var cabitnetDoorStyleId;
|
|
47
|
-
targetDoorStyle === null || targetDoorStyle === void 0 || (_targetDoorStyle$ccdf = targetDoorStyle.ccdf_list) === null || _targetDoorStyle$ccdf === void 0 || _targetDoorStyle$ccdf.forEach(function (asItem) {
|
|
48
|
-
if (!(0, _helper.isEmpty)(asItem === null || asItem === void 0 ? void 0 : asItem.id)) {
|
|
49
|
-
cabitnetDoorStyleId = asItem.id;
|
|
50
|
-
}
|
|
51
|
-
asItem === null || asItem === void 0 || asItem.assets3d.forEach(function (as) {
|
|
52
|
-
if (!(0, _helper.isEmpty)(as === null || as === void 0 ? void 0 : as.placeholder_name) && !(0, _helper.isEmpty)(as === null || as === void 0 ? void 0 : as.gltf)) {
|
|
53
|
-
var updatedName = 'base_' + (as === null || as === void 0 ? void 0 : as.placeholder_name) + '_gltf';
|
|
54
|
-
itemCDSData[updatedName] = as === null || as === void 0 ? void 0 : as.gltf;
|
|
55
|
-
}
|
|
56
|
-
itemCDSData['is_euro_cds'] = !(0, _helper.isEmpty)(as === null || as === void 0 ? void 0 : as.is_euro_cds) ? as.is_euro_cds : 0;
|
|
57
|
-
itemCDSData['euro_shape_svg'] = !(0, _helper.isEmpty)(as === null || as === void 0 ? void 0 : as.euro_shape_svg) ? as.is_euro_cds : null;
|
|
58
|
-
itemCDSData['euro_width'] = !(0, _helper.isEmpty)(as === null || as === void 0 ? void 0 : as.euro_width) ? as.is_euro_cds : null;
|
|
59
|
-
itemCDSData['euro_height'] = !(0, _helper.isEmpty)(as === null || as === void 0 ? void 0 : as.euro_height) ? as.is_euro_cds : null;
|
|
60
|
-
itemCDSData['euro_length'] = !(0, _helper.isEmpty)(as === null || as === void 0 ? void 0 : as.euro_length) ? as.is_euro_cds : null;
|
|
61
|
-
});
|
|
62
|
-
var data = [];
|
|
63
|
-
data.push(itemCDSData);
|
|
64
|
-
itemCDS.push({
|
|
65
|
-
itemID: asItem.cabinet_id,
|
|
66
|
-
data: data,
|
|
67
|
-
cabinet_door_style_id: cabitnetDoorStyleId
|
|
68
|
-
});
|
|
69
|
-
});
|
|
70
|
-
evt.payload.itemCDS = itemCDS;
|
|
71
43
|
return evt;
|
|
72
44
|
}
|
package/lib/reducers/export.js
CHANGED
|
@@ -46,12 +46,6 @@ Object.defineProperty(exports, "KitchenConfiguratorSceneReducer", {
|
|
|
46
46
|
return _sceneReducer["default"];
|
|
47
47
|
}
|
|
48
48
|
});
|
|
49
|
-
Object.defineProperty(exports, "KitchenConfiguratorUserReducer", {
|
|
50
|
-
enumerable: true,
|
|
51
|
-
get: function get() {
|
|
52
|
-
return _userReducer["default"];
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
49
|
Object.defineProperty(exports, "KitchenConfiguratorVerticesReducer", {
|
|
56
50
|
enumerable: true,
|
|
57
51
|
get: function get() {
|
|
@@ -81,7 +75,6 @@ var _sceneReducer = _interopRequireDefault(require("./scene-reducer"));
|
|
|
81
75
|
var _verticesReducer = _interopRequireDefault(require("./vertices-reducer"));
|
|
82
76
|
var _viewer2dReducer = _interopRequireDefault(require("./viewer2d-reducer"));
|
|
83
77
|
var _viewer3dReducer = _interopRequireDefault(require("./viewer3d-reducer"));
|
|
84
|
-
var _userReducer = _interopRequireDefault(require("./user-reducer"));
|
|
85
78
|
var _default = exports["default"] = {
|
|
86
79
|
KitchenConfiguratorAreasReducer: _areasReducer["default"],
|
|
87
80
|
KitchenConfiguratorHolesReducer: _holesReducer["default"],
|
|
@@ -92,6 +85,5 @@ var _default = exports["default"] = {
|
|
|
92
85
|
KitchenConfiguratorSceneReducer: _sceneReducer["default"],
|
|
93
86
|
KitchenConfiguratorVerticesReducer: _verticesReducer["default"],
|
|
94
87
|
KitchenConfiguratorViewer2dReducer: _viewer2dReducer["default"],
|
|
95
|
-
KitchenConfiguratorViewer3dReducer: _viewer3dReducer["default"]
|
|
96
|
-
KitchenConfiguratorUserReducer: _userReducer["default"]
|
|
88
|
+
KitchenConfiguratorViewer3dReducer: _viewer3dReducer["default"]
|
|
97
89
|
};
|
package/lib/reducers/reducer.js
CHANGED
|
@@ -21,6 +21,5 @@ function appReducer(state, action) {
|
|
|
21
21
|
if (_constants.GROUP_ACTIONS[action.type]) return _export.KitchenConfiguratorGroupsReducer.apply(void 0, arguments);
|
|
22
22
|
if (_constants.SCENE_ACTIONS[action.type]) return _export.KitchenConfiguratorSceneReducer.apply(void 0, arguments);
|
|
23
23
|
if (_constants.VERTEX_ACTIONS[action.type]) return _export.KitchenConfiguratorVerticesReducer.apply(void 0, arguments);
|
|
24
|
-
if (_constants.USER_ACTIONS[action.type]) return _export.KitchenConfiguratorUserReducer.apply(void 0, arguments);
|
|
25
24
|
return state || initialState;
|
|
26
25
|
}
|
package/lib/utils/geometry.js
CHANGED
|
@@ -2236,8 +2236,6 @@ function relationshipOfTwoOverlappedLines2(srcLine, destLine) {
|
|
|
2236
2236
|
};
|
|
2237
2237
|
var line0 = [p1, p2].sort(comparator);
|
|
2238
2238
|
var line1 = [p3, p4].sort(comparator);
|
|
2239
|
-
var isReversedSrcLineDirection = false;
|
|
2240
|
-
if (line0[0].x === srcLine.x2 && line0[0].y === srcLine.y2) isReversedSrcLineDirection = true;
|
|
2241
2239
|
var _sort3 = [line0, line1].sort(function (lineA, lineB) {
|
|
2242
2240
|
return comparator(lineA[0], lineB[0]);
|
|
2243
2241
|
}),
|
|
@@ -2245,101 +2243,305 @@ function relationshipOfTwoOverlappedLines2(srcLine, destLine) {
|
|
|
2245
2243
|
lineSX = _sort4[0],
|
|
2246
2244
|
lineDX = _sort4[1];
|
|
2247
2245
|
var isReversedSrcLineIdx = false;
|
|
2248
|
-
if (lineSX[0].x === line0[0].x && lineSX[0].y === line0[0].y) isReversedSrcLineIdx = false;
|
|
2249
|
-
|
|
2246
|
+
if (lineSX[0].x === line0[0].x && lineSX[0].y === line0[0].y) isReversedSrcLineIdx = false; // SX=srcLine, DX=destLine
|
|
2247
|
+
else if (lineSX[0].x === line1[0].x && lineSX[0].y === line1[0].y) isReversedSrcLineIdx = true; // DX=srcLine, SX=destLine
|
|
2248
|
+
|
|
2249
|
+
var compare0 = comparator(lineSX[0], lineDX[0]); // always <= 0
|
|
2250
2250
|
var compare1 = comparator(lineSX[1], lineDX[0]);
|
|
2251
2251
|
var compare2 = comparator(lineSX[1], lineDX[1]);
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
//
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2252
|
+
var sp = null,
|
|
2253
|
+
ep = null;
|
|
2254
|
+
if (_export.MathUtils.fAbs(compare1) < _constants.EPSILON) {
|
|
2255
|
+
// SX
|
|
2256
|
+
// |----------|
|
|
2257
|
+
// DX
|
|
2258
|
+
// |------------|
|
|
2259
|
+
// link : lineSX[0] - lineDX[1]
|
|
2260
|
+
if (lineSX[0].x === p1.x && lineSX[0].y === p1.y || lineDX[1].x === p2.x && lineDX[1].y === p2.y) {
|
|
2261
|
+
sp = {
|
|
2262
|
+
x: lineSX[0].x,
|
|
2263
|
+
y: lineSX[0].y
|
|
2264
|
+
};
|
|
2265
|
+
ep = {
|
|
2266
|
+
x: lineDX[1].x,
|
|
2267
|
+
y: lineDX[1].y
|
|
2268
|
+
};
|
|
2269
|
+
} else {
|
|
2270
|
+
// srcLine Direction is reversed
|
|
2271
|
+
sp = {
|
|
2272
|
+
x: lineDX[1].x,
|
|
2273
|
+
y: lineDX[1].y
|
|
2274
|
+
};
|
|
2275
|
+
ep = {
|
|
2276
|
+
x: lineSX[0].x,
|
|
2277
|
+
y: lineSX[0].y
|
|
2263
2278
|
};
|
|
2264
2279
|
}
|
|
2265
|
-
// else {
|
|
2266
|
-
// // src includes dest
|
|
2267
|
-
// // return OVERLAP_SOME; // lineSX[1] - lineDX[1]
|
|
2268
|
-
// return {
|
|
2269
|
-
// result: OVERLAP_SOME,
|
|
2270
|
-
// trimmedSegs: {
|
|
2271
|
-
// x1: lineSX[1].x,
|
|
2272
|
-
// y1: lineSX[1].y,
|
|
2273
|
-
// x2: lineDX[1].x,
|
|
2274
|
-
// y2: lineDX[1].y
|
|
2275
|
-
// }
|
|
2276
|
-
// };
|
|
2277
|
-
// }
|
|
2278
|
-
}
|
|
2279
|
-
if (_export.MathUtils.fAbs(compare1) < _constants.EPSILON) {
|
|
2280
|
-
// return OVERLAP_LINK; // lineSX[1]
|
|
2281
2280
|
return {
|
|
2282
2281
|
result: _constants.OVERLAP_LINK,
|
|
2283
2282
|
linkedLine: {
|
|
2284
|
-
x1:
|
|
2285
|
-
y1:
|
|
2286
|
-
x2:
|
|
2287
|
-
y2:
|
|
2283
|
+
x1: sp.x,
|
|
2284
|
+
y1: sp.y,
|
|
2285
|
+
x2: ep.x,
|
|
2286
|
+
y2: ep.y
|
|
2288
2287
|
}
|
|
2289
2288
|
};
|
|
2290
2289
|
} else if (compare1 < 0) {
|
|
2290
|
+
// SX
|
|
2291
|
+
// |----------|
|
|
2292
|
+
// DX
|
|
2293
|
+
// |----------|
|
|
2294
|
+
// none
|
|
2291
2295
|
return {
|
|
2292
2296
|
result: _constants.OVERLAP_NONE
|
|
2293
2297
|
};
|
|
2294
|
-
} else {
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2298
|
+
} else if (_export.MathUtils.fAbs(compare0) < _constants.EPSILON && _export.MathUtils.fAbs(compare2) < _constants.EPSILON) {
|
|
2299
|
+
// SX
|
|
2300
|
+
// |----------|
|
|
2301
|
+
// DX
|
|
2302
|
+
// |----------|
|
|
2303
|
+
return {
|
|
2304
|
+
result: _constants.OVERLAP_SAME
|
|
2305
|
+
};
|
|
2306
|
+
} else if (_export.MathUtils.fAbs(compare0) < _constants.EPSILON) {
|
|
2307
|
+
if (compare2 < 0 && isReversedSrcLineIdx) {
|
|
2308
|
+
// SX
|
|
2309
|
+
// |---------------|
|
|
2310
|
+
// DX
|
|
2311
|
+
// |-----------------------|
|
|
2312
|
+
// DX includes SX, DX=srcLine, SX=destLine : sx1 - dx1
|
|
2313
|
+
if (lineDX[1].x === p2.x && lineDX[1].y === p2.y) {
|
|
2314
|
+
sp = {
|
|
2315
|
+
x: lineSX[1].x,
|
|
2316
|
+
y: lineSX[1].y
|
|
2317
|
+
};
|
|
2318
|
+
ep = {
|
|
2319
|
+
x: lineDX[1].x,
|
|
2320
|
+
y: lineDX[1].y
|
|
2321
|
+
};
|
|
2322
|
+
} else {
|
|
2323
|
+
// srcLine Direction is reversed
|
|
2324
|
+
sp = {
|
|
2325
|
+
x: lineDX[1].x,
|
|
2326
|
+
y: lineDX[1].y
|
|
2327
|
+
};
|
|
2328
|
+
ep = {
|
|
2329
|
+
x: lineSX[1].x,
|
|
2330
|
+
y: lineSX[1].y
|
|
2331
|
+
};
|
|
2332
|
+
}
|
|
2333
|
+
return {
|
|
2334
|
+
result: _constants.OVERLAP_SOME,
|
|
2335
|
+
trimmedSegs: [{
|
|
2336
|
+
x1: sp.x,
|
|
2337
|
+
y1: sp.y,
|
|
2338
|
+
x2: ep.x,
|
|
2339
|
+
y2: ep.y
|
|
2340
|
+
}]
|
|
2341
|
+
};
|
|
2342
|
+
} else if (compare2 > 0 && !isReversedSrcLineIdx) {
|
|
2343
|
+
// SX
|
|
2344
|
+
// |-----------------------|
|
|
2345
|
+
// DX
|
|
2346
|
+
// |---------------|
|
|
2347
|
+
// SX includes DX, SX=srcLine, DX=destLine : dx1 - sx1
|
|
2348
|
+
if (lineSX[1].x === p2.x && lineSX[1].y === p2.y) {
|
|
2349
|
+
sp = {
|
|
2350
|
+
x: lineDX[1].x,
|
|
2351
|
+
y: lineDX[1].y
|
|
2352
|
+
};
|
|
2353
|
+
ep = {
|
|
2354
|
+
x: lineSX[1].x,
|
|
2355
|
+
y: lineSX[1].y
|
|
2356
|
+
};
|
|
2357
|
+
} else {
|
|
2358
|
+
// srcLine Direction is reversed
|
|
2359
|
+
sp = {
|
|
2360
|
+
x: lineSX[1].x,
|
|
2361
|
+
y: lineSX[1].y
|
|
2362
|
+
};
|
|
2363
|
+
ep = {
|
|
2364
|
+
x: lineDX[1].x,
|
|
2365
|
+
y: lineDX[1].y
|
|
2366
|
+
};
|
|
2367
|
+
}
|
|
2368
|
+
return {
|
|
2369
|
+
result: _constants.OVERLAP_SOME,
|
|
2370
|
+
trimmedSegs: [{
|
|
2371
|
+
x1: sp.x,
|
|
2372
|
+
y1: sp.y,
|
|
2373
|
+
x2: ep.x,
|
|
2374
|
+
y2: ep.y
|
|
2375
|
+
}]
|
|
2376
|
+
};
|
|
2377
|
+
} else {
|
|
2378
|
+
// srcLine
|
|
2379
|
+
// |---------------|
|
|
2380
|
+
// destLine
|
|
2381
|
+
// |-----------------------|
|
|
2382
|
+
// destLine includes srcLine
|
|
2383
|
+
return {
|
|
2384
|
+
result: _constants.OVERLAP_INCLUDED
|
|
2385
|
+
};
|
|
2386
|
+
}
|
|
2387
|
+
} else if (_export.MathUtils.fAbs(compare2) < _constants.EPSILON) {
|
|
2388
|
+
// SX
|
|
2389
|
+
// |-----------------------|
|
|
2390
|
+
// DX
|
|
2391
|
+
// |------------------|
|
|
2392
|
+
if (isReversedSrcLineIdx) {
|
|
2393
|
+
// SX includes DX, DX=srcLine, SX=destLine
|
|
2394
|
+
// destLine includes srcLine
|
|
2395
|
+
return {
|
|
2396
|
+
result: _constants.OVERLAP_INCLUDED
|
|
2397
|
+
};
|
|
2398
|
+
} else {
|
|
2399
|
+
// SX includes DX, SX=srcLine, DX=destLine
|
|
2400
|
+
// srcLine incluedes destLine : sx0 - dx0
|
|
2401
|
+
if (lineSX[1].x === p2.x && lineSX[1].y === p2.y) {
|
|
2402
|
+
sp = {
|
|
2403
|
+
x: lineSX[0].x,
|
|
2404
|
+
y: lineSX[0].y
|
|
2405
|
+
};
|
|
2406
|
+
ep = {
|
|
2407
|
+
x: lineDX[0].x,
|
|
2408
|
+
y: lineDX[0].y
|
|
2409
|
+
};
|
|
2410
|
+
} else {
|
|
2411
|
+
// srcLine direction is reversed
|
|
2412
|
+
sp = {
|
|
2413
|
+
x: lineDX[0].x,
|
|
2414
|
+
y: lineDX[0].y
|
|
2415
|
+
};
|
|
2416
|
+
ep = {
|
|
2417
|
+
x: lineSX[0].x,
|
|
2418
|
+
y: lineSX[0].y
|
|
2419
|
+
};
|
|
2420
|
+
}
|
|
2421
|
+
return {
|
|
2422
|
+
result: _constants.OVERLAP_SOME,
|
|
2423
|
+
trimmedSegs: [{
|
|
2424
|
+
x1: sp.x,
|
|
2425
|
+
y1: sp.y,
|
|
2426
|
+
x2: ep.x,
|
|
2427
|
+
y2: ep.y
|
|
2428
|
+
}]
|
|
2429
|
+
};
|
|
2430
|
+
}
|
|
2431
|
+
} else if (compare0 < 0 && compare2 > 0) {
|
|
2432
|
+
// SX
|
|
2433
|
+
// |-----------------------|
|
|
2434
|
+
// DX
|
|
2435
|
+
// |----------------|
|
|
2436
|
+
if (isReversedSrcLineIdx) {
|
|
2437
|
+
// SX includes DX, DX=srcLine, SX=destLine
|
|
2438
|
+
// destLine includes srcLine
|
|
2439
|
+
return {
|
|
2440
|
+
result: _constants.OVERLAP_INCLUDED
|
|
2441
|
+
};
|
|
2442
|
+
} else {
|
|
2443
|
+
// SX includes DX, SX=srcLine, DX=destLine
|
|
2444
|
+
// srcLine incluedes destLine : sx0 - dx0, dx1 - sx1
|
|
2445
|
+
if (lineSX[1].x === p2.x && lineSX[1].y === p2.y) {
|
|
2300
2446
|
return {
|
|
2301
|
-
result: _constants.
|
|
2447
|
+
result: _constants.OVERLAP_SOME,
|
|
2448
|
+
trimmedSegs: [{
|
|
2449
|
+
x1: lineSX[0].x,
|
|
2450
|
+
y1: lineSX[0].y,
|
|
2451
|
+
x2: lineDX[0].x,
|
|
2452
|
+
y2: lineDX[0].y
|
|
2453
|
+
}, {
|
|
2454
|
+
x1: lineDX[1].x,
|
|
2455
|
+
y1: lineDX[1].y,
|
|
2456
|
+
x2: lineSX[1].x,
|
|
2457
|
+
y2: lineSX[1].y
|
|
2458
|
+
}]
|
|
2302
2459
|
};
|
|
2303
2460
|
} else {
|
|
2304
|
-
//
|
|
2305
|
-
var trimmedSegs = [];
|
|
2306
|
-
// return OVERLAP_SOME; // lineSX[0] - lineDX[0], lineDX[1] - lineSX[1]
|
|
2307
|
-
if (compare0 < 0) trimmedSegs.push({
|
|
2308
|
-
x1: isReversedSrcLineDirection ? lineDX[0].x : lineSX[0].x,
|
|
2309
|
-
y1: isReversedSrcLineDirection ? lineDX[0].y : lineSX[0].y,
|
|
2310
|
-
x2: isReversedSrcLineDirection ? lineSX[0].x : lineDX[0].x,
|
|
2311
|
-
y2: isReversedSrcLineDirection ? lineSX[0].y : lineDX[0].y
|
|
2312
|
-
});
|
|
2313
|
-
if (compare2 > 0) trimmedSegs.push({
|
|
2314
|
-
x1: isReversedSrcLineDirection ? lineSX[1].x : lineDX[1].x,
|
|
2315
|
-
y1: isReversedSrcLineDirection ? lineSX[1].y : lineDX[1].y,
|
|
2316
|
-
x2: isReversedSrcLineDirection ? lineDX[1].x : lineSX[1].x,
|
|
2317
|
-
y2: isReversedSrcLineDirection ? lineDX[1].y : lineSX[1].y
|
|
2318
|
-
});
|
|
2461
|
+
// srcLine direction is reversed
|
|
2319
2462
|
return {
|
|
2320
2463
|
result: _constants.OVERLAP_SOME,
|
|
2321
|
-
trimmedSegs:
|
|
2464
|
+
trimmedSegs: [{
|
|
2465
|
+
x1: lineDX[0].x,
|
|
2466
|
+
y1: lineDX[0].y,
|
|
2467
|
+
x2: lineSX[0].x,
|
|
2468
|
+
y2: lineSX[0].y
|
|
2469
|
+
}, {
|
|
2470
|
+
x1: lineSX[1].x,
|
|
2471
|
+
y1: lineSX[1].y,
|
|
2472
|
+
x2: lineDX[1].x,
|
|
2473
|
+
y2: lineDX[1].y
|
|
2474
|
+
}]
|
|
2322
2475
|
};
|
|
2323
2476
|
}
|
|
2324
2477
|
}
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2478
|
+
} else if (compare2 < 0) {
|
|
2479
|
+
// SX
|
|
2480
|
+
// |-----------------------|
|
|
2481
|
+
// DX
|
|
2482
|
+
// |----------------------------|
|
|
2483
|
+
// overlap some
|
|
2484
|
+
if (isReversedSrcLineIdx) {
|
|
2485
|
+
// DX=srcLine, SX=destLine
|
|
2486
|
+
if (lineDX[1].x === p2.x && lineDX[1].y === p2.y) {
|
|
2487
|
+
sp = {
|
|
2488
|
+
x: lineSX[1].x,
|
|
2489
|
+
y: lineSX[1].y
|
|
2490
|
+
};
|
|
2491
|
+
ep = {
|
|
2492
|
+
x: lineDX[1].x,
|
|
2493
|
+
y: lineDX[1].y
|
|
2494
|
+
};
|
|
2495
|
+
} else {
|
|
2496
|
+
// srcLine direction is reversed
|
|
2497
|
+
sp = {
|
|
2498
|
+
x: lineDX[1].x,
|
|
2499
|
+
y: lineDX[1].y
|
|
2500
|
+
};
|
|
2501
|
+
ep = {
|
|
2502
|
+
x: lineSX[1].x,
|
|
2503
|
+
y: lineSX[1].y
|
|
2504
|
+
};
|
|
2505
|
+
}
|
|
2506
|
+
return {
|
|
2507
|
+
result: _constants.OVERLAP_SOME,
|
|
2508
|
+
trimmedSegs: [{
|
|
2509
|
+
x1: sp.x,
|
|
2510
|
+
y1: sp.y,
|
|
2511
|
+
x2: ep.x,
|
|
2512
|
+
y2: ep.y
|
|
2513
|
+
}]
|
|
2514
|
+
};
|
|
2515
|
+
} else {
|
|
2516
|
+
// SX=srcLine, DX=destLine
|
|
2517
|
+
if (lineSX[1].x === p2.x && lineSX[1].y === p2.y) {
|
|
2518
|
+
sp = {
|
|
2519
|
+
x: lineSX[0].x,
|
|
2520
|
+
y: lineSX[0].y
|
|
2521
|
+
};
|
|
2522
|
+
ep = {
|
|
2523
|
+
x: lineDX[0].x,
|
|
2524
|
+
y: lineDX[0].y
|
|
2525
|
+
};
|
|
2526
|
+
} else {
|
|
2527
|
+
// srcLine direction is reversed
|
|
2528
|
+
sp = {
|
|
2529
|
+
x: lineDX[0].x,
|
|
2530
|
+
y: lineDX[0].y
|
|
2531
|
+
};
|
|
2532
|
+
ep = {
|
|
2533
|
+
x: lineSX[0].x,
|
|
2534
|
+
y: lineSX[0].y
|
|
2535
|
+
};
|
|
2536
|
+
}
|
|
2340
2537
|
return {
|
|
2341
2538
|
result: _constants.OVERLAP_SOME,
|
|
2342
|
-
trimmedSegs:
|
|
2539
|
+
trimmedSegs: [{
|
|
2540
|
+
x1: sp.x,
|
|
2541
|
+
y1: sp.y,
|
|
2542
|
+
x2: ep.x,
|
|
2543
|
+
y2: ep.y
|
|
2544
|
+
}]
|
|
2343
2545
|
};
|
|
2344
2546
|
}
|
|
2345
2547
|
}
|
package/lib/utils/history.js
CHANGED
|
@@ -18,7 +18,7 @@ var historyPush = exports.historyPush = function historyPush(historyStructure, i
|
|
|
18
18
|
});
|
|
19
19
|
|
|
20
20
|
// convert map to object of the [value] field
|
|
21
|
-
if (_immutable.List.isList(toPush.get('diff')) && ((_toPush$get = toPush.get('diff')) === null || _toPush$get === void 0 ? void 0 : _toPush$get.size) >
|
|
21
|
+
if (_immutable.List.isList(toPush.get('diff')) && ((_toPush$get = toPush.get('diff')) === null || _toPush$get === void 0 ? void 0 : _toPush$get.size) > 0) {
|
|
22
22
|
for (var i = 0; i < toPush.get('diff').size; i++) {
|
|
23
23
|
var mapValue = toPush.get('diff').get(i).get('value');
|
|
24
24
|
if (_immutable.Map.isMap(mapValue)) {
|
package/lib/utils/molding.js
CHANGED
|
@@ -276,8 +276,9 @@ function getLinesOfItem(item, allLineRects, catalog) {
|
|
|
276
276
|
var hUnit = item.properties.get('depth').get('_unit') || 'cm';
|
|
277
277
|
newDepth = (0, _convertUnitsLite.convert)(newDepth).from(hUnit).to('cm');
|
|
278
278
|
if (item) {
|
|
279
|
+
var _element;
|
|
279
280
|
// Get Outline Data of Selected Item
|
|
280
|
-
outline = element.info.outline;
|
|
281
|
+
outline = (_element = element) === null || _element === void 0 || (_element = _element.info) === null || _element === void 0 ? void 0 : _element.outline;
|
|
281
282
|
if (outline) {
|
|
282
283
|
// Extract Points from `outline`
|
|
283
284
|
var outlinePaths = outline.paths;
|
|
@@ -347,9 +348,9 @@ function getLinesOfItem2(item, allLineRects, catalog) {
|
|
|
347
348
|
var hUnit = item.properties.get('depth').get('_unit') || 'cm';
|
|
348
349
|
newDepth = (0, _convertUnitsLite.convert)(newDepth).from(hUnit).to('cm');
|
|
349
350
|
if (item) {
|
|
350
|
-
var
|
|
351
|
+
var _element2;
|
|
351
352
|
// Get Outline Data of Selected Item
|
|
352
|
-
outline = (
|
|
353
|
+
outline = (_element2 = element) === null || _element2 === void 0 ? void 0 : _element2.info.outline;
|
|
353
354
|
if (outline) {
|
|
354
355
|
// Extract Points from `outline`
|
|
355
356
|
var outlinePaths = outline.paths;
|
|
@@ -457,6 +458,7 @@ function getLinesFromItems2(moldingGroup, layer, catalog) {
|
|
|
457
458
|
var MGlines = [];
|
|
458
459
|
var MGlinesOtherSnapped = [];
|
|
459
460
|
var items = (0, _toConsumableArray2["default"])(moldingGroup.items);
|
|
461
|
+
items = sortItemsByDistance(items, items[0]);
|
|
460
462
|
// The other item's lines (these items are snapped to the moldingGroup items)
|
|
461
463
|
var itemsOtherSnapped = layer.items.toArray().filter(function (item) {
|
|
462
464
|
if (items.some(function (it) {
|
|
@@ -591,23 +593,7 @@ function getLinesFromItems2(moldingGroup, layer, catalog) {
|
|
|
591
593
|
})) return 1; // continue
|
|
592
594
|
var mergedResult = getMergedLine(MGlines[_i3], filteredMGlines, 0);
|
|
593
595
|
if (mergedResult) {
|
|
594
|
-
|
|
595
|
-
var rstLine = mergedResult.mergedLine;
|
|
596
|
-
// if (
|
|
597
|
-
// (Math.abs(MGlines[i][0].x - rstLine[1].x) < EPSILON &&
|
|
598
|
-
// Math.abs(MGlines[i][0].y - rstLine[1].y) < EPSILON) ||
|
|
599
|
-
// (Math.abs(MGlines[i][1].x - rstLine[0].x) < EPSILON &&
|
|
600
|
-
// Math.abs(MGlines[i][1].y - rstLine[0].y) < EPSILON)
|
|
601
|
-
// ) {
|
|
602
|
-
// // swap two end points
|
|
603
|
-
// const tx = rstLine[0].x;
|
|
604
|
-
// const ty = rstLine[0].y;
|
|
605
|
-
// rstLine[0].x = rstLine[1].x;
|
|
606
|
-
// rstLine[0].y = rstLine[1].y;
|
|
607
|
-
// rstLine[1].x = tx;
|
|
608
|
-
// rstLine[1].y = ty;
|
|
609
|
-
// }
|
|
610
|
-
newMGlines.push(rstLine);
|
|
596
|
+
newMGlines.push(mergedResult.mergedLine);
|
|
611
597
|
filteredMGlines = mergedResult.filteredMGlines;
|
|
612
598
|
}
|
|
613
599
|
},
|
package/package.json
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|