kitchen-simulator 1.1.1-test.7 → 1.1.1-test.70
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/@history.js +8 -2
- package/es/AppContext.js +8 -3
- package/es/KitchenConfigurator.js +93 -106
- package/es/KitchenConfiguratorApp.js +143 -154
- package/es/actions/area-actions.js +10 -5
- package/es/actions/export.js +27 -12
- package/es/actions/groups-actions.js +43 -27
- package/es/actions/holes-actions.js +53 -34
- package/es/actions/items-actions.js +143 -94
- package/es/actions/lines-actions.js +34 -21
- package/es/actions/project-actions.js +143 -94
- package/es/actions/scene-actions.js +19 -11
- package/es/actions/vertices-actions.js +13 -7
- package/es/actions/viewer2d-actions.js +34 -21
- package/es/actions/viewer3d-actions.js +16 -9
- package/es/catalog/areas/area/planner-element.js +16 -8
- package/es/catalog/catalog.js +19 -24
- package/es/catalog/factories/area-factory-3d.js +29 -22
- package/es/catalog/factories/area-factory.js +18 -14
- package/es/catalog/factories/export.js +12 -6
- package/es/catalog/factories/wall-factory-3d.js +39 -31
- package/es/catalog/factories/wall-factory.js +29 -21
- package/es/catalog/holes/door-closet/planner-element.js +22 -15
- package/es/catalog/holes/door-double/planner-element.js +22 -15
- package/es/catalog/holes/door-exterior/planner-element.js +23 -16
- package/es/catalog/holes/door-interior/planner-element.js +23 -16
- package/es/catalog/holes/door-panic/planner-element.js +14 -7
- package/es/catalog/holes/door-panic-double/planner-element.js +22 -15
- package/es/catalog/holes/door-sliding/planner-element.js +23 -16
- package/es/catalog/holes/doorway-framed/planner-element.js +18 -11
- package/es/catalog/holes/doorway-frameless/planner-element.js +14 -7
- package/es/catalog/holes/export.js +31 -13
- package/es/catalog/holes/window-clear/planner-element.js +17 -10
- package/es/catalog/holes/window-cross/planner-element.js +17 -10
- package/es/catalog/holes/window-double-hung/planner-element.js +17 -10
- package/es/catalog/holes/window-vertical/planner-element.js +17 -10
- package/es/catalog/lines/wall/planner-element.js +19 -11
- package/es/catalog/molding/molding-dcm/planner-element.js +12 -5
- package/es/catalog/molding/molding-fbm/planner-element.js +12 -5
- package/es/catalog/molding/molding-lrm/planner-element.js +12 -5
- package/es/catalog/properties/export.js +33 -20
- package/es/catalog/properties/property-checkbox.js +82 -35
- package/es/catalog/properties/property-color.js +21 -16
- package/es/catalog/properties/property-enum.js +70 -28
- package/es/catalog/properties/property-hidden.js +14 -9
- package/es/catalog/properties/property-lenght-measure.js +43 -39
- package/es/catalog/properties/property-length-measure.js +82 -34
- package/es/catalog/properties/property-length-measure_hole.js +43 -39
- package/es/catalog/properties/property-number.js +22 -17
- package/es/catalog/properties/property-read-only.js +21 -16
- package/es/catalog/properties/property-string.js +21 -16
- package/es/catalog/properties/property-toggle.js +21 -16
- package/es/catalog/properties/shared-property-style.js +5 -1
- package/es/catalog/utils/FuseUtils.js +13 -11
- package/es/catalog/utils/exporter.js +13 -11
- package/es/catalog/utils/geom-utils.js +27 -13
- package/es/catalog/utils/item-loader.js +95 -91
- package/es/catalog/utils/load-obj.js +26 -20
- package/es/catalog/utils/mtl-loader.js +7 -3
- package/es/catalog/utils/obj-loader.js +7 -3
- package/es/class/FuseUtils.js +13 -11
- package/es/class/area.js +26 -26
- package/es/class/export.js +38 -23
- package/es/class/group.js +57 -62
- package/es/class/guide.js +19 -19
- package/es/class/hole.js +87 -88
- package/es/class/item.js +148 -155
- package/es/class/layer.js +63 -63
- package/es/class/line.js +141 -144
- package/es/class/project.js +96 -94
- package/es/class/vertex.js +33 -33
- package/es/components/content.js +27 -19
- package/es/components/disclaimer/disclaimer.js +79 -93
- package/es/components/export.js +15 -8
- package/es/components/style/button.js +29 -30
- package/es/components/style/cancel-button.js +12 -8
- package/es/components/style/content-container.js +14 -12
- package/es/components/style/content-title.js +18 -15
- package/es/components/style/delete-button.js +15 -9
- package/es/components/style/export.js +48 -30
- package/es/components/style/form-block.js +13 -12
- package/es/components/style/form-color-input.js +12 -8
- package/es/components/style/form-label.js +13 -12
- package/es/components/style/form-number-input.js +71 -47
- package/es/components/style/form-number-input_2.js +42 -42
- package/es/components/style/form-select.js +58 -14
- package/es/components/style/form-slider.js +36 -16
- package/es/components/style/form-submit-button.js +15 -9
- package/es/components/style/form-text-input.js +55 -37
- package/es/components/viewer2d/area.js +22 -17
- package/es/components/viewer2d/export.js +48 -30
- package/es/components/viewer2d/grids/grid-horizontal-streak.js +15 -11
- package/es/components/viewer2d/grids/grid-streak.js +15 -11
- package/es/components/viewer2d/grids/grid-vertical-streak.js +15 -11
- package/es/components/viewer2d/grids/grids.js +17 -15
- package/es/components/viewer2d/group.js +22 -15
- package/es/components/viewer2d/item.js +68 -68
- package/es/components/viewer2d/layer.js +28 -23
- package/es/components/viewer2d/line.js +109 -104
- package/es/components/viewer2d/ruler.js +27 -23
- package/es/components/viewer2d/rulerDist.js +26 -21
- package/es/components/viewer2d/rulerX.js +45 -45
- package/es/components/viewer2d/rulerY.js +43 -43
- package/es/components/viewer2d/scene.js +40 -46
- package/es/components/viewer2d/snap.js +20 -13
- package/es/components/viewer2d/state.js +25 -23
- package/es/components/viewer2d/utils.js +63 -21
- package/es/components/viewer2d/vertex.js +15 -8
- package/es/components/viewer2d/viewer2d.js +169 -166
- package/es/components/viewer3d/camera-controls-module/camera-controls.module.js +21 -24
- package/es/components/viewer3d/dcm.js +5 -1
- package/es/components/viewer3d/fbm.js +5 -1
- package/es/components/viewer3d/front3D.js +19 -17
- package/es/components/viewer3d/grid-creator.js +15 -8
- package/es/components/viewer3d/grids/grid-horizontal-streak.js +12 -6
- package/es/components/viewer3d/grids/grid-streak.js +11 -5
- package/es/components/viewer3d/grids/grid-vertical-streak.js +12 -6
- package/es/components/viewer3d/libs/first-person-controls.js +7 -2
- package/es/components/viewer3d/libs/helvetiker_regular.typeface.js +5 -1
- package/es/components/viewer3d/libs/mtl-loader.js +6 -2
- package/es/components/viewer3d/libs/obj-loader.js +6 -2
- package/es/components/viewer3d/libs/orbit-controls.js +10 -5
- package/es/components/viewer3d/libs/pointer-lock-controls.js +9 -4
- package/es/components/viewer3d/lrm.js +5 -1
- package/es/components/viewer3d/model.js +5 -1
- package/es/components/viewer3d/pointer-lock-navigation.js +8 -3
- package/es/components/viewer3d/ruler-utils/itemRect.js +23 -18
- package/es/components/viewer3d/ruler-utils/layer3D.js +64 -59
- package/es/components/viewer3d/ruler-utils/ruler3D.js +44 -42
- package/es/components/viewer3d/ruler-utils/scene3D.js +16 -11
- package/es/components/viewer3d/ruler-utils/state3D.js +9 -4
- package/es/components/viewer3d/scene-creator.js +225 -198
- package/es/components/viewer3d/three-memory-cleaner.js +10 -3
- package/es/components/viewer3d/viewer3d-first-person.js +44 -46
- package/es/components/viewer3d/viewer3d.js +206 -209
- package/es/constants.js +356 -349
- package/es/index.js +20 -15
- package/es/models.js +183 -183
- package/es/plugins/SVGLoader.js +51 -48
- package/es/plugins/autosave.js +7 -3
- package/es/plugins/console-debugger.js +10 -8
- package/es/plugins/export.js +15 -8
- package/es/plugins/keyboard.js +33 -29
- package/es/reducers/areas-reducer.js +11 -7
- package/es/reducers/export.js +39 -24
- package/es/reducers/groups-reducer.js +35 -31
- package/es/reducers/holes-reducer.js +47 -43
- package/es/reducers/items-reducer.js +110 -109
- package/es/reducers/lines-reducer.js +32 -28
- package/es/reducers/project-reducer.js +109 -105
- package/es/reducers/reducer.js +21 -16
- package/es/reducers/scene-reducer.js +19 -15
- package/es/reducers/user-reducer.js +9 -6
- package/es/reducers/vertices-reducer.js +15 -11
- package/es/reducers/viewer2d-reducer.js +22 -18
- package/es/reducers/viewer3d-reducer.js +20 -16
- package/es/shared-style.js +14 -10
- package/es/styles/export.js +9 -3
- package/es/translator/en.js +5 -1
- package/es/translator/it.js +5 -1
- package/es/translator/ru.js +5 -1
- package/es/translator/translator.js +17 -17
- package/es/utils/browser.js +7 -2
- package/es/utils/convert-units-lite.js +33 -0
- package/es/utils/email-validator.js +5 -1
- package/es/utils/export.js +32 -15
- package/es/utils/geometry.js +277 -191
- package/es/utils/get-edges-of-subgraphs.js +7 -1
- package/es/utils/graph-cycles.js +9 -9
- package/es/utils/graph-inner-cycles.js +16 -10
- package/es/utils/graph.js +15 -12
- package/es/utils/helper.js +61 -109
- package/es/utils/history.js +13 -8
- package/es/utils/id-broker.js +13 -12
- package/es/utils/logger.js +5 -1
- package/es/utils/math.js +10 -5
- package/es/utils/molding.js +175 -158
- package/es/utils/name-generator.js +11 -11
- package/es/utils/objects-utils.js +17 -7
- package/es/utils/phone-validator.js +5 -1
- package/es/utils/process-black-list.js +8 -6
- package/es/utils/react-if.js +10 -6
- package/es/utils/snap-scene.js +32 -32
- package/es/utils/snap.js +57 -51
- package/es/utils/summarizeCart.js +5 -1
- package/es/utils/threeCSG.es6.js +20 -17
- package/es/version.js +5 -1
- package/lib/@history.js +3 -2
- package/lib/AppContext.js +3 -2
- package/lib/KitchenConfigurator.js +70 -88
- package/lib/KitchenConfiguratorApp.js +98 -113
- package/lib/actions/export.js +1 -1
- package/lib/catalog/areas/area/planner-element.js +13 -8
- package/lib/catalog/catalog.js +9 -16
- package/lib/catalog/factories/area-factory-3d.js +1 -1
- package/lib/catalog/factories/area-factory.js +6 -7
- package/lib/catalog/factories/export.js +1 -1
- package/lib/catalog/factories/wall-factory-3d.js +4 -4
- package/lib/catalog/factories/wall-factory.js +4 -3
- package/lib/catalog/holes/door-closet/planner-element.js +4 -3
- package/lib/catalog/holes/door-double/planner-element.js +4 -3
- package/lib/catalog/holes/door-exterior/planner-element.js +4 -3
- package/lib/catalog/holes/door-interior/planner-element.js +4 -3
- package/lib/catalog/holes/door-panic/planner-element.js +4 -3
- package/lib/catalog/holes/door-panic-double/planner-element.js +4 -3
- package/lib/catalog/holes/door-sliding/planner-element.js +4 -3
- package/lib/catalog/holes/doorway-framed/planner-element.js +4 -3
- package/lib/catalog/holes/doorway-frameless/planner-element.js +4 -3
- package/lib/catalog/holes/export.js +14 -14
- package/lib/catalog/holes/window-clear/planner-element.js +4 -3
- package/lib/catalog/holes/window-cross/planner-element.js +4 -3
- package/lib/catalog/holes/window-double-hung/planner-element.js +4 -3
- package/lib/catalog/holes/window-vertical/planner-element.js +4 -3
- package/lib/catalog/lines/wall/planner-element.js +16 -11
- package/lib/catalog/molding/molding-dcm/planner-element.js +4 -3
- package/lib/catalog/molding/molding-fbm/planner-element.js +4 -3
- package/lib/catalog/molding/molding-lrm/planner-element.js +4 -3
- package/lib/catalog/properties/export.js +1 -1
- package/lib/catalog/properties/property-checkbox.js +68 -25
- package/lib/catalog/properties/property-color.js +3 -2
- package/lib/catalog/properties/property-enum.js +54 -16
- package/lib/catalog/properties/property-hidden.js +3 -2
- package/lib/catalog/properties/property-lenght-measure.js +10 -10
- package/lib/catalog/properties/property-length-measure.js +61 -17
- package/lib/catalog/properties/property-length-measure_hole.js +10 -10
- package/lib/catalog/properties/property-number.js +3 -2
- package/lib/catalog/properties/property-read-only.js +3 -2
- package/lib/catalog/properties/property-string.js +3 -2
- package/lib/catalog/properties/property-toggle.js +3 -2
- package/lib/catalog/properties/shared-property-style.js +2 -1
- package/lib/catalog/utils/FuseUtils.js +10 -11
- package/lib/catalog/utils/exporter.js +10 -12
- package/lib/catalog/utils/geom-utils.js +1 -1
- package/lib/catalog/utils/item-loader.js +29 -35
- package/lib/catalog/utils/mtl-loader.js +7 -3
- package/lib/catalog/utils/obj-loader.js +7 -3
- package/lib/class/FuseUtils.js +10 -11
- package/lib/class/area.js +9 -11
- package/lib/class/export.js +1 -1
- package/lib/class/group.js +13 -20
- package/lib/class/guide.js +9 -12
- package/lib/class/hole.js +7 -9
- package/lib/class/item.js +25 -35
- package/lib/class/layer.js +7 -9
- package/lib/class/line.js +14 -20
- package/lib/class/project.js +10 -11
- package/lib/class/vertex.js +9 -11
- package/lib/components/content.js +5 -3
- package/lib/components/disclaimer/disclaimer.js +69 -88
- package/lib/components/export.js +1 -1
- package/lib/components/style/button.js +17 -22
- package/lib/components/style/cancel-button.js +7 -7
- package/lib/components/style/content-container.js +5 -7
- package/lib/components/style/content-title.js +10 -12
- package/lib/components/style/delete-button.js +8 -8
- package/lib/components/style/export.js +1 -1
- package/lib/components/style/form-block.js +9 -12
- package/lib/components/style/form-color-input.js +7 -7
- package/lib/components/style/form-label.js +9 -12
- package/lib/components/style/form-number-input.js +43 -23
- package/lib/components/style/form-number-input_2.js +15 -19
- package/lib/components/style/form-select.js +53 -15
- package/lib/components/style/form-slider.js +28 -12
- package/lib/components/style/form-submit-button.js +8 -8
- package/lib/components/style/form-text-input.js +46 -32
- package/lib/components/viewer2d/area.js +8 -7
- package/lib/components/viewer2d/export.js +1 -1
- package/lib/components/viewer2d/grids/grid-horizontal-streak.js +3 -3
- package/lib/components/viewer2d/grids/grid-streak.js +3 -3
- package/lib/components/viewer2d/grids/grid-vertical-streak.js +3 -3
- package/lib/components/viewer2d/grids/grids.js +6 -10
- package/lib/components/viewer2d/group.js +4 -3
- package/lib/components/viewer2d/item.js +14 -19
- package/lib/components/viewer2d/layer.js +3 -2
- package/lib/components/viewer2d/line.js +4 -7
- package/lib/components/viewer2d/ruler.js +9 -9
- package/lib/components/viewer2d/rulerDist.js +7 -6
- package/lib/components/viewer2d/rulerX.js +15 -19
- package/lib/components/viewer2d/rulerY.js +15 -19
- package/lib/components/viewer2d/scene.js +24 -34
- package/lib/components/viewer2d/snap.js +4 -3
- package/lib/components/viewer2d/state.js +7 -11
- package/lib/components/viewer2d/utils.js +35 -2
- package/lib/components/viewer2d/vertex.js +4 -3
- package/lib/components/viewer2d/viewer2d.js +40 -41
- package/lib/components/viewer3d/camera-controls-module/camera-controls.module.js +14 -20
- package/lib/components/viewer3d/dcm.js +2 -1
- package/lib/components/viewer3d/fbm.js +2 -1
- package/lib/components/viewer3d/front3D.js +6 -10
- package/lib/components/viewer3d/grid-creator.js +4 -3
- package/lib/components/viewer3d/grids/grid-horizontal-streak.js +3 -2
- package/lib/components/viewer3d/grids/grid-streak.js +3 -2
- package/lib/components/viewer3d/grids/grid-vertical-streak.js +3 -2
- package/lib/components/viewer3d/libs/mtl-loader.js +7 -2
- package/lib/components/viewer3d/libs/obj-loader.js +7 -2
- package/lib/components/viewer3d/libs/orbit-controls.js +10 -5
- package/lib/components/viewer3d/libs/pointer-lock-controls.js +9 -4
- package/lib/components/viewer3d/lrm.js +2 -1
- package/lib/components/viewer3d/pointer-lock-navigation.js +1 -1
- package/lib/components/viewer3d/ruler-utils/itemRect.js +10 -9
- package/lib/components/viewer3d/ruler-utils/layer3D.js +35 -34
- package/lib/components/viewer3d/ruler-utils/ruler3D.js +5 -7
- package/lib/components/viewer3d/ruler-utils/scene3D.js +4 -5
- package/lib/components/viewer3d/ruler-utils/state3D.js +3 -2
- package/lib/components/viewer3d/scene-creator.js +40 -45
- package/lib/components/viewer3d/three-memory-cleaner.js +1 -1
- package/lib/components/viewer3d/viewer3d-first-person.js +13 -17
- package/lib/components/viewer3d/viewer3d.js +34 -38
- package/lib/index.js +16 -88
- package/lib/models.js +58 -63
- package/lib/plugins/autosave.js +2 -1
- package/lib/plugins/console-debugger.js +5 -7
- package/lib/plugins/export.js +1 -1
- package/lib/plugins/keyboard.js +2 -1
- package/lib/reducers/areas-reducer.js +2 -1
- package/lib/reducers/export.js +1 -1
- package/lib/reducers/groups-reducer.js +2 -1
- package/lib/reducers/holes-reducer.js +2 -1
- package/lib/reducers/items-reducer.js +2 -1
- package/lib/reducers/lines-reducer.js +2 -1
- package/lib/reducers/project-reducer.js +2 -1
- package/lib/reducers/scene-reducer.js +2 -1
- package/lib/reducers/user-reducer.js +2 -2
- package/lib/reducers/vertices-reducer.js +2 -1
- package/lib/reducers/viewer2d-reducer.js +5 -5
- package/lib/reducers/viewer3d-reducer.js +5 -5
- package/lib/styles/export.js +1 -1
- package/lib/translator/en.js +2 -1
- package/lib/translator/it.js +2 -1
- package/lib/translator/ru.js +2 -1
- package/lib/translator/translator.js +7 -10
- package/lib/utils/convert-units-lite.js +35 -0
- package/lib/utils/export.js +2 -2
- package/lib/utils/geometry.js +20 -28
- package/lib/utils/get-edges-of-subgraphs.js +7 -1
- package/lib/utils/graph-cycles.js +9 -9
- package/lib/utils/graph-inner-cycles.js +1 -1
- package/lib/utils/graph.js +15 -12
- package/lib/utils/helper.js +14 -83
- package/lib/utils/history.js +1 -1
- package/lib/utils/id-broker.js +7 -10
- package/lib/utils/molding.js +66 -71
- package/lib/utils/name-generator.js +7 -9
- package/lib/utils/objects-utils.js +5 -3
- package/lib/utils/process-black-list.js +3 -5
- package/lib/utils/react-if.js +3 -2
- package/lib/utils/snap-scene.js +3 -7
- package/lib/utils/snap.js +22 -26
- package/lib/utils/threeCSG.es6.js +16 -15
- package/package.json +26 -54
- package/es/analytics/ga4.js +0 -191
- package/es/analytics/posthog.js +0 -60
- package/lib/analytics/ga4.js +0 -197
- package/lib/analytics/posthog.js +0 -68
package/es/utils/molding.js
CHANGED
|
@@ -1,33 +1,50 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
|
+
exports.__esModule = true;
|
|
6
|
+
exports.createMonldingGroup = createMonldingGroup;
|
|
7
|
+
exports.getAllMoldingGroups = getAllMoldingGroups;
|
|
8
|
+
exports.getItemGroupFromMolding = getItemGroupFromMolding;
|
|
9
|
+
exports.getItemRect = getItemRect;
|
|
10
|
+
exports.getLinesFromItems = getLinesFromItems;
|
|
11
|
+
exports.getLinesFromItems2 = getLinesFromItems2;
|
|
12
|
+
exports.getLinesOfItem = getLinesOfItem;
|
|
13
|
+
exports.hasMoldingLayout = hasMoldingLayout;
|
|
14
|
+
exports.isEnableItemForMolding = isEnableItemForMolding;
|
|
15
|
+
exports.isItemSameItemByLocation = isItemSameItemByLocation;
|
|
16
|
+
exports.isItemSnappedGroup = isItemSnappedGroup;
|
|
17
|
+
exports.isItemSnappedItem = isItemSnappedItem;
|
|
18
|
+
exports.isLinesOverlapped = isLinesOverlapped;
|
|
19
|
+
exports.isSameMoldingLayoutpos = isSameMoldingLayoutpos;
|
|
20
|
+
exports.mergeOverlappedLines = mergeOverlappedLines;
|
|
21
|
+
exports.sortItemsByDistance = sortItemsByDistance;
|
|
22
|
+
exports.tryMergeMDItem = tryMergeMDItem;
|
|
23
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/defineProperty"));
|
|
24
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/toConsumableArray"));
|
|
25
|
+
var _constants = require("../constants");
|
|
26
|
+
var Three = _interopRequireWildcard(require("three"));
|
|
27
|
+
var _convertUnitsLite = require("./convert-units-lite");
|
|
28
|
+
var _idBroker = _interopRequireDefault(require("./id-broker"));
|
|
29
|
+
var _utils = require("../components/viewer2d/utils");
|
|
30
|
+
var _export = require("./export");
|
|
31
|
+
var _helper = require("./helper");
|
|
32
|
+
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" != _typeof(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); }
|
|
2
33
|
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) {
|
|
4
|
-
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
5
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
6
|
-
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
|
-
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
8
|
-
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
9
|
-
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
10
|
-
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
|
34
|
+
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; }
|
|
11
35
|
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
|
|
12
36
|
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
13
37
|
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
14
|
-
|
|
15
|
-
import * as Three from 'three';
|
|
16
|
-
import convert from 'convert-units';
|
|
17
|
-
import IDBroker from "./id-broker";
|
|
18
|
-
import { returnReplaceableDeepSearchType } from "../components/viewer2d/utils";
|
|
19
|
-
import { GeometryUtils } from "./export";
|
|
20
|
-
import { isEmpty } from "./helper";
|
|
21
|
-
export function getItemRect(item) {
|
|
38
|
+
function getItemRect(item) {
|
|
22
39
|
var x = item.x;
|
|
23
40
|
var y = item.y;
|
|
24
41
|
var rotRad = item.rotation / 180 * Math.PI;
|
|
25
42
|
var itemWidth = item.properties.get('width').get('_length');
|
|
26
43
|
var itemWidthUnit = item.properties.get('width').get('_unit') || 'cm';
|
|
27
|
-
itemWidth = convert(itemWidth / 2).from(itemWidthUnit).to('cm');
|
|
44
|
+
itemWidth = (0, _convertUnitsLite.convert)(itemWidth / 2).from(itemWidthUnit).to('cm');
|
|
28
45
|
var itemDepth = item.properties.get('depth').get('_length');
|
|
29
46
|
var itemDepthUnit = item.properties.get('depth').get('_unit') || 'cm';
|
|
30
|
-
itemDepth = convert(itemDepth / 2).from(itemDepthUnit).to('cm');
|
|
47
|
+
itemDepth = (0, _convertUnitsLite.convert)(itemDepth / 2).from(itemDepthUnit).to('cm');
|
|
31
48
|
var mx = x - itemWidth * Math.cos(rotRad);
|
|
32
49
|
var my = y - itemWidth * Math.sin(rotRad);
|
|
33
50
|
var x0 = mx + itemDepth * Math.sin(rotRad);
|
|
@@ -54,31 +71,31 @@ export function getItemRect(item) {
|
|
|
54
71
|
}]
|
|
55
72
|
};
|
|
56
73
|
}
|
|
57
|
-
|
|
74
|
+
function hasMoldingLayout(molding, layoutpos) {
|
|
58
75
|
var types = molding === null || molding === void 0 ? void 0 : molding.molding_type;
|
|
59
76
|
return (Array.isArray(types) || typeof types === 'string') && types.includes(layoutpos);
|
|
60
77
|
}
|
|
61
|
-
|
|
78
|
+
function isEnableItemForMolding(layer, selItem) {
|
|
62
79
|
var molding = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
63
|
-
var allLineRects = GeometryUtils.buildRectFromLines(layer, GeometryUtils.getAllLines(layer));
|
|
64
|
-
var result = !isEmpty(selItem) && selItem.category === 'cabinet' && (selItem.layoutpos === BASE_CABINET_LAYOUTPOS && !GeometryUtils.isSnappedLine(getItemRect(selItem), allLineRects) || (selItem.layoutpos === WALL_CABINET_LAYOUTPOS || selItem.layoutpos === TALL_CABINET_LAYOUTPOS) && GeometryUtils.isSnappedLine(getItemRect(selItem), allLineRects));
|
|
80
|
+
var allLineRects = _export.GeometryUtils.buildRectFromLines(layer, _export.GeometryUtils.getAllLines(layer));
|
|
81
|
+
var result = !(0, _helper.isEmpty)(selItem) && selItem.category === 'cabinet' && (selItem.layoutpos === _constants.BASE_CABINET_LAYOUTPOS && !_export.GeometryUtils.isSnappedLine(getItemRect(selItem), allLineRects) || (selItem.layoutpos === _constants.WALL_CABINET_LAYOUTPOS || selItem.layoutpos === _constants.TALL_CABINET_LAYOUTPOS) && _export.GeometryUtils.isSnappedLine(getItemRect(selItem), allLineRects));
|
|
65
82
|
|
|
66
83
|
// check this item is enable for any molding
|
|
67
|
-
if (isEmpty(molding)) return result;
|
|
84
|
+
if ((0, _helper.isEmpty)(molding)) return result;
|
|
68
85
|
// check this item is enable for specified molding
|
|
69
86
|
else return result && hasMoldingLayout(molding, selItem.layoutpos);
|
|
70
87
|
}
|
|
71
88
|
|
|
72
|
-
/**
|
|
73
|
-
* Check two line segments are overlap. The direction of the two line segments must be opposite.
|
|
74
|
-
* s1 c2 s2 c1
|
|
75
|
-
* |--------|------|-----------|
|
|
76
|
-
* Decision Formular: L(s1,c1) + L(s2, c2) = L(s1, s2) + L(c1, c2)
|
|
77
|
-
* @param {*} selRectPos1
|
|
78
|
-
* @param {*} selRectPos2
|
|
79
|
-
* @param {*} curRectPos1
|
|
80
|
-
* @param {*} curRectPos2
|
|
81
|
-
* @returns L(s1,c1) + L(s2, c2) - L(s1, s2) - L(c1, c2)
|
|
89
|
+
/**
|
|
90
|
+
* Check two line segments are overlap. The direction of the two line segments must be opposite.
|
|
91
|
+
* s1 c2 s2 c1
|
|
92
|
+
* |--------|------|-----------|
|
|
93
|
+
* Decision Formular: L(s1,c1) + L(s2, c2) = L(s1, s2) + L(c1, c2)
|
|
94
|
+
* @param {*} selRectPos1
|
|
95
|
+
* @param {*} selRectPos2
|
|
96
|
+
* @param {*} curRectPos1
|
|
97
|
+
* @param {*} curRectPos2
|
|
98
|
+
* @returns L(s1,c1) + L(s2, c2) - L(s1, s2) - L(c1, c2)
|
|
82
99
|
*/
|
|
83
100
|
function getDelta(selRectPos1, selRectPos2, curRectPos1, curRectPos2) {
|
|
84
101
|
return (
|
|
@@ -88,66 +105,66 @@ function getDelta(selRectPos1, selRectPos2, curRectPos1, curRectPos2) {
|
|
|
88
105
|
// GeometryUtils.verticesDistance(curRectPos2, curRectPos1) -
|
|
89
106
|
// GeometryUtils.verticesDistance(selRectPos1, selRectPos2)
|
|
90
107
|
// )
|
|
91
|
-
Math.abs(GeometryUtils.verticesDistance(curRectPos1, selRectPos1) + GeometryUtils.verticesDistance(selRectPos2, curRectPos2) - GeometryUtils.verticesDistance(curRectPos2, curRectPos1) - GeometryUtils.verticesDistance(selRectPos1, selRectPos2))
|
|
108
|
+
Math.abs(_export.GeometryUtils.verticesDistance(curRectPos1, selRectPos1) + _export.GeometryUtils.verticesDistance(selRectPos2, curRectPos2) - _export.GeometryUtils.verticesDistance(curRectPos2, curRectPos1) - _export.GeometryUtils.verticesDistance(selRectPos1, selRectPos2))
|
|
92
109
|
);
|
|
93
110
|
}
|
|
94
|
-
|
|
111
|
+
function isItemSnappedItem(selItem, curItem) {
|
|
95
112
|
var selRect = getItemRect(selItem).rect;
|
|
96
113
|
var curRect = getItemRect(curItem).rect;
|
|
97
|
-
var flag30 = getDelta(selRect[3], selRect[0], curRect[1], curRect[2]) < EPSILON;
|
|
98
|
-
var flag21 = getDelta(selRect[2], selRect[1], curRect[0], curRect[3]) < EPSILON;
|
|
99
|
-
var flag23 = getDelta(selRect[2], selRect[3], curRect[2], curRect[3]) < EPSILON;
|
|
100
|
-
var flag01 = getDelta(selRect[1], selRect[0], curRect[0], curRect[3]) < EPSILON;
|
|
101
|
-
var flag03 = getDelta(selRect[0], selRect[3], curRect[1], curRect[0]) < EPSILON;
|
|
114
|
+
var flag30 = getDelta(selRect[3], selRect[0], curRect[1], curRect[2]) < _constants.EPSILON;
|
|
115
|
+
var flag21 = getDelta(selRect[2], selRect[1], curRect[0], curRect[3]) < _constants.EPSILON;
|
|
116
|
+
var flag23 = getDelta(selRect[2], selRect[3], curRect[2], curRect[3]) < _constants.EPSILON;
|
|
117
|
+
var flag01 = getDelta(selRect[1], selRect[0], curRect[0], curRect[3]) < _constants.EPSILON;
|
|
118
|
+
var flag03 = getDelta(selRect[0], selRect[3], curRect[1], curRect[0]) < _constants.EPSILON;
|
|
102
119
|
return flag30 || flag21 || flag23 || flag01 || flag03;
|
|
103
120
|
}
|
|
104
|
-
|
|
121
|
+
function isItemSnappedGroup(selItem, itemGroup) {
|
|
105
122
|
return itemGroup.some(function (curItem) {
|
|
106
123
|
return isItemSnappedItem(selItem, curItem);
|
|
107
124
|
});
|
|
108
125
|
}
|
|
109
|
-
|
|
126
|
+
function sortItemsByDistance(items, selItem) {
|
|
110
127
|
items.sort(function (a, b) {
|
|
111
|
-
return GeometryUtils.pointsDistance(a.x, a.y, selItem.x, selItem.y) - GeometryUtils.pointsDistance(b.x, b.y, selItem.x, selItem.y);
|
|
128
|
+
return _export.GeometryUtils.pointsDistance(a.x, a.y, selItem.x, selItem.y) - _export.GeometryUtils.pointsDistance(b.x, b.y, selItem.x, selItem.y);
|
|
112
129
|
});
|
|
113
130
|
return items;
|
|
114
131
|
}
|
|
115
|
-
|
|
116
|
-
return curItem.layoutpos === BASE_CABINET_LAYOUTPOS && curItem.layoutpos === item.layoutpos || [WALL_CABINET_LAYOUTPOS, TALL_CABINET_LAYOUTPOS].includes(curItem.layoutpos) && [WALL_CABINET_LAYOUTPOS, TALL_CABINET_LAYOUTPOS].includes(item.layoutpos);
|
|
132
|
+
function isSameMoldingLayoutpos(curItem, item) {
|
|
133
|
+
return curItem.layoutpos === _constants.BASE_CABINET_LAYOUTPOS && curItem.layoutpos === item.layoutpos || [_constants.WALL_CABINET_LAYOUTPOS, _constants.TALL_CABINET_LAYOUTPOS].includes(curItem.layoutpos) && [_constants.WALL_CABINET_LAYOUTPOS, _constants.TALL_CABINET_LAYOUTPOS].includes(item.layoutpos);
|
|
117
134
|
}
|
|
118
|
-
|
|
135
|
+
function isItemSameItemByLocation(item1, item2, location) {
|
|
119
136
|
var item1Altitude = item1.properties.get('altitude').get('_length');
|
|
120
137
|
var item1AltitudeUnit = item1.properties.get('altitude').get('_unit');
|
|
121
|
-
item1Altitude = convert(item1Altitude).from(item1AltitudeUnit).to('cm');
|
|
138
|
+
item1Altitude = (0, _convertUnitsLite.convert)(item1Altitude).from(item1AltitudeUnit).to('cm');
|
|
122
139
|
var item1Height = item1.properties.get('height').get('_length');
|
|
123
140
|
var item1HeightUnit = item1.properties.get('height').get('_unit');
|
|
124
|
-
item1Height = convert(item1Height).from(item1HeightUnit).to('cm');
|
|
141
|
+
item1Height = (0, _convertUnitsLite.convert)(item1Height).from(item1HeightUnit).to('cm');
|
|
125
142
|
var item2Altitude = item2.properties.get('altitude').get('_length');
|
|
126
143
|
var item2AltitudeUnit = item2.properties.get('altitude').get('_unit');
|
|
127
|
-
item2Altitude = convert(item2Altitude).from(item2AltitudeUnit).to('cm');
|
|
144
|
+
item2Altitude = (0, _convertUnitsLite.convert)(item2Altitude).from(item2AltitudeUnit).to('cm');
|
|
128
145
|
var item2Height = item2.properties.get('height').get('_length');
|
|
129
146
|
var item2HeightUnit = item2.properties.get('height').get('_unit');
|
|
130
|
-
item2Height = convert(item2Height).from(item2HeightUnit).to('cm');
|
|
147
|
+
item2Height = (0, _convertUnitsLite.convert)(item2Height).from(item2HeightUnit).to('cm');
|
|
131
148
|
var flag = false;
|
|
132
149
|
switch (location) {
|
|
133
|
-
case TOP_MOLDING_LOCATION:
|
|
134
|
-
if (GeometryUtils.sameDistances(item1Altitude + item1Height, item2Altitude + item2Height)) flag = true;
|
|
150
|
+
case _constants.TOP_MOLDING_LOCATION:
|
|
151
|
+
if (_export.GeometryUtils.sameDistances(item1Altitude + item1Height, item2Altitude + item2Height)) flag = true;
|
|
135
152
|
break;
|
|
136
|
-
case MIDDLE_MOLDING_LOCATION:
|
|
137
|
-
if (GeometryUtils.sameDistances(item1Altitude + item1Height / 2, item2Altitude + item2Height / 2)) flag = true;
|
|
153
|
+
case _constants.MIDDLE_MOLDING_LOCATION:
|
|
154
|
+
if (_export.GeometryUtils.sameDistances(item1Altitude + item1Height / 2, item2Altitude + item2Height / 2)) flag = true;
|
|
138
155
|
break;
|
|
139
|
-
case BOTTOM_MOLDING_LOCATION:
|
|
140
|
-
if (GeometryUtils.sameDistances(item1Altitude, item2Altitude)) flag = true;
|
|
156
|
+
case _constants.BOTTOM_MOLDING_LOCATION:
|
|
157
|
+
if (_export.GeometryUtils.sameDistances(item1Altitude, item2Altitude)) flag = true;
|
|
141
158
|
break;
|
|
142
159
|
}
|
|
143
160
|
return flag;
|
|
144
161
|
}
|
|
145
|
-
|
|
162
|
+
function tryMergeMDItem(layer, selItem, curItem, itemGroup, molding) {
|
|
146
163
|
return isSameMoldingLayoutpos(selItem, curItem) && isEnableItemForMolding(layer, curItem, molding) && isItemSnappedGroup(curItem, itemGroup) && !itemGroup.some(function (item) {
|
|
147
164
|
return item.id === curItem.id;
|
|
148
165
|
}) && isItemSameItemByLocation(selItem, curItem, molding.location_type);
|
|
149
166
|
}
|
|
150
|
-
|
|
167
|
+
function getItemGroupFromMolding(layer, curItem, molding) {
|
|
151
168
|
var selectedItem = layer.getIn(['items', layer.selected.toJS().items[0]]);
|
|
152
169
|
var itemGroup = [curItem];
|
|
153
170
|
var temp_layer_items = layer.items.toArray().filter(function (item) {
|
|
@@ -168,13 +185,13 @@ function tryMergeItemWithLocation(curItem, itemGroup, location) {
|
|
|
168
185
|
});
|
|
169
186
|
}
|
|
170
187
|
|
|
171
|
-
/**
|
|
172
|
-
* Make the molding group array with [items].
|
|
173
|
-
* @param {*} layer
|
|
174
|
-
* @param {*} items - Mergable snapped item group, if [items] is null then get all MG array of layer
|
|
175
|
-
* @returns MG array
|
|
188
|
+
/**
|
|
189
|
+
* Make the molding group array with [items].
|
|
190
|
+
* @param {*} layer
|
|
191
|
+
* @param {*} items - Mergable snapped item group, if [items] is null then get all MG array of layer
|
|
192
|
+
* @returns MG array
|
|
176
193
|
*/
|
|
177
|
-
|
|
194
|
+
function getAllMoldingGroups(layer) {
|
|
178
195
|
var items = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
179
196
|
if (items === null) items = layer.items.toArray();
|
|
180
197
|
var MGArray = [];
|
|
@@ -196,7 +213,7 @@ export function getAllMoldingGroups(layer) {
|
|
|
196
213
|
return it.category === 'cabinet' && isSameMoldingLayoutpos(curItem, it) && it.id !== curItem.id;
|
|
197
214
|
});
|
|
198
215
|
temp_items = sortItemsByDistance(temp_items, curItem);
|
|
199
|
-
MOLDING_LOCATIONS.forEach(function (location) {
|
|
216
|
+
_constants.MOLDING_LOCATIONS.forEach(function (location) {
|
|
200
217
|
if (!MGArray.some(function (mg) {
|
|
201
218
|
return mg.items.some(function (it) {
|
|
202
219
|
return it.id === curItem.id;
|
|
@@ -219,7 +236,7 @@ export function getAllMoldingGroups(layer) {
|
|
|
219
236
|
}
|
|
220
237
|
} while (isChangedItemGroup);
|
|
221
238
|
MGArray.push({
|
|
222
|
-
id:
|
|
239
|
+
id: _idBroker["default"].acquireID(),
|
|
223
240
|
items: itemGroup,
|
|
224
241
|
location_type: location,
|
|
225
242
|
molding: null,
|
|
@@ -236,18 +253,18 @@ export function getAllMoldingGroups(layer) {
|
|
|
236
253
|
});
|
|
237
254
|
return MGArray;
|
|
238
255
|
}
|
|
239
|
-
|
|
256
|
+
function getLinesOfItem(item, allLineRects, catalog) {
|
|
240
257
|
var lines = [];
|
|
241
258
|
var outline = null;
|
|
242
259
|
var element = catalog.elements[item.get('type')];
|
|
243
|
-
if (!element) element = catalog.elements[returnReplaceableDeepSearchType(item.get('type'))];
|
|
260
|
+
if (!element) element = catalog.elements[(0, _utils.returnReplaceableDeepSearchType)(item.get('type'))];
|
|
244
261
|
// get edge lines
|
|
245
262
|
var newWidth = item.properties.get('width').get('_length');
|
|
246
263
|
var wUnit = item.properties.get('width').get('_unit') || 'cm';
|
|
247
|
-
newWidth = convert(newWidth).from(wUnit).to('cm');
|
|
264
|
+
newWidth = (0, _convertUnitsLite.convert)(newWidth).from(wUnit).to('cm');
|
|
248
265
|
var newDepth = item.properties.get('depth').get('_length');
|
|
249
266
|
var hUnit = item.properties.get('depth').get('_unit') || 'cm';
|
|
250
|
-
newDepth = convert(newDepth).from(hUnit).to('cm');
|
|
267
|
+
newDepth = (0, _convertUnitsLite.convert)(newDepth).from(hUnit).to('cm');
|
|
251
268
|
if (item) {
|
|
252
269
|
// Get Outline Data of Selected Item
|
|
253
270
|
outline = element.info.outline;
|
|
@@ -282,18 +299,18 @@ export function getLinesOfItem(item, allLineRects, catalog) {
|
|
|
282
299
|
}
|
|
283
300
|
outline.reverse && outlinePoints.reverse();
|
|
284
301
|
for (var i = 0; i < outlinePoints.length - 1; i++) {
|
|
285
|
-
lines.push([GeometryUtils.rotatePointAroundPoint((outlinePoints[i].x / outlineWidth - 0.5) * newWidth + item.x, (outlinePoints[i].y / outlineHeight - 0.5) * newDepth + item.y, item.x, item.y, item.rotation + 90), GeometryUtils.rotatePointAroundPoint((outlinePoints[i + 1].x / outlineWidth - 0.5) * newWidth + item.x, (outlinePoints[i + 1].y / outlineHeight - 0.5) * newDepth + item.y, item.x, item.y, item.rotation + 90),
|
|
302
|
+
lines.push([_export.GeometryUtils.rotatePointAroundPoint((outlinePoints[i].x / outlineWidth - 0.5) * newWidth + item.x, (outlinePoints[i].y / outlineHeight - 0.5) * newDepth + item.y, item.x, item.y, item.rotation + 90), _export.GeometryUtils.rotatePointAroundPoint((outlinePoints[i + 1].x / outlineWidth - 0.5) * newWidth + item.x, (outlinePoints[i + 1].y / outlineHeight - 0.5) * newDepth + item.y, item.x, item.y, item.rotation + 90), _idBroker["default"].acquireID()]);
|
|
286
303
|
}
|
|
287
304
|
} else {
|
|
288
305
|
var pos = [[-1, -1], [1, -1], [1, 1], [-1, 1]];
|
|
289
306
|
for (var _i = 0; _i < 4; _i++) {
|
|
290
|
-
lines.push([GeometryUtils.rotatePointAroundPoint(pos[_i][0] * newWidth / 2 + item.x, pos[_i][1] * newDepth / 2 + item.y, item.x, item.y, item.rotation), GeometryUtils.rotatePointAroundPoint(pos[(_i + 1) % 4][0] * newWidth / 2 + item.x, pos[(_i + 1) % 4][1] * newDepth / 2 + item.y, item.x, item.y, item.rotation),
|
|
307
|
+
lines.push([_export.GeometryUtils.rotatePointAroundPoint(pos[_i][0] * newWidth / 2 + item.x, pos[_i][1] * newDepth / 2 + item.y, item.x, item.y, item.rotation), _export.GeometryUtils.rotatePointAroundPoint(pos[(_i + 1) % 4][0] * newWidth / 2 + item.x, pos[(_i + 1) % 4][1] * newDepth / 2 + item.y, item.x, item.y, item.rotation), _idBroker["default"].acquireID()]);
|
|
291
308
|
}
|
|
292
309
|
}
|
|
293
310
|
}
|
|
294
|
-
if (item.layoutpos !== BASE_CABINET_LAYOUTPOS) {
|
|
311
|
+
if (item.layoutpos !== _constants.BASE_CABINET_LAYOUTPOS) {
|
|
295
312
|
lines = lines.filter(function (line) {
|
|
296
|
-
return !GeometryUtils.isSnappedLine({
|
|
313
|
+
return !_export.GeometryUtils.isSnappedLine({
|
|
297
314
|
rect: [{
|
|
298
315
|
x: 0,
|
|
299
316
|
y: 0
|
|
@@ -308,29 +325,29 @@ export function getLinesOfItem(item, allLineRects, catalog) {
|
|
|
308
325
|
}
|
|
309
326
|
function isParallelLines(line1, line2) {
|
|
310
327
|
var isParallel = false;
|
|
311
|
-
if (Math.abs(line1[0].y - line1[1].y) <= EPSILON && Math.abs(line2[0].y - line2[1].y) <= EPSILON) isParallel = true;
|
|
312
|
-
if (Math.abs(line1[0].x - line1[1].x) <= EPSILON && Math.abs(line2[0].x - line2[1].x) <= EPSILON) isParallel = true;
|
|
313
|
-
if (Math.abs((line1[0].x - line1[1].x) / (line1[0].y - line1[1].y) - (line2[0].x - line2[1].x) / (line2[0].y - line2[1].y)) <= EPSILON) isParallel = true;
|
|
328
|
+
if (Math.abs(line1[0].y - line1[1].y) <= _constants.EPSILON && Math.abs(line2[0].y - line2[1].y) <= _constants.EPSILON) isParallel = true;
|
|
329
|
+
if (Math.abs(line1[0].x - line1[1].x) <= _constants.EPSILON && Math.abs(line2[0].x - line2[1].x) <= _constants.EPSILON) isParallel = true;
|
|
330
|
+
if (Math.abs((line1[0].x - line1[1].x) / (line1[0].y - line1[1].y) - (line2[0].x - line2[1].x) / (line2[0].y - line2[1].y)) <= _constants.EPSILON) isParallel = true;
|
|
314
331
|
if (isParallel) {
|
|
315
332
|
return true;
|
|
316
333
|
}
|
|
317
334
|
return false;
|
|
318
335
|
}
|
|
319
|
-
|
|
336
|
+
function isLinesOverlapped(line1, line2) {
|
|
320
337
|
return isParallelLines(line1, line2) && line1.some(function (l1) {
|
|
321
338
|
return line2.some(function (l2) {
|
|
322
|
-
return GeometryUtils.samePoints(l1, l2);
|
|
339
|
+
return _export.GeometryUtils.samePoints(l1, l2);
|
|
323
340
|
});
|
|
324
341
|
});
|
|
325
342
|
}
|
|
326
|
-
|
|
343
|
+
function mergeOverlappedLines(line1, line2) {
|
|
327
344
|
var line1_idx = 0,
|
|
328
345
|
line2_idx = 0;
|
|
329
346
|
line1.forEach(function (l1, idx1) {
|
|
330
347
|
if (idx1 !== line1.length - 1) {
|
|
331
348
|
line2.forEach(function (l2, idx2) {
|
|
332
349
|
if (idx2 !== line2.length - 1) {
|
|
333
|
-
if (GeometryUtils.samePoints(l1, l2)) {
|
|
350
|
+
if (_export.GeometryUtils.samePoints(l1, l2)) {
|
|
334
351
|
line1_idx = idx1;
|
|
335
352
|
line2_idx = idx2;
|
|
336
353
|
}
|
|
@@ -341,25 +358,25 @@ export function mergeOverlappedLines(line1, line2) {
|
|
|
341
358
|
//If line1 's end point and line2 's start point is same, two lines merge into a line with
|
|
342
359
|
//the line1's start point as the start point and line2's end point as the end point.
|
|
343
360
|
if (line1_idx === 1) {
|
|
344
|
-
return [line1[1 - line1_idx], line2[1 - line2_idx],
|
|
361
|
+
return [line1[1 - line1_idx], line2[1 - line2_idx], _idBroker["default"].acquireID()];
|
|
345
362
|
} else {
|
|
346
|
-
return [line2[1 - line2_idx], line1[1 - line1_idx],
|
|
363
|
+
return [line2[1 - line2_idx], line1[1 - line1_idx], _idBroker["default"].acquireID()];
|
|
347
364
|
}
|
|
348
365
|
}
|
|
349
366
|
|
|
350
|
-
/**
|
|
351
|
-
* Get the contour line array of moldingGroup items
|
|
352
|
-
* @param {*} moldingGroup
|
|
353
|
-
* @param {*} layer
|
|
354
|
-
* @param {*} catalog
|
|
355
|
-
* @returns contour line array of moldingGroup items
|
|
367
|
+
/**
|
|
368
|
+
* Get the contour line array of moldingGroup items
|
|
369
|
+
* @param {*} moldingGroup
|
|
370
|
+
* @param {*} layer
|
|
371
|
+
* @param {*} catalog
|
|
372
|
+
* @returns contour line array of moldingGroup items
|
|
356
373
|
*/
|
|
357
|
-
|
|
374
|
+
function getLinesFromItems2(moldingGroup, layer, catalog) {
|
|
358
375
|
// wall lines
|
|
359
|
-
var allLineRects = GeometryUtils.buildRectFromLines(layer, GeometryUtils.getAllLines(layer));
|
|
376
|
+
var allLineRects = _export.GeometryUtils.buildRectFromLines(layer, _export.GeometryUtils.getAllLines(layer));
|
|
360
377
|
var MGlines = [];
|
|
361
378
|
var MGlinesOtherSnapped = [];
|
|
362
|
-
var items =
|
|
379
|
+
var items = (0, _toConsumableArray2["default"])(moldingGroup.items);
|
|
363
380
|
// The other item's lines (these items are snapped to the moldingGroup items)
|
|
364
381
|
var itemsOtherSnapped = layer.items.toArray().filter(function (item) {
|
|
365
382
|
if (items.some(function (it) {
|
|
@@ -369,17 +386,17 @@ export function getLinesFromItems2(moldingGroup, layer, catalog) {
|
|
|
369
386
|
var itemLines = getLinesOfItem(item, allLineRects, catalog);
|
|
370
387
|
var itemAltitude = item.properties.get('altitude').get('_length');
|
|
371
388
|
var itemAltitudeUnit = item.properties.get('altitude').get('_unit');
|
|
372
|
-
itemAltitude = convert(itemAltitude).from(itemAltitudeUnit).to('cm');
|
|
389
|
+
itemAltitude = (0, _convertUnitsLite.convert)(itemAltitude).from(itemAltitudeUnit).to('cm');
|
|
373
390
|
var itemHeight = item.properties.get('height').get('_length');
|
|
374
391
|
var itemHeightUnit = item.properties.get('height').get('_unit');
|
|
375
|
-
itemHeight = convert(itemHeight).from(itemHeightUnit).to('cm');
|
|
392
|
+
itemHeight = (0, _convertUnitsLite.convert)(itemHeight).from(itemHeightUnit).to('cm');
|
|
376
393
|
itemLines.forEach(function (line) {
|
|
377
394
|
line.push({
|
|
378
395
|
altitude: itemAltitude,
|
|
379
396
|
height: itemHeight
|
|
380
397
|
});
|
|
381
398
|
});
|
|
382
|
-
MGlinesOtherSnapped = [].concat(
|
|
399
|
+
MGlinesOtherSnapped = [].concat((0, _toConsumableArray2["default"])(MGlinesOtherSnapped), (0, _toConsumableArray2["default"])(itemLines));
|
|
383
400
|
return true;
|
|
384
401
|
} else return false;
|
|
385
402
|
});
|
|
@@ -388,10 +405,10 @@ export function getLinesFromItems2(moldingGroup, layer, catalog) {
|
|
|
388
405
|
items.forEach(function (item) {
|
|
389
406
|
var itemAltitude = item.properties.get('altitude').get('_length');
|
|
390
407
|
var itemAltitudeUnit = item.properties.get('altitude').get('_unit');
|
|
391
|
-
itemAltitude = convert(itemAltitude).from(itemAltitudeUnit).to('cm');
|
|
408
|
+
itemAltitude = (0, _convertUnitsLite.convert)(itemAltitude).from(itemAltitudeUnit).to('cm');
|
|
392
409
|
var itemHeight = item.properties.get('height').get('_length');
|
|
393
410
|
var itemHeightUnit = item.properties.get('height').get('_unit');
|
|
394
|
-
itemHeight = convert(itemHeight).from(itemHeightUnit).to('cm');
|
|
411
|
+
itemHeight = (0, _convertUnitsLite.convert)(itemHeight).from(itemHeightUnit).to('cm');
|
|
395
412
|
var itemLines = getLinesOfItem(item, allLineRects, catalog);
|
|
396
413
|
|
|
397
414
|
// remove the edge that overlapped with other snapped items
|
|
@@ -406,17 +423,17 @@ export function getLinesFromItems2(moldingGroup, layer, catalog) {
|
|
|
406
423
|
for (var j = 0; j < MGlinesOtherSnapped.length; j++) {
|
|
407
424
|
var bCheck = false;
|
|
408
425
|
switch (moldingGroup.location_type) {
|
|
409
|
-
case TOP_MOLDING_LOCATION:
|
|
426
|
+
case _constants.TOP_MOLDING_LOCATION:
|
|
410
427
|
bCheck = MGlinesOtherSnapped[j][3].altitude + MGlinesOtherSnapped[j][3].height > itemAltitude + itemHeight;
|
|
411
428
|
break;
|
|
412
|
-
case MIDDLE_MOLDING_LOCATION:
|
|
429
|
+
case _constants.MIDDLE_MOLDING_LOCATION:
|
|
413
430
|
bCheck = true;
|
|
414
431
|
break;
|
|
415
|
-
case BOTTOM_MOLDING_LOCATION:
|
|
432
|
+
case _constants.BOTTOM_MOLDING_LOCATION:
|
|
416
433
|
bCheck = MGlinesOtherSnapped[j][3].altitude < itemAltitude;
|
|
417
434
|
break;
|
|
418
435
|
}
|
|
419
|
-
if (item.category !== 'cabinet' || ![BASE_CABINET_LAYOUTPOS, WALL_CABINET_LAYOUTPOS, TALL_CABINET_LAYOUTPOS].includes(item.layoutpos)) bCheck = true;
|
|
436
|
+
if (item.category !== 'cabinet' || ![_constants.BASE_CABINET_LAYOUTPOS, _constants.WALL_CABINET_LAYOUTPOS, _constants.TALL_CABINET_LAYOUTPOS].includes(item.layoutpos)) bCheck = true;
|
|
420
437
|
if (bCheck) {
|
|
421
438
|
var destLine = {
|
|
422
439
|
x1: MGlinesOtherSnapped[j][0].x,
|
|
@@ -424,8 +441,8 @@ export function getLinesFromItems2(moldingGroup, layer, catalog) {
|
|
|
424
441
|
x2: MGlinesOtherSnapped[j][1].x,
|
|
425
442
|
y2: MGlinesOtherSnapped[j][1].y
|
|
426
443
|
};
|
|
427
|
-
var rst = GeometryUtils.relationshipOfTwoOverlappedLines(srcLine, destLine);
|
|
428
|
-
if (rst.result === OVERLAP_SAME || rst.result === OVERLAP_INCLUDED) {
|
|
444
|
+
var rst = _export.GeometryUtils.relationshipOfTwoOverlappedLines(srcLine, destLine);
|
|
445
|
+
if (rst.result === _constants.OVERLAP_SAME || rst.result === _constants.OVERLAP_INCLUDED) {
|
|
429
446
|
ret = false;
|
|
430
447
|
break;
|
|
431
448
|
}
|
|
@@ -433,7 +450,7 @@ export function getLinesFromItems2(moldingGroup, layer, catalog) {
|
|
|
433
450
|
}
|
|
434
451
|
return ret;
|
|
435
452
|
});
|
|
436
|
-
MGlines = [].concat(
|
|
453
|
+
MGlines = [].concat((0, _toConsumableArray2["default"])(MGlines), (0, _toConsumableArray2["default"])(itemLines));
|
|
437
454
|
});
|
|
438
455
|
|
|
439
456
|
// Filtering overlapped edges and get contour edges
|
|
@@ -454,16 +471,16 @@ export function getLinesFromItems2(moldingGroup, layer, catalog) {
|
|
|
454
471
|
x2: MGlines[j][1].x,
|
|
455
472
|
y2: MGlines[j][1].y
|
|
456
473
|
};
|
|
457
|
-
var rst = GeometryUtils.relationshipOfTwoOverlappedLines(srcLine, destLine);
|
|
458
|
-
if (rst.result === OVERLAP_SAME || rst.result === OVERLAP_INCLUDED) {
|
|
474
|
+
var rst = _export.GeometryUtils.relationshipOfTwoOverlappedLines(srcLine, destLine);
|
|
475
|
+
if (rst.result === _constants.OVERLAP_SAME || rst.result === _constants.OVERLAP_INCLUDED) {
|
|
459
476
|
removeLineIds.push(i);
|
|
460
477
|
return 1; // break
|
|
461
|
-
} else if (rst.result === OVERLAP_SOME) {
|
|
478
|
+
} else if (rst.result === _constants.OVERLAP_SOME) {
|
|
462
479
|
removeLineIds.push(i);
|
|
463
480
|
var lineSegs = getTrimmedContourLineSegs(rst.trimmedSegs, MGlines.filter(function (v, idx) {
|
|
464
481
|
return idx !== i && idx !== j;
|
|
465
482
|
}), 0);
|
|
466
|
-
if (lineSegs.length > 0) newLines = [].concat(
|
|
483
|
+
if (lineSegs.length > 0) newLines = [].concat((0, _toConsumableArray2["default"])(newLines), (0, _toConsumableArray2["default"])(lineSegs));
|
|
467
484
|
return 1; // break
|
|
468
485
|
}
|
|
469
486
|
},
|
|
@@ -482,7 +499,7 @@ export function getLinesFromItems2(moldingGroup, layer, catalog) {
|
|
|
482
499
|
return idx === id;
|
|
483
500
|
});
|
|
484
501
|
});
|
|
485
|
-
if (newLines.length > 0) MGlines = [].concat(
|
|
502
|
+
if (newLines.length > 0) MGlines = [].concat((0, _toConsumableArray2["default"])(MGlines), (0, _toConsumableArray2["default"])(newLines));
|
|
486
503
|
|
|
487
504
|
// merge the collinear linked lines to one line
|
|
488
505
|
var newMGlines = [];
|
|
@@ -507,13 +524,13 @@ export function getLinesFromItems2(moldingGroup, layer, catalog) {
|
|
|
507
524
|
return newMGlines;
|
|
508
525
|
}
|
|
509
526
|
|
|
510
|
-
/**
|
|
511
|
-
* Get the line that colinear linked with [line], and merge them to a new line
|
|
512
|
-
* @param {*} line
|
|
513
|
-
* @param {*} MGlines
|
|
514
|
-
* @returns
|
|
515
|
-
* - returns merged new line
|
|
516
|
-
* - returns filtered new line group (remove linked line from [MGlines])
|
|
527
|
+
/**
|
|
528
|
+
* Get the line that colinear linked with [line], and merge them to a new line
|
|
529
|
+
* @param {*} line
|
|
530
|
+
* @param {*} MGlines
|
|
531
|
+
* @returns
|
|
532
|
+
* - returns merged new line
|
|
533
|
+
* - returns filtered new line group (remove linked line from [MGlines])
|
|
517
534
|
*/
|
|
518
535
|
function getMergedLine(line, MGlines, cnt) {
|
|
519
536
|
try {
|
|
@@ -542,15 +559,15 @@ function getMergedLine(line, MGlines, cnt) {
|
|
|
542
559
|
x2: newMGlines[i][1].x,
|
|
543
560
|
y2: newMGlines[i][1].y
|
|
544
561
|
};
|
|
545
|
-
var rst = GeometryUtils.relationshipOfTwoOverlappedLines(srcLine, destLine);
|
|
546
|
-
if (rst.result === OVERLAP_LINK) {
|
|
562
|
+
var rst = _export.GeometryUtils.relationshipOfTwoOverlappedLines(srcLine, destLine);
|
|
563
|
+
if (rst.result === _constants.OVERLAP_LINK) {
|
|
547
564
|
var mergedLine = [{
|
|
548
565
|
x: rst.linkedLine.x1,
|
|
549
566
|
y: rst.linkedLine.y1
|
|
550
567
|
}, {
|
|
551
568
|
x: rst.linkedLine.x2,
|
|
552
569
|
y: rst.linkedLine.y2
|
|
553
|
-
},
|
|
570
|
+
}, _idBroker["default"].acquireID()];
|
|
554
571
|
mergeResult = getMergedLine(mergedLine, newMGlines.filter(function (v, idx) {
|
|
555
572
|
return idx !== i;
|
|
556
573
|
}), cnt);
|
|
@@ -566,11 +583,11 @@ function getMergedLine(line, MGlines, cnt) {
|
|
|
566
583
|
}
|
|
567
584
|
}
|
|
568
585
|
|
|
569
|
-
/**
|
|
570
|
-
* Get the contour line segments from [lineSegs]
|
|
571
|
-
* @param {*} lineSegs
|
|
572
|
-
* @param {*} otherLines
|
|
573
|
-
* @returns
|
|
586
|
+
/**
|
|
587
|
+
* Get the contour line segments from [lineSegs]
|
|
588
|
+
* @param {*} lineSegs
|
|
589
|
+
* @param {*} otherLines
|
|
590
|
+
* @returns
|
|
574
591
|
*/
|
|
575
592
|
function getTrimmedContourLineSegs(lineSegs, otherLines, cnt) {
|
|
576
593
|
try {
|
|
@@ -595,15 +612,15 @@ function getTrimmedContourLineSegs(lineSegs, otherLines, cnt) {
|
|
|
595
612
|
x2: otherLines[j][1].x,
|
|
596
613
|
y2: otherLines[j][1].y
|
|
597
614
|
};
|
|
598
|
-
var rst = GeometryUtils.relationshipOfTwoOverlappedLines(srcLine, destLine);
|
|
599
|
-
if (rst.result == OVERLAP_SAME || rst.result == OVERLAP_INCLUDED) {
|
|
615
|
+
var rst = _export.GeometryUtils.relationshipOfTwoOverlappedLines(srcLine, destLine);
|
|
616
|
+
if (rst.result == _constants.OVERLAP_SAME || rst.result == _constants.OVERLAP_INCLUDED) {
|
|
600
617
|
bContourSeg = false;
|
|
601
618
|
return 0; // break
|
|
602
|
-
} else if (rst.result == OVERLAP_SOME) {
|
|
619
|
+
} else if (rst.result == _constants.OVERLAP_SOME) {
|
|
603
620
|
var tLineSegs = getTrimmedContourLineSegs(rst.trimmedSegs, otherLines.filter(function (v, idx) {
|
|
604
621
|
return idx !== j;
|
|
605
622
|
}), cnt);
|
|
606
|
-
if (tLineSegs.length > 0) returnSegs = [].concat(
|
|
623
|
+
if (tLineSegs.length > 0) returnSegs = [].concat((0, _toConsumableArray2["default"])(returnSegs), (0, _toConsumableArray2["default"])(tLineSegs));
|
|
607
624
|
bContourSeg = false;
|
|
608
625
|
return 0; // break
|
|
609
626
|
}
|
|
@@ -619,7 +636,7 @@ function getTrimmedContourLineSegs(lineSegs, otherLines, cnt) {
|
|
|
619
636
|
}, {
|
|
620
637
|
x: lineSegs[i].x2,
|
|
621
638
|
y: lineSegs[i].y2
|
|
622
|
-
},
|
|
639
|
+
}, _idBroker["default"].acquireID()]);
|
|
623
640
|
}
|
|
624
641
|
return returnSegs;
|
|
625
642
|
} catch (e) {
|
|
@@ -627,9 +644,9 @@ function getTrimmedContourLineSegs(lineSegs, otherLines, cnt) {
|
|
|
627
644
|
return [];
|
|
628
645
|
}
|
|
629
646
|
}
|
|
630
|
-
|
|
631
|
-
var allLineRects = GeometryUtils.buildRectFromLines(layer, GeometryUtils.getAllLines(layer));
|
|
632
|
-
var items =
|
|
647
|
+
function getLinesFromItems(moldingGroup, layer, catalog) {
|
|
648
|
+
var allLineRects = _export.GeometryUtils.buildRectFromLines(layer, _export.GeometryUtils.getAllLines(layer));
|
|
649
|
+
var items = (0, _toConsumableArray2["default"])(moldingGroup.items);
|
|
633
650
|
var MGlines = getLinesOfItem(items[0], allLineRects, catalog);
|
|
634
651
|
items = sortItemsByDistance(items, items[0]);
|
|
635
652
|
var _loop7 = function _loop7() {
|
|
@@ -641,7 +658,7 @@ export function getLinesFromItems(moldingGroup, layer, catalog) {
|
|
|
641
658
|
});
|
|
642
659
|
var curItemLine = itemLines[idx];
|
|
643
660
|
if (idx > -1) {
|
|
644
|
-
if (!(GeometryUtils.samePoints(line[0], curItemLine[0]) && GeometryUtils.samePoints(line[1], curItemLine[1]) || GeometryUtils.samePoints(line[0], curItemLine[1]) && GeometryUtils.samePoints(line[1], curItemLine[0]))) {
|
|
661
|
+
if (!(_export.GeometryUtils.samePoints(line[0], curItemLine[0]) && _export.GeometryUtils.samePoints(line[1], curItemLine[1]) || _export.GeometryUtils.samePoints(line[0], curItemLine[1]) && _export.GeometryUtils.samePoints(line[1], curItemLine[0]))) {
|
|
645
662
|
var MGLine = mergeOverlappedLines(line, curItemLine);
|
|
646
663
|
temp_MGLines.push(MGLine);
|
|
647
664
|
}
|
|
@@ -668,29 +685,29 @@ export function getLinesFromItems(moldingGroup, layer, catalog) {
|
|
|
668
685
|
snapped_other_items.forEach(function (item) {
|
|
669
686
|
var itemAltitude = item.properties.get('altitude').get('_length');
|
|
670
687
|
var itemAltitudeUnit = item.properties.get('altitude').get('_unit');
|
|
671
|
-
itemAltitude = convert(itemAltitude).from(itemAltitudeUnit).to('cm');
|
|
688
|
+
itemAltitude = (0, _convertUnitsLite.convert)(itemAltitude).from(itemAltitudeUnit).to('cm');
|
|
672
689
|
var itemHeight = item.properties.get('height').get('_length');
|
|
673
690
|
var itemHeightUnit = item.properties.get('height').get('_unit');
|
|
674
|
-
itemHeight = convert(itemHeight).from(itemHeightUnit).to('cm');
|
|
691
|
+
itemHeight = (0, _convertUnitsLite.convert)(itemHeight).from(itemHeightUnit).to('cm');
|
|
675
692
|
var mgroupAltitude = items[0].properties.get('altitude').get('_length');
|
|
676
693
|
var mgroupAltitudeUnit = items[0].properties.get('altitude').get('_unit');
|
|
677
|
-
mgroupAltitude = convert(mgroupAltitude).from(mgroupAltitudeUnit).to('cm');
|
|
694
|
+
mgroupAltitude = (0, _convertUnitsLite.convert)(mgroupAltitude).from(mgroupAltitudeUnit).to('cm');
|
|
678
695
|
var mgroupHeight = items[0].properties.get('height').get('_length');
|
|
679
696
|
var mgroupHeightUnit = items[0].properties.get('height').get('_unit');
|
|
680
|
-
mgroupHeight = convert(mgroupHeight).from(mgroupHeightUnit).to('cm');
|
|
697
|
+
mgroupHeight = (0, _convertUnitsLite.convert)(mgroupHeight).from(mgroupHeightUnit).to('cm');
|
|
681
698
|
var flag = false;
|
|
682
699
|
switch (moldingGroup.location_type) {
|
|
683
|
-
case TOP_MOLDING_LOCATION:
|
|
700
|
+
case _constants.TOP_MOLDING_LOCATION:
|
|
684
701
|
flag = itemAltitude + itemHeight > mgroupAltitude + mgroupHeight;
|
|
685
702
|
break;
|
|
686
|
-
case MIDDLE_MOLDING_LOCATION:
|
|
703
|
+
case _constants.MIDDLE_MOLDING_LOCATION:
|
|
687
704
|
flag = true;
|
|
688
705
|
break;
|
|
689
|
-
case BOTTOM_MOLDING_LOCATION:
|
|
706
|
+
case _constants.BOTTOM_MOLDING_LOCATION:
|
|
690
707
|
flag = itemAltitude < mgroupAltitude;
|
|
691
708
|
break;
|
|
692
709
|
}
|
|
693
|
-
if (item.category !== 'cabinet' || ![BASE_CABINET_LAYOUTPOS, WALL_CABINET_LAYOUTPOS, TALL_CABINET_LAYOUTPOS].includes(item.layoutpos)) flag = true;
|
|
710
|
+
if (item.category !== 'cabinet' || ![_constants.BASE_CABINET_LAYOUTPOS, _constants.WALL_CABINET_LAYOUTPOS, _constants.TALL_CABINET_LAYOUTPOS].includes(item.layoutpos)) flag = true;
|
|
694
711
|
if (flag) {
|
|
695
712
|
var itemLines = getLinesOfItem(item, allLineRects, catalog);
|
|
696
713
|
var temp_MGLines = [];
|
|
@@ -700,8 +717,8 @@ export function getLinesFromItems(moldingGroup, layer, catalog) {
|
|
|
700
717
|
});
|
|
701
718
|
var curITL = itemLines[idx];
|
|
702
719
|
if (idx > -1) {
|
|
703
|
-
if (getDelta(mgl[0], mgl[1], curITL[1], curITL[0]) < EPSILON || getDelta(mgl[0], mgl[1], curITL[0], curITL[1]) < EPSILON) {
|
|
704
|
-
if (GeometryUtils.verticesDistance(mgl[0], mgl[1]) > GeometryUtils.verticesDistance(curITL[0], curITL[1])) {
|
|
720
|
+
if (getDelta(mgl[0], mgl[1], curITL[1], curITL[0]) < _constants.EPSILON || getDelta(mgl[0], mgl[1], curITL[0], curITL[1]) < _constants.EPSILON) {
|
|
721
|
+
if (_export.GeometryUtils.verticesDistance(mgl[0], mgl[1]) > _export.GeometryUtils.verticesDistance(curITL[0], curITL[1])) {
|
|
705
722
|
var MGLine = mergeOverlappedLines(mgl, curITL);
|
|
706
723
|
temp_MGLines.push(MGLine);
|
|
707
724
|
}
|
|
@@ -763,7 +780,7 @@ function getMDPoints(newMD) {
|
|
|
763
780
|
});
|
|
764
781
|
|
|
765
782
|
// get vertex points
|
|
766
|
-
var MDlines =
|
|
783
|
+
var MDlines = (0, _toConsumableArray2["default"])(newMD.lines);
|
|
767
784
|
var pointGroups = [[]];
|
|
768
785
|
var flag = 1;
|
|
769
786
|
var i = 0;
|
|
@@ -775,10 +792,10 @@ function getMDPoints(newMD) {
|
|
|
775
792
|
if (flag) {
|
|
776
793
|
var lastPoint = pointGroups[i][pointGroups[i].length - 1];
|
|
777
794
|
var res = MDlines.findIndex(function (a) {
|
|
778
|
-
return GeometryUtils.samePoints({
|
|
795
|
+
return _export.GeometryUtils.samePoints({
|
|
779
796
|
x: a[0].x - cPos.x,
|
|
780
797
|
y: a[0].y - cPos.y
|
|
781
|
-
}, lastPoint) || GeometryUtils.samePoints({
|
|
798
|
+
}, lastPoint) || _export.GeometryUtils.samePoints({
|
|
782
799
|
x: a[1].x - cPos.x,
|
|
783
800
|
y: a[1].y - cPos.y
|
|
784
801
|
}, lastPoint);
|
|
@@ -788,7 +805,7 @@ function getMDPoints(newMD) {
|
|
|
788
805
|
x: MDlines[res][0].x - cPos.x,
|
|
789
806
|
y: MDlines[res][0].y - cPos.y
|
|
790
807
|
};
|
|
791
|
-
if (GeometryUtils.samePoints(newPos, lastPoint)) {
|
|
808
|
+
if (_export.GeometryUtils.samePoints(newPos, lastPoint)) {
|
|
792
809
|
newPos = {
|
|
793
810
|
x: MDlines[res][1].x - cPos.x,
|
|
794
811
|
y: MDlines[res][1].y - cPos.y
|
|
@@ -802,10 +819,10 @@ function getMDPoints(newMD) {
|
|
|
802
819
|
} else {
|
|
803
820
|
var firstPoint = pointGroups[i][0];
|
|
804
821
|
var _res = MDlines.findIndex(function (a) {
|
|
805
|
-
return GeometryUtils.samePoints({
|
|
822
|
+
return _export.GeometryUtils.samePoints({
|
|
806
823
|
x: a[0].x - cPos.x,
|
|
807
824
|
y: a[0].y - cPos.y
|
|
808
|
-
}, firstPoint) || GeometryUtils.samePoints({
|
|
825
|
+
}, firstPoint) || _export.GeometryUtils.samePoints({
|
|
809
826
|
x: a[1].x - cPos.x,
|
|
810
827
|
y: a[1].y - cPos.y
|
|
811
828
|
}, firstPoint);
|
|
@@ -815,13 +832,13 @@ function getMDPoints(newMD) {
|
|
|
815
832
|
x: MDlines[_res][0].x - cPos.x,
|
|
816
833
|
y: MDlines[_res][0].y - cPos.y
|
|
817
834
|
};
|
|
818
|
-
if (GeometryUtils.samePoints(_newPos, firstPoint)) {
|
|
835
|
+
if (_export.GeometryUtils.samePoints(_newPos, firstPoint)) {
|
|
819
836
|
_newPos = {
|
|
820
837
|
x: MDlines[_res][1].x - cPos.x,
|
|
821
838
|
y: MDlines[_res][1].y - cPos.y
|
|
822
839
|
};
|
|
823
840
|
}
|
|
824
|
-
pointGroups[i] = [new Three.Vector2(_newPos.x, _newPos.y)].concat(
|
|
841
|
+
pointGroups[i] = [new Three.Vector2(_newPos.x, _newPos.y)].concat((0, _toConsumableArray2["default"])(pointGroups[i]));
|
|
825
842
|
MDlines.splice(_res, 1);
|
|
826
843
|
} else {
|
|
827
844
|
flag = 1;
|
|
@@ -836,18 +853,18 @@ function getMDPoints(newMD) {
|
|
|
836
853
|
}
|
|
837
854
|
var z = newMD.items[0].properties.get('altitude').get('_length');
|
|
838
855
|
var zUnit = newMD.items[0].properties.get('altitude').get('_unit') || 'cm';
|
|
839
|
-
z = convert(z).from(zUnit).to('cm');
|
|
856
|
+
z = (0, _convertUnitsLite.convert)(z).from(zUnit).to('cm');
|
|
840
857
|
var height = newMD.items[0].properties.get('height').get('_length');
|
|
841
858
|
var heightUnit = newMD.items[0].properties.get('height').get('_unit') || 'cm';
|
|
842
|
-
height = convert(height).from(heightUnit).to('cm');
|
|
859
|
+
height = (0, _convertUnitsLite.convert)(height).from(heightUnit).to('cm');
|
|
843
860
|
switch (newMD.location_type) {
|
|
844
|
-
case TOP_MOLDING_LOCATION:
|
|
861
|
+
case _constants.TOP_MOLDING_LOCATION:
|
|
845
862
|
z += height;
|
|
846
863
|
break;
|
|
847
|
-
case MIDDLE_MOLDING_LOCATION:
|
|
864
|
+
case _constants.MIDDLE_MOLDING_LOCATION:
|
|
848
865
|
z += height / 2;
|
|
849
866
|
break;
|
|
850
|
-
case BOTTOM_MOLDING_LOCATION:
|
|
867
|
+
case _constants.BOTTOM_MOLDING_LOCATION:
|
|
851
868
|
z += 0;
|
|
852
869
|
break;
|
|
853
870
|
default:
|
|
@@ -861,7 +878,7 @@ function getMDPoints(newMD) {
|
|
|
861
878
|
size: newSize
|
|
862
879
|
});
|
|
863
880
|
}
|
|
864
|
-
|
|
881
|
+
function createMonldingGroup(oldMG, layer, molding, catalog) {
|
|
865
882
|
var newMG = _objectSpread({}, oldMG);
|
|
866
883
|
newMG.molding = molding;
|
|
867
884
|
newMG.lines = getLinesFromItems2(oldMG, layer, catalog);
|