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