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
|
@@ -1,33 +1,60 @@
|
|
|
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.addMolding = addMolding;
|
|
7
|
+
exports.addWarningBox = addWarningBox;
|
|
8
|
+
exports.checkCabinetOverlap = checkCabinetOverlap;
|
|
9
|
+
exports.createBacksplash = createBacksplash;
|
|
10
|
+
exports.createMDFromItem = createMDFromItem;
|
|
11
|
+
exports.createWarningObject = createWarningObject;
|
|
12
|
+
exports.deleteAllMolding = deleteAllMolding;
|
|
13
|
+
exports.deleteCountertop = deleteCountertop;
|
|
14
|
+
exports.deleteMGMesh = deleteMGMesh;
|
|
15
|
+
exports.deleteSpecifiedMeshObjects = deleteSpecifiedMeshObjects;
|
|
16
|
+
exports.fVLine = void 0;
|
|
17
|
+
exports.getDistanceBetweenLineSegment = getDistanceBetweenLineSegment;
|
|
18
|
+
exports.getDistances = getDistances;
|
|
19
|
+
exports.getIntersectPoint = getIntersectPoint;
|
|
20
|
+
exports.getMeshesFromScene = getMeshesFromScene;
|
|
21
|
+
exports.getTotalDistance = getTotalDistance;
|
|
22
|
+
exports.parseData = parseData;
|
|
23
|
+
exports.removeItem = removeItem;
|
|
24
|
+
exports.removeSelItemMesh = removeSelItemMesh;
|
|
25
|
+
exports.sameSign = sameSign;
|
|
26
|
+
exports.showYelloBox = showYelloBox;
|
|
27
|
+
exports.threedfabs = threedfabs;
|
|
28
|
+
exports.tryAdjacentMD = tryAdjacentMD;
|
|
29
|
+
exports.updateDoorHandleMesh = updateDoorHandleMesh;
|
|
30
|
+
exports.updateMoldingGroupArray = updateMoldingGroupArray;
|
|
31
|
+
exports.updateScene = updateScene;
|
|
32
|
+
exports.visibleTransformBox = visibleTransformBox;
|
|
33
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/defineProperty"));
|
|
34
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/toConsumableArray"));
|
|
35
|
+
var _three = _interopRequireWildcard(require("three"));
|
|
36
|
+
var Three = _three;
|
|
37
|
+
var _gridCreator = _interopRequireDefault(require("./grid-creator"));
|
|
38
|
+
var _threeMemoryCleaner = require("./three-memory-cleaner");
|
|
39
|
+
var _constants = require("../../constants");
|
|
40
|
+
var _export = require("../../utils/export");
|
|
41
|
+
var _convertUnitsLite = require("../../utils/convert-units-lite");
|
|
42
|
+
var _geometry2 = require("../../utils/geometry");
|
|
43
|
+
var GeomUtils = _interopRequireWildcard(require("../../catalog/utils/geom-utils"));
|
|
44
|
+
var _itemLoader = require("../../catalog/utils/item-loader");
|
|
45
|
+
var _utils = require("../viewer2d/utils");
|
|
46
|
+
var _helper = require("../../utils/helper");
|
|
47
|
+
var _math = require("../../utils/math");
|
|
48
|
+
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
49
|
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; } } }; }
|
|
3
|
-
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; }
|
|
4
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5
|
-
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; }
|
|
6
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
7
|
-
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); }
|
|
8
|
-
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
9
|
-
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."); }
|
|
10
50
|
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; } }
|
|
11
|
-
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
12
|
-
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
|
13
51
|
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
|
-
|
|
16
|
-
import createGrid from "./grid-creator";
|
|
17
|
-
import { disposeObject } from "./three-memory-cleaner";
|
|
18
|
-
import { ANIMATE_STEP_MAX, ANIMATE_STEP_MIN, ARRAY_3D_MODES, ARROW_TEXT_BACKCOLOR, ARROW_TEXT_FONTFACE, ARROW_TEXT_FORECOLOR, BASE_CABINET_LAYOUTPOS, BOTTOM_MOLDING_LOCATION, DECIMAL_PLACES_2, DIFFERENT_VALUES_PATH_LENGTH, DISTANCE_EPSILON, EPSILON, MIDDLE_MOLDING_LOCATION, MODE_DRAGGING_ITEM_3D, MODE_DRAWING_ITEM_3D, MODE_IDLE, MODE_IDLE_3D, MODE_ROTATING_ITEM_3D, OBJTYPE_MESH, SHADE_DARK_PURPLE_COLOR, TOP_MOLDING_LOCATION, UNIT_CENTIMETER, WALL_CABINET_LAYOUTPOS } from "../../constants";
|
|
19
|
-
import { GeometryUtils, IDBroker, MoldingUtils } from "../../utils/export";
|
|
20
|
-
import convert from 'convert-units';
|
|
21
|
-
import { verticesDistance } from "../../utils/geometry";
|
|
22
|
-
import * as GeomUtils from "../../catalog/utils/geom-utils";
|
|
23
|
-
import { loadTexture } from "../../catalog/utils/item-loader";
|
|
24
|
-
import { returnReplaceableDeepSearchType } from "../viewer2d/utils";
|
|
25
|
-
import { animateDoor, isElevationView, isEmpty, replaceMeshesWithLineSegments, translateDrawer } from "../../utils/helper";
|
|
26
|
-
import { formatNumber } from "../../utils/math";
|
|
52
|
+
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; }
|
|
53
|
+
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; }
|
|
27
54
|
var transformBox;
|
|
28
|
-
|
|
55
|
+
var fVLine = exports.fVLine = [];
|
|
29
56
|
var scene_mode = null;
|
|
30
|
-
|
|
57
|
+
function parseData(sceneData, actions, catalog, camera, renderer, mode) {
|
|
31
58
|
var planData = {
|
|
32
59
|
catalog: catalog,
|
|
33
60
|
sceneData: sceneData
|
|
@@ -49,7 +76,7 @@ export function parseData(sceneData, actions, catalog, camera, renderer, mode) {
|
|
|
49
76
|
planData.cam.name = 'cam';
|
|
50
77
|
|
|
51
78
|
// Add a grid to the plan
|
|
52
|
-
planData.grid =
|
|
79
|
+
planData.grid = (0, _gridCreator["default"])(sceneData);
|
|
53
80
|
planData.grid.name = 'grid';
|
|
54
81
|
planData.boundingBox = new Three.Box3().setFromObject(planData.grid);
|
|
55
82
|
planData.boundingBox.name = 'boundingBox';
|
|
@@ -65,7 +92,7 @@ export function parseData(sceneData, actions, catalog, camera, renderer, mode) {
|
|
|
65
92
|
updateBoundingBox(planData, false, mode);
|
|
66
93
|
|
|
67
94
|
// if mode is elevation, build elevation scene
|
|
68
|
-
if (isElevationView(mode)) buildElevationScene(planData, mode);
|
|
95
|
+
if ((0, _helper.isElevationView)(mode)) buildElevationScene(planData, mode);
|
|
69
96
|
}
|
|
70
97
|
resolve('success');
|
|
71
98
|
});
|
|
@@ -77,7 +104,7 @@ export function parseData(sceneData, actions, catalog, camera, renderer, mode) {
|
|
|
77
104
|
|
|
78
105
|
// return planData;
|
|
79
106
|
}
|
|
80
|
-
|
|
107
|
+
function visibleTransformBox(flag) {
|
|
81
108
|
// if (transformBox instanceof Three.Mesh)
|
|
82
109
|
// transformBox.visible = flag;
|
|
83
110
|
}
|
|
@@ -102,14 +129,14 @@ var buildElevationScene = function buildElevationScene(planData, mode) {
|
|
|
102
129
|
planData.elevationGroup = elevationGroup;
|
|
103
130
|
scene.traverse(function (obj) {
|
|
104
131
|
if (obj.name == 'MainObject') {
|
|
105
|
-
replaceMeshesWithLineSegments(obj);
|
|
132
|
+
(0, _helper.replaceMeshesWithLineSegments)(obj);
|
|
106
133
|
}
|
|
107
134
|
});
|
|
108
135
|
scene.add(elevationGroup);
|
|
109
136
|
};
|
|
110
137
|
function createLayerObjects(layer, planData, sceneData, actions, catalog, mode, camera, renderer) {
|
|
111
138
|
var promises = [];
|
|
112
|
-
var moldingGroups = MoldingUtils.getAllMoldingGroups(layer);
|
|
139
|
+
var moldingGroups = _export.MoldingUtils.getAllMoldingGroups(layer);
|
|
113
140
|
planData.sceneGraph.layers[layer.id] = {
|
|
114
141
|
id: layer.id,
|
|
115
142
|
lines: {},
|
|
@@ -179,7 +206,7 @@ img2.src = '/assets/img/svg/3d_item_warning_edit.svg';
|
|
|
179
206
|
img2.onload = function () {
|
|
180
207
|
ctx.drawImage(img2, 8, 58, 34, 34);
|
|
181
208
|
};
|
|
182
|
-
|
|
209
|
+
function createWarningObject() {
|
|
183
210
|
var warningTexture = new Three.Texture(canvas);
|
|
184
211
|
warningTexture.needsUpdate = true;
|
|
185
212
|
var warningObj = new Three.Sprite(new Three.SpriteMaterial({
|
|
@@ -193,7 +220,7 @@ export function createWarningObject() {
|
|
|
193
220
|
warningObj.name = 'warningObj';
|
|
194
221
|
return warningObj;
|
|
195
222
|
}
|
|
196
|
-
|
|
223
|
+
function updateScene(planData, sceneData, oldSceneData, diffArray, actions, catalog) {
|
|
197
224
|
var _draggingItem$toJS, _filteredDiffs, _filteredDiffs2;
|
|
198
225
|
var mode = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : null;
|
|
199
226
|
var toolObj = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : null;
|
|
@@ -222,7 +249,7 @@ export function updateScene(planData, sceneData, oldSceneData, diffArray, action
|
|
|
222
249
|
});
|
|
223
250
|
//*******************************
|
|
224
251
|
//This is executed when dragging item is end and performs the updateing filteredDiffs.
|
|
225
|
-
if ((sceneData === null || sceneData === void 0 ? void 0 : sceneData.isEndDragging) === true && draggingItem && !isEmpty((_draggingItem$toJS = draggingItem.toJS) === null || _draggingItem$toJS === void 0 ? void 0 : _draggingItem$toJS.call(draggingItem)) && ((_filteredDiffs = filteredDiffs) === null || _filteredDiffs === void 0 || (_filteredDiffs = _filteredDiffs[0]) === null || _filteredDiffs === void 0 || (_filteredDiffs = _filteredDiffs.path) === null || _filteredDiffs === void 0 ? void 0 : _filteredDiffs.length) < DIFFERENT_VALUES_PATH_LENGTH && (_filteredDiffs2 = filteredDiffs) !== null && _filteredDiffs2 !== void 0 && (_filteredDiffs2 = _filteredDiffs2[0]) !== null && _filteredDiffs2 !== void 0 && (_filteredDiffs2 = _filteredDiffs2.path) !== null && _filteredDiffs2 !== void 0 && _filteredDiffs2.includes('showfg')) {
|
|
252
|
+
if ((sceneData === null || sceneData === void 0 ? void 0 : sceneData.isEndDragging) === true && draggingItem && !(0, _helper.isEmpty)((_draggingItem$toJS = draggingItem.toJS) === null || _draggingItem$toJS === void 0 ? void 0 : _draggingItem$toJS.call(draggingItem)) && ((_filteredDiffs = filteredDiffs) === null || _filteredDiffs === void 0 || (_filteredDiffs = _filteredDiffs[0]) === null || _filteredDiffs === void 0 || (_filteredDiffs = _filteredDiffs.path) === null || _filteredDiffs === void 0 ? void 0 : _filteredDiffs.length) < _constants.DIFFERENT_VALUES_PATH_LENGTH && (_filteredDiffs2 = filteredDiffs) !== null && _filteredDiffs2 !== void 0 && (_filteredDiffs2 = _filteredDiffs2[0]) !== null && _filteredDiffs2 !== void 0 && (_filteredDiffs2 = _filteredDiffs2.path) !== null && _filteredDiffs2 !== void 0 && _filteredDiffs2.includes('showfg')) {
|
|
226
253
|
var _draggingItem$getIn, _draggingItem$getIn2;
|
|
227
254
|
var layerID = (_draggingItem$getIn = draggingItem.getIn) === null || _draggingItem$getIn === void 0 ? void 0 : _draggingItem$getIn.call(draggingItem, ['layerID']);
|
|
228
255
|
var itemID = (_draggingItem$getIn2 = draggingItem.getIn) === null || _draggingItem$getIn2 === void 0 ? void 0 : _draggingItem$getIn2.call(draggingItem, ['itemID']);
|
|
@@ -318,7 +345,7 @@ export function updateScene(planData, sceneData, oldSceneData, diffArray, action
|
|
|
318
345
|
Promise.all(result).then(function (replaceValue) {
|
|
319
346
|
// if mode is elevation, build elevation scene
|
|
320
347
|
// When scene is updated, replaceValue is not empty.
|
|
321
|
-
if (isElevationView(mode) && !isEmpty(replaceValue)) buildElevationScene(planData, mode);
|
|
348
|
+
if ((0, _helper.isElevationView)(mode) && !(0, _helper.isEmpty)(replaceValue)) buildElevationScene(planData, mode);
|
|
322
349
|
resolve('successPromise');
|
|
323
350
|
});
|
|
324
351
|
});
|
|
@@ -335,22 +362,22 @@ function myAnimRotate(obj, open_doors, item, isCorner) {
|
|
|
335
362
|
animateStep = open_doors ? animateStep + 1 : animateStep - 1;
|
|
336
363
|
|
|
337
364
|
// clear interval when the opening or closing door is ended.
|
|
338
|
-
if (animateStep > ANIMATE_STEP_MAX || animateStep < ANIMATE_STEP_MIN) {
|
|
365
|
+
if (animateStep > _constants.ANIMATE_STEP_MAX || animateStep < _constants.ANIMATE_STEP_MIN) {
|
|
339
366
|
clearInterval(animate_objects[obj.name].animate_intervalID);
|
|
340
367
|
return;
|
|
341
368
|
}
|
|
342
369
|
animate_objects[obj.name].animateStep = animateStep;
|
|
343
|
-
animateDoor(animate_objects[obj.name].offset, obj, open_doors, item, isCorner, 'Opened3D');
|
|
370
|
+
(0, _helper.animateDoor)(animate_objects[obj.name].offset, obj, open_doors, item, isCorner, 'Opened3D');
|
|
344
371
|
}
|
|
345
372
|
function myAnimTranslate(obj, open_doors, item) {
|
|
346
373
|
var animateStep = animate_objects[obj.name].animateStep;
|
|
347
374
|
animateStep = open_doors ? animateStep + 1 : animateStep - 1;
|
|
348
|
-
if (animateStep > ANIMATE_STEP_MAX || animateStep < ANIMATE_STEP_MIN) {
|
|
375
|
+
if (animateStep > _constants.ANIMATE_STEP_MAX || animateStep < _constants.ANIMATE_STEP_MIN) {
|
|
349
376
|
clearInterval(animate_objects[obj.name].animate_intervalID);
|
|
350
377
|
return;
|
|
351
378
|
}
|
|
352
379
|
animate_objects[obj.name].animateStep = animateStep;
|
|
353
|
-
translateDrawer(item, obj, open_doors, 'Opened3D');
|
|
380
|
+
(0, _helper.translateDrawer)(item, obj, open_doors, 'Opened3D');
|
|
354
381
|
}
|
|
355
382
|
function replaceObject(modifiedPath, layer, planData, actions, sceneData, oldSceneData, catalog) {
|
|
356
383
|
var mode = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : null;
|
|
@@ -436,7 +463,7 @@ function replaceObject(modifiedPath, layer, planData, actions, sceneData, oldSce
|
|
|
436
463
|
case 'items':
|
|
437
464
|
var item = layer.getIn(['items', modifiedPath[4]]);
|
|
438
465
|
deleteCountertop(planData.sceneGraph.layers[layer.id].countertops, item, planData, layer);
|
|
439
|
-
var tmpMoldings =
|
|
466
|
+
var tmpMoldings = (0, _toConsumableArray2["default"])(planData.sceneGraph.layers[layer.id].moldingGroups);
|
|
440
467
|
if (catalog.getElement(item.type).updateRender3D) {
|
|
441
468
|
promises.push(updateItem(sceneData, oldSceneData, planData, layer, modifiedPath[4], modifiedPath.slice(5), catalog, actions.itemsActions, function () {
|
|
442
469
|
return removeItem(planData, layer.id, modifiedPath[4], oldSceneData.getIn(['layers', layer.id]), layer);
|
|
@@ -472,7 +499,7 @@ function replaceObject(modifiedPath, layer, planData, actions, sceneData, oldSce
|
|
|
472
499
|
}, 50);
|
|
473
500
|
removeSelItemMesh(tmpMoldings, item, planData, mode);
|
|
474
501
|
} else if (modifiedPath[keyIndex] == 'selected') {
|
|
475
|
-
var itemType = !!catalog.elements[item.type] ? catalog.elements[item.type].type : catalog.elements[returnReplaceableDeepSearchType(item.type)].type;
|
|
502
|
+
var itemType = !!catalog.elements[item.type] ? catalog.elements[item.type].type : catalog.elements[(0, _utils.returnReplaceableDeepSearchType)(item.type)].type;
|
|
476
503
|
if (value == false) {
|
|
477
504
|
item3D.children[0].children = item3D.children[0].children.filter(function (item3DElement) {
|
|
478
505
|
return item3DElement.name !== 'TransformBox' && item3DElement.name !== 'TransformGizmo';
|
|
@@ -512,17 +539,17 @@ function replaceObject(modifiedPath, layer, planData, actions, sceneData, oldSce
|
|
|
512
539
|
var posVec = new Three.Vector3(object.position.x, object.position.y, object.position.z);
|
|
513
540
|
var newAltitude = item.properties.get('altitude').get('_length');
|
|
514
541
|
var newUnit = item.properties.get('altitude').get('_unit') || 'in';
|
|
515
|
-
newAltitude = convert(newAltitude).from(newUnit).to(sceneData.unit);
|
|
542
|
+
newAltitude = (0, _convertUnitsLite.convert)(newAltitude).from(newUnit).to(sceneData.unit);
|
|
516
543
|
var newWidth = item.properties.get('width').get('_length');
|
|
517
544
|
var newWidthUnit = item.properties.get('width').get('_unit') || 'in';
|
|
518
|
-
newWidth = convert(newWidth).from(newWidthUnit).to('in');
|
|
545
|
+
newWidth = (0, _convertUnitsLite.convert)(newWidth).from(newWidthUnit).to('in');
|
|
519
546
|
var newHeight = item.properties.get('height').get('_length');
|
|
520
547
|
var newHeightUnit = item.properties.get('height').get('_unit') || 'in';
|
|
521
|
-
newHeight = convert(newHeight).from(newHeightUnit).to('in');
|
|
548
|
+
newHeight = (0, _convertUnitsLite.convert)(newHeight).from(newHeightUnit).to('in');
|
|
522
549
|
var newDepth = item.properties.get('depth').get('_length');
|
|
523
550
|
var newDepthUnit = item.properties.get('depth').get('_unit') || 'in';
|
|
524
|
-
newDepth = convert(newDepth).from(newDepthUnit).to('in');
|
|
525
|
-
var sizeinfo = !!catalog.elements[item.type] ? catalog.elements[item.type].info.sizeinfo : catalog.elements[returnReplaceableDeepSearchType(item.type)].info.sizeinfo;
|
|
551
|
+
newDepth = (0, _convertUnitsLite.convert)(newDepth).from(newDepthUnit).to('in');
|
|
552
|
+
var sizeinfo = !!catalog.elements[item.type] ? catalog.elements[item.type].info.sizeinfo : catalog.elements[(0, _utils.returnReplaceableDeepSearchType)(item.type)].info.sizeinfo;
|
|
526
553
|
object.scale.set(1 * newWidth / sizeinfo.width, 1 * newHeight / sizeinfo.height, 1 * newDepth / sizeinfo.depth);
|
|
527
554
|
object.position.set(0, 0, 0);
|
|
528
555
|
object.rotation.set(0, 0, 0);
|
|
@@ -579,10 +606,10 @@ function replaceObject(modifiedPath, layer, planData, actions, sceneData, oldSce
|
|
|
579
606
|
upObj.name = 'transUp';
|
|
580
607
|
var upwardbox = new Three.BoxHelper(upObj, 0x326780);
|
|
581
608
|
upwardbox.material.lineWidth = 0.01;
|
|
582
|
-
fVLine = [];
|
|
609
|
+
exports.fVLine = fVLine = [];
|
|
583
610
|
// let obj = new Three.Mesh(controlGeom, new Three.MeshPhongMaterial({ color: 0xffffff, side: Three.DoubleSide, colorWrite: true }));
|
|
584
611
|
// obj.name = "translateX";
|
|
585
|
-
var color = SHADE_DARK_PURPLE_COLOR;
|
|
612
|
+
var color = _constants.SHADE_DARK_PURPLE_COLOR;
|
|
586
613
|
var _mBox = new Three.Mesh(moveBox, new Three.MeshBasicMaterial({
|
|
587
614
|
color: 0xdd6699,
|
|
588
615
|
side: Three.DoubleSide,
|
|
@@ -754,7 +781,7 @@ function replaceObject(modifiedPath, layer, planData, actions, sceneData, oldSce
|
|
|
754
781
|
moveObjectChildrens.forEach(function (element) {
|
|
755
782
|
var _animate_objects$elem, _animate_objects$elem2;
|
|
756
783
|
if (((_animate_objects$elem = animate_objects[element.obj.name]) === null || _animate_objects$elem === void 0 ? void 0 : _animate_objects$elem.animateStep) === undefined) {
|
|
757
|
-
animate_objects[element.obj.name].animateStep = selectedItem.properties.open_doors ? ANIMATE_STEP_MIN : ANIMATE_STEP_MAX;
|
|
784
|
+
animate_objects[element.obj.name].animateStep = selectedItem.properties.open_doors ? _constants.ANIMATE_STEP_MIN : _constants.ANIMATE_STEP_MAX;
|
|
758
785
|
}
|
|
759
786
|
|
|
760
787
|
// clear origin Interval.
|
|
@@ -830,7 +857,7 @@ function replaceObject(modifiedPath, layer, planData, actions, sceneData, oldSce
|
|
|
830
857
|
addCountertop(planData.sceneGraph.layers[layer.id].countertops, item, planData, layer);
|
|
831
858
|
// Toggle selection should not update molding
|
|
832
859
|
if (item.category === 'cabinet' && modifiedPath[modifiedPath.length - 1] !== 'selected') {
|
|
833
|
-
planData.sceneGraph.layers[layer.id].moldingGroups = addMolding(tmpMoldings, item, planData, layer, actions.itemsActions, mode) ||
|
|
860
|
+
planData.sceneGraph.layers[layer.id].moldingGroups = addMolding(tmpMoldings, item, planData, layer, actions.itemsActions, mode) || (0, _toConsumableArray2["default"])(tmpMoldings);
|
|
834
861
|
}
|
|
835
862
|
break;
|
|
836
863
|
case 'visible':
|
|
@@ -866,7 +893,7 @@ function replaceObject(modifiedPath, layer, planData, actions, sceneData, oldSce
|
|
|
866
893
|
promise: p1
|
|
867
894
|
};
|
|
868
895
|
}
|
|
869
|
-
|
|
896
|
+
function getDistances(layer, isCalcWall) {
|
|
870
897
|
fVLine.forEach(function (line, index) {
|
|
871
898
|
getLineDistance(line, layer, isCalcWall === undefined ? false : isCalcWall, index);
|
|
872
899
|
});
|
|
@@ -926,7 +953,7 @@ function getLineDistance(obj, layer, isCalcWall, index) {
|
|
|
926
953
|
obj.geometry.attributes.position.needsUpdate = true;
|
|
927
954
|
obj.geometry.computeBoundingSphere();
|
|
928
955
|
obj.geometry.computeBoundingBox();
|
|
929
|
-
var dist = formatNumber(convert(intersects[i].distance).from('cm').to('in'), DECIMAL_PLACES_2);
|
|
956
|
+
var dist = (0, _math.formatNumber)((0, _convertUnitsLite.convert)(intersects[i].distance).from('cm').to('in'), _constants.DECIMAL_PLACES_2);
|
|
930
957
|
if (dist > 3) {
|
|
931
958
|
var _canvas = getTextCanvas(dist);
|
|
932
959
|
var wid = _canvas.width / window.innerWidth * 30;
|
|
@@ -943,7 +970,7 @@ function getLineDistance(obj, layer, isCalcWall, index) {
|
|
|
943
970
|
var textMesh = new Three.Mesh(geometry, material);
|
|
944
971
|
for (; obj.children.length != 0;) {
|
|
945
972
|
var temp = obj.children.pop();
|
|
946
|
-
disposeObject(temp);
|
|
973
|
+
(0, _threeMemoryCleaner.disposeObject)(temp);
|
|
947
974
|
}
|
|
948
975
|
textMesh.rotation.set(Math.PI / 2, Math.PI, 0);
|
|
949
976
|
// obj.add(textMesh);
|
|
@@ -969,10 +996,10 @@ function getLineDistance(obj, layer, isCalcWall, index) {
|
|
|
969
996
|
var objW = (max.x - min.x) / 100,
|
|
970
997
|
objL = (max.z - min.z) / 100;
|
|
971
998
|
var triangle = new Three.Mesh(geom, new Three.MeshBasicMaterial({
|
|
972
|
-
color: SHADE_DARK_PURPLE_COLOR
|
|
999
|
+
color: _constants.SHADE_DARK_PURPLE_COLOR
|
|
973
1000
|
}));
|
|
974
1001
|
var triangle1 = new Three.Mesh(geom, new Three.MeshBasicMaterial({
|
|
975
|
-
color: SHADE_DARK_PURPLE_COLOR
|
|
1002
|
+
color: _constants.SHADE_DARK_PURPLE_COLOR
|
|
976
1003
|
}));
|
|
977
1004
|
triangle.position.set((index < 2 ? 0 : Math.sin((index === 2 ? 1 : -1) * Math.PI / 2)) * (obj.geometry.attributes.position.array[0] + h / 4 + (index % 2 === 0 ? 0 : objW)), newVec.y, (index < 2 ? Math.cos(index * Math.PI) : 0) * (obj.geometry.attributes.position.array[2] + h / 4 + (index % 2 === 0 ? 0 : objL)));
|
|
978
1005
|
triangle1.position.set(newVec.x - (index < 2 ? 0 : Math.sin((index === 2 ? 1 : -1) * Math.PI / 2)) * h / 4, newVec.y, newVec.z - (index < 2 ? Math.cos(index * Math.PI) : 0) * h / 4);
|
|
@@ -1048,7 +1075,7 @@ function getLineDistance(obj, layer, isCalcWall, index) {
|
|
|
1048
1075
|
obj.geometry.attributes.position.array[4] = _newVec.y;
|
|
1049
1076
|
obj.geometry.attributes.position.array[5] = _newVec.z;
|
|
1050
1077
|
obj.geometry.attributes.position.needsUpdate = true;
|
|
1051
|
-
var _dist = formatNumber(distance, DECIMAL_PLACES_2);
|
|
1078
|
+
var _dist = (0, _math.formatNumber)(distance, _constants.DECIMAL_PLACES_2);
|
|
1052
1079
|
if (_dist > 3) {
|
|
1053
1080
|
var _canvas2 = getTextCanvas(_dist);
|
|
1054
1081
|
var _wid = _canvas2.width / window.innerWidth * 30;
|
|
@@ -1064,7 +1091,7 @@ function getLineDistance(obj, layer, isCalcWall, index) {
|
|
|
1064
1091
|
var _textMesh = new Three.Mesh(_geometry, _material);
|
|
1065
1092
|
for (; obj.children.length != 0;) {
|
|
1066
1093
|
var _temp = obj.children.pop();
|
|
1067
|
-
disposeObject(_temp);
|
|
1094
|
+
(0, _threeMemoryCleaner.disposeObject)(_temp);
|
|
1068
1095
|
}
|
|
1069
1096
|
_textMesh.rotation.set(Math.PI / 2, Math.PI, 0);
|
|
1070
1097
|
// obj.add(textMesh);
|
|
@@ -1087,10 +1114,10 @@ function getLineDistance(obj, layer, isCalcWall, index) {
|
|
|
1087
1114
|
var _objW = (_max.x - _min.x) / 100,
|
|
1088
1115
|
_objL = (_max.z - _min.z) / 100;
|
|
1089
1116
|
var triangle = new Three.Mesh(geom, new Three.MeshBasicMaterial({
|
|
1090
|
-
color: SHADE_DARK_PURPLE_COLOR
|
|
1117
|
+
color: _constants.SHADE_DARK_PURPLE_COLOR
|
|
1091
1118
|
}));
|
|
1092
1119
|
var triangle1 = new Three.Mesh(geom, new Three.MeshBasicMaterial({
|
|
1093
|
-
color: SHADE_DARK_PURPLE_COLOR
|
|
1120
|
+
color: _constants.SHADE_DARK_PURPLE_COLOR
|
|
1094
1121
|
}));
|
|
1095
1122
|
triangle.position.set((index < 2 ? 0 : Math.sin((index === 2 ? 1 : -1) * Math.PI / 2)) * (obj.geometry.attributes.position.array[0] + h / 4 + (index % 2 === 0 ? 0 : _objW)), _newVec.y, (index < 2 ? Math.cos(index * Math.PI) : 0) * (obj.geometry.attributes.position.array[2] + h / 4 + (index % 2 === 0 ? 0 : _objL)) - 0.02);
|
|
1096
1123
|
triangle1.position.set(_newVec.x - (index < 2 ? 0 : Math.sin((index === 2 ? 1 : -1) * Math.PI / 2)) * h / 4, _newVec.y, _newVec.z - (index < 2 ? Math.cos(index * Math.PI) : 0) * h / 4);
|
|
@@ -1130,7 +1157,7 @@ function getLineDistance(obj, layer, isCalcWall, index) {
|
|
|
1130
1157
|
obj.visible = false;
|
|
1131
1158
|
return obj;
|
|
1132
1159
|
}
|
|
1133
|
-
|
|
1160
|
+
function getIntersectPoint(opX, opY, pX, pY) {
|
|
1134
1161
|
var oA;
|
|
1135
1162
|
if (opX[1] == opX[0]) oA = null;else oA = (opY[1] - opY[0]) / (opX[1] - opX[0]);
|
|
1136
1163
|
var A;
|
|
@@ -1184,7 +1211,7 @@ function getTextCanvas(text) {
|
|
|
1184
1211
|
var ctx = canvas.getContext('2d');
|
|
1185
1212
|
var fontSize = 16;
|
|
1186
1213
|
var integral = String(text) + "''";
|
|
1187
|
-
parameters.fontName = parameters.fontName || ARROW_TEXT_FONTFACE;
|
|
1214
|
+
parameters.fontName = parameters.fontName || _constants.ARROW_TEXT_FONTFACE;
|
|
1188
1215
|
|
|
1189
1216
|
// Prepare the font to be able to measure
|
|
1190
1217
|
ctx.font = "".concat(fontSize, "px ") + parameters.fontName;
|
|
@@ -1222,7 +1249,7 @@ function getTextCanvas(text) {
|
|
|
1222
1249
|
ctx.textBaseline = parameters.baseline || 'middle';
|
|
1223
1250
|
var r = 10;
|
|
1224
1251
|
// Make the canvas transparent for simplicity
|
|
1225
|
-
ctx.fillStyle = ARROW_TEXT_BACKCOLOR;
|
|
1252
|
+
ctx.fillStyle = _constants.ARROW_TEXT_BACKCOLOR;
|
|
1226
1253
|
// ctx.fillRect(0, 0, ctx.canvas.width, ctx.canvas.height);
|
|
1227
1254
|
var w = ctx.canvas.width;
|
|
1228
1255
|
var h = ctx.canvas.height;
|
|
@@ -1238,9 +1265,9 @@ function getTextCanvas(text) {
|
|
|
1238
1265
|
ctx.arcTo(0, 0, r, 0, r);
|
|
1239
1266
|
// ctx.arcTo(w+r, h+2*r, w+r, 0, r);
|
|
1240
1267
|
ctx.fill();
|
|
1241
|
-
ctx.fillStyle = parameters.fillColor || ARROW_TEXT_FORECOLOR;
|
|
1268
|
+
ctx.fillStyle = parameters.fillColor || _constants.ARROW_TEXT_FORECOLOR;
|
|
1242
1269
|
ctx.fillText(integral, (width - textMetrics.width) / 2, height / 2);
|
|
1243
|
-
ctx.strokeStyle = parameters.strokeColor || ARROW_TEXT_FORECOLOR;
|
|
1270
|
+
ctx.strokeStyle = parameters.strokeColor || _constants.ARROW_TEXT_FORECOLOR;
|
|
1244
1271
|
ctx.strokeText(integral, (width - textMetrics.width) / 2, height / 2);
|
|
1245
1272
|
|
|
1246
1273
|
// ctx.font = `${fontSize - 5}px ` + parameters.fontName;
|
|
@@ -1301,7 +1328,7 @@ function removeObject(modifiedPath, layer, planData, actions, sceneData, oldScen
|
|
|
1301
1328
|
});
|
|
1302
1329
|
removeLine(planData, layer.id, lineID);
|
|
1303
1330
|
var mode = oldSceneData.mode;
|
|
1304
|
-
if (ARRAY_3D_MODES.includes(mode)) mode = MODE_IDLE_3D;else mode = MODE_IDLE;
|
|
1331
|
+
if (_constants.ARRAY_3D_MODES.includes(mode)) mode = _constants.MODE_IDLE_3D;else mode = _constants.MODE_IDLE;
|
|
1305
1332
|
if (modifiedPath.length > 5) {
|
|
1306
1333
|
// I removed an hole, so I should add the new line
|
|
1307
1334
|
promises.push(addLine(sceneData, planData, layer, lineID, catalog, actions.linesActions));
|
|
@@ -1346,7 +1373,7 @@ function removeHole(planData, layerId, holeID) {
|
|
|
1346
1373
|
var hole3D = planData.sceneGraph.layers[layerId].holes[holeID];
|
|
1347
1374
|
if (hole3D) {
|
|
1348
1375
|
planData.plan.remove(hole3D);
|
|
1349
|
-
disposeObject(hole3D);
|
|
1376
|
+
(0, _threeMemoryCleaner.disposeObject)(hole3D);
|
|
1350
1377
|
delete planData.sceneGraph.layers[layerId].holes[holeID];
|
|
1351
1378
|
delete planData.sceneGraph.LODs[holeID];
|
|
1352
1379
|
hole3D = null;
|
|
@@ -1365,7 +1392,7 @@ function removeLine(planData, layerId, lineID) {
|
|
|
1365
1392
|
var line3D = planData.sceneGraph.layers[layerId].lines[lineID];
|
|
1366
1393
|
if (line3D) {
|
|
1367
1394
|
planData.plan.remove(line3D);
|
|
1368
|
-
disposeObject(line3D);
|
|
1395
|
+
(0, _threeMemoryCleaner.disposeObject)(line3D);
|
|
1369
1396
|
delete planData.sceneGraph.layers[layerId].lines[lineID];
|
|
1370
1397
|
delete planData.sceneGraph.LODs[lineID];
|
|
1371
1398
|
line3D = null;
|
|
@@ -1384,7 +1411,7 @@ function removeArea(planData, layerId, areaID) {
|
|
|
1384
1411
|
var area3D = planData.sceneGraph.layers[layerId].areas[areaID];
|
|
1385
1412
|
if (area3D) {
|
|
1386
1413
|
planData.plan.remove(area3D);
|
|
1387
|
-
disposeObject(area3D);
|
|
1414
|
+
(0, _threeMemoryCleaner.disposeObject)(area3D);
|
|
1388
1415
|
delete planData.sceneGraph.layers[layerId].areas[areaID];
|
|
1389
1416
|
delete planData.sceneGraph.LODs[areaID];
|
|
1390
1417
|
area3D = null;
|
|
@@ -1392,7 +1419,7 @@ function removeArea(planData, layerId, areaID) {
|
|
|
1392
1419
|
}
|
|
1393
1420
|
planData.sceneGraph.busyResources.layers[layerId].areas[areaID] = false;
|
|
1394
1421
|
}
|
|
1395
|
-
|
|
1422
|
+
function removeItem(planData, layerId, itemID) {
|
|
1396
1423
|
var oldSceneLayer = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
|
|
1397
1424
|
var newSceneLayer = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
|
|
1398
1425
|
if (planData.sceneGraph.busyResources.layers[layerId].items[itemID]) {
|
|
@@ -1411,7 +1438,7 @@ export function removeItem(planData, layerId, itemID) {
|
|
|
1411
1438
|
var item3D = planData.sceneGraph.layers[layerId].items[itemID];
|
|
1412
1439
|
if (item3D) {
|
|
1413
1440
|
planData.plan.remove(item3D);
|
|
1414
|
-
disposeObject(item3D);
|
|
1441
|
+
(0, _threeMemoryCleaner.disposeObject)(item3D);
|
|
1415
1442
|
delete planData.sceneGraph.layers[layerId].items[itemID];
|
|
1416
1443
|
delete planData.sceneGraph.LODs[itemID];
|
|
1417
1444
|
item3D = null;
|
|
@@ -1433,7 +1460,7 @@ function removeItemWithoutItem(planData, layerId, itemID) {
|
|
|
1433
1460
|
var item3D = planData.sceneGraph.layers[layerId].items[itemID];
|
|
1434
1461
|
if (item3D) {
|
|
1435
1462
|
planData.plan.remove(item3D);
|
|
1436
|
-
disposeObject(item3D);
|
|
1463
|
+
(0, _threeMemoryCleaner.disposeObject)(item3D);
|
|
1437
1464
|
item3D = null;
|
|
1438
1465
|
updateBoundingBox(planData);
|
|
1439
1466
|
delete planData.sceneGraph.layers[layerId].items[itemID];
|
|
@@ -1494,7 +1521,7 @@ function addHole(sceneData, planData, layer, holeID, catalog, holesActions, mode
|
|
|
1494
1521
|
item.castShadow = true;
|
|
1495
1522
|
var texture;
|
|
1496
1523
|
if (name.includes('_wood')) {
|
|
1497
|
-
texture = loadTexture('/assets/img/texture/white1px.jpg');
|
|
1524
|
+
texture = (0, _itemLoader.loadTexture)('/assets/img/texture/white1px.jpg');
|
|
1498
1525
|
} else if (name.includes('_glass')) {
|
|
1499
1526
|
var material = new Three.MeshPhysicalMaterial({
|
|
1500
1527
|
roughness: 0.5,
|
|
@@ -1506,7 +1533,7 @@ function addHole(sceneData, planData, layer, holeID, catalog, holesActions, mode
|
|
|
1506
1533
|
item.material = material;
|
|
1507
1534
|
return item;
|
|
1508
1535
|
} else if (name.includes('_steel')) {
|
|
1509
|
-
texture = loadTexture('/assets/img/texture/steel.jpg');
|
|
1536
|
+
texture = (0, _itemLoader.loadTexture)('/assets/img/texture/steel.jpg');
|
|
1510
1537
|
} else if (name.includes('_glass')) {
|
|
1511
1538
|
var _material2 = new Three.MeshPhysicalMaterial({
|
|
1512
1539
|
roughness: 0.5,
|
|
@@ -1580,7 +1607,7 @@ function addHole(sceneData, planData, layer, holeID, catalog, holesActions, mode
|
|
|
1580
1607
|
}
|
|
1581
1608
|
var pivot = new Three.Object3D();
|
|
1582
1609
|
pivot.name = 'pivot';
|
|
1583
|
-
if (isElevationView(mode)) {
|
|
1610
|
+
if ((0, _helper.isElevationView)(mode)) {
|
|
1584
1611
|
var lineID = holeData.getIn(['line']);
|
|
1585
1612
|
if (planData.sceneGraph.layers['layer-1'].lines[lineID].visible) {
|
|
1586
1613
|
pivot.visible = true;
|
|
@@ -1588,7 +1615,7 @@ function addHole(sceneData, planData, layer, holeID, catalog, holesActions, mode
|
|
|
1588
1615
|
pivot.visible = false;
|
|
1589
1616
|
}
|
|
1590
1617
|
object.traverse(function (obj) {
|
|
1591
|
-
replaceMeshesWithLineSegments(obj);
|
|
1618
|
+
(0, _helper.replaceMeshesWithLineSegments)(obj);
|
|
1592
1619
|
});
|
|
1593
1620
|
}
|
|
1594
1621
|
pivot.add(object);
|
|
@@ -1682,11 +1709,11 @@ function addLine(sceneData, planData, layer, lineID, catalog, linesActions) {
|
|
|
1682
1709
|
pivot.userData.type = 'line';
|
|
1683
1710
|
|
|
1684
1711
|
// In elevation view, show(visible = true) just selected wall pivot. If not, hidden(visible = false)
|
|
1685
|
-
if (isElevationView(mode)) {
|
|
1712
|
+
if ((0, _helper.isElevationView)(mode)) {
|
|
1686
1713
|
var lineVisible;
|
|
1687
1714
|
if (line.selected) {
|
|
1688
1715
|
pivot.traverse(function (obj) {
|
|
1689
|
-
replaceMeshesWithLineSegments(obj);
|
|
1716
|
+
(0, _helper.replaceMeshesWithLineSegments)(obj);
|
|
1690
1717
|
});
|
|
1691
1718
|
lineVisible = true;
|
|
1692
1719
|
} else {
|
|
@@ -1780,7 +1807,7 @@ function addArea(sceneData, planData, layer, areaID, catalog, areaActions, mode)
|
|
|
1780
1807
|
realVec.push(vec);
|
|
1781
1808
|
});
|
|
1782
1809
|
if (vertices.includes(realVec[0]) && vertices.includes(realVec[1])) {
|
|
1783
|
-
height = convert(layer.ceilHeight).from(layer.unit).to(UNIT_CENTIMETER);
|
|
1810
|
+
height = (0, _convertUnitsLite.convert)(layer.ceilHeight).from(layer.unit).to(_constants.UNIT_CENTIMETER);
|
|
1784
1811
|
// height = data.properties.getIn(["height", "length"]);
|
|
1785
1812
|
return 1; // break
|
|
1786
1813
|
}
|
|
@@ -1788,7 +1815,7 @@ function addArea(sceneData, planData, layer, areaID, catalog, areaActions, mode)
|
|
|
1788
1815
|
for (var i = 0; i < lines.length; i++) {
|
|
1789
1816
|
if (_loop2()) break;
|
|
1790
1817
|
}
|
|
1791
|
-
ceil.translateZ(convert(layer.ceilHeight).from(layer.unit).to(UNIT_CENTIMETER));
|
|
1818
|
+
ceil.translateZ((0, _convertUnitsLite.convert)(layer.ceilHeight).from(layer.unit).to(_constants.UNIT_CENTIMETER));
|
|
1792
1819
|
pivot.name = 'pivot';
|
|
1793
1820
|
pivot.add(area3D);
|
|
1794
1821
|
pivot.add(area3D.userData.floorSupport);
|
|
@@ -1796,7 +1823,7 @@ function addArea(sceneData, planData, layer, areaID, catalog, areaActions, mode)
|
|
|
1796
1823
|
pivot.position.y = layer.altitude;
|
|
1797
1824
|
|
|
1798
1825
|
// if elevation view, show just wall - not show floor and ceil
|
|
1799
|
-
if (isElevationView(mode)) pivot.visible = false;
|
|
1826
|
+
if ((0, _helper.isElevationView)(mode)) pivot.visible = false;
|
|
1800
1827
|
planData.plan.add(pivot);
|
|
1801
1828
|
planData.sceneGraph.layers[layer.id].areas[areaID] = pivot;
|
|
1802
1829
|
// document.getElementById('setting_dialog').style.display = 'none';
|
|
@@ -1832,11 +1859,11 @@ function addItem(sceneData, planData, layer, itemID, catalog, itemsActions) {
|
|
|
1832
1859
|
console.log(item.name + 's doorStyle is null!');
|
|
1833
1860
|
return;
|
|
1834
1861
|
}
|
|
1835
|
-
if (!sceneData.loadFlag && scene_mode == MODE_DRAWING_ITEM_3D) {
|
|
1862
|
+
if (!sceneData.loadFlag && scene_mode == _constants.MODE_DRAWING_ITEM_3D) {
|
|
1836
1863
|
itemsActions.toggleLoadingCabinet();
|
|
1837
1864
|
}
|
|
1838
1865
|
var catalogElement = catalog.getElement(item.type);
|
|
1839
|
-
if (!catalogElement) catalogElement = catalog.getElement(returnReplaceableDeepSearchType(item.type));
|
|
1866
|
+
if (!catalogElement) catalogElement = catalog.getElement((0, _utils.returnReplaceableDeepSearchType)(item.type));
|
|
1840
1867
|
if (!catalogElement) return false;
|
|
1841
1868
|
return catalogElement.render3D(item, layer, sceneData, mode).then(function (item3D) {
|
|
1842
1869
|
if (item3D instanceof Three.LOD) {
|
|
@@ -1844,7 +1871,7 @@ function addItem(sceneData, planData, layer, itemID, catalog, itemsActions) {
|
|
|
1844
1871
|
}
|
|
1845
1872
|
if (rItem !== null) {
|
|
1846
1873
|
planData.plan.remove(rItem);
|
|
1847
|
-
disposeObject(rItem);
|
|
1874
|
+
(0, _threeMemoryCleaner.disposeObject)(rItem);
|
|
1848
1875
|
rItem = null;
|
|
1849
1876
|
}
|
|
1850
1877
|
var pivot = new Three.Object3D();
|
|
@@ -1887,7 +1914,7 @@ function addItem(sceneData, planData, layer, itemID, catalog, itemsActions) {
|
|
|
1887
1914
|
var opacity = layer.opacity;
|
|
1888
1915
|
if (item.selected) {
|
|
1889
1916
|
opacity = 1;
|
|
1890
|
-
fVLine = [];
|
|
1917
|
+
exports.fVLine = fVLine = [];
|
|
1891
1918
|
var TransformGizmo = item3D.children[item3D.children.length - 1];
|
|
1892
1919
|
TransformGizmo.children.forEach(function (child) {
|
|
1893
1920
|
if (child.type === 'Line' && child.geometry.attributes !== undefined) fVLine.push(child);
|
|
@@ -1933,11 +1960,11 @@ function addItem(sceneData, planData, layer, itemID, catalog, itemsActions) {
|
|
|
1933
1960
|
var r3 = itemRect.rect[3];
|
|
1934
1961
|
|
|
1935
1962
|
// it doesn't need consider distance between item's line01 (frontside - it has door) and wall
|
|
1936
|
-
var delta12 = GeometryUtils.distancePointFromLineSegment(l0, l1, (r1.x + r2.x) / 2, (r1.y + r2.y) / 2); // distance between item's line12 and wall
|
|
1937
|
-
var delta23 = GeometryUtils.distancePointFromLineSegment(l0, l1, (r2.x + r3.x) / 2, (r2.y + r3.y) / 2); // distance between item's line23 and wall
|
|
1938
|
-
var delta30 = GeometryUtils.distancePointFromLineSegment(l0, l1, (r3.x + r0.x) / 2, (r3.y + r0.y) / 2); // distance between item's line30 and wall
|
|
1963
|
+
var delta12 = _export.GeometryUtils.distancePointFromLineSegment(l0, l1, (r1.x + r2.x) / 2, (r1.y + r2.y) / 2); // distance between item's line12 and wall
|
|
1964
|
+
var delta23 = _export.GeometryUtils.distancePointFromLineSegment(l0, l1, (r2.x + r3.x) / 2, (r2.y + r3.y) / 2); // distance between item's line23 and wall
|
|
1965
|
+
var delta30 = _export.GeometryUtils.distancePointFromLineSegment(l0, l1, (r3.x + r0.x) / 2, (r3.y + r0.y) / 2); // distance between item's line30 and wall
|
|
1939
1966
|
|
|
1940
|
-
if (delta12 < DISTANCE_EPSILON || delta23 < DISTANCE_EPSILON || delta30 < DISTANCE_EPSILON) {
|
|
1967
|
+
if (delta12 < _constants.DISTANCE_EPSILON || delta23 < _constants.DISTANCE_EPSILON || delta30 < _constants.DISTANCE_EPSILON) {
|
|
1941
1968
|
itemVisible = true;
|
|
1942
1969
|
}
|
|
1943
1970
|
return itemVisible;
|
|
@@ -1951,10 +1978,10 @@ function addItem(sceneData, planData, layer, itemID, catalog, itemsActions) {
|
|
|
1951
1978
|
};
|
|
1952
1979
|
var catid = item.type;
|
|
1953
1980
|
var cat = catalog.elements[catid];
|
|
1954
|
-
if (!cat) cat = catalog.elements[returnReplaceableDeepSearchType(catid)];
|
|
1955
|
-
var width = convert(item.properties.getIn(['width', '_length'])).from('in').to(sceneData.unit);
|
|
1956
|
-
var height = convert(item.properties.getIn(['height', '_length'])).from('in').to(sceneData.unit);
|
|
1957
|
-
var depth = convert(item.properties.getIn(['depth', '_length'])).from('in').to(sceneData.unit);
|
|
1981
|
+
if (!cat) cat = catalog.elements[(0, _utils.returnReplaceableDeepSearchType)(catid)];
|
|
1982
|
+
var width = (0, _convertUnitsLite.convert)(item.properties.getIn(['width', '_length'])).from('in').to(sceneData.unit);
|
|
1983
|
+
var height = (0, _convertUnitsLite.convert)(item.properties.getIn(['height', '_length'])).from('in').to(sceneData.unit);
|
|
1984
|
+
var depth = (0, _convertUnitsLite.convert)(item.properties.getIn(['depth', '_length'])).from('in').to(sceneData.unit);
|
|
1958
1985
|
val.size = {
|
|
1959
1986
|
width: width,
|
|
1960
1987
|
height: height,
|
|
@@ -1963,24 +1990,24 @@ function addItem(sceneData, planData, layer, itemID, catalog, itemsActions) {
|
|
|
1963
1990
|
val.layoutpos = cat.info.layoutpos;
|
|
1964
1991
|
val.is_corner = cat.info.is_corner;
|
|
1965
1992
|
val.item = item;
|
|
1966
|
-
var calcrect = GeometryUtils.getCalcRectFromItem3D(val);
|
|
1993
|
+
var calcrect = _export.GeometryUtils.getCalcRectFromItem3D(val);
|
|
1967
1994
|
|
|
1968
1995
|
// In elevation view, determin if item show or not
|
|
1969
|
-
if (isElevationView(mode)) pivot.visible = getItemVisible(calcrect);
|
|
1996
|
+
if ((0, _helper.isElevationView)(mode)) pivot.visible = getItemVisible(calcrect);
|
|
1970
1997
|
planData.plan.add(pivot);
|
|
1971
1998
|
planData.sceneGraph.layers[layer.id].items[item.id] = pivot;
|
|
1972
1999
|
//In a 3D view, merge each couterTop of equal height into a single conuterTop.
|
|
1973
|
-
if (!isElevationView(mode)) {
|
|
2000
|
+
if (!(0, _helper.isElevationView)(mode)) {
|
|
1974
2001
|
addCountertop(planData.sceneGraph.layers[layer.id].countertops, item, planData, layer);
|
|
1975
2002
|
}
|
|
1976
|
-
if (bAddMolding && item.category === 'cabinet' && (isElevationView(mode) && getItemVisible(calcrect) || !isElevationView(mode))) {
|
|
2003
|
+
if (bAddMolding && item.category === 'cabinet' && ((0, _helper.isElevationView)(mode) && getItemVisible(calcrect) || !(0, _helper.isElevationView)(mode))) {
|
|
1977
2004
|
planData.sceneGraph.layers[layer.id].moldingGroups = addMolding(planData.sceneGraph.layers[layer.id].moldingGroups, item, planData, layer, itemsActions, mode) || planData.sceneGraph.layers[layer.id].moldingGroups;
|
|
1978
2005
|
}
|
|
1979
2006
|
if (pivot) {
|
|
1980
2007
|
// update the tool object's position to selected object's position
|
|
1981
2008
|
var selectedItem = planData.sceneGraph.layers[sceneData.selectedLayer].items[itemID];
|
|
1982
2009
|
var itemPos = selectedItem.position.clone();
|
|
1983
|
-
if (!isEmpty(toolObj)) {
|
|
2010
|
+
if (!(0, _helper.isEmpty)(toolObj)) {
|
|
1984
2011
|
toolObj.position.set(planData.plan.position.x + itemPos.x, selectedItem.category === 'lighting' ? -planData.plan.position.y - selectedItem.properties.get('height').get('length') : planData.plan.position.y + selectedItem.children[0].position.y, planData.plan.position.z + itemPos.z);
|
|
1985
2012
|
}
|
|
1986
2013
|
pivot.children[0].children.forEach(function (pivotElement) {
|
|
@@ -2008,7 +2035,7 @@ function addItem(sceneData, planData, layer, itemID, catalog, itemsActions) {
|
|
|
2008
2035
|
setTimeout(function () {
|
|
2009
2036
|
return getDistances(layer);
|
|
2010
2037
|
}, 100);
|
|
2011
|
-
if (!sceneData.loadFlag && scene_mode == MODE_DRAWING_ITEM_3D) {
|
|
2038
|
+
if (!sceneData.loadFlag && scene_mode == _constants.MODE_DRAWING_ITEM_3D) {
|
|
2012
2039
|
itemsActions.endLoading();
|
|
2013
2040
|
itemsActions.toggleLoadingCabinet();
|
|
2014
2041
|
}
|
|
@@ -2071,14 +2098,14 @@ function applyOpacity(object, opacity) {
|
|
|
2071
2098
|
function updateBoundingBox(planData) {
|
|
2072
2099
|
var flag = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
2073
2100
|
var mode = arguments.length > 2 ? arguments[2] : undefined;
|
|
2074
|
-
if (scene_mode == MODE_DRAWING_ITEM_3D) return;
|
|
2101
|
+
if (scene_mode == _constants.MODE_DRAWING_ITEM_3D) return;
|
|
2075
2102
|
var newBoundingBox = new Three.Box3().setFromObject(planData.plan);
|
|
2076
2103
|
if (isFinite(newBoundingBox.max.x) && isFinite(newBoundingBox.min.x) && isFinite(newBoundingBox.max.y) && isFinite(newBoundingBox.min.y) && isFinite(newBoundingBox.max.z) && isFinite(newBoundingBox.min.z)) {
|
|
2077
2104
|
var newCenter = new Three.Vector3((newBoundingBox.max.x - newBoundingBox.min.x) / 2 + newBoundingBox.min.x, (newBoundingBox.max.y - newBoundingBox.min.y) / 2 + newBoundingBox.min.y, (newBoundingBox.max.z - newBoundingBox.min.z) / 2 + newBoundingBox.min.z);
|
|
2078
2105
|
if (!flag) {
|
|
2079
2106
|
planData.plan.position.sub(newCenter);
|
|
2080
2107
|
planData.grid.position.sub(newCenter);
|
|
2081
|
-
if (isElevationView(mode)) {
|
|
2108
|
+
if ((0, _helper.isElevationView)(mode)) {
|
|
2082
2109
|
planData.cam.position.sub(newCenter);
|
|
2083
2110
|
}
|
|
2084
2111
|
}
|
|
@@ -2185,7 +2212,7 @@ function createCTFromItem(item, unit, catalog) {
|
|
|
2185
2212
|
function createCTFromItems(items, unit, catalog) {
|
|
2186
2213
|
var item0 = items[0];
|
|
2187
2214
|
var item1 = items[items.length - 1];
|
|
2188
|
-
var CTId = IDBroker.acquireID();
|
|
2215
|
+
var CTId = _export.IDBroker.acquireID();
|
|
2189
2216
|
var ct3d = null;
|
|
2190
2217
|
var catid = item0.type;
|
|
2191
2218
|
var pos = {
|
|
@@ -2199,13 +2226,13 @@ function createCTFromItems(items, unit, catalog) {
|
|
|
2199
2226
|
// let height = convert(item0.properties.getIn(['height', '_length'])).from('in').to('cm');
|
|
2200
2227
|
var width = item0.properties.get('width').get('_length');
|
|
2201
2228
|
var widthUnit = item0.properties.get('width').get('_unit') || 'cm';
|
|
2202
|
-
width = convert(width).from(widthUnit).to('cm');
|
|
2229
|
+
width = (0, _convertUnitsLite.convert)(width).from(widthUnit).to('cm');
|
|
2203
2230
|
var depth = item0.properties.get('depth').get('_length');
|
|
2204
2231
|
var depthUnit = item0.properties.get('depth').get('_unit') || 'cm';
|
|
2205
|
-
depth = convert(depth).from(depthUnit).to('cm');
|
|
2232
|
+
depth = (0, _convertUnitsLite.convert)(depth).from(depthUnit).to('cm');
|
|
2206
2233
|
var height = item0.properties.get('height').get('_length');
|
|
2207
2234
|
var heightUnit = item0.properties.get('height').get('_unit') || 'cm';
|
|
2208
|
-
height = convert(height).from(heightUnit).to('cm');
|
|
2235
|
+
height = (0, _convertUnitsLite.convert)(height).from(heightUnit).to('cm');
|
|
2209
2236
|
var size = {
|
|
2210
2237
|
width: width * items.length,
|
|
2211
2238
|
depth: depth,
|
|
@@ -2221,22 +2248,22 @@ function createCTFromItems(items, unit, catalog) {
|
|
|
2221
2248
|
size: size
|
|
2222
2249
|
};
|
|
2223
2250
|
}
|
|
2224
|
-
|
|
2225
|
-
var MDId = IDBroker.acquireID();
|
|
2251
|
+
function createMDFromItem(item, lines, molding) {
|
|
2252
|
+
var MDId = _export.IDBroker.acquireID();
|
|
2226
2253
|
var z = item.properties.get('altitude').get('_length');
|
|
2227
2254
|
var zUnit = item.properties.get('altitude').get('_unit') || 'cm';
|
|
2228
|
-
z = convert(z).from(zUnit).to('cm');
|
|
2255
|
+
z = (0, _convertUnitsLite.convert)(z).from(zUnit).to('cm');
|
|
2229
2256
|
var height = item.properties.get('height').get('_length');
|
|
2230
2257
|
var heightUnit = item.properties.get('height').get('_unit') || 'cm';
|
|
2231
|
-
height = convert(height).from(heightUnit).to('cm');
|
|
2258
|
+
height = (0, _convertUnitsLite.convert)(height).from(heightUnit).to('cm');
|
|
2232
2259
|
switch (molding.location_type) {
|
|
2233
|
-
case TOP_MOLDING_LOCATION:
|
|
2260
|
+
case _constants.TOP_MOLDING_LOCATION:
|
|
2234
2261
|
z += height;
|
|
2235
2262
|
break;
|
|
2236
|
-
case MIDDLE_MOLDING_LOCATION:
|
|
2263
|
+
case _constants.MIDDLE_MOLDING_LOCATION:
|
|
2237
2264
|
z += height / 2;
|
|
2238
2265
|
break;
|
|
2239
|
-
case BOTTOM_MOLDING_LOCATION:
|
|
2266
|
+
case _constants.BOTTOM_MOLDING_LOCATION:
|
|
2240
2267
|
z += 0;
|
|
2241
2268
|
break;
|
|
2242
2269
|
default:
|
|
@@ -2272,7 +2299,7 @@ function tryAdjacent(ct1, ct2) {
|
|
|
2272
2299
|
if (ct1.rotRad != ct2.rotRad) return false;
|
|
2273
2300
|
log('ct1', ct1.pos.x, ct1.pos.y, ct1.size.width);
|
|
2274
2301
|
log('ct2', ct2.pos.x, ct2.pos.y, ct2.size.width);
|
|
2275
|
-
var dist = GeometryUtils.verticesDistance(ct1.pos, ct2.pos);
|
|
2302
|
+
var dist = _export.GeometryUtils.verticesDistance(ct1.pos, ct2.pos);
|
|
2276
2303
|
var totalwidth = ct1.size.width + ct2.size.width;
|
|
2277
2304
|
log('epsilon', dist, totalwidth, Math.abs(2 * dist - totalwidth));
|
|
2278
2305
|
if (Math.abs(2 * dist - totalwidth) / totalwidth > 1e-3) return false;
|
|
@@ -2286,8 +2313,8 @@ function tryAdjacent(ct1, ct2) {
|
|
|
2286
2313
|
depth: ct1.size.depth,
|
|
2287
2314
|
height: ct1.size.height
|
|
2288
2315
|
};
|
|
2289
|
-
var CTId = IDBroker.acquireID();
|
|
2290
|
-
var items = GeometryUtils.compareVertices(ct1.pos, ct2.pos) > 0 ? [].concat(
|
|
2316
|
+
var CTId = _export.IDBroker.acquireID();
|
|
2317
|
+
var items = _export.GeometryUtils.compareVertices(ct1.pos, ct2.pos) > 0 ? [].concat((0, _toConsumableArray2["default"])(ct1.items), (0, _toConsumableArray2["default"])(ct2.items)) : [].concat((0, _toConsumableArray2["default"])(ct2.items), (0, _toConsumableArray2["default"])(ct1.items));
|
|
2291
2318
|
var ct3d = null;
|
|
2292
2319
|
var catid = ct1.catid;
|
|
2293
2320
|
return {
|
|
@@ -2302,17 +2329,17 @@ function tryAdjacent(ct1, ct2) {
|
|
|
2302
2329
|
}
|
|
2303
2330
|
function isParallelLines(line1, line2) {
|
|
2304
2331
|
var isParallel = false;
|
|
2305
|
-
if (Math.abs(line1[0].y - line1[1].y) <= EPSILON && Math.abs(line2[0].y - line2[1].y) <= EPSILON) isParallel = true;
|
|
2306
|
-
if (Math.abs(line1[0].x - line1[1].x) <= EPSILON && Math.abs(line2[0].x - line2[1].x) <= EPSILON) isParallel = true;
|
|
2307
|
-
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;
|
|
2332
|
+
if (Math.abs(line1[0].y - line1[1].y) <= _constants.EPSILON && Math.abs(line2[0].y - line2[1].y) <= _constants.EPSILON) isParallel = true;
|
|
2333
|
+
if (Math.abs(line1[0].x - line1[1].x) <= _constants.EPSILON && Math.abs(line2[0].x - line2[1].x) <= _constants.EPSILON) isParallel = true;
|
|
2334
|
+
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;
|
|
2308
2335
|
if (isParallel) {
|
|
2309
2336
|
return true;
|
|
2310
2337
|
}
|
|
2311
2338
|
return false;
|
|
2312
2339
|
}
|
|
2313
|
-
|
|
2340
|
+
function tryAdjacentMD(md1, md2, molding) {
|
|
2314
2341
|
log('----tryAdjacent', md1.id, md2.id);
|
|
2315
|
-
if (Math.abs(md1.pos.z - md2.pos.z) > EPSILON) return false;
|
|
2342
|
+
if (Math.abs(md1.pos.z - md2.pos.z) > _constants.EPSILON) return false;
|
|
2316
2343
|
var id1 = md1.items[0].doorStyle.hasOwnProperty('id') ? md1.items[0].doorStyle.id : md1.items[0].doorStyle.toJS().id,
|
|
2317
2344
|
id2 = md2.items[0].doorStyle.hasOwnProperty('id') ? md2.items[0].doorStyle.id : md2.items[0].doorStyle.toJS().id;
|
|
2318
2345
|
if (id1 !== id2) return false;
|
|
@@ -2328,30 +2355,30 @@ export function tryAdjacentMD(md1, md2, molding) {
|
|
|
2328
2355
|
}) === -1) return false;
|
|
2329
2356
|
// is parallel two lines
|
|
2330
2357
|
if (isParallelLines(line1, line2)) {
|
|
2331
|
-
var disLine1 = GeometryUtils.verticesDistance(line1[0], line1[1]);
|
|
2332
|
-
var disLine2 = GeometryUtils.verticesDistance(line2[0], line2[1]);
|
|
2333
|
-
if (GeometryUtils.sameMDistances(GeometryUtils.verticesDistance(line2[0], line1[0]) + GeometryUtils.verticesDistance(line1[1], line2[1]), Math.abs(disLine2 - disLine1))) {
|
|
2358
|
+
var disLine1 = _export.GeometryUtils.verticesDistance(line1[0], line1[1]);
|
|
2359
|
+
var disLine2 = _export.GeometryUtils.verticesDistance(line2[0], line2[1]);
|
|
2360
|
+
if (_export.GeometryUtils.sameMDistances(_export.GeometryUtils.verticesDistance(line2[0], line1[0]) + _export.GeometryUtils.verticesDistance(line1[1], line2[1]), Math.abs(disLine2 - disLine1))) {
|
|
2334
2361
|
newLines = newLines.filter(function (a) {
|
|
2335
2362
|
return !(a[2] === line1[2] || a[2] === line2[2]);
|
|
2336
2363
|
});
|
|
2337
|
-
if (!GeometryUtils.sameMPoints(line1[0], line2[0])) newLines.push([line1[0], line2[0], IDBroker.acquireID()]);
|
|
2338
|
-
if (!GeometryUtils.sameMPoints(line1[1], line2[1])) newLines.push([line1[1], line2[1], IDBroker.acquireID()]);
|
|
2364
|
+
if (!_export.GeometryUtils.sameMPoints(line1[0], line2[0])) newLines.push([line1[0], line2[0], _export.IDBroker.acquireID()]);
|
|
2365
|
+
if (!_export.GeometryUtils.sameMPoints(line1[1], line2[1])) newLines.push([line1[1], line2[1], _export.IDBroker.acquireID()]);
|
|
2339
2366
|
isMerge = true;
|
|
2340
2367
|
return false;
|
|
2341
2368
|
}
|
|
2342
|
-
if (GeometryUtils.sameMDistances(GeometryUtils.verticesDistance(line2[0], line1[1]) + GeometryUtils.verticesDistance(line1[0], line2[1]), Math.abs(disLine2 - disLine1))) {
|
|
2369
|
+
if (_export.GeometryUtils.sameMDistances(_export.GeometryUtils.verticesDistance(line2[0], line1[1]) + _export.GeometryUtils.verticesDistance(line1[0], line2[1]), Math.abs(disLine2 - disLine1))) {
|
|
2343
2370
|
newLines = newLines.filter(function (a) {
|
|
2344
2371
|
return !(a[2] === line1[2] || a[2] === line2[2]);
|
|
2345
2372
|
});
|
|
2346
|
-
if (!GeometryUtils.sameMPoints(line1[1], line2[0])) newLines.push([line1[1], line2[0], IDBroker.acquireID()]);
|
|
2347
|
-
if (!GeometryUtils.sameMPoints(line1[0], line2[1])) newLines.push([line1[0], line2[1], IDBroker.acquireID()]);
|
|
2373
|
+
if (!_export.GeometryUtils.sameMPoints(line1[1], line2[0])) newLines.push([line1[1], line2[0], _export.IDBroker.acquireID()]);
|
|
2374
|
+
if (!_export.GeometryUtils.sameMPoints(line1[0], line2[1])) newLines.push([line1[0], line2[1], _export.IDBroker.acquireID()]);
|
|
2348
2375
|
isMerge = true;
|
|
2349
2376
|
return false;
|
|
2350
2377
|
}
|
|
2351
2378
|
var samePointNum = -1,
|
|
2352
2379
|
i = 0;
|
|
2353
2380
|
while (i < 4 && samePointNum === -1) {
|
|
2354
|
-
if (GeometryUtils.sameMPoints(line1[Math.floor(i / 2)], line2[i % 2]) && GeometryUtils.sameMDistances(disLine1 + disLine2, GeometryUtils.verticesDistance(line1[Math.floor((3 - i) / 2)], line2[(3 - i) % 2]))) {
|
|
2381
|
+
if (_export.GeometryUtils.sameMPoints(line1[Math.floor(i / 2)], line2[i % 2]) && _export.GeometryUtils.sameMDistances(disLine1 + disLine2, _export.GeometryUtils.verticesDistance(line1[Math.floor((3 - i) / 2)], line2[(3 - i) % 2]))) {
|
|
2355
2382
|
samePointNum = 3 - i;
|
|
2356
2383
|
} else {
|
|
2357
2384
|
i++;
|
|
@@ -2361,14 +2388,14 @@ export function tryAdjacentMD(md1, md2, molding) {
|
|
|
2361
2388
|
newLines = newLines.filter(function (a) {
|
|
2362
2389
|
return !(a[2] === line1[2] || a[2] === line2[2]);
|
|
2363
2390
|
});
|
|
2364
|
-
newLines.push([_objectSpread({}, line1[Math.floor(samePointNum / 2)]), _objectSpread({}, line2[samePointNum % 2]), IDBroker.acquireID()]);
|
|
2391
|
+
newLines.push([_objectSpread({}, line1[Math.floor(samePointNum / 2)]), _objectSpread({}, line2[samePointNum % 2]), _export.IDBroker.acquireID()]);
|
|
2365
2392
|
isMerge = true;
|
|
2366
2393
|
return false;
|
|
2367
2394
|
}
|
|
2368
2395
|
var pointNum = -1,
|
|
2369
2396
|
k = 0;
|
|
2370
2397
|
while (k < 4 && pointNum === -1) {
|
|
2371
|
-
if (GeometryUtils.sameMDistances(GeometryUtils.verticesDistance(line1[Math.floor(k / 2)], line2[k % 2]) + GeometryUtils.verticesDistance(line1[1 - Math.floor(k / 2)], line2[k % 2]), disLine1) && GeometryUtils.sameMDistances(GeometryUtils.verticesDistance(line1[1 - Math.floor(k / 2)], line2[k % 2]) + GeometryUtils.verticesDistance(line1[1 - Math.floor(k / 2)], line2[1 - k % 2]), disLine2)) {
|
|
2398
|
+
if (_export.GeometryUtils.sameMDistances(_export.GeometryUtils.verticesDistance(line1[Math.floor(k / 2)], line2[k % 2]) + _export.GeometryUtils.verticesDistance(line1[1 - Math.floor(k / 2)], line2[k % 2]), disLine1) && _export.GeometryUtils.sameMDistances(_export.GeometryUtils.verticesDistance(line1[1 - Math.floor(k / 2)], line2[k % 2]) + _export.GeometryUtils.verticesDistance(line1[1 - Math.floor(k / 2)], line2[1 - k % 2]), disLine2)) {
|
|
2372
2399
|
pointNum = k;
|
|
2373
2400
|
} else {
|
|
2374
2401
|
k++;
|
|
@@ -2381,12 +2408,12 @@ export function tryAdjacentMD(md1, md2, molding) {
|
|
|
2381
2408
|
if (!newLines.length) return _objectSpread({}, md2);
|
|
2382
2409
|
if (!isMerge) return false;
|
|
2383
2410
|
return {
|
|
2384
|
-
id: IDBroker.acquireID(),
|
|
2385
|
-
items: [].concat(
|
|
2411
|
+
id: _export.IDBroker.acquireID(),
|
|
2412
|
+
items: [].concat((0, _toConsumableArray2["default"])(md2.items.filter(function (item) {
|
|
2386
2413
|
return md1.items.findIndex(function (it) {
|
|
2387
2414
|
return it.id === item.id;
|
|
2388
2415
|
}) === -1;
|
|
2389
|
-
})),
|
|
2416
|
+
})), (0, _toConsumableArray2["default"])(md1.items)),
|
|
2390
2417
|
meshes: [],
|
|
2391
2418
|
pos: md1.pos,
|
|
2392
2419
|
size: md1.size,
|
|
@@ -2402,9 +2429,9 @@ function showItemCT(item, CT, visible, planData, layer) {
|
|
|
2402
2429
|
child.visible = visible;
|
|
2403
2430
|
if (child.material.map === null) {
|
|
2404
2431
|
var normalMap = item.counterTop.uri;
|
|
2405
|
-
var interiortexture = loadTexture(normalMap);
|
|
2432
|
+
var interiortexture = (0, _itemLoader.loadTexture)(normalMap);
|
|
2406
2433
|
applyTexture(child.material, interiortexture, 100, 100);
|
|
2407
|
-
child.material.color = new Color(1, 1, 1);
|
|
2434
|
+
child.material.color = new _three.Color(1, 1, 1);
|
|
2408
2435
|
return;
|
|
2409
2436
|
}
|
|
2410
2437
|
child.material.map.repeat.x = 1;
|
|
@@ -2437,7 +2464,7 @@ function getDoorStyleMaterial(items, planData, layer, name) {
|
|
|
2437
2464
|
var door_mesh = null;
|
|
2438
2465
|
if (!item3D) return undefined;
|
|
2439
2466
|
item3D.traverse(function (child) {
|
|
2440
|
-
if (!door_mesh && !child.name.includes('countertop') && !child.name.includes('_interior_') && !child.name.includes('handle') && child.type === OBJTYPE_MESH) {
|
|
2467
|
+
if (!door_mesh && !child.name.includes('countertop') && !child.name.includes('_interior_') && !child.name.includes('handle') && child.type === _constants.OBJTYPE_MESH) {
|
|
2441
2468
|
door_mesh = child;
|
|
2442
2469
|
}
|
|
2443
2470
|
});
|
|
@@ -2487,7 +2514,7 @@ function addCTMesh(countertop, planData, layer) {
|
|
|
2487
2514
|
var unit_width = countertop.items.find(function (ct) {
|
|
2488
2515
|
return !ct.type.includes('Dishwasher') && !ct.type.includes('BF');
|
|
2489
2516
|
}).properties.get('width').get('_unit') || 'cm';
|
|
2490
|
-
width = convert(width).from(unit_width).to('cm');
|
|
2517
|
+
width = (0, _convertUnitsLite.convert)(width).from(unit_width).to('cm');
|
|
2491
2518
|
pivotMat.scale(new Three.Vector3(countertop.size.width / width, 1, 1));
|
|
2492
2519
|
var finalMat = objMat.premultiply(pivotMat);
|
|
2493
2520
|
_ct3d.applyMatrix4(finalMat);
|
|
@@ -2516,7 +2543,7 @@ function moldingVertices(mPointGroup, mdGeo, MDV, model, svg_width, svg_height,
|
|
|
2516
2543
|
|
|
2517
2544
|
// Point O
|
|
2518
2545
|
var o = new Three.Vector2(0, 0);
|
|
2519
|
-
if (GeometryUtils.samePoints(pointGroup[0], pointGroup[length - 1])) {
|
|
2546
|
+
if (_export.GeometryUtils.samePoints(pointGroup[0], pointGroup[length - 1])) {
|
|
2520
2547
|
pointGroup = pointGroup.slice(0, length - 1);
|
|
2521
2548
|
length--;
|
|
2522
2549
|
isSnap = false;
|
|
@@ -2685,7 +2712,7 @@ var assignUVsA = function assignUVsA(geometry) {
|
|
|
2685
2712
|
/*
|
|
2686
2713
|
Remove specified type of 3d object easily
|
|
2687
2714
|
*/
|
|
2688
|
-
|
|
2715
|
+
function deleteSpecifiedMeshObjects(type) {
|
|
2689
2716
|
var childLen = planData.plan.children.length;
|
|
2690
2717
|
var children = [];
|
|
2691
2718
|
for (var i = 0; i < childLen; i++) {
|
|
@@ -2693,18 +2720,18 @@ export function deleteSpecifiedMeshObjects(type) {
|
|
|
2693
2720
|
}
|
|
2694
2721
|
planData.plan.children = children;
|
|
2695
2722
|
}
|
|
2696
|
-
|
|
2723
|
+
function getMeshesFromScene() {
|
|
2697
2724
|
var childLen = planData.plan.children.length;
|
|
2698
2725
|
var children = [];
|
|
2699
2726
|
for (var i = 0; i < childLen; i++) {
|
|
2700
|
-
if (planData.plan.children[i].type == OBJTYPE_MESH) children.push(planData.plan.children[i]);
|
|
2727
|
+
if (planData.plan.children[i].type == _constants.OBJTYPE_MESH) children.push(planData.plan.children[i]);
|
|
2701
2728
|
}
|
|
2702
2729
|
return children;
|
|
2703
2730
|
}
|
|
2704
|
-
|
|
2731
|
+
function threedfabs(a) {
|
|
2705
2732
|
return a > 0 ? a : -a;
|
|
2706
2733
|
}
|
|
2707
|
-
|
|
2734
|
+
function getDistanceBetweenLineSegment(pos1, pos2, pos3, pos4) {
|
|
2708
2735
|
if (pos1.x == pos2.x && pos3.x == pos4.x) return pos3.x - pos1.x;else if (pos1.y == pos2.y && pos3.y == pos4.y) return pos3.y - pos1.y;else return -1;
|
|
2709
2736
|
}
|
|
2710
2737
|
|
|
@@ -2713,7 +2740,7 @@ export function getDistanceBetweenLineSegment(pos1, pos2, pos3, pos4) {
|
|
|
2713
2740
|
* @param _item
|
|
2714
2741
|
* @returns true if it's not suitable.
|
|
2715
2742
|
*/
|
|
2716
|
-
|
|
2743
|
+
function showYelloBox(_item) {
|
|
2717
2744
|
var _doorStyle;
|
|
2718
2745
|
var doorStyle = _item === null || _item === void 0 ? void 0 : _item.doorStyle;
|
|
2719
2746
|
|
|
@@ -2736,7 +2763,7 @@ function isSimilar(a, b) {
|
|
|
2736
2763
|
if (threedfabs(a - b) <= 0.01) return 1;
|
|
2737
2764
|
return 0;
|
|
2738
2765
|
}
|
|
2739
|
-
|
|
2766
|
+
function sameSign(pos1, pos2, pos3) {
|
|
2740
2767
|
var ch1 = 0.0;
|
|
2741
2768
|
var ch2 = 1.0;
|
|
2742
2769
|
if (isSimilar(pos1.x, pos2.x) && isSimilar(pos1.x, pos3.x)) {
|
|
@@ -2750,10 +2777,10 @@ export function sameSign(pos1, pos2, pos3) {
|
|
|
2750
2777
|
if (ch1 * ch2 >= 0) return 1;
|
|
2751
2778
|
return 0;
|
|
2752
2779
|
}
|
|
2753
|
-
|
|
2780
|
+
function getTotalDistance(pos, rect) {
|
|
2754
2781
|
var sum = 0;
|
|
2755
2782
|
for (var i = 0; i < rect.length; i++) {
|
|
2756
|
-
sum += verticesDistance(pos, rect[i]);
|
|
2783
|
+
sum += (0, _geometry2.verticesDistance)(pos, rect[i]);
|
|
2757
2784
|
}
|
|
2758
2785
|
return sum;
|
|
2759
2786
|
}
|
|
@@ -2765,7 +2792,7 @@ var applyTexture = function applyTexture(material, texture, length, height) {
|
|
|
2765
2792
|
material.map.wrapT = Three.RepeatWrapping;
|
|
2766
2793
|
material.map.repeat.set(length * 0.01, height * 0.01);
|
|
2767
2794
|
if (texture.normal) {
|
|
2768
|
-
material.normalMap = loadTexture(texture.normal.uri);
|
|
2795
|
+
material.normalMap = (0, _itemLoader.loadTexture)(texture.normal.uri);
|
|
2769
2796
|
material.normalScale = new Vector2(texture.normal.normalScaleX, texture.normal.normalScaleY);
|
|
2770
2797
|
material.normalMap.wrapS = Three.RepeatWrapping;
|
|
2771
2798
|
material.normalMap.wrapT = Three.RepeatWrapping;
|
|
@@ -2782,7 +2809,7 @@ var applyTexture = function applyTexture(material, texture, length, height) {
|
|
|
2782
2809
|
* @param {{boundingBox:Box3,catalog:Catalog,grid: Object3D,plan: Object3D,sceneData: Scene,sceneGraph}} planData
|
|
2783
2810
|
* @param {Scene} scene
|
|
2784
2811
|
*/
|
|
2785
|
-
|
|
2812
|
+
function createBacksplash(item, layer, planData, scene) {
|
|
2786
2813
|
var sceneGraph = planData.sceneGraph;
|
|
2787
2814
|
var selectedLayer = planData.sceneData.selectedLayer;
|
|
2788
2815
|
/**
|
|
@@ -2810,7 +2837,7 @@ export function createBacksplash(item, layer, planData, scene) {
|
|
|
2810
2837
|
|
|
2811
2838
|
var i,
|
|
2812
2839
|
wallItems = [];
|
|
2813
|
-
var allWallItems = GeometryUtils.getAllItemSpecified(scene, planData.catalog, WALL_CABINET_LAYOUTPOS);
|
|
2840
|
+
var allWallItems = _export.GeometryUtils.getAllItemSpecified(scene, planData.catalog, _constants.WALL_CABINET_LAYOUTPOS);
|
|
2814
2841
|
for (i = 0; i < allWallItems.others.length; i++) wallItems.push(allWallItems.others[i]);
|
|
2815
2842
|
if (allWallItems.cur) wallItems.push(allWallItems.cur);
|
|
2816
2843
|
|
|
@@ -2818,7 +2845,7 @@ export function createBacksplash(item, layer, planData, scene) {
|
|
|
2818
2845
|
|
|
2819
2846
|
var altitude = item.itemInfo.properties.get('altitude').get('_length');
|
|
2820
2847
|
var altitudeUnit = item.itemInfo.properties.get('altitude').get('_unit') || 'cm';
|
|
2821
|
-
altitude = convert(altitude).from(altitudeUnit).to('cm');
|
|
2848
|
+
altitude = (0, _convertUnitsLite.convert)(altitude).from(altitudeUnit).to('cm');
|
|
2822
2849
|
var thickness = 1,
|
|
2823
2850
|
/** Height --- altitude */depth;
|
|
2824
2851
|
|
|
@@ -2833,7 +2860,7 @@ export function createBacksplash(item, layer, planData, scene) {
|
|
|
2833
2860
|
wallItems.map(function (wallItem) {
|
|
2834
2861
|
var altitude = wallItem.itemInfo.properties.get('altitude').get('_length');
|
|
2835
2862
|
var altitudeUnit = wallItem.itemInfo.properties.get('altitude').get('_unit') || 'cm';
|
|
2836
|
-
altitude = convert(altitude).from(altitudeUnit).to('cm');
|
|
2863
|
+
altitude = (0, _convertUnitsLite.convert)(altitude).from(altitudeUnit).to('cm');
|
|
2837
2864
|
altItems.push({
|
|
2838
2865
|
x: wallItem.pos.x,
|
|
2839
2866
|
width: wallItem.size.width,
|
|
@@ -2929,7 +2956,7 @@ export function createBacksplash(item, layer, planData, scene) {
|
|
|
2929
2956
|
metalness: texture.metalness,
|
|
2930
2957
|
roughness: texture.roughness
|
|
2931
2958
|
});
|
|
2932
|
-
var interiortexture = loadTexture(texture.uri);
|
|
2959
|
+
var interiortexture = (0, _itemLoader.loadTexture)(texture.uri);
|
|
2933
2960
|
applyTexture(areaMaterial, interiortexture, splashWidth * 1.5, splashHeight * 1.5);
|
|
2934
2961
|
|
|
2935
2962
|
// Make geometry
|
|
@@ -2942,9 +2969,9 @@ export function createBacksplash(item, layer, planData, scene) {
|
|
|
2942
2969
|
backsplash.position.y = itemToSave.info.posY;
|
|
2943
2970
|
backsplash.position.z = itemToSave.info.posZ;
|
|
2944
2971
|
backsplash.rotation.y = itemToSave.info.rotY;
|
|
2945
|
-
var allLines = GeometryUtils.getAllLines(layer);
|
|
2946
|
-
var allLineRects = GeometryUtils.buildRectFromLines(layer, allLines);
|
|
2947
|
-
if (item.is_corner && GeometryUtils.isSnappedSideLine(item, allLineRects)) {
|
|
2972
|
+
var allLines = _export.GeometryUtils.getAllLines(layer);
|
|
2973
|
+
var allLineRects = _export.GeometryUtils.buildRectFromLines(layer, allLines);
|
|
2974
|
+
if (item.is_corner && _export.GeometryUtils.isSnappedSideLine(item, allLineRects)) {
|
|
2948
2975
|
// corner cabinet item.itemInfo.getIn(["cabinet_category"]) === "Corner Base Cabinets"
|
|
2949
2976
|
var geometry1 = new Three.BoxGeometry(splashWidth, splashHeight, splashDepth);
|
|
2950
2977
|
// Make backsplash mesh
|
|
@@ -2954,7 +2981,7 @@ export function createBacksplash(item, layer, planData, scene) {
|
|
|
2954
2981
|
backsplash1.position.y = posY1;
|
|
2955
2982
|
backsplash1.position.z = posZ1;
|
|
2956
2983
|
backsplash1.rotation.y = rotY1;
|
|
2957
|
-
var newBacksplash = new Group();
|
|
2984
|
+
var newBacksplash = new _three.Group();
|
|
2958
2985
|
newBacksplash.add(backsplash);
|
|
2959
2986
|
newBacksplash.add(backsplash1);
|
|
2960
2987
|
backsplash = newBacksplash;
|
|
@@ -2970,7 +2997,7 @@ export function createBacksplash(item, layer, planData, scene) {
|
|
|
2970
2997
|
if (index < 0) {
|
|
2971
2998
|
backsplashes.push(itemToSave);
|
|
2972
2999
|
} else {
|
|
2973
|
-
disposeObject(backsplashes[index].backsplash);
|
|
3000
|
+
(0, _threeMemoryCleaner.disposeObject)(backsplashes[index].backsplash);
|
|
2974
3001
|
backsplashes.splice(index, 1, itemToSave);
|
|
2975
3002
|
}
|
|
2976
3003
|
}
|
|
@@ -2983,7 +3010,7 @@ function addMGMesh(molding, planData, layer) {
|
|
|
2983
3010
|
var flag = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
2984
3011
|
var point = [];
|
|
2985
3012
|
var data = molding === null || molding === void 0 || (_molding$molding = molding.molding) === null || _molding$molding === void 0 ? void 0 : _molding$molding.data;
|
|
2986
|
-
if (isEmpty(data)) return;
|
|
3013
|
+
if ((0, _helper.isEmpty)(data)) return;
|
|
2987
3014
|
var paths = data.paths,
|
|
2988
3015
|
svg_width = data.svg_width,
|
|
2989
3016
|
svg_height = data.svg_height;
|
|
@@ -3002,7 +3029,7 @@ function addMGMesh(molding, planData, layer) {
|
|
|
3002
3029
|
_addMGMesh(molding, planData, layer, point, svg_width, svg_height, flag);
|
|
3003
3030
|
}
|
|
3004
3031
|
var isBaseCabinet = function isBaseCabinet(item) {
|
|
3005
|
-
return item.layoutpos === BASE_CABINET_LAYOUTPOS;
|
|
3032
|
+
return item.layoutpos === _constants.BASE_CABINET_LAYOUTPOS;
|
|
3006
3033
|
};
|
|
3007
3034
|
|
|
3008
3035
|
/**
|
|
@@ -3025,24 +3052,24 @@ function _addMGMesh(molding, planData, layer, data, svg_width, svg_height, flag)
|
|
|
3025
3052
|
var length = data.length; //point array
|
|
3026
3053
|
var temp_unit = child.height_unit;
|
|
3027
3054
|
if (temp_unit === 'inch') {
|
|
3028
|
-
child.height = convert(child.height).from('in').to('cm');
|
|
3055
|
+
child.height = (0, _convertUnitsLite.convert)(child.height).from('in').to('cm');
|
|
3029
3056
|
child.height_unit = 'cm';
|
|
3030
3057
|
}
|
|
3031
3058
|
temp_unit = child.width_unit;
|
|
3032
3059
|
if (temp_unit === 'inch') {
|
|
3033
|
-
child.width = convert(child.width).from('in').to('cm');
|
|
3060
|
+
child.width = (0, _convertUnitsLite.convert)(child.width).from('in').to('cm');
|
|
3034
3061
|
child.width_unit = 'cm';
|
|
3035
3062
|
}
|
|
3036
3063
|
temp_unit = child.length_unit;
|
|
3037
3064
|
if (temp_unit === 'inch') {
|
|
3038
|
-
child.length = convert(child.length).from('in').to('cm');
|
|
3065
|
+
child.length = (0, _convertUnitsLite.convert)(child.length).from('in').to('cm');
|
|
3039
3066
|
child.length_unit = 'cm';
|
|
3040
3067
|
}
|
|
3041
3068
|
geometry.needsUpdate = true;
|
|
3042
3069
|
geometry = moldingVertices(pointGroup, geometry, data, child, svg_width, svg_height, molding.pointGroups.length);
|
|
3043
3070
|
var total = geometry.attributes.position.count;
|
|
3044
3071
|
var len = geometry.attributes.position.count / length;
|
|
3045
|
-
if (!GeometryUtils.samePoints(pointGroup[0], pointGroup[pointGroup.length - 1])) {
|
|
3072
|
+
if (!_export.GeometryUtils.samePoints(pointGroup[0], pointGroup[pointGroup.length - 1])) {
|
|
3046
3073
|
len--;
|
|
3047
3074
|
}
|
|
3048
3075
|
for (var i = 0; i < len; i++) {
|
|
@@ -3083,7 +3110,7 @@ function _addMGMesh(molding, planData, layer, data, svg_width, svg_height, flag)
|
|
|
3083
3110
|
x: data[_i2 + 1].x,
|
|
3084
3111
|
y: data[_i2 + 1].y
|
|
3085
3112
|
};
|
|
3086
|
-
var posDistance = verticesDistance(v1, v2);
|
|
3113
|
+
var posDistance = (0, _geometry2.verticesDistance)(v1, v2);
|
|
3087
3114
|
sumDistance += posDistance;
|
|
3088
3115
|
if (_i2 === data.length - 2) finalDistance = sumDistance;
|
|
3089
3116
|
sumDistanceArray.push(sumDistance);
|
|
@@ -3095,7 +3122,7 @@ function _addMGMesh(molding, planData, layer, data, svg_width, svg_height, flag)
|
|
|
3095
3122
|
var uvs_item = [];
|
|
3096
3123
|
for (var _i4 = 0; _i4 < uvs_element_array.length - 1; _i4++) {
|
|
3097
3124
|
uvs_item = [0, uvs_element_array[_i4], 1, uvs_element_array[_i4], 1, uvs_element_array[_i4 + 1], 1, uvs_element_array[_i4 + 1], 0, uvs_element_array[_i4 + 1], 0, uvs_element_array[_i4]];
|
|
3098
|
-
uvs.push.apply(uvs,
|
|
3125
|
+
uvs.push.apply(uvs, (0, _toConsumableArray2["default"])(uvs_item));
|
|
3099
3126
|
}
|
|
3100
3127
|
var all_uvs = [];
|
|
3101
3128
|
for (var _i5 = 0; _i5 < pointGroup.length; _i5++) {
|
|
@@ -3122,15 +3149,15 @@ function deleteCTMesh(countertop, planData, layer) {
|
|
|
3122
3149
|
var ct3d = countertop.ct3d;
|
|
3123
3150
|
if (ct3d) {
|
|
3124
3151
|
planData.plan.remove(ct3d);
|
|
3125
|
-
disposeObject(ct3d);
|
|
3152
|
+
(0, _threeMemoryCleaner.disposeObject)(ct3d);
|
|
3126
3153
|
}
|
|
3127
3154
|
}
|
|
3128
3155
|
}
|
|
3129
|
-
|
|
3156
|
+
function deleteMGMesh(molding, planData) {
|
|
3130
3157
|
var mode = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
3131
3158
|
// mode is 3D or elevation
|
|
3132
3159
|
molding.meshes.forEach(function (mesh) {
|
|
3133
|
-
if (isElevationView(mode)) {
|
|
3160
|
+
if ((0, _helper.isElevationView)(mode)) {
|
|
3134
3161
|
var _planData$plan$childr;
|
|
3135
3162
|
// when elevation mode, remove obj same as selected global molding_name in platnData.plan
|
|
3136
3163
|
(_planData$plan$childr = planData.plan.children) === null || _planData$plan$childr === void 0 || _planData$plan$childr.forEach(function (obj) {
|
|
@@ -3140,7 +3167,7 @@ export function deleteMGMesh(molding, planData) {
|
|
|
3140
3167
|
} else {
|
|
3141
3168
|
// when 3D mode
|
|
3142
3169
|
planData.plan.remove(mesh);
|
|
3143
|
-
disposeObject(mesh);
|
|
3170
|
+
(0, _threeMemoryCleaner.disposeObject)(mesh);
|
|
3144
3171
|
}
|
|
3145
3172
|
});
|
|
3146
3173
|
molding.meshes = [];
|
|
@@ -3149,10 +3176,10 @@ function log() {
|
|
|
3149
3176
|
// console.log(...arguments);
|
|
3150
3177
|
}
|
|
3151
3178
|
function addCountertop(CTArray, addItem, planData, layer) {
|
|
3152
|
-
log('addCountertop',
|
|
3179
|
+
log('addCountertop', (0, _toConsumableArray2["default"])(CTArray), addItem.id);
|
|
3153
3180
|
var tmp = planData;
|
|
3154
3181
|
tmp = tmp && tmp.catalog.getElement(addItem.type);
|
|
3155
|
-
if (!tmp) tmp = planData.catalog.getElement(returnReplaceableDeepSearchType(addItem.type));
|
|
3182
|
+
if (!tmp) tmp = planData.catalog.getElement((0, _utils.returnReplaceableDeepSearchType)(addItem.type));
|
|
3156
3183
|
var long_name = tmp && tmp.long_name;
|
|
3157
3184
|
if (long_name.includes('Sink ')) return;
|
|
3158
3185
|
var newCT = createCTFromItem(addItem, planData.sceneGraph.unit, planData.catalog);
|
|
@@ -3175,11 +3202,11 @@ function addCountertop(CTArray, addItem, planData, layer) {
|
|
|
3175
3202
|
addCTMesh(newCT, planData, layer);
|
|
3176
3203
|
CTArray.push(newCT);
|
|
3177
3204
|
}
|
|
3178
|
-
|
|
3205
|
+
function deleteCountertop(CTArray, delItem, planData, layer) {
|
|
3179
3206
|
if (delItem == undefined) {
|
|
3180
3207
|
return;
|
|
3181
3208
|
}
|
|
3182
|
-
log('deleteCountertop',
|
|
3209
|
+
log('deleteCountertop', (0, _toConsumableArray2["default"])(CTArray), delItem.id);
|
|
3183
3210
|
var delCT = null;
|
|
3184
3211
|
var delItemIndex = -1;
|
|
3185
3212
|
var delCTIndex = CTArray.findIndex(function (el) {
|
|
@@ -3202,9 +3229,9 @@ export function deleteCountertop(CTArray, delItem, planData, layer) {
|
|
|
3202
3229
|
});
|
|
3203
3230
|
}
|
|
3204
3231
|
}
|
|
3205
|
-
|
|
3206
|
-
var tempMGArray =
|
|
3207
|
-
if (isEmpty(delItem)) {
|
|
3232
|
+
function deleteAllMolding(MGArray, delItem, planData, oldSceneLayer, newSceneLayer) {
|
|
3233
|
+
var tempMGArray = (0, _toConsumableArray2["default"])(MGArray);
|
|
3234
|
+
if ((0, _helper.isEmpty)(delItem)) {
|
|
3208
3235
|
return tempMGArray;
|
|
3209
3236
|
}
|
|
3210
3237
|
|
|
@@ -3221,7 +3248,7 @@ export function deleteAllMolding(MGArray, delItem, planData, oldSceneLayer, newS
|
|
|
3221
3248
|
// find the snapped items with delItem
|
|
3222
3249
|
var snappedItems = [];
|
|
3223
3250
|
oldSceneLayer.items.toArray().forEach(function (oItem) {
|
|
3224
|
-
if (oItem.category === 'cabinet' && oItem.id !== delItem.id && MoldingUtils.isItemSnappedItem(delItem, oItem)) {
|
|
3251
|
+
if (oItem.category === 'cabinet' && oItem.id !== delItem.id && _export.MoldingUtils.isItemSnappedItem(delItem, oItem)) {
|
|
3225
3252
|
snappedItems.push(oItem);
|
|
3226
3253
|
}
|
|
3227
3254
|
});
|
|
@@ -3233,8 +3260,8 @@ export function deleteAllMolding(MGArray, delItem, planData, oldSceneLayer, newS
|
|
|
3233
3260
|
}
|
|
3234
3261
|
return tempMGArray;
|
|
3235
3262
|
}
|
|
3236
|
-
|
|
3237
|
-
if (addItem.selected && [MODE_DRAGGING_ITEM_3D, MODE_ROTATING_ITEM_3D].includes(mode)) return false;
|
|
3263
|
+
function addMolding(MGArray, addItem, planData, layer, itemActions, mode) {
|
|
3264
|
+
if (addItem.selected && [_constants.MODE_DRAGGING_ITEM_3D, _constants.MODE_ROTATING_ITEM_3D].includes(mode)) return false;
|
|
3238
3265
|
|
|
3239
3266
|
// If the item is not available for current doorStyle
|
|
3240
3267
|
if (showYelloBox(addItem))
|
|
@@ -3268,15 +3295,15 @@ export function addMolding(MGArray, addItem, planData, layer, itemActions, mode)
|
|
|
3268
3295
|
var temp_MGArray = updateMoldingGroupArray(MGArray, addItem, planData, layer, itemActions, mode, 0);
|
|
3269
3296
|
temp_MGArray.forEach(function (mg) {
|
|
3270
3297
|
var moldingMesh = mg.meshes[0];
|
|
3271
|
-
if (isElevationView(mode)) {
|
|
3272
|
-
if (!isEmpty(moldingMesh)) {
|
|
3273
|
-
replaceMeshesWithLineSegments(moldingMesh);
|
|
3298
|
+
if ((0, _helper.isElevationView)(mode)) {
|
|
3299
|
+
if (!(0, _helper.isEmpty)(moldingMesh)) {
|
|
3300
|
+
(0, _helper.replaceMeshesWithLineSegments)(moldingMesh);
|
|
3274
3301
|
}
|
|
3275
3302
|
}
|
|
3276
3303
|
});
|
|
3277
3304
|
return temp_MGArray;
|
|
3278
3305
|
}
|
|
3279
|
-
|
|
3306
|
+
function updateMoldingGroupArray(MGArray, selItem, planData, layer) {
|
|
3280
3307
|
var itemActions = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
|
|
3281
3308
|
var mode = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : null;
|
|
3282
3309
|
var cnt = arguments.length > 6 ? arguments[6] : undefined;
|
|
@@ -3286,9 +3313,9 @@ export function updateMoldingGroupArray(MGArray, selItem, planData, layer) {
|
|
|
3286
3313
|
console.log('updateMoldingGroupArray has limited!');
|
|
3287
3314
|
return MGArray;
|
|
3288
3315
|
}
|
|
3289
|
-
var temp_MGArray =
|
|
3290
|
-
if (isEmpty(selItem)) return temp_MGArray;
|
|
3291
|
-
var isEnableMolding = MoldingUtils.isEnableItemForMolding(layer, selItem);
|
|
3316
|
+
var temp_MGArray = (0, _toConsumableArray2["default"])(MGArray);
|
|
3317
|
+
if ((0, _helper.isEmpty)(selItem)) return temp_MGArray;
|
|
3318
|
+
var isEnableMolding = _export.MoldingUtils.isEnableItemForMolding(layer, selItem);
|
|
3292
3319
|
// Make a items group with selItem to create the new MG(molding group) array of selItem
|
|
3293
3320
|
var itemsForGroup = [selItem];
|
|
3294
3321
|
var i = 0;
|
|
@@ -3296,7 +3323,7 @@ export function updateMoldingGroupArray(MGArray, selItem, planData, layer) {
|
|
|
3296
3323
|
layer.items.toArray().forEach(function (curItem) {
|
|
3297
3324
|
if (!itemsForGroup.some(function (it) {
|
|
3298
3325
|
return it.id === curItem.id;
|
|
3299
|
-
}) && curItem.category === 'cabinet' && MoldingUtils.isSameMoldingLayoutpos(curItem, itemsForGroup[i]) && MoldingUtils.isItemSnappedItem(itemsForGroup[i], curItem)) {
|
|
3326
|
+
}) && curItem.category === 'cabinet' && _export.MoldingUtils.isSameMoldingLayoutpos(curItem, itemsForGroup[i]) && _export.MoldingUtils.isItemSnappedItem(itemsForGroup[i], curItem)) {
|
|
3300
3327
|
itemsForGroup.push(curItem);
|
|
3301
3328
|
}
|
|
3302
3329
|
});
|
|
@@ -3304,7 +3331,7 @@ export function updateMoldingGroupArray(MGArray, selItem, planData, layer) {
|
|
|
3304
3331
|
}
|
|
3305
3332
|
|
|
3306
3333
|
// Create the new MG(molding group) array of selItem
|
|
3307
|
-
var new_MGArray = MoldingUtils.getAllMoldingGroups(layer, itemsForGroup);
|
|
3334
|
+
var new_MGArray = _export.MoldingUtils.getAllMoldingGroups(layer, itemsForGroup);
|
|
3308
3335
|
|
|
3309
3336
|
// get molding settings of update molding from adjoined item's molding
|
|
3310
3337
|
var changeMoldings = [];
|
|
@@ -3320,13 +3347,13 @@ export function updateMoldingGroupArray(MGArray, selItem, planData, layer) {
|
|
|
3320
3347
|
});
|
|
3321
3348
|
|
|
3322
3349
|
// if current item has not destination molding then set it to the current molding
|
|
3323
|
-
if (!isEmpty(destMolding) && !selItem.molding.some(function (md) {
|
|
3350
|
+
if (!(0, _helper.isEmpty)(destMolding) && !selItem.molding.some(function (md) {
|
|
3324
3351
|
return md.location_type === destMolding.location_type;
|
|
3325
3352
|
})) {
|
|
3326
3353
|
// only update with the same height cabinet or update the bottom molding setting
|
|
3327
3354
|
// itemActions.setMolding(destMoldings[i], false);
|
|
3328
3355
|
changeMoldings.push(destMolding);
|
|
3329
|
-
} else if (isEmpty(destMolding) && selItem.molding.some(function (md) {
|
|
3356
|
+
} else if ((0, _helper.isEmpty)(destMolding) && selItem.molding.some(function (md) {
|
|
3330
3357
|
return md.location_type === mg.location_type;
|
|
3331
3358
|
})) {
|
|
3332
3359
|
// if current item has more molding than adjoined then remove theses moldings
|
|
@@ -3344,7 +3371,7 @@ export function updateMoldingGroupArray(MGArray, selItem, planData, layer) {
|
|
|
3344
3371
|
var filteredNewMGList = new_MGArray.filter(function (mg) {
|
|
3345
3372
|
return mg.location_type === oldMG.location_type;
|
|
3346
3373
|
});
|
|
3347
|
-
if (isEmpty(filteredNewMGList)) {
|
|
3374
|
+
if ((0, _helper.isEmpty)(filteredNewMGList)) {
|
|
3348
3375
|
return true;
|
|
3349
3376
|
}
|
|
3350
3377
|
var _loop3 = function _loop3() {
|
|
@@ -3418,7 +3445,7 @@ export function updateMoldingGroupArray(MGArray, selItem, planData, layer) {
|
|
|
3418
3445
|
if (mg.molding !== null && mg.molding.itemID !== molding.itemID) {
|
|
3419
3446
|
deleteMGMesh(mg, planData, mode);
|
|
3420
3447
|
}
|
|
3421
|
-
mg = MoldingUtils.createMonldingGroup(mg, layer, molding, planData.catalog);
|
|
3448
|
+
mg = _export.MoldingUtils.createMonldingGroup(mg, layer, molding, planData.catalog);
|
|
3422
3449
|
}
|
|
3423
3450
|
if (!mg.meshes.length) {
|
|
3424
3451
|
addMGMesh(mg, planData, layer);
|
|
@@ -3447,7 +3474,7 @@ export function updateMoldingGroupArray(MGArray, selItem, planData, layer) {
|
|
|
3447
3474
|
return MGArray;
|
|
3448
3475
|
}
|
|
3449
3476
|
}
|
|
3450
|
-
|
|
3477
|
+
function removeSelItemMesh(MGArray, selItem, planData, mode) {
|
|
3451
3478
|
if (selItem) {
|
|
3452
3479
|
if (!selItem.selected) {
|
|
3453
3480
|
return;
|
|
@@ -3477,7 +3504,7 @@ export function removeSelItemMesh(MGArray, selItem, planData, mode) {
|
|
|
3477
3504
|
*
|
|
3478
3505
|
* And one-door-cabinet is the same case with the left door of two-door-cabinet
|
|
3479
3506
|
*/
|
|
3480
|
-
|
|
3507
|
+
function updateDoorHandleMesh(_, item3D, flip) {
|
|
3481
3508
|
if (!item3D) {
|
|
3482
3509
|
console.error('Item mesh is undefined.');
|
|
3483
3510
|
return;
|
|
@@ -3558,11 +3585,11 @@ export function updateDoorHandleMesh(_, item3D, flip) {
|
|
|
3558
3585
|
}
|
|
3559
3586
|
});
|
|
3560
3587
|
}
|
|
3561
|
-
|
|
3588
|
+
function addWarningBox(itemId, altitude, planData) {
|
|
3562
3589
|
deleteSpecifiedMeshObjects('WarningBox' + itemId);
|
|
3563
3590
|
var item3D = planData.sceneGraph.layers[planData.sceneData.selectedLayer].items[itemId];
|
|
3564
3591
|
if (item3D == undefined) return;
|
|
3565
|
-
var altitudeLength = convert(altitude).from('in').to('cm');
|
|
3592
|
+
var altitudeLength = (0, _convertUnitsLite.convert)(altitude).from('in').to('cm');
|
|
3566
3593
|
var sBounding = item3D.children[0].userData;
|
|
3567
3594
|
var width = sBounding.max.x - sBounding.min.x;
|
|
3568
3595
|
var height = sBounding.max.y - sBounding.min.y;
|
|
@@ -3584,7 +3611,7 @@ export function addWarningBox(itemId, altitude, planData) {
|
|
|
3584
3611
|
warnBoxObj.name = 'WarningBox' + itemId;
|
|
3585
3612
|
// planData.plan.add(warnBoxObj);
|
|
3586
3613
|
}
|
|
3587
|
-
|
|
3614
|
+
function checkCabinetOverlap(itemPos, itemRect, holeItems, planData) {
|
|
3588
3615
|
if (holeItems.length) {
|
|
3589
3616
|
var depth = itemRect.size.depth;
|
|
3590
3617
|
var i;
|
|
@@ -3601,7 +3628,7 @@ export function checkCabinetOverlap(itemPos, itemRect, holeItems, planData) {
|
|
|
3601
3628
|
if (i != holeItems.length) {
|
|
3602
3629
|
var altitude = itemRect.itemInfo.properties.get('altitude').get('_length');
|
|
3603
3630
|
var altitudeUnit = itemRect.itemInfo.properties.get('altitude').get('_unit') || 'cm';
|
|
3604
|
-
altitude = convert(altitude).from(altitudeUnit).to('cm');
|
|
3631
|
+
altitude = (0, _convertUnitsLite.convert)(altitude).from(altitudeUnit).to('cm');
|
|
3605
3632
|
addWarningBox(itemRect.itemInfo.id, altitude, planData);
|
|
3606
3633
|
}
|
|
3607
3634
|
}
|