kitchen-simulator 1.1.1-test.7 → 1.1.1-test.70
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/@history.js +8 -2
- package/es/AppContext.js +8 -3
- package/es/KitchenConfigurator.js +93 -106
- package/es/KitchenConfiguratorApp.js +143 -154
- package/es/actions/area-actions.js +10 -5
- package/es/actions/export.js +27 -12
- package/es/actions/groups-actions.js +43 -27
- package/es/actions/holes-actions.js +53 -34
- package/es/actions/items-actions.js +143 -94
- package/es/actions/lines-actions.js +34 -21
- package/es/actions/project-actions.js +143 -94
- package/es/actions/scene-actions.js +19 -11
- package/es/actions/vertices-actions.js +13 -7
- package/es/actions/viewer2d-actions.js +34 -21
- package/es/actions/viewer3d-actions.js +16 -9
- package/es/catalog/areas/area/planner-element.js +16 -8
- package/es/catalog/catalog.js +19 -24
- package/es/catalog/factories/area-factory-3d.js +29 -22
- package/es/catalog/factories/area-factory.js +18 -14
- package/es/catalog/factories/export.js +12 -6
- package/es/catalog/factories/wall-factory-3d.js +39 -31
- package/es/catalog/factories/wall-factory.js +29 -21
- package/es/catalog/holes/door-closet/planner-element.js +22 -15
- package/es/catalog/holes/door-double/planner-element.js +22 -15
- package/es/catalog/holes/door-exterior/planner-element.js +23 -16
- package/es/catalog/holes/door-interior/planner-element.js +23 -16
- package/es/catalog/holes/door-panic/planner-element.js +14 -7
- package/es/catalog/holes/door-panic-double/planner-element.js +22 -15
- package/es/catalog/holes/door-sliding/planner-element.js +23 -16
- package/es/catalog/holes/doorway-framed/planner-element.js +18 -11
- package/es/catalog/holes/doorway-frameless/planner-element.js +14 -7
- package/es/catalog/holes/export.js +31 -13
- package/es/catalog/holes/window-clear/planner-element.js +17 -10
- package/es/catalog/holes/window-cross/planner-element.js +17 -10
- package/es/catalog/holes/window-double-hung/planner-element.js +17 -10
- package/es/catalog/holes/window-vertical/planner-element.js +17 -10
- package/es/catalog/lines/wall/planner-element.js +19 -11
- package/es/catalog/molding/molding-dcm/planner-element.js +12 -5
- package/es/catalog/molding/molding-fbm/planner-element.js +12 -5
- package/es/catalog/molding/molding-lrm/planner-element.js +12 -5
- package/es/catalog/properties/export.js +33 -20
- package/es/catalog/properties/property-checkbox.js +82 -35
- package/es/catalog/properties/property-color.js +21 -16
- package/es/catalog/properties/property-enum.js +70 -28
- package/es/catalog/properties/property-hidden.js +14 -9
- package/es/catalog/properties/property-lenght-measure.js +43 -39
- package/es/catalog/properties/property-length-measure.js +82 -34
- package/es/catalog/properties/property-length-measure_hole.js +43 -39
- package/es/catalog/properties/property-number.js +22 -17
- package/es/catalog/properties/property-read-only.js +21 -16
- package/es/catalog/properties/property-string.js +21 -16
- package/es/catalog/properties/property-toggle.js +21 -16
- package/es/catalog/properties/shared-property-style.js +5 -1
- package/es/catalog/utils/FuseUtils.js +13 -11
- package/es/catalog/utils/exporter.js +13 -11
- package/es/catalog/utils/geom-utils.js +27 -13
- package/es/catalog/utils/item-loader.js +95 -91
- package/es/catalog/utils/load-obj.js +26 -20
- package/es/catalog/utils/mtl-loader.js +7 -3
- package/es/catalog/utils/obj-loader.js +7 -3
- package/es/class/FuseUtils.js +13 -11
- package/es/class/area.js +26 -26
- package/es/class/export.js +38 -23
- package/es/class/group.js +57 -62
- package/es/class/guide.js +19 -19
- package/es/class/hole.js +87 -88
- package/es/class/item.js +148 -155
- package/es/class/layer.js +63 -63
- package/es/class/line.js +141 -144
- package/es/class/project.js +96 -94
- package/es/class/vertex.js +33 -33
- package/es/components/content.js +27 -19
- package/es/components/disclaimer/disclaimer.js +79 -93
- package/es/components/export.js +15 -8
- package/es/components/style/button.js +29 -30
- package/es/components/style/cancel-button.js +12 -8
- package/es/components/style/content-container.js +14 -12
- package/es/components/style/content-title.js +18 -15
- package/es/components/style/delete-button.js +15 -9
- package/es/components/style/export.js +48 -30
- package/es/components/style/form-block.js +13 -12
- package/es/components/style/form-color-input.js +12 -8
- package/es/components/style/form-label.js +13 -12
- package/es/components/style/form-number-input.js +71 -47
- package/es/components/style/form-number-input_2.js +42 -42
- package/es/components/style/form-select.js +58 -14
- package/es/components/style/form-slider.js +36 -16
- package/es/components/style/form-submit-button.js +15 -9
- package/es/components/style/form-text-input.js +55 -37
- package/es/components/viewer2d/area.js +22 -17
- package/es/components/viewer2d/export.js +48 -30
- package/es/components/viewer2d/grids/grid-horizontal-streak.js +15 -11
- package/es/components/viewer2d/grids/grid-streak.js +15 -11
- package/es/components/viewer2d/grids/grid-vertical-streak.js +15 -11
- package/es/components/viewer2d/grids/grids.js +17 -15
- package/es/components/viewer2d/group.js +22 -15
- package/es/components/viewer2d/item.js +68 -68
- package/es/components/viewer2d/layer.js +28 -23
- package/es/components/viewer2d/line.js +109 -104
- package/es/components/viewer2d/ruler.js +27 -23
- package/es/components/viewer2d/rulerDist.js +26 -21
- package/es/components/viewer2d/rulerX.js +45 -45
- package/es/components/viewer2d/rulerY.js +43 -43
- package/es/components/viewer2d/scene.js +40 -46
- package/es/components/viewer2d/snap.js +20 -13
- package/es/components/viewer2d/state.js +25 -23
- package/es/components/viewer2d/utils.js +63 -21
- package/es/components/viewer2d/vertex.js +15 -8
- package/es/components/viewer2d/viewer2d.js +169 -166
- package/es/components/viewer3d/camera-controls-module/camera-controls.module.js +21 -24
- package/es/components/viewer3d/dcm.js +5 -1
- package/es/components/viewer3d/fbm.js +5 -1
- package/es/components/viewer3d/front3D.js +19 -17
- package/es/components/viewer3d/grid-creator.js +15 -8
- package/es/components/viewer3d/grids/grid-horizontal-streak.js +12 -6
- package/es/components/viewer3d/grids/grid-streak.js +11 -5
- package/es/components/viewer3d/grids/grid-vertical-streak.js +12 -6
- package/es/components/viewer3d/libs/first-person-controls.js +7 -2
- package/es/components/viewer3d/libs/helvetiker_regular.typeface.js +5 -1
- package/es/components/viewer3d/libs/mtl-loader.js +6 -2
- package/es/components/viewer3d/libs/obj-loader.js +6 -2
- package/es/components/viewer3d/libs/orbit-controls.js +10 -5
- package/es/components/viewer3d/libs/pointer-lock-controls.js +9 -4
- package/es/components/viewer3d/lrm.js +5 -1
- package/es/components/viewer3d/model.js +5 -1
- package/es/components/viewer3d/pointer-lock-navigation.js +8 -3
- package/es/components/viewer3d/ruler-utils/itemRect.js +23 -18
- package/es/components/viewer3d/ruler-utils/layer3D.js +64 -59
- package/es/components/viewer3d/ruler-utils/ruler3D.js +44 -42
- package/es/components/viewer3d/ruler-utils/scene3D.js +16 -11
- package/es/components/viewer3d/ruler-utils/state3D.js +9 -4
- package/es/components/viewer3d/scene-creator.js +225 -198
- package/es/components/viewer3d/three-memory-cleaner.js +10 -3
- package/es/components/viewer3d/viewer3d-first-person.js +44 -46
- package/es/components/viewer3d/viewer3d.js +206 -209
- package/es/constants.js +356 -349
- package/es/index.js +20 -15
- package/es/models.js +183 -183
- package/es/plugins/SVGLoader.js +51 -48
- package/es/plugins/autosave.js +7 -3
- package/es/plugins/console-debugger.js +10 -8
- package/es/plugins/export.js +15 -8
- package/es/plugins/keyboard.js +33 -29
- package/es/reducers/areas-reducer.js +11 -7
- package/es/reducers/export.js +39 -24
- package/es/reducers/groups-reducer.js +35 -31
- package/es/reducers/holes-reducer.js +47 -43
- package/es/reducers/items-reducer.js +110 -109
- package/es/reducers/lines-reducer.js +32 -28
- package/es/reducers/project-reducer.js +109 -105
- package/es/reducers/reducer.js +21 -16
- package/es/reducers/scene-reducer.js +19 -15
- package/es/reducers/user-reducer.js +9 -6
- package/es/reducers/vertices-reducer.js +15 -11
- package/es/reducers/viewer2d-reducer.js +22 -18
- package/es/reducers/viewer3d-reducer.js +20 -16
- package/es/shared-style.js +14 -10
- package/es/styles/export.js +9 -3
- package/es/translator/en.js +5 -1
- package/es/translator/it.js +5 -1
- package/es/translator/ru.js +5 -1
- package/es/translator/translator.js +17 -17
- package/es/utils/browser.js +7 -2
- package/es/utils/convert-units-lite.js +33 -0
- package/es/utils/email-validator.js +5 -1
- package/es/utils/export.js +32 -15
- package/es/utils/geometry.js +277 -191
- package/es/utils/get-edges-of-subgraphs.js +7 -1
- package/es/utils/graph-cycles.js +9 -9
- package/es/utils/graph-inner-cycles.js +16 -10
- package/es/utils/graph.js +15 -12
- package/es/utils/helper.js +61 -109
- package/es/utils/history.js +13 -8
- package/es/utils/id-broker.js +13 -12
- package/es/utils/logger.js +5 -1
- package/es/utils/math.js +10 -5
- package/es/utils/molding.js +175 -158
- package/es/utils/name-generator.js +11 -11
- package/es/utils/objects-utils.js +17 -7
- package/es/utils/phone-validator.js +5 -1
- package/es/utils/process-black-list.js +8 -6
- package/es/utils/react-if.js +10 -6
- package/es/utils/snap-scene.js +32 -32
- package/es/utils/snap.js +57 -51
- package/es/utils/summarizeCart.js +5 -1
- package/es/utils/threeCSG.es6.js +20 -17
- package/es/version.js +5 -1
- package/lib/@history.js +3 -2
- package/lib/AppContext.js +3 -2
- package/lib/KitchenConfigurator.js +70 -88
- package/lib/KitchenConfiguratorApp.js +98 -113
- package/lib/actions/export.js +1 -1
- package/lib/catalog/areas/area/planner-element.js +13 -8
- package/lib/catalog/catalog.js +9 -16
- package/lib/catalog/factories/area-factory-3d.js +1 -1
- package/lib/catalog/factories/area-factory.js +6 -7
- package/lib/catalog/factories/export.js +1 -1
- package/lib/catalog/factories/wall-factory-3d.js +4 -4
- package/lib/catalog/factories/wall-factory.js +4 -3
- package/lib/catalog/holes/door-closet/planner-element.js +4 -3
- package/lib/catalog/holes/door-double/planner-element.js +4 -3
- package/lib/catalog/holes/door-exterior/planner-element.js +4 -3
- package/lib/catalog/holes/door-interior/planner-element.js +4 -3
- package/lib/catalog/holes/door-panic/planner-element.js +4 -3
- package/lib/catalog/holes/door-panic-double/planner-element.js +4 -3
- package/lib/catalog/holes/door-sliding/planner-element.js +4 -3
- package/lib/catalog/holes/doorway-framed/planner-element.js +4 -3
- package/lib/catalog/holes/doorway-frameless/planner-element.js +4 -3
- package/lib/catalog/holes/export.js +14 -14
- package/lib/catalog/holes/window-clear/planner-element.js +4 -3
- package/lib/catalog/holes/window-cross/planner-element.js +4 -3
- package/lib/catalog/holes/window-double-hung/planner-element.js +4 -3
- package/lib/catalog/holes/window-vertical/planner-element.js +4 -3
- package/lib/catalog/lines/wall/planner-element.js +16 -11
- package/lib/catalog/molding/molding-dcm/planner-element.js +4 -3
- package/lib/catalog/molding/molding-fbm/planner-element.js +4 -3
- package/lib/catalog/molding/molding-lrm/planner-element.js +4 -3
- package/lib/catalog/properties/export.js +1 -1
- package/lib/catalog/properties/property-checkbox.js +68 -25
- package/lib/catalog/properties/property-color.js +3 -2
- package/lib/catalog/properties/property-enum.js +54 -16
- package/lib/catalog/properties/property-hidden.js +3 -2
- package/lib/catalog/properties/property-lenght-measure.js +10 -10
- package/lib/catalog/properties/property-length-measure.js +61 -17
- package/lib/catalog/properties/property-length-measure_hole.js +10 -10
- package/lib/catalog/properties/property-number.js +3 -2
- package/lib/catalog/properties/property-read-only.js +3 -2
- package/lib/catalog/properties/property-string.js +3 -2
- package/lib/catalog/properties/property-toggle.js +3 -2
- package/lib/catalog/properties/shared-property-style.js +2 -1
- package/lib/catalog/utils/FuseUtils.js +10 -11
- package/lib/catalog/utils/exporter.js +10 -12
- package/lib/catalog/utils/geom-utils.js +1 -1
- package/lib/catalog/utils/item-loader.js +29 -35
- package/lib/catalog/utils/mtl-loader.js +7 -3
- package/lib/catalog/utils/obj-loader.js +7 -3
- package/lib/class/FuseUtils.js +10 -11
- package/lib/class/area.js +9 -11
- package/lib/class/export.js +1 -1
- package/lib/class/group.js +13 -20
- package/lib/class/guide.js +9 -12
- package/lib/class/hole.js +7 -9
- package/lib/class/item.js +25 -35
- package/lib/class/layer.js +7 -9
- package/lib/class/line.js +14 -20
- package/lib/class/project.js +10 -11
- package/lib/class/vertex.js +9 -11
- package/lib/components/content.js +5 -3
- package/lib/components/disclaimer/disclaimer.js +69 -88
- package/lib/components/export.js +1 -1
- package/lib/components/style/button.js +17 -22
- package/lib/components/style/cancel-button.js +7 -7
- package/lib/components/style/content-container.js +5 -7
- package/lib/components/style/content-title.js +10 -12
- package/lib/components/style/delete-button.js +8 -8
- package/lib/components/style/export.js +1 -1
- package/lib/components/style/form-block.js +9 -12
- package/lib/components/style/form-color-input.js +7 -7
- package/lib/components/style/form-label.js +9 -12
- package/lib/components/style/form-number-input.js +43 -23
- package/lib/components/style/form-number-input_2.js +15 -19
- package/lib/components/style/form-select.js +53 -15
- package/lib/components/style/form-slider.js +28 -12
- package/lib/components/style/form-submit-button.js +8 -8
- package/lib/components/style/form-text-input.js +46 -32
- package/lib/components/viewer2d/area.js +8 -7
- package/lib/components/viewer2d/export.js +1 -1
- package/lib/components/viewer2d/grids/grid-horizontal-streak.js +3 -3
- package/lib/components/viewer2d/grids/grid-streak.js +3 -3
- package/lib/components/viewer2d/grids/grid-vertical-streak.js +3 -3
- package/lib/components/viewer2d/grids/grids.js +6 -10
- package/lib/components/viewer2d/group.js +4 -3
- package/lib/components/viewer2d/item.js +14 -19
- package/lib/components/viewer2d/layer.js +3 -2
- package/lib/components/viewer2d/line.js +4 -7
- package/lib/components/viewer2d/ruler.js +9 -9
- package/lib/components/viewer2d/rulerDist.js +7 -6
- package/lib/components/viewer2d/rulerX.js +15 -19
- package/lib/components/viewer2d/rulerY.js +15 -19
- package/lib/components/viewer2d/scene.js +24 -34
- package/lib/components/viewer2d/snap.js +4 -3
- package/lib/components/viewer2d/state.js +7 -11
- package/lib/components/viewer2d/utils.js +35 -2
- package/lib/components/viewer2d/vertex.js +4 -3
- package/lib/components/viewer2d/viewer2d.js +40 -41
- package/lib/components/viewer3d/camera-controls-module/camera-controls.module.js +14 -20
- package/lib/components/viewer3d/dcm.js +2 -1
- package/lib/components/viewer3d/fbm.js +2 -1
- package/lib/components/viewer3d/front3D.js +6 -10
- package/lib/components/viewer3d/grid-creator.js +4 -3
- package/lib/components/viewer3d/grids/grid-horizontal-streak.js +3 -2
- package/lib/components/viewer3d/grids/grid-streak.js +3 -2
- package/lib/components/viewer3d/grids/grid-vertical-streak.js +3 -2
- package/lib/components/viewer3d/libs/mtl-loader.js +7 -2
- package/lib/components/viewer3d/libs/obj-loader.js +7 -2
- package/lib/components/viewer3d/libs/orbit-controls.js +10 -5
- package/lib/components/viewer3d/libs/pointer-lock-controls.js +9 -4
- package/lib/components/viewer3d/lrm.js +2 -1
- package/lib/components/viewer3d/pointer-lock-navigation.js +1 -1
- package/lib/components/viewer3d/ruler-utils/itemRect.js +10 -9
- package/lib/components/viewer3d/ruler-utils/layer3D.js +35 -34
- package/lib/components/viewer3d/ruler-utils/ruler3D.js +5 -7
- package/lib/components/viewer3d/ruler-utils/scene3D.js +4 -5
- package/lib/components/viewer3d/ruler-utils/state3D.js +3 -2
- package/lib/components/viewer3d/scene-creator.js +40 -45
- package/lib/components/viewer3d/three-memory-cleaner.js +1 -1
- package/lib/components/viewer3d/viewer3d-first-person.js +13 -17
- package/lib/components/viewer3d/viewer3d.js +34 -38
- package/lib/index.js +16 -88
- package/lib/models.js +58 -63
- package/lib/plugins/autosave.js +2 -1
- package/lib/plugins/console-debugger.js +5 -7
- package/lib/plugins/export.js +1 -1
- package/lib/plugins/keyboard.js +2 -1
- package/lib/reducers/areas-reducer.js +2 -1
- package/lib/reducers/export.js +1 -1
- package/lib/reducers/groups-reducer.js +2 -1
- package/lib/reducers/holes-reducer.js +2 -1
- package/lib/reducers/items-reducer.js +2 -1
- package/lib/reducers/lines-reducer.js +2 -1
- package/lib/reducers/project-reducer.js +2 -1
- package/lib/reducers/scene-reducer.js +2 -1
- package/lib/reducers/user-reducer.js +2 -2
- package/lib/reducers/vertices-reducer.js +2 -1
- package/lib/reducers/viewer2d-reducer.js +5 -5
- package/lib/reducers/viewer3d-reducer.js +5 -5
- package/lib/styles/export.js +1 -1
- package/lib/translator/en.js +2 -1
- package/lib/translator/it.js +2 -1
- package/lib/translator/ru.js +2 -1
- package/lib/translator/translator.js +7 -10
- package/lib/utils/convert-units-lite.js +35 -0
- package/lib/utils/export.js +2 -2
- package/lib/utils/geometry.js +20 -28
- package/lib/utils/get-edges-of-subgraphs.js +7 -1
- package/lib/utils/graph-cycles.js +9 -9
- package/lib/utils/graph-inner-cycles.js +1 -1
- package/lib/utils/graph.js +15 -12
- package/lib/utils/helper.js +14 -83
- package/lib/utils/history.js +1 -1
- package/lib/utils/id-broker.js +7 -10
- package/lib/utils/molding.js +66 -71
- package/lib/utils/name-generator.js +7 -9
- package/lib/utils/objects-utils.js +5 -3
- package/lib/utils/process-black-list.js +3 -5
- package/lib/utils/react-if.js +3 -2
- package/lib/utils/snap-scene.js +3 -7
- package/lib/utils/snap.js +22 -26
- package/lib/utils/threeCSG.es6.js +16 -15
- package/package.json +26 -54
- package/es/analytics/ga4.js +0 -191
- package/es/analytics/posthog.js +0 -60
- package/lib/analytics/ga4.js +0 -197
- package/lib/analytics/posthog.js +0 -68
|
@@ -1,48 +1,45 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
|
+
exports.__esModule = true;
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
var _readOnlyError2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/readOnlyError"));
|
|
8
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/defineProperty"));
|
|
9
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck"));
|
|
10
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createClass"));
|
|
11
|
+
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/possibleConstructorReturn"));
|
|
12
|
+
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/getPrototypeOf"));
|
|
13
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/inherits"));
|
|
14
|
+
var _react = _interopRequireDefault(require("react"));
|
|
15
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
16
|
+
var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
17
|
+
var Three = _interopRequireWildcard(require("three"));
|
|
18
|
+
var _sceneCreator = require("./scene-creator");
|
|
19
|
+
var _threeMemoryCleaner = require("./three-memory-cleaner");
|
|
20
|
+
var _immutablediff = _interopRequireDefault(require("immutablediff"));
|
|
21
|
+
var SharedStyle = _interopRequireWildcard(require("../../shared-style"));
|
|
22
|
+
var _constants = require("../../constants");
|
|
23
|
+
var _geometry = require("../../utils/geometry");
|
|
24
|
+
var _convertUnitsLite = require("../../utils/convert-units-lite");
|
|
25
|
+
var _export = require("../../utils/export");
|
|
26
|
+
var _helper = require("../../utils/helper");
|
|
27
|
+
var _RGBELoader = require("three/examples/jsm/loaders/RGBELoader");
|
|
28
|
+
var _cameraControls = _interopRequireDefault(require("camera-controls"));
|
|
29
|
+
var _utils = require("../viewer2d/utils");
|
|
30
|
+
var _objectsUtils = require("../../utils/objects-utils");
|
|
31
|
+
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); }
|
|
5
32
|
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; }
|
|
6
|
-
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) {
|
|
7
|
-
function
|
|
8
|
-
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
9
|
-
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
10
|
-
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
11
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
12
|
-
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); }
|
|
13
|
-
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
14
|
-
function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
|
|
15
|
-
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
33
|
+
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; }
|
|
34
|
+
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2["default"])(o), (0, _possibleConstructorReturn2["default"])(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2["default"])(t).constructor) : o.apply(t, e)); }
|
|
16
35
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
17
|
-
|
|
18
|
-
function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
|
|
19
|
-
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
|
|
20
|
-
import React from 'react';
|
|
21
|
-
import PropTypes from 'prop-types';
|
|
22
|
-
import ReactDOM from 'react-dom';
|
|
23
|
-
import * as Three from 'three';
|
|
24
|
-
import { parseData, updateScene, visibleTransformBox, getDistances, fVLine, deleteSpecifiedMeshObjects, createBacksplash, checkCabinetOverlap } from "./scene-creator";
|
|
25
|
-
import { disposeScene } from "./three-memory-cleaner";
|
|
26
|
-
import { disposeObject } from "./three-memory-cleaner";
|
|
27
|
-
import diff from 'immutablediff';
|
|
28
|
-
import * as SharedStyle from "../../shared-style";
|
|
29
|
-
import { MODE_DRAWING_ITEM_3D, MODE_IDLE_3D, MODE_3D_VIEW, UNIT_CENTIMETER, MODE_DRAWING_HOLE_3D, SECONDARY_PURPLE_COLOR, MODE_ELEVATION_VIEW, MODE_DRAGGING_ITEM_3D, MODE_ROTATING_ITEM_3D, WALL_CABINET_LAYOUTPOS, BASE_CABINET_LAYOUTPOS, TALL_CABINET_LAYOUTPOS } from "../../constants";
|
|
30
|
-
import { isUndefined } from 'util';
|
|
31
|
-
import { verticesDistance } from "../../utils/geometry";
|
|
32
|
-
import convert from 'convert-units';
|
|
33
|
-
import { GeometryUtils } from "../../utils/export";
|
|
34
|
-
import { handleCamRect, isElevationView, isEmpty } from "../../utils/helper";
|
|
35
|
-
import { RGBELoader } from 'three/examples/jsm/loaders/RGBELoader';
|
|
36
|
-
import CameraControls from 'camera-controls';
|
|
37
|
-
CameraControls.install({
|
|
36
|
+
_cameraControls["default"].install({
|
|
38
37
|
THREE: Three
|
|
39
38
|
});
|
|
40
|
-
|
|
41
|
-
import { getAllMeshes, vectorIntersectWithMesh } from "../../utils/objects-utils";
|
|
42
|
-
var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
39
|
+
var Scene3DViewer = exports["default"] = /*#__PURE__*/function (_React$Component) {
|
|
43
40
|
function Scene3DViewer(props) {
|
|
44
41
|
var _this;
|
|
45
|
-
|
|
42
|
+
(0, _classCallCheck2["default"])(this, Scene3DViewer);
|
|
46
43
|
_this = _callSuper(this, Scene3DViewer, [props]);
|
|
47
44
|
_this.state = {
|
|
48
45
|
isLoading: false,
|
|
@@ -62,14 +59,14 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
62
59
|
window.__elevationRendererDownload = {};
|
|
63
60
|
}
|
|
64
61
|
switch (mode) {
|
|
65
|
-
case MODE_IDLE_3D:
|
|
62
|
+
case _constants.MODE_IDLE_3D:
|
|
66
63
|
_this.renderer = window.__threeRenderer || new Three.WebGLRenderer({
|
|
67
64
|
preserveDrawingBuffer: true,
|
|
68
65
|
alpha: true,
|
|
69
66
|
antialias: true
|
|
70
67
|
});
|
|
71
68
|
break;
|
|
72
|
-
case MODE_3D_VIEW:
|
|
69
|
+
case _constants.MODE_3D_VIEW:
|
|
73
70
|
_this.renderer = window.__threeRendererDownload || new Three.WebGLRenderer({
|
|
74
71
|
preserveDrawingBuffer: true,
|
|
75
72
|
alpha: true,
|
|
@@ -104,8 +101,8 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
104
101
|
_this.renderer.domElement.style.display = 'none';
|
|
105
102
|
return _this;
|
|
106
103
|
}
|
|
107
|
-
|
|
108
|
-
return
|
|
104
|
+
(0, _inherits2["default"])(Scene3DViewer, _React$Component);
|
|
105
|
+
return (0, _createClass2["default"])(Scene3DViewer, [{
|
|
109
106
|
key: "componentDidMount",
|
|
110
107
|
value: function componentDidMount(nextProps) {
|
|
111
108
|
var _this2 = this;
|
|
@@ -125,7 +122,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
125
122
|
var mode = state.mode,
|
|
126
123
|
scene = state.scene;
|
|
127
124
|
function setupLight(scene, inbBox) {
|
|
128
|
-
if (isElevationView(mode)) {
|
|
125
|
+
if ((0, _helper.isElevationView)(mode)) {
|
|
129
126
|
var ambilight = new Three.AmbientLight('0xffffff', 3);
|
|
130
127
|
scene.add(ambilight);
|
|
131
128
|
} else {
|
|
@@ -184,10 +181,10 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
184
181
|
var spotlightDis = 1.5 * Math.abs(inbBox.min.y - inbBox.max.y);
|
|
185
182
|
|
|
186
183
|
// check if spotlight is inside the room
|
|
187
|
-
vectorIntersectWithMesh(spot1, scene3D.getObjectByName('floor')) && addSpotLight('0xffffff', 0.8, spot1, spot1, spotlightDis);
|
|
188
|
-
vectorIntersectWithMesh(spot2, scene3D.getObjectByName('floor')) && addSpotLight('0xffffff', 0.8, spot2, spot2, spotlightDis);
|
|
189
|
-
vectorIntersectWithMesh(spot3, scene3D.getObjectByName('floor')) && addSpotLight('0xffffff', 0.8, spot3, spot3, spotlightDis);
|
|
190
|
-
vectorIntersectWithMesh(spot4, scene3D.getObjectByName('floor')) && addSpotLight('0xffffff', 0.8, spot4, spot4, spotlightDis);
|
|
184
|
+
(0, _objectsUtils.vectorIntersectWithMesh)(spot1, scene3D.getObjectByName('floor')) && addSpotLight('0xffffff', 0.8, spot1, spot1, spotlightDis);
|
|
185
|
+
(0, _objectsUtils.vectorIntersectWithMesh)(spot2, scene3D.getObjectByName('floor')) && addSpotLight('0xffffff', 0.8, spot2, spot2, spotlightDis);
|
|
186
|
+
(0, _objectsUtils.vectorIntersectWithMesh)(spot3, scene3D.getObjectByName('floor')) && addSpotLight('0xffffff', 0.8, spot3, spot3, spotlightDis);
|
|
187
|
+
(0, _objectsUtils.vectorIntersectWithMesh)(spot4, scene3D.getObjectByName('floor')) && addSpotLight('0xffffff', 0.8, spot4, spot4, spotlightDis);
|
|
191
188
|
}
|
|
192
189
|
}
|
|
193
190
|
}
|
|
@@ -203,15 +200,15 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
203
200
|
|
|
204
201
|
// set loading bar
|
|
205
202
|
switch (self.props.state.mode) {
|
|
206
|
-
case MODE_ELEVATION_VIEW:
|
|
203
|
+
case _constants.MODE_ELEVATION_VIEW:
|
|
207
204
|
self.props.setIsLoadingElevation('front', true);
|
|
208
205
|
break;
|
|
209
|
-
case MODE_3D_VIEW:
|
|
206
|
+
case _constants.MODE_3D_VIEW:
|
|
210
207
|
self.props.setIsLoading3D(true);
|
|
211
208
|
break;
|
|
212
209
|
}
|
|
213
210
|
}
|
|
214
|
-
var _parseData = parseData(scene, actions, this.context.catalog, camera, this.renderer, state.mode),
|
|
211
|
+
var _parseData = (0, _sceneCreator.parseData)(scene, actions, this.context.catalog, camera, this.renderer, state.mode),
|
|
215
212
|
promise = _parseData.promise,
|
|
216
213
|
planData = _parseData.planData;
|
|
217
214
|
promise.then(function () {
|
|
@@ -225,7 +222,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
225
222
|
obj.removeFromParent();
|
|
226
223
|
});
|
|
227
224
|
var bbox = new Three.Box3().setFromObject(planData.plan);
|
|
228
|
-
if (!isElevationView(state.mode)) {
|
|
225
|
+
if (!(0, _helper.isElevationView)(state.mode)) {
|
|
229
226
|
cameraControls.fitToBox(bbox);
|
|
230
227
|
}
|
|
231
228
|
setupLight(scene3D, planData.boundingBox);
|
|
@@ -284,7 +281,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
284
281
|
realVec.push(vec);
|
|
285
282
|
});
|
|
286
283
|
if (aVertices.includes(realVec[0]) && aVertices.includes(realVec[1])) {
|
|
287
|
-
height = convert(layer.ceilHeight).from(layer.unit).to(UNIT_CENTIMETER);
|
|
284
|
+
height = (0, _convertUnitsLite.convert)(layer.ceilHeight).from(layer.unit).to(_constants.UNIT_CENTIMETER);
|
|
288
285
|
// height = data.properties.getIn(['height', 'length']);
|
|
289
286
|
return 1; // break
|
|
290
287
|
}
|
|
@@ -382,11 +379,11 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
382
379
|
|
|
383
380
|
// end snap function variable///////////////////////
|
|
384
381
|
var backsplashVisible = false;
|
|
385
|
-
var holeItems = GeometryUtils.getHoleItems(layer);
|
|
382
|
+
var holeItems = _export.GeometryUtils.getHoleItems(layer);
|
|
386
383
|
var removeSnapBox = function removeSnapBox() {
|
|
387
384
|
if (snapBox != null) {
|
|
388
385
|
planData.plan.remove(snapBox);
|
|
389
|
-
disposeObject(snapBox);
|
|
386
|
+
(0, _threeMemoryCleaner.disposeObject)(snapBox);
|
|
390
387
|
snapBox = null;
|
|
391
388
|
targetObj = null;
|
|
392
389
|
snapFlag = false;
|
|
@@ -457,7 +454,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
457
454
|
x: shape2[j + 1].x,
|
|
458
455
|
y: shape2[j + 1].y
|
|
459
456
|
};
|
|
460
|
-
var flag = GeometryUtils.getLineInterSect(sl1.x, sl1.y, sl2.x, sl2.y, el1.x, el1.y, el2.x, el2.y);
|
|
457
|
+
var flag = _export.GeometryUtils.getLineInterSect(sl1.x, sl1.y, sl2.x, sl2.y, el1.x, el1.y, el2.x, el2.y);
|
|
461
458
|
if (flag) {
|
|
462
459
|
count++;
|
|
463
460
|
if (count > 1) return true;
|
|
@@ -504,20 +501,20 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
504
501
|
return vertices;
|
|
505
502
|
};
|
|
506
503
|
var prepareSnap = function prepareSnap(layer) {
|
|
507
|
-
allLines = GeometryUtils.getAllLines(layer);
|
|
508
|
-
allLineRects = GeometryUtils.buildRectFromLines(layer, allLines);
|
|
509
|
-
allItemRect = GeometryUtils.getAllItems(_this2.props.state.scene, actions.catalog, allLineRects);
|
|
510
|
-
allItemSnap = GeometryUtils.getAllItemSnap(allItemRect);
|
|
511
|
-
allLineSnap = GeometryUtils.getAllLineSnap(allLineRects, allItemRect.cur);
|
|
504
|
+
allLines = _export.GeometryUtils.getAllLines(layer);
|
|
505
|
+
allLineRects = _export.GeometryUtils.buildRectFromLines(layer, allLines);
|
|
506
|
+
allItemRect = _export.GeometryUtils.getAllItems(_this2.props.state.scene, actions.catalog, allLineRects);
|
|
507
|
+
allItemSnap = _export.GeometryUtils.getAllItemSnap(allItemRect);
|
|
508
|
+
allLineSnap = _export.GeometryUtils.getAllLineSnap(allLineRects, allItemRect.cur);
|
|
512
509
|
allRect = allItemRect.others.concat(allLineRects);
|
|
513
|
-
allItemSnap = GeometryUtils.validateSnaps(allItemSnap, allRect);
|
|
514
|
-
allLineSnap = GeometryUtils.validateSnaps(allLineSnap, allRect);
|
|
515
|
-
allArea = GeometryUtils.getAllArea(layer);
|
|
510
|
+
allItemSnap = _export.GeometryUtils.validateSnaps(allItemSnap, allRect);
|
|
511
|
+
allLineSnap = _export.GeometryUtils.validateSnaps(allLineSnap, allRect);
|
|
512
|
+
allArea = _export.GeometryUtils.getAllArea(layer);
|
|
516
513
|
};
|
|
517
514
|
var prepareSnapSpec = function prepareSnapSpec(layer) {
|
|
518
|
-
allLines = GeometryUtils.getAllLines(layer);
|
|
519
|
-
allLineRects = GeometryUtils.buildRectFromLines(layer, allLines);
|
|
520
|
-
allItemRect = GeometryUtils.getAllItemSpecified(_this2.props.state.scene, actions.catalog, WALL_CABINET_LAYOUTPOS);
|
|
515
|
+
allLines = _export.GeometryUtils.getAllLines(layer);
|
|
516
|
+
allLineRects = _export.GeometryUtils.buildRectFromLines(layer, allLines);
|
|
517
|
+
allItemRect = _export.GeometryUtils.getAllItemSpecified(_this2.props.state.scene, actions.catalog, _constants.WALL_CABINET_LAYOUTPOS);
|
|
521
518
|
// allItemSnap = GeometryUtils.getAllItemSnap(allItemRect);
|
|
522
519
|
};
|
|
523
520
|
|
|
@@ -570,7 +567,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
570
567
|
var ocatid = _item.type;
|
|
571
568
|
var ocat = catalog.elements[ocatid];
|
|
572
569
|
var olayoutpos = ocat.info.layoutpos;
|
|
573
|
-
if (!(layoutpos === BASE_CABINET_LAYOUTPOS && olayoutpos === WALL_CABINET_LAYOUTPOS || layoutpos === WALL_CABINET_LAYOUTPOS && olayoutpos === BASE_CABINET_LAYOUTPOS)) {
|
|
570
|
+
if (!(layoutpos === _constants.BASE_CABINET_LAYOUTPOS && olayoutpos === _constants.WALL_CABINET_LAYOUTPOS || layoutpos === _constants.WALL_CABINET_LAYOUTPOS && olayoutpos === _constants.BASE_CABINET_LAYOUTPOS)) {
|
|
574
571
|
var tRot = _item.rotation;
|
|
575
572
|
var tPos = new Three.Vector2(_item.x, _item.y);
|
|
576
573
|
var tBounding = target.children[0].userData;
|
|
@@ -652,12 +649,13 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
652
649
|
var _item2 = layer.items.getIn([data.id]);
|
|
653
650
|
var ocatid = _item2.type;
|
|
654
651
|
var ocat = catalog.elements[ocatid];
|
|
655
|
-
if (!ocat) ocat = catalog.elements[returnReplaceableDeepSearchType(ocatid)];
|
|
652
|
+
if (!ocat) ocat = catalog.elements[(0, _utils.returnReplaceableDeepSearchType)(ocatid)];
|
|
656
653
|
var otherItem = {
|
|
657
654
|
item: _item2,
|
|
658
655
|
cat: ocat
|
|
659
656
|
};
|
|
660
|
-
|
|
657
|
+
console.log('currentItem =>', currentItem);
|
|
658
|
+
if (_export.GeometryUtils.needSnap(currentItem, otherItem) && otherItem.cat.type != 'cabinet') {
|
|
661
659
|
var tRot = _item2.rotation;
|
|
662
660
|
var tPos = new Three.Vector2(_item2.x, _item2.y);
|
|
663
661
|
var tBounding = target.children[0].userData;
|
|
@@ -711,7 +709,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
711
709
|
// sort from distance
|
|
712
710
|
for (var _i5 = 0; _i5 < items.length - 1; _i5++) {
|
|
713
711
|
for (var j = _i5 + 1; j < items.length; j++) {
|
|
714
|
-
if (verticesDistance(oPos, new Three.Vector2(items[_i5].x, items[_i5].y)) > verticesDistance(oPos, new Three.Vector2(items[j].x, items[j].y))) {
|
|
712
|
+
if ((0, _geometry.verticesDistance)(oPos, new Three.Vector2(items[_i5].x, items[_i5].y)) > (0, _geometry.verticesDistance)(oPos, new Three.Vector2(items[j].x, items[j].y))) {
|
|
715
713
|
var exchange = items[j];
|
|
716
714
|
items[j] = items[_i5];
|
|
717
715
|
items[_i5] = exchange;
|
|
@@ -829,7 +827,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
829
827
|
var tRot = layer.getIn(['items', target.userData.itemId]) ? layer.getIn(['items', target.userData.itemId]).rotation : 0;
|
|
830
828
|
var item = layer.getIn(['items', source.userData.itemId]);
|
|
831
829
|
var layoutType = item.layoutpos;
|
|
832
|
-
var altitudeLength = convert(item.properties.getIn(['altitude', '_length'])).from('in').to('cm');
|
|
830
|
+
var altitudeLength = (0, _convertUnitsLite.convert)(item.properties.getIn(['altitude', '_length'])).from('in').to('cm');
|
|
833
831
|
var sBounding = source.children[0].userData;
|
|
834
832
|
var tBounding = target.children[0].userData;
|
|
835
833
|
var tPos = target.position.clone();
|
|
@@ -846,7 +844,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
846
844
|
var removeSnapBoxObj = function removeSnapBoxObj() {
|
|
847
845
|
if (snapBoxObj) {
|
|
848
846
|
planData.plan.remove(snapBoxObj);
|
|
849
|
-
disposeObject(snapBoxObj);
|
|
847
|
+
(0, _threeMemoryCleaner.disposeObject)(snapBoxObj);
|
|
850
848
|
}
|
|
851
849
|
snapFlag = false;
|
|
852
850
|
};
|
|
@@ -855,7 +853,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
855
853
|
box.material.depthTest = false;
|
|
856
854
|
box.renderOrder = 200;
|
|
857
855
|
snapBoxObj.add(box);
|
|
858
|
-
snapBoxObj.position.set(source.position.x, layoutType === WALL_CABINET_LAYOUTPOS ? altitudeLength + source.position.y + height / 2 : source.position.y + height / 2, source.position.z);
|
|
856
|
+
snapBoxObj.position.set(source.position.x, layoutType === _constants.WALL_CABINET_LAYOUTPOS ? altitudeLength + source.position.y + height / 2 : source.position.y + height / 2, source.position.z);
|
|
859
857
|
snapBoxObj.rotation.set(source.rotation.x, source.rotation.y, source.rotation.z);
|
|
860
858
|
snapBoxObj.name = 'TransformBox';
|
|
861
859
|
planData.plan.add(snapBoxObj);
|
|
@@ -930,7 +928,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
930
928
|
return;
|
|
931
929
|
} else {
|
|
932
930
|
var _layoutType = _item3.layoutpos;
|
|
933
|
-
var _altitudeLength = convert(_item3.properties.getIn(['altitude', '_length'])).from('in').to('cm');
|
|
931
|
+
var _altitudeLength = (0, _convertUnitsLite.convert)(_item3.properties.getIn(['altitude', '_length'])).from('in').to('cm');
|
|
934
932
|
var _sBounding = source.children[0].userData;
|
|
935
933
|
var _width = _sBounding.max.x - _sBounding.min.x;
|
|
936
934
|
var _height = _sBounding.max.y - _sBounding.min.y;
|
|
@@ -945,7 +943,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
945
943
|
var _removeSnapBoxObj = function _removeSnapBoxObj() {
|
|
946
944
|
if (_snapBoxObj) {
|
|
947
945
|
planData.plan.remove(_snapBoxObj);
|
|
948
|
-
disposeObject(_snapBoxObj);
|
|
946
|
+
(0, _threeMemoryCleaner.disposeObject)(_snapBoxObj);
|
|
949
947
|
}
|
|
950
948
|
snapFlag = false;
|
|
951
949
|
};
|
|
@@ -954,7 +952,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
954
952
|
_box.material.depthTest = false;
|
|
955
953
|
_box.renderOrder = 100;
|
|
956
954
|
_snapBoxObj.add(_box);
|
|
957
|
-
_snapBoxObj.position.set(source.position.x, _layoutType === WALL_CABINET_LAYOUTPOS ? _altitudeLength + source.position.y + _height / 2 : source.position.y + _height / 2, source.position.z);
|
|
955
|
+
_snapBoxObj.position.set(source.position.x, _layoutType === _constants.WALL_CABINET_LAYOUTPOS ? _altitudeLength + source.position.y + _height / 2 : source.position.y + _height / 2, source.position.z);
|
|
958
956
|
_snapBoxObj.rotation.set(source.rotation.x, source.rotation.y, source.rotation.z);
|
|
959
957
|
_snapBoxObj.name = 'TransformBox';
|
|
960
958
|
planData.plan.add(_snapBoxObj);
|
|
@@ -1091,7 +1089,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1091
1089
|
ctx.beginPath();
|
|
1092
1090
|
ctx.arc(50, 50, 45, 0, 2 * Math.PI);
|
|
1093
1091
|
ctx.stroke();
|
|
1094
|
-
ctx.strokeStyle = SECONDARY_PURPLE_COLOR;
|
|
1092
|
+
ctx.strokeStyle = _constants.SECONDARY_PURPLE_COLOR;
|
|
1095
1093
|
ctx.lineWidth = 6;
|
|
1096
1094
|
ctx.beginPath();
|
|
1097
1095
|
if (lastAngle < 15 && lastAngle > -15) {
|
|
@@ -1195,7 +1193,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1195
1193
|
var properties = allItemRect.cur.itemInfo.properties;
|
|
1196
1194
|
altitude = properties.getIn(['altitude', '_length']);
|
|
1197
1195
|
var unit = properties.getIn(['altitude', '_unit']) || 'in';
|
|
1198
|
-
altitude = convert(altitude).from(unit).to(_this2.props.state.scene.unit);
|
|
1196
|
+
altitude = (0, _convertUnitsLite.convert)(altitude).from(unit).to(_this2.props.state.scene.unit);
|
|
1199
1197
|
}
|
|
1200
1198
|
getPoint(event, altitude);
|
|
1201
1199
|
var state = _this2.props.state;
|
|
@@ -1260,7 +1258,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1260
1258
|
console.log('intersects[i] is undefined in viewer3d/viewer3d.js');
|
|
1261
1259
|
}
|
|
1262
1260
|
}
|
|
1263
|
-
if (_this2.props.state.mode == MODE_DRAWING_ITEM_3D) return;
|
|
1261
|
+
if (_this2.props.state.mode == _constants.MODE_DRAWING_ITEM_3D) return;
|
|
1264
1262
|
if (isSelected) {
|
|
1265
1263
|
!_this2.props.downloadFlag && _this2.props.setToolbar('');
|
|
1266
1264
|
if (intersects.length > 0 && !isNaN(intersects[0].distance)) {
|
|
@@ -1287,13 +1285,13 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1287
1285
|
var _properties = allItemRect.cur.itemInfo.properties;
|
|
1288
1286
|
alti = _properties.getIn(['altitude', '_length']);
|
|
1289
1287
|
var _unit = _properties.getIn(['altitude', '_unit']) || 'in';
|
|
1290
|
-
alti = convert(alti).from(_unit).to(_this2.props.state.scene.unit);
|
|
1288
|
+
alti = (0, _convertUnitsLite.convert)(alti).from(_unit).to(_this2.props.state.scene.unit);
|
|
1291
1289
|
}
|
|
1292
1290
|
getPoint({
|
|
1293
1291
|
offsetX: event.offsetX - 50,
|
|
1294
1292
|
offsetY: event.offsetY
|
|
1295
1293
|
}, alti);
|
|
1296
|
-
if (
|
|
1294
|
+
if (!selectedItem) return;
|
|
1297
1295
|
var selItem = _this2.props.state.scene.layers.get(selectedObject.layerID).items.get(selectedObject.itemID);
|
|
1298
1296
|
lastAngle = 0;
|
|
1299
1297
|
angleObj.position.set(planData.plan.position.x + Point.x, selItem.category === 'lighting' ? -planData.plan.position.y - selItem.properties.get('height').get('length') : selItem.properties.get('altitude').get('length') + planData.plan.position.y, planData.plan.position.z - Point.y);
|
|
@@ -1324,8 +1322,8 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1324
1322
|
for (_i1 = 0; _i1 < intersects.length; _i1++) {
|
|
1325
1323
|
if (selectedItem != undefined && intersects[_i1].object.parent && intersects[_i1].object.parent.parent.userData.itemId === selectedItem.userData.itemId) selectedFlag = true;
|
|
1326
1324
|
}
|
|
1327
|
-
if (selectedFlag || toolIntersects.length > 0 && !isElevationView(mode)) {
|
|
1328
|
-
cameraControls.mouseButtons.left =
|
|
1325
|
+
if (selectedFlag || toolIntersects.length > 0 && !(0, _helper.isElevationView)(mode)) {
|
|
1326
|
+
cameraControls.mouseButtons.left = _cameraControls["default"].ACTION.NONE;
|
|
1329
1327
|
selectedFlag = false;
|
|
1330
1328
|
} else {
|
|
1331
1329
|
isSelected = false;
|
|
@@ -1351,7 +1349,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1351
1349
|
var properties = allItemRect.cur.itemInfo.properties;
|
|
1352
1350
|
altitude = properties.getIn(['altitude', '_length']);
|
|
1353
1351
|
var unit = properties.getIn(['altitude', '_unit']) || 'in';
|
|
1354
|
-
altitude = convert(altitude).from(unit).to(_this2.props.state.scene.unit);
|
|
1352
|
+
altitude = (0, _convertUnitsLite.convert)(altitude).from(unit).to(_this2.props.state.scene.unit);
|
|
1355
1353
|
}
|
|
1356
1354
|
scene3D.remove(angleObj);
|
|
1357
1355
|
scene3D.remove(toolObj);
|
|
@@ -1359,7 +1357,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1359
1357
|
_this2.props.setToolbar('');
|
|
1360
1358
|
}
|
|
1361
1359
|
getPoint(event, altitude);
|
|
1362
|
-
if (_this2.props.state.mode == MODE_DRAWING_ITEM_3D) {
|
|
1360
|
+
if (_this2.props.state.mode == _constants.MODE_DRAWING_ITEM_3D) {
|
|
1363
1361
|
if (Point.x > _this2.props.state.scene.width) Point.x = _this2.props.state.width;
|
|
1364
1362
|
if (Point.y > _this2.props.state.scene.height) Point.y = _this2.props.state.height;
|
|
1365
1363
|
if (Point.x < 0) Point.x = 0;
|
|
@@ -1370,7 +1368,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1370
1368
|
removeSnapBox();
|
|
1371
1369
|
var polygon = lineRect(layer);
|
|
1372
1370
|
// if cursor is outside of room
|
|
1373
|
-
if (!GeometryUtils.ContainsPoint(polygon, Point.x, Point.y)) {
|
|
1371
|
+
if (!_export.GeometryUtils.ContainsPoint(polygon, Point.x, Point.y)) {
|
|
1374
1372
|
actions.itemsActions.endDrawingItem(_this2.props.state.scene.selectedLayer, sPoint.x, sPoint.y);
|
|
1375
1373
|
} else {
|
|
1376
1374
|
actions.itemsActions.updateDraggingItemChanged(targetPoint.x, -targetPoint.z, selectedObject.layerID, selectedObject.itemID);
|
|
@@ -1381,13 +1379,13 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1381
1379
|
bMove = false;
|
|
1382
1380
|
return;
|
|
1383
1381
|
}
|
|
1384
|
-
if (_this2.props.state.mode == MODE_DRAGGING_ITEM_3D) {
|
|
1382
|
+
if (_this2.props.state.mode == _constants.MODE_DRAGGING_ITEM_3D) {
|
|
1385
1383
|
_this2.context.itemsActions.endDraggingItem3D();
|
|
1386
1384
|
}
|
|
1387
|
-
if (_this2.props.state.mode == MODE_ROTATING_ITEM_3D) {
|
|
1385
|
+
if (_this2.props.state.mode == _constants.MODE_ROTATING_ITEM_3D) {
|
|
1388
1386
|
_this2.context.itemsActions.endRotatingItem3D(sPoint.x, sPoint.y);
|
|
1389
1387
|
}
|
|
1390
|
-
if (_this2.props.state.mode == MODE_DRAWING_HOLE_3D) {
|
|
1388
|
+
if (_this2.props.state.mode == _constants.MODE_DRAWING_HOLE_3D) {
|
|
1391
1389
|
gridPlanOrigin = gridPlane.position;
|
|
1392
1390
|
gridMatrix.copy(gridPlane.matrixWorld).invert();
|
|
1393
1391
|
camPos = camera.position;
|
|
@@ -1398,7 +1396,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1398
1396
|
}
|
|
1399
1397
|
event.preventDefault();
|
|
1400
1398
|
if (event.button === 0) {
|
|
1401
|
-
cameraControls.mouseButtons.left =
|
|
1399
|
+
cameraControls.mouseButtons.left = _cameraControls["default"].ACTION.ROTATE;
|
|
1402
1400
|
mouse.x = event.offsetX / _this2.width * 2 - 1;
|
|
1403
1401
|
mouse.y = -(event.offsetY / _this2.height) * 2 + 1;
|
|
1404
1402
|
raycaster.setFromCamera(mouse, camera);
|
|
@@ -1462,9 +1460,9 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1462
1460
|
}
|
|
1463
1461
|
isSelected = true;
|
|
1464
1462
|
setTimeout(function () {
|
|
1465
|
-
getDistances(layer);
|
|
1463
|
+
(0, _sceneCreator.getDistances)(layer);
|
|
1466
1464
|
var selectedItem = planData.sceneGraph.layers[selectedObject.layerID].items[selectedObject.itemID];
|
|
1467
|
-
if (
|
|
1465
|
+
if (!selectedItem) return;
|
|
1468
1466
|
var selItem = _this2.props.state.scene.layers.get(selectedObject.layerID).items.get(selectedObject.itemID);
|
|
1469
1467
|
var itemPos = selectedItem.position.clone();
|
|
1470
1468
|
if (intersects[_i10].object.parent && intersects[_i10].object.parent.parent.userData.itemId === selectedItem.userData.itemId) {
|
|
@@ -1479,10 +1477,10 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1479
1477
|
// showItemButtons(layer.getIn(['items', selectedObject.itemID]), currentObject, event, camera, this.renderer);
|
|
1480
1478
|
var pointArray = [],
|
|
1481
1479
|
cnt = 0;
|
|
1482
|
-
pointArray.push([fVLine[0].userData.distance, 90]);
|
|
1483
|
-
pointArray.push([fVLine[1].userData.distance, -90]);
|
|
1484
|
-
pointArray.push([fVLine[2].userData.distance, 180]);
|
|
1485
|
-
pointArray.push([fVLine[3].userData.distance, 0]);
|
|
1480
|
+
pointArray.push([_sceneCreator.fVLine[0].userData.distance, 90]);
|
|
1481
|
+
pointArray.push([_sceneCreator.fVLine[1].userData.distance, -90]);
|
|
1482
|
+
pointArray.push([_sceneCreator.fVLine[2].userData.distance, 180]);
|
|
1483
|
+
pointArray.push([_sceneCreator.fVLine[3].userData.distance, 0]);
|
|
1486
1484
|
pointArray.forEach(function (pointElement, index) {
|
|
1487
1485
|
if (pointElement[0] == undefined) pointArray[index][0] = 0;
|
|
1488
1486
|
});
|
|
@@ -1534,19 +1532,19 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1534
1532
|
selectedObj = allItemRect.cur;
|
|
1535
1533
|
}
|
|
1536
1534
|
} else {
|
|
1537
|
-
visibleTransformBox(false);
|
|
1535
|
+
(0, _sceneCreator.visibleTransformBox)(false);
|
|
1538
1536
|
var alti = 0;
|
|
1539
1537
|
if (allItemRect && allItemRect.cur && allItemRect.cur.itemInfo !== undefined) {
|
|
1540
1538
|
var _properties2 = allItemRect.cur.itemInfo.properties;
|
|
1541
1539
|
alti = _properties2.getIn(['altitude', '_length']);
|
|
1542
1540
|
var _unit2 = _properties2.getIn(['altitude', '_unit']) || 'in';
|
|
1543
|
-
alti = convert(alti).from(_unit2).to(_this2.props.state.scene.unit);
|
|
1541
|
+
alti = (0, _convertUnitsLite.convert)(alti).from(_unit2).to(_this2.props.state.scene.unit);
|
|
1544
1542
|
}
|
|
1545
1543
|
getPoint(event, alti);
|
|
1546
1544
|
if (bRotate) {
|
|
1547
1545
|
var _intersects$_i;
|
|
1548
1546
|
var selectedItem = planData.sceneGraph.layers[selectedObject.layerID].items[selectedObject.itemID];
|
|
1549
|
-
if (
|
|
1547
|
+
if (!selectedItem) return;
|
|
1550
1548
|
var selItem = _this2.props.state.scene.layers.get(selectedObject.layerID).items.get(selectedObject.itemID);
|
|
1551
1549
|
var itemPos = selectedItem.position.clone();
|
|
1552
1550
|
if (((_intersects$_i = intersects[_i10]) === null || _intersects$_i === void 0 || (_intersects$_i = _intersects$_i.object) === null || _intersects$_i === void 0 || (_intersects$_i = _intersects$_i.parent) === null || _intersects$_i === void 0 || (_intersects$_i = _intersects$_i.parent) === null || _intersects$_i === void 0 || (_intersects$_i = _intersects$_i.userData) === null || _intersects$_i === void 0 ? void 0 : _intersects$_i.itemId) === selectedItem.userData.itemId) {
|
|
@@ -1564,7 +1562,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1564
1562
|
if (bMove) {
|
|
1565
1563
|
bMove = false;
|
|
1566
1564
|
var _selectedItem = planData.sceneGraph.layers[selectedObject.layerID].items[selectedObject.itemID];
|
|
1567
|
-
if (
|
|
1565
|
+
if (!_selectedItem) return;
|
|
1568
1566
|
var _selItem = _this2.props.state.scene.layers.get(selectedObject.layerID).items.get(selectedObject.itemID);
|
|
1569
1567
|
var _itemPos = _selectedItem.position.clone();
|
|
1570
1568
|
if (intersects[_i10].object.parent.parent.userData.itemId === _selectedItem.userData.itemId) {
|
|
@@ -1613,9 +1611,9 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1613
1611
|
var properties = allItemRect.cur.itemInfo.properties;
|
|
1614
1612
|
altitude = properties.getIn(['altitude', '_length']);
|
|
1615
1613
|
var unit = properties.getIn(['altitude', '_unit']) || 'in';
|
|
1616
|
-
altitude = convert(altitude).from(unit).to(_this2.props.state.scene.unit);
|
|
1614
|
+
altitude = (0, _convertUnitsLite.convert)(altitude).from(unit).to(_this2.props.state.scene.unit);
|
|
1617
1615
|
}
|
|
1618
|
-
if (_this2.props.state.mode === MODE_DRAWING_HOLE_3D) {
|
|
1616
|
+
if (_this2.props.state.mode === _constants.MODE_DRAWING_HOLE_3D) {
|
|
1619
1617
|
gridPlanOrigin = gridPlane.position;
|
|
1620
1618
|
gridMatrix.copy(gridPlane.matrixWorld).invert();
|
|
1621
1619
|
camPos = camera.position;
|
|
@@ -1627,7 +1625,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1627
1625
|
} else {
|
|
1628
1626
|
var layerID = _this2.props.state.scene.selectedLayer;
|
|
1629
1627
|
var holeID = _this2.props.state.drawingSupport.get('currentID');
|
|
1630
|
-
deleteSpecifiedMeshObjects('WarningBox' + holeID);
|
|
1628
|
+
(0, _sceneCreator.deleteSpecifiedMeshObjects)('WarningBox' + holeID);
|
|
1631
1629
|
prepareSnap(layer);
|
|
1632
1630
|
|
|
1633
1631
|
// let {nx, ny, rot} = GeometryUtils.calcSnap(allItemRect, allItemSnap, allLineRects, allLineSnap, allRect, Point.x, Point.y, allArea);
|
|
@@ -1637,7 +1635,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1637
1635
|
sPoint.set(nx, ny);
|
|
1638
1636
|
}
|
|
1639
1637
|
}
|
|
1640
|
-
if (_this2.props.state.mode === MODE_DRAWING_ITEM_3D) {
|
|
1638
|
+
if (_this2.props.state.mode === _constants.MODE_DRAWING_ITEM_3D) {
|
|
1641
1639
|
// We need to set cam position since when MODE_DRAWING_ITEM_3D mouse down event
|
|
1642
1640
|
// is not emited so cam position is not valid
|
|
1643
1641
|
gridPlanOrigin = gridPlane.position;
|
|
@@ -1651,7 +1649,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1651
1649
|
};
|
|
1652
1650
|
var _layer = _this2.props.state.scene.getIn(['layers', selectedObject.layerID]);
|
|
1653
1651
|
var polygon = lineRect(_layer);
|
|
1654
|
-
var isCursorInArea = GeometryUtils.ContainsPoint(polygon, Point.x, Point.y);
|
|
1652
|
+
var isCursorInArea = _export.GeometryUtils.ContainsPoint(polygon, Point.x, Point.y);
|
|
1655
1653
|
var _drawingSupport = _this2.props.state.drawingSupport;
|
|
1656
1654
|
if (!_drawingSupport.has('currentID')) {
|
|
1657
1655
|
var initialX = Point.x,
|
|
@@ -1670,7 +1668,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1670
1668
|
point = [];
|
|
1671
1669
|
}
|
|
1672
1670
|
});
|
|
1673
|
-
var centroid = GeometryUtils.getCentroidOfPolygon(points);
|
|
1671
|
+
var centroid = _export.GeometryUtils.getCentroidOfPolygon(points);
|
|
1674
1672
|
initialX = centroid[0];
|
|
1675
1673
|
initialY = centroid[1];
|
|
1676
1674
|
}
|
|
@@ -1682,8 +1680,8 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1682
1680
|
var mX = Point.x - sPoint.x;
|
|
1683
1681
|
var mY = Point.y - sPoint.y;
|
|
1684
1682
|
var item3D = planData.sceneGraph.layers[selectedObject.layerID].items[selectedObject.itemID];
|
|
1685
|
-
deleteSpecifiedMeshObjects('TransformBox');
|
|
1686
|
-
deleteSpecifiedMeshObjects('WarningBox' + itemID);
|
|
1683
|
+
(0, _sceneCreator.deleteSpecifiedMeshObjects)('TransformBox');
|
|
1684
|
+
(0, _sceneCreator.deleteSpecifiedMeshObjects)('WarningBox' + itemID);
|
|
1687
1685
|
var item = _layer.items.getIn([selectedObject.itemID]);
|
|
1688
1686
|
if (item.counterTop.uri == '') item.counterTop.uri = _layer.counterTop.uri;
|
|
1689
1687
|
var sRot = item.rotation;
|
|
@@ -1695,7 +1693,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1695
1693
|
var sdepth = sBounding.max.z - sBounding.min.z;
|
|
1696
1694
|
var sVertices = _this2.getRectPoints(swidth, sdepth, tPos.clone(), sRot % 360 / 180 * Math.PI);
|
|
1697
1695
|
prepareSnap(_layer);
|
|
1698
|
-
var _GeometryUtils$calcSn = GeometryUtils.calcSnap(allItemRect, allItemSnap, allLineRects, allLineSnap, allRect, Point.x, Point.y, allArea),
|
|
1696
|
+
var _GeometryUtils$calcSn = _export.GeometryUtils.calcSnap(allItemRect, allItemSnap, allLineRects, allLineSnap, allRect, Point.x, Point.y, allArea),
|
|
1699
1697
|
_nx = _GeometryUtils$calcSn.nx,
|
|
1700
1698
|
_ny = _GeometryUtils$calcSn.ny,
|
|
1701
1699
|
rot = _GeometryUtils$calcSn.rot;
|
|
@@ -1709,9 +1707,9 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1709
1707
|
//return;
|
|
1710
1708
|
}
|
|
1711
1709
|
if (polygon.length > 0) {
|
|
1712
|
-
var PolygonSect = GeometryUtils.ContainsPoint(polygon, _nx, _ny);
|
|
1710
|
+
var PolygonSect = _export.GeometryUtils.ContainsPoint(polygon, _nx, _ny);
|
|
1713
1711
|
if (!PolygonSect) {
|
|
1714
|
-
var _GeometryUtils$calcCr = GeometryUtils.calcCreateSnap(allItemRect, allItemSnap, allLineRects, allLineSnap, allRect, Point.x, Point.y, polygon),
|
|
1712
|
+
var _GeometryUtils$calcCr = _export.GeometryUtils.calcCreateSnap(allItemRect, allItemSnap, allLineRects, allLineSnap, allRect, Point.x, Point.y, polygon),
|
|
1715
1713
|
cx = _GeometryUtils$calcCr.cx,
|
|
1716
1714
|
cy = _GeometryUtils$calcCr.cy,
|
|
1717
1715
|
crot = _GeometryUtils$calcCr.crot;
|
|
@@ -1721,19 +1719,19 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1721
1719
|
}
|
|
1722
1720
|
}
|
|
1723
1721
|
if (polygon.length > 0) {
|
|
1724
|
-
var isSnapInArea = GeometryUtils.ContainsPoint(polygon, _nx, _ny);
|
|
1722
|
+
var isSnapInArea = _export.GeometryUtils.ContainsPoint(polygon, _nx, _ny);
|
|
1725
1723
|
if (!isSnapInArea) return;
|
|
1726
1724
|
}
|
|
1727
1725
|
actions.itemsActions.updateDraggingItemChanged(_nx, _ny, selectedObject.layerID, selectedObject.itemID);
|
|
1728
1726
|
actions.itemsActions.updateRotatingItemChanged(rot, selectedObject.layerID, selectedObject.itemID);
|
|
1729
1727
|
sPoint.set(_nx, _ny);
|
|
1730
|
-
getDistances(_layer);
|
|
1728
|
+
(0, _sceneCreator.getDistances)(_layer);
|
|
1731
1729
|
var pointArray = [],
|
|
1732
1730
|
cnt = 0;
|
|
1733
|
-
pointArray.push([fVLine[0].userData.distance, 90]);
|
|
1734
|
-
pointArray.push([fVLine[1].userData.distance, -90]);
|
|
1735
|
-
pointArray.push([fVLine[2].userData.distance, 180]);
|
|
1736
|
-
pointArray.push([fVLine[3].userData.distance, 0]);
|
|
1731
|
+
pointArray.push([_sceneCreator.fVLine[0].userData.distance, 90]);
|
|
1732
|
+
pointArray.push([_sceneCreator.fVLine[1].userData.distance, -90]);
|
|
1733
|
+
pointArray.push([_sceneCreator.fVLine[2].userData.distance, 180]);
|
|
1734
|
+
pointArray.push([_sceneCreator.fVLine[3].userData.distance, 0]);
|
|
1737
1735
|
pointArray.forEach(function (pointElement, index) {
|
|
1738
1736
|
if (pointElement[0] == undefined) pointArray[index][0] = 0;
|
|
1739
1737
|
});
|
|
@@ -1745,8 +1743,8 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1745
1743
|
pointArray[1][0] = 100;
|
|
1746
1744
|
}
|
|
1747
1745
|
actions.itemsActions.storeDistArray(_layer.id, item.id, pointArray);
|
|
1748
|
-
var minDis = fVLine[0].userData.distance;
|
|
1749
|
-
var snapObj = fVLine[0];
|
|
1746
|
+
var minDis = _sceneCreator.fVLine[0].userData.distance;
|
|
1747
|
+
var snapObj = _sceneCreator.fVLine[0];
|
|
1750
1748
|
var iPos = item3D.position.clone();
|
|
1751
1749
|
var snapDis = Math.sqrt((iPos.x - targetPoint.x) * (iPos.x - targetPoint.x) + (iPos.z - targetPoint.z) * (iPos.z - targetPoint.z));
|
|
1752
1750
|
if (snapDis >= 100 && snapObj != null) {
|
|
@@ -1754,10 +1752,10 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1754
1752
|
backsplashVisible = false;
|
|
1755
1753
|
//console.log('1 snap no');
|
|
1756
1754
|
}
|
|
1757
|
-
for (var _i11 = 1; _i11 < fVLine.length; _i11++) {
|
|
1758
|
-
if (minDis > fVLine[_i11].userData.distance) {
|
|
1759
|
-
minDis = fVLine[_i11].userData.distance;
|
|
1760
|
-
snapObj = fVLine[_i11];
|
|
1755
|
+
for (var _i11 = 1; _i11 < _sceneCreator.fVLine.length; _i11++) {
|
|
1756
|
+
if (minDis > _sceneCreator.fVLine[_i11].userData.distance) {
|
|
1757
|
+
minDis = _sceneCreator.fVLine[_i11].userData.distance;
|
|
1758
|
+
snapObj = _sceneCreator.fVLine[_i11];
|
|
1761
1759
|
}
|
|
1762
1760
|
}
|
|
1763
1761
|
if (snapBox == null) {
|
|
@@ -1768,14 +1766,14 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1768
1766
|
_this2.snap(snapObj, _layer);
|
|
1769
1767
|
snapFlag = true;
|
|
1770
1768
|
//console.log('1 snap Yes')
|
|
1771
|
-
getDistances(_layer, true);
|
|
1769
|
+
(0, _sceneCreator.getDistances)(_layer, true);
|
|
1772
1770
|
var _i12 = 0;
|
|
1773
|
-
for (_i12 = 0; _i12 < fVLine.length; _i12++) {
|
|
1774
|
-
if (fVLine[_i12].userData.distance < snapDelta) {
|
|
1771
|
+
for (_i12 = 0; _i12 < _sceneCreator.fVLine.length; _i12++) {
|
|
1772
|
+
if (_sceneCreator.fVLine[_i12].userData.distance < snapDelta) {
|
|
1775
1773
|
break;
|
|
1776
1774
|
}
|
|
1777
1775
|
}
|
|
1778
|
-
if (_i12 === fVLine.length) backsplashVisible = false;else backsplashVisible = true;
|
|
1776
|
+
if (_i12 === _sceneCreator.fVLine.length) backsplashVisible = false;else backsplashVisible = true;
|
|
1779
1777
|
}
|
|
1780
1778
|
actions.itemsActions.setBacksplashVisible(selectedObject.itemID, backsplashVisible);
|
|
1781
1779
|
}
|
|
@@ -1788,8 +1786,8 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1788
1786
|
var orginRot = _this2.props.state.rotatingSupport.get('originRotation');
|
|
1789
1787
|
angleTexture.image = createAngleObject((orginRot < 0 ? 360 - orginRot : orginRot) - _item4.rotation);
|
|
1790
1788
|
angleTexture.needsUpdate = true;
|
|
1791
|
-
deleteSpecifiedMeshObjects('WarningBox' + selectedObject.itemID);
|
|
1792
|
-
deleteSpecifiedMeshObjects('backsplash' + selectedObject.itemID);
|
|
1789
|
+
(0, _sceneCreator.deleteSpecifiedMeshObjects)('WarningBox' + selectedObject.itemID);
|
|
1790
|
+
(0, _sceneCreator.deleteSpecifiedMeshObjects)('backsplash' + selectedObject.itemID);
|
|
1793
1791
|
actions.sceneActions.updateMovingState(false);
|
|
1794
1792
|
}
|
|
1795
1793
|
if (bMoveUP) {
|
|
@@ -1807,7 +1805,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1807
1805
|
sPoint.set(Point.x, Point.y);
|
|
1808
1806
|
} else {
|
|
1809
1807
|
var _holeID = _this2.props.state.draggingSupport.get('currentID');
|
|
1810
|
-
deleteSpecifiedMeshObjects('WarningBox' + _holeID);
|
|
1808
|
+
(0, _sceneCreator.deleteSpecifiedMeshObjects)('WarningBox' + _holeID);
|
|
1811
1809
|
var _nx2 = Point.x;
|
|
1812
1810
|
var _ny2 = Point.y;
|
|
1813
1811
|
actions.holesActions.updateDraggingHole(_nx2, _ny2);
|
|
@@ -1822,8 +1820,8 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1822
1820
|
var _sRot2 = _item5.rotation;
|
|
1823
1821
|
var _mX = Point.x - sPoint.x;
|
|
1824
1822
|
var _mY = Point.y - sPoint.y;
|
|
1825
|
-
deleteSpecifiedMeshObjects('WarningBox' + selectedObject.itemID);
|
|
1826
|
-
deleteSpecifiedMeshObjects('backsplash' + selectedObject.itemID);
|
|
1823
|
+
(0, _sceneCreator.deleteSpecifiedMeshObjects)('WarningBox' + selectedObject.itemID);
|
|
1824
|
+
(0, _sceneCreator.deleteSpecifiedMeshObjects)('backsplash' + selectedObject.itemID);
|
|
1827
1825
|
prepareSnap(_layer3);
|
|
1828
1826
|
getPoint(event, altitude);
|
|
1829
1827
|
var _originPos = _item3D2.position.clone();
|
|
@@ -1832,7 +1830,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1832
1830
|
var _swidth = _sBounding2.max.x - _sBounding2.min.x;
|
|
1833
1831
|
var _sdepth = _sBounding2.max.z - _sBounding2.min.z;
|
|
1834
1832
|
var _sVertices = _this2.getRectPoints(_swidth, _sdepth, _tPos4.clone(), _sRot2 % 360 / 180 * Math.PI);
|
|
1835
|
-
var _GeometryUtils$calcSn2 = GeometryUtils.calcSnap(allItemRect, allItemSnap, allLineRects, allLineSnap, allRect, Point.x, Point.y, allArea),
|
|
1833
|
+
var _GeometryUtils$calcSn2 = _export.GeometryUtils.calcSnap(allItemRect, allItemSnap, allLineRects, allLineSnap, allRect, Point.x, Point.y, allArea),
|
|
1836
1834
|
_nx3 = _GeometryUtils$calcSn2.nx,
|
|
1837
1835
|
_ny3 = _GeometryUtils$calcSn2.ny,
|
|
1838
1836
|
_rot = _GeometryUtils$calcSn2.rot;
|
|
@@ -1847,9 +1845,9 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1847
1845
|
}
|
|
1848
1846
|
var polygonPoint = lineRect(_layer3);
|
|
1849
1847
|
if (polygonPoint.length > 0) {
|
|
1850
|
-
var _PolygonSect = GeometryUtils.ContainsPoint(polygonPoint, _nx3, _ny3);
|
|
1848
|
+
var _PolygonSect = _export.GeometryUtils.ContainsPoint(polygonPoint, _nx3, _ny3);
|
|
1851
1849
|
if (!_PolygonSect) {
|
|
1852
|
-
var _GeometryUtils$calcCr2 = GeometryUtils.calcCreateSnap(allItemRect, allItemSnap, allLineRects, allLineSnap, allRect, Point.x, Point.y, polygonPoint),
|
|
1850
|
+
var _GeometryUtils$calcCr2 = _export.GeometryUtils.calcCreateSnap(allItemRect, allItemSnap, allLineRects, allLineSnap, allRect, Point.x, Point.y, polygonPoint),
|
|
1853
1851
|
_cx3 = _GeometryUtils$calcCr2.cx,
|
|
1854
1852
|
_cy = _GeometryUtils$calcCr2.cy,
|
|
1855
1853
|
_crot = _GeometryUtils$calcCr2.crot;
|
|
@@ -1860,19 +1858,19 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1860
1858
|
}
|
|
1861
1859
|
var _polygon = lineRect(_layer3);
|
|
1862
1860
|
if (_polygon.length > 0) {
|
|
1863
|
-
var Sect = GeometryUtils.ContainsPoint(_polygon, _nx3, _ny3);
|
|
1861
|
+
var Sect = _export.GeometryUtils.ContainsPoint(_polygon, _nx3, _ny3);
|
|
1864
1862
|
if (!Sect) return;
|
|
1865
1863
|
}
|
|
1866
1864
|
actions.itemsActions.updateDraggingItemChanged(_nx3, _ny3, selectedObject.layerID, selectedObject.itemID);
|
|
1867
1865
|
actions.itemsActions.updateRotatingItemChanged(_rot, selectedObject.layerID, selectedObject.itemID);
|
|
1868
1866
|
sPoint.set(_nx3, _ny3);
|
|
1869
|
-
getDistances(_layer3);
|
|
1867
|
+
(0, _sceneCreator.getDistances)(_layer3);
|
|
1870
1868
|
var _pointArray = [],
|
|
1871
1869
|
_cnt = 0;
|
|
1872
|
-
_pointArray.push([fVLine[0].userData.distance, 90]);
|
|
1873
|
-
_pointArray.push([fVLine[1].userData.distance, -90]);
|
|
1874
|
-
_pointArray.push([fVLine[2].userData.distance, 180]);
|
|
1875
|
-
_pointArray.push([fVLine[3].userData.distance, 0]);
|
|
1870
|
+
_pointArray.push([_sceneCreator.fVLine[0].userData.distance, 90]);
|
|
1871
|
+
_pointArray.push([_sceneCreator.fVLine[1].userData.distance, -90]);
|
|
1872
|
+
_pointArray.push([_sceneCreator.fVLine[2].userData.distance, 180]);
|
|
1873
|
+
_pointArray.push([_sceneCreator.fVLine[3].userData.distance, 0]);
|
|
1876
1874
|
_pointArray.forEach(function (pointElement, index) {
|
|
1877
1875
|
if (pointElement[0] == undefined) _pointArray[index][0] = 0;
|
|
1878
1876
|
});
|
|
@@ -1884,8 +1882,8 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1884
1882
|
_pointArray[1][0] = 100;
|
|
1885
1883
|
}
|
|
1886
1884
|
actions.itemsActions.storeDistArray(_layer3.id, _item5.id, _pointArray);
|
|
1887
|
-
var _minDis = fVLine[0].userData.distance;
|
|
1888
|
-
var _snapObj = fVLine[0];
|
|
1885
|
+
var _minDis = _sceneCreator.fVLine[0].userData.distance;
|
|
1886
|
+
var _snapObj = _sceneCreator.fVLine[0];
|
|
1889
1887
|
var _iPos = _item3D2.position.clone();
|
|
1890
1888
|
var _snapDis = Math.sqrt((_iPos.x - targetPoint.x) * (_iPos.x - targetPoint.x) + (_iPos.z - targetPoint.z) * (_iPos.z - targetPoint.z));
|
|
1891
1889
|
if (_snapDis >= 100 && _snapObj != null) {
|
|
@@ -1893,10 +1891,10 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1893
1891
|
backsplashVisible = false;
|
|
1894
1892
|
//console.log('1 snap no');
|
|
1895
1893
|
}
|
|
1896
|
-
for (var _i13 = 1; _i13 < fVLine.length; _i13++) {
|
|
1897
|
-
if (_minDis > fVLine[_i13].userData.distance) {
|
|
1898
|
-
_minDis = fVLine[_i13].userData.distance;
|
|
1899
|
-
_snapObj = fVLine[_i13];
|
|
1894
|
+
for (var _i13 = 1; _i13 < _sceneCreator.fVLine.length; _i13++) {
|
|
1895
|
+
if (_minDis > _sceneCreator.fVLine[_i13].userData.distance) {
|
|
1896
|
+
_minDis = _sceneCreator.fVLine[_i13].userData.distance;
|
|
1897
|
+
_snapObj = _sceneCreator.fVLine[_i13];
|
|
1900
1898
|
}
|
|
1901
1899
|
}
|
|
1902
1900
|
if (snapBox == null) {
|
|
@@ -1907,14 +1905,14 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1907
1905
|
_this2.snap(_snapObj, _layer3);
|
|
1908
1906
|
snapFlag = true;
|
|
1909
1907
|
//console.log('1 snap Yes')
|
|
1910
|
-
getDistances(_layer3, true);
|
|
1908
|
+
(0, _sceneCreator.getDistances)(_layer3, true);
|
|
1911
1909
|
var _i14 = 0;
|
|
1912
|
-
for (_i14 = 0; _i14 < fVLine.length; _i14++) {
|
|
1913
|
-
if (fVLine[_i14].userData.distance < snapDelta) {
|
|
1910
|
+
for (_i14 = 0; _i14 < _sceneCreator.fVLine.length; _i14++) {
|
|
1911
|
+
if (_sceneCreator.fVLine[_i14].userData.distance < snapDelta) {
|
|
1914
1912
|
break;
|
|
1915
1913
|
}
|
|
1916
1914
|
}
|
|
1917
|
-
if (_i14 === fVLine.length) backsplashVisible = false;else backsplashVisible = true;
|
|
1915
|
+
if (_i14 === _sceneCreator.fVLine.length) backsplashVisible = false;else backsplashVisible = true;
|
|
1918
1916
|
}
|
|
1919
1917
|
actions.itemsActions.setBacksplashVisible(selectedObject.itemID, backsplashVisible);
|
|
1920
1918
|
}
|
|
@@ -1927,7 +1925,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1927
1925
|
raycaster.setFromCamera(curPos, camera);
|
|
1928
1926
|
rayDirection = raycaster.ray.direction;
|
|
1929
1927
|
rayDirection = rayDirection.normalize();
|
|
1930
|
-
var meshes = getAllMeshes(toIntersect);
|
|
1928
|
+
var meshes = (0, _objectsUtils.getAllMeshes)(toIntersect);
|
|
1931
1929
|
var intersects = raycaster.intersectObjects(meshes, true);
|
|
1932
1930
|
var _i15;
|
|
1933
1931
|
if (intersects.length > 0 && !isNaN(intersects[0].distance)) {
|
|
@@ -1962,7 +1960,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1962
1960
|
document.getElementById('warning_box_2d').style.display = 'none';
|
|
1963
1961
|
};
|
|
1964
1962
|
this.onkeydown = function (event) {
|
|
1965
|
-
if (_this2.props.keyDownEnable && !isElevationView(state.mode)) {
|
|
1963
|
+
if (_this2.props.keyDownEnable && !(0, _helper.isElevationView)(state.mode)) {
|
|
1966
1964
|
switch (event.keyCode) {
|
|
1967
1965
|
case 27:
|
|
1968
1966
|
// escape key
|
|
@@ -2031,7 +2029,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
2031
2029
|
}
|
|
2032
2030
|
|
|
2033
2031
|
// Add the output of the renderer to the html element
|
|
2034
|
-
var canvasWrapper =
|
|
2032
|
+
var canvasWrapper = _reactDom["default"].findDOMNode(this.refs.canvasWrapper);
|
|
2035
2033
|
canvasWrapper && canvasWrapper.appendChild(this.renderer.domElement);
|
|
2036
2034
|
|
|
2037
2035
|
//
|
|
@@ -2044,7 +2042,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
2044
2042
|
setTimeout(function () {
|
|
2045
2043
|
try {
|
|
2046
2044
|
currentObject = planData.sceneGraph.layers[selectedObject.layerID].items[selectedObject.itemID];
|
|
2047
|
-
if (
|
|
2045
|
+
if (!currentObject) return;
|
|
2048
2046
|
var selItem = _this2.props.state.scene.layers.get(selectedObject.layerID).items.get(selectedObject.itemID);
|
|
2049
2047
|
var itemPos = currentObject.position.clone();
|
|
2050
2048
|
toolObj.position.set(planData.plan.position.x + itemPos.x, selItem.category === 'lighting' ? -planData.plan.position.y - selItem.properties.get('height').get('length') : planData.plan.position.y + currentObject.children[0].position.y, planData.plan.position.z + itemPos.z);
|
|
@@ -2063,17 +2061,17 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
2063
2061
|
function init() {
|
|
2064
2062
|
clock = new Three.Clock();
|
|
2065
2063
|
scene3D = new Three.Scene();
|
|
2066
|
-
if (isElevationView(state.mode)) scene3D.background = new Three.Color(0xffffff);
|
|
2064
|
+
if ((0, _helper.isElevationView)(state.mode)) scene3D.background = new Three.Color(0xffffff);
|
|
2067
2065
|
// change color about v1: 0x8791AB, v2: 0xC2C2C2, v3: 0xC3CADC
|
|
2068
2066
|
else scene3D.background = new Three.Color(0xc3cadc); // change color about v1: 0x8791AB, v2: 0xC2C2C2, v3: 0xC3CADC
|
|
2069
2067
|
// scene3D.fog = new Three.Fog(0xC3CADC, 2000, 3500);
|
|
2070
2068
|
window.scene3D = scene3D;
|
|
2071
2069
|
// Camera
|
|
2072
|
-
if (isElevationView(state.mode)) {
|
|
2070
|
+
if ((0, _helper.isElevationView)(state.mode)) {
|
|
2073
2071
|
// In elevation view, set Orthographic camera's position, angle and rotation about selected line
|
|
2074
2072
|
var layers = scene.layers;
|
|
2075
2073
|
var selectedLayer = layers.get(scene.selectedLayer);
|
|
2076
|
-
var ceilHeight = convert(selectedLayer.ceilHeight).from(selectedLayer.unit).to(scene.unit);
|
|
2074
|
+
var ceilHeight = (0, _convertUnitsLite.convert)(selectedLayer.ceilHeight).from(selectedLayer.unit).to(scene.unit);
|
|
2077
2075
|
var lines = [];
|
|
2078
2076
|
var selectedLine = selectedLayer.lines.get(selectedLayer.selected.lines.toJS()[0]);
|
|
2079
2077
|
var vertex0 = selectedLayer.vertices.get(selectedLine.vertices.get(0));
|
|
@@ -2082,7 +2080,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
2082
2080
|
y1 = vertex0.y;
|
|
2083
2081
|
var x2 = vertex1.x,
|
|
2084
2082
|
y2 = vertex1.y;
|
|
2085
|
-
if (GeometryUtils.compareVertices(vertex0, vertex1) >= 0 && vertex0.x !== vertex1.x) {
|
|
2083
|
+
if (_export.GeometryUtils.compareVertices(vertex0, vertex1) >= 0 && vertex0.x !== vertex1.x) {
|
|
2086
2084
|
x1 = vertex1.x;
|
|
2087
2085
|
y1 = vertex1.y;
|
|
2088
2086
|
x2 = vertex0.x;
|
|
@@ -2104,11 +2102,11 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
2104
2102
|
lines.push(data);
|
|
2105
2103
|
}
|
|
2106
2104
|
});
|
|
2107
|
-
var lineLength = GeometryUtils.pointsDistance(x1, y1, x2, y2);
|
|
2105
|
+
var lineLength = _export.GeometryUtils.pointsDistance(x1, y1, x2, y2);
|
|
2108
2106
|
self.setState({
|
|
2109
2107
|
lineLength: lineLength
|
|
2110
2108
|
});
|
|
2111
|
-
var cameraRect = handleCamRect(self.width, self.height, ceilHeight, lineLength);
|
|
2109
|
+
var cameraRect = (0, _helper.handleCamRect)(self.width, self.height, ceilHeight, lineLength);
|
|
2112
2110
|
camera = new Three.OrthographicCamera(-cameraRect.width / 2, cameraRect.width / 2, cameraRect.height / 2, -cameraRect.height / 2, 1, 1000);
|
|
2113
2111
|
var angle = Math.atan((y1 - y2) / (x1 - x2));
|
|
2114
2112
|
var r = 300;
|
|
@@ -2129,15 +2127,15 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
2129
2127
|
}
|
|
2130
2128
|
camera.layers.enable(1);
|
|
2131
2129
|
function loadENV() {
|
|
2132
|
-
new RGBELoader().load('/assets/brown_photostudio_02_1k.hdr', function (texture) {
|
|
2130
|
+
new _RGBELoader.RGBELoader().load('/assets/brown_photostudio_02_1k.hdr', function (texture) {
|
|
2133
2131
|
texture.mapping = Three.EquirectangularReflectionMapping;
|
|
2134
2132
|
scene3D.environment = texture;
|
|
2135
2133
|
texture.dispose();
|
|
2136
2134
|
});
|
|
2137
2135
|
}
|
|
2138
2136
|
// Camera Controls
|
|
2139
|
-
if (!isElevationView(state.mode)) {
|
|
2140
|
-
cameraControls = new
|
|
2137
|
+
if (!(0, _helper.isElevationView)(state.mode)) {
|
|
2138
|
+
cameraControls = new _cameraControls["default"](camera, self.renderer.domElement);
|
|
2141
2139
|
cameraControls.dollyToCursor = true;
|
|
2142
2140
|
cameraControls.infinityDolly = true;
|
|
2143
2141
|
cameraControls.minDistance = 50;
|
|
@@ -2148,7 +2146,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
2148
2146
|
scene3D.add(planData.plan);
|
|
2149
2147
|
scene3D.add(planData.grid);
|
|
2150
2148
|
scene3D.add(camera);
|
|
2151
|
-
if (isElevationView(state.mode)) {
|
|
2149
|
+
if ((0, _helper.isElevationView)(state.mode)) {
|
|
2152
2150
|
planData.cam.add(camera);
|
|
2153
2151
|
scene3D.add(planData.cam);
|
|
2154
2152
|
} else {
|
|
@@ -2163,7 +2161,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
2163
2161
|
}
|
|
2164
2162
|
function render() {
|
|
2165
2163
|
var delta = clock.getDelta(); // Get time delta for smooth updates
|
|
2166
|
-
if (!isElevationView(state.mode)) cameraControls.update(delta);
|
|
2164
|
+
if (!(0, _helper.isElevationView)(state.mode)) cameraControls.update(delta);
|
|
2167
2165
|
for (var _i16 = 0; _i16 < lights.length; _i16++) {
|
|
2168
2166
|
lights[_i16].light.position.set(planData.plan.position.x + lights[_i16].x, planData.plan.position.y + lights[_i16].height - 10, planData.plan.position.z - lights[_i16].y);
|
|
2169
2167
|
lights[_i16].target.position.set(planData.plan.position.x + lights[_i16].x, planData.plan.position.y, planData.plan.position.z - lights[_i16].y);
|
|
@@ -2210,7 +2208,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
2210
2208
|
var indexAttribute = line.geometry.getIndex();
|
|
2211
2209
|
var firstFaceIndices = undefined;
|
|
2212
2210
|
if (indexAttribute && indexAttribute.length > 0) {
|
|
2213
|
-
[indexAttribute.getX(0), indexAttribute.getX(1), indexAttribute.getX(2)],
|
|
2211
|
+
[indexAttribute.getX(0), indexAttribute.getX(1), indexAttribute.getX(2)], (0, _readOnlyError2["default"])("firstFaceIndices");
|
|
2214
2212
|
}
|
|
2215
2213
|
if (firstFaceIndices == undefined) return;
|
|
2216
2214
|
// normal vector of the line
|
|
@@ -2259,7 +2257,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
2259
2257
|
isLoading: false,
|
|
2260
2258
|
waitForRender: 0
|
|
2261
2259
|
});
|
|
2262
|
-
if (isElevationView(self.props.state.mode)) {
|
|
2260
|
+
if ((0, _helper.isElevationView)(self.props.state.mode)) {
|
|
2263
2261
|
setTimeout(function () {
|
|
2264
2262
|
self.props.setIsLoadingElevation('front', false);
|
|
2265
2263
|
}, 100);
|
|
@@ -2283,14 +2281,14 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
2283
2281
|
key: "componentWillUnmount",
|
|
2284
2282
|
value: function componentWillUnmount() {
|
|
2285
2283
|
cancelAnimationFrame(this.renderingID);
|
|
2286
|
-
if (!isElevationView(this.props.state.mode)) {
|
|
2284
|
+
if (!(0, _helper.isElevationView)(this.props.state.mode)) {
|
|
2287
2285
|
if (this.cameraControls !== undefined) this.cameraControls.dispose();
|
|
2288
2286
|
}
|
|
2289
2287
|
if (!this.props.downloadFlag) {
|
|
2290
2288
|
this.renderer.domElement.removeEventListener('mousedown', this.mouseDownEvent);
|
|
2291
2289
|
this.renderer.domElement.removeEventListener('mouseup', this.mouseUpEvent);
|
|
2292
2290
|
}
|
|
2293
|
-
disposeScene(this.scene3D);
|
|
2291
|
+
(0, _threeMemoryCleaner.disposeScene)(this.scene3D);
|
|
2294
2292
|
this.scene3D.remove(this.planData.plan);
|
|
2295
2293
|
this.scene3D.remove(this.planData.grid);
|
|
2296
2294
|
this.scene3D = null;
|
|
@@ -2303,11 +2301,11 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
2303
2301
|
key: "componentWillReceiveProps",
|
|
2304
2302
|
value: function componentWillReceiveProps(nextProps) {
|
|
2305
2303
|
var _this4 = this;
|
|
2306
|
-
if (this.props.downloadFlag &&
|
|
2304
|
+
if (this.props.downloadFlag && (0, _immutablediff["default"])(this.props.state, nextProps.state).toJS().length == 0 || (0, _helper.isEmpty)(nextProps.state.scene)) return;
|
|
2307
2305
|
var width = nextProps.width,
|
|
2308
2306
|
height = nextProps.height;
|
|
2309
2307
|
var selectedLayer = nextProps.state.getIn(['scene', 'layers', nextProps.state.scene.selectedLayer]);
|
|
2310
|
-
var ceilHeight = convert(selectedLayer.ceilHeight).from(selectedLayer.unit).to(nextProps.state.scene.unit);
|
|
2308
|
+
var ceilHeight = (0, _convertUnitsLite.convert)(selectedLayer.ceilHeight).from(selectedLayer.unit).to(nextProps.state.scene.unit);
|
|
2311
2309
|
var actions = {
|
|
2312
2310
|
areaActions: this.context.areaActions,
|
|
2313
2311
|
holesActions: this.context.holesActions,
|
|
@@ -2329,9 +2327,9 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
2329
2327
|
|
|
2330
2328
|
// handle camera setting
|
|
2331
2329
|
switch (this.props.state.mode) {
|
|
2332
|
-
case MODE_ELEVATION_VIEW:
|
|
2330
|
+
case _constants.MODE_ELEVATION_VIEW:
|
|
2333
2331
|
// when Elevation mode (camera: Orthographic)
|
|
2334
|
-
var cameraRect = handleCamRect(width, height, ceilHeight, this.state.lineLength);
|
|
2332
|
+
var cameraRect = (0, _helper.handleCamRect)(width, height, ceilHeight, this.state.lineLength);
|
|
2335
2333
|
// camera size
|
|
2336
2334
|
this.camera.left = -cameraRect.width / 2;
|
|
2337
2335
|
this.camera.right = cameraRect.width / 2;
|
|
@@ -2340,7 +2338,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
2340
2338
|
//camera position
|
|
2341
2339
|
this.camera.position.y = ceilHeight / 2;
|
|
2342
2340
|
break;
|
|
2343
|
-
case MODE_3D_VIEW:
|
|
2341
|
+
case _constants.MODE_3D_VIEW:
|
|
2344
2342
|
// when 3D mode (camera: Perspective)
|
|
2345
2343
|
this.camera.aspect = width / height;
|
|
2346
2344
|
break;
|
|
@@ -2350,34 +2348,34 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
2350
2348
|
var layer = data.getIn(['layers', data.selectedLayer]);
|
|
2351
2349
|
var self = this;
|
|
2352
2350
|
function implementBacksplash() {
|
|
2353
|
-
if (isElevationView(self.props.state.mode)) return; // apply backsplash when just 3D_mode, not elevation_mode
|
|
2354
|
-
var allItems = GeometryUtils.getAllItemSpecified(nextProps.state.scene, actions.catalog, BASE_CABINET_LAYOUTPOS);
|
|
2351
|
+
if ((0, _helper.isElevationView)(self.props.state.mode)) return; // apply backsplash when just 3D_mode, not elevation_mode
|
|
2352
|
+
var allItems = _export.GeometryUtils.getAllItemSpecified(nextProps.state.scene, actions.catalog, _constants.BASE_CABINET_LAYOUTPOS);
|
|
2355
2353
|
var i,
|
|
2356
2354
|
items = [];
|
|
2357
2355
|
for (i = 0; i < allItems.others.length; i++) items.push(allItems.others[i]);
|
|
2358
2356
|
if (allItems.cur) items.push(allItems.cur);
|
|
2359
2357
|
for (i = 0; i < items.length; i++) {
|
|
2360
|
-
var calcRect = GeometryUtils.getCalcRectFromItem3D(items[i]);
|
|
2361
|
-
var visible = GeometryUtils.isSnappedLine(calcRect, allLineRects);
|
|
2358
|
+
var calcRect = _export.GeometryUtils.getCalcRectFromItem3D(items[i]);
|
|
2359
|
+
var visible = _export.GeometryUtils.isSnappedLine(calcRect, allLineRects);
|
|
2362
2360
|
actions.itemsActions.setBacksplashVisible(items[i].itemInfo.id, visible);
|
|
2363
|
-
createBacksplash(items[i], nextProps.state.scene.getIn(['layers', nextProps.state.scene.selectedLayer]), planData, nextProps.state.scene);
|
|
2361
|
+
(0, _sceneCreator.createBacksplash)(items[i], nextProps.state.scene.getIn(['layers', nextProps.state.scene.selectedLayer]), planData, nextProps.state.scene);
|
|
2364
2362
|
}
|
|
2365
2363
|
}
|
|
2366
2364
|
function implementWarningBox() {
|
|
2367
|
-
var holeItems = GeometryUtils.getHoleItems(layer);
|
|
2365
|
+
var holeItems = _export.GeometryUtils.getHoleItems(layer);
|
|
2368
2366
|
var i,
|
|
2369
2367
|
items = [];
|
|
2370
2368
|
for (i = 0; i < allItemRect.others.length; i++) items.push(allItemRect.others[i]);
|
|
2371
2369
|
if (allItemRect.cur) items.push(allItemRect.cur);
|
|
2372
|
-
for (i = 0; i < items.length; i++) checkCabinetOverlap({
|
|
2370
|
+
for (i = 0; i < items.length; i++) (0, _sceneCreator.checkCabinetOverlap)({
|
|
2373
2371
|
x: items[i].pos.x,
|
|
2374
2372
|
y: items[i].pos.y
|
|
2375
2373
|
}, items[i], holeItems, planData);
|
|
2376
2374
|
}
|
|
2377
2375
|
var prepareSnapSpec = function prepareSnapSpec(layer) {
|
|
2378
|
-
allLines = GeometryUtils.getAllLines(layer);
|
|
2379
|
-
allLineRects = GeometryUtils.buildRectFromLines(layer, allLines);
|
|
2380
|
-
allItemRect = GeometryUtils.getAllItemSpecified(_this4.props.state.scene, actions.catalog, [WALL_CABINET_LAYOUTPOS, TALL_CABINET_LAYOUTPOS]);
|
|
2376
|
+
allLines = _export.GeometryUtils.getAllLines(layer);
|
|
2377
|
+
allLineRects = _export.GeometryUtils.buildRectFromLines(layer, allLines);
|
|
2378
|
+
allItemRect = _export.GeometryUtils.getAllItemSpecified(_this4.props.state.scene, actions.catalog, [_constants.WALL_CABINET_LAYOUTPOS, _constants.TALL_CABINET_LAYOUTPOS]);
|
|
2381
2379
|
};
|
|
2382
2380
|
var layer1 = this.props.state.scene.getIn(['layers', data.selectedLayer]);
|
|
2383
2381
|
if (this.state.showflag) {
|
|
@@ -2389,7 +2387,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
2389
2387
|
});
|
|
2390
2388
|
}
|
|
2391
2389
|
if (nextProps.state.scene !== this.props.state.scene || nextProps.state.doorStyle && nextProps.state.doorStyle.get('name') !== this.props.state.doorStyle.get('name')) {
|
|
2392
|
-
var changedValues =
|
|
2390
|
+
var changedValues = (0, _immutablediff["default"])(this.props.state.scene, nextProps.state.scene);
|
|
2393
2391
|
prepareSnapSpec(layer);
|
|
2394
2392
|
if (nextProps.state.doorStyle && nextProps.state.doorStyle.get('name') === this.props.state.doorStyle.get('name')) {
|
|
2395
2393
|
self.setState({
|
|
@@ -2400,10 +2398,10 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
2400
2398
|
waitForRender: 0
|
|
2401
2399
|
});
|
|
2402
2400
|
switch (self.props.state.mode) {
|
|
2403
|
-
case MODE_ELEVATION_VIEW:
|
|
2401
|
+
case _constants.MODE_ELEVATION_VIEW:
|
|
2404
2402
|
self.props.setIsLoadingElevation('front', true);
|
|
2405
2403
|
break;
|
|
2406
|
-
case MODE_3D_VIEW:
|
|
2404
|
+
case _constants.MODE_3D_VIEW:
|
|
2407
2405
|
self.props.setIsLoading3D(true);
|
|
2408
2406
|
break;
|
|
2409
2407
|
}
|
|
@@ -2414,12 +2412,12 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
2414
2412
|
implementBacksplash();
|
|
2415
2413
|
implementWarningBox();
|
|
2416
2414
|
} else {
|
|
2417
|
-
deleteSpecifiedMeshObjects('TransformBox');
|
|
2415
|
+
(0, _sceneCreator.deleteSpecifiedMeshObjects)('TransformBox');
|
|
2418
2416
|
}
|
|
2419
2417
|
var _this$state = this.state,
|
|
2420
2418
|
toolObj = _this$state.toolObj,
|
|
2421
2419
|
angleObj = _this$state.angleObj;
|
|
2422
|
-
var _updateScene = updateScene(this.planData, nextProps.state.scene, this.props.state.scene, changedValues.toJS(), actions, this.context.catalog, nextProps.state.mode, toolObj, angleObj, nextProps.state.draggingSupport),
|
|
2420
|
+
var _updateScene = (0, _sceneCreator.updateScene)(this.planData, nextProps.state.scene, this.props.state.scene, changedValues.toJS(), actions, this.context.catalog, nextProps.state.mode, toolObj, angleObj, nextProps.state.draggingSupport),
|
|
2423
2421
|
promise = _updateScene.promise;
|
|
2424
2422
|
self.setState();
|
|
2425
2423
|
promise.then(function (p1Value) {
|
|
@@ -2446,7 +2444,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
2446
2444
|
if (isLoading) {
|
|
2447
2445
|
if (this.props.downloadFlag) {
|
|
2448
2446
|
this.renderer.domElement.style.display = 'none';
|
|
2449
|
-
return /*#__PURE__*/
|
|
2447
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
2450
2448
|
style: {
|
|
2451
2449
|
alignItems: ' center',
|
|
2452
2450
|
width: this.props.width,
|
|
@@ -2454,7 +2452,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
2454
2452
|
display: 'inline-flex',
|
|
2455
2453
|
justifyContent: 'center'
|
|
2456
2454
|
}
|
|
2457
|
-
}, /*#__PURE__*/
|
|
2455
|
+
}, /*#__PURE__*/_react["default"].createElement("img", {
|
|
2458
2456
|
style: {
|
|
2459
2457
|
width: '70px',
|
|
2460
2458
|
height: '70px',
|
|
@@ -2467,12 +2465,12 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
2467
2465
|
document.getElementById('front') && (document.getElementById('front').style.display = 'none');
|
|
2468
2466
|
document.getElementById('error').style.display = 'none';
|
|
2469
2467
|
this.renderer.domElement.style.display = 'none';
|
|
2470
|
-
return /*#__PURE__*/
|
|
2468
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
2471
2469
|
style: {
|
|
2472
2470
|
textAlign: 'center',
|
|
2473
2471
|
width: '100%'
|
|
2474
2472
|
}
|
|
2475
|
-
}, /*#__PURE__*/
|
|
2473
|
+
}, /*#__PURE__*/_react["default"].createElement("img", {
|
|
2476
2474
|
style: {
|
|
2477
2475
|
animation: 'spin 2s linear infinite',
|
|
2478
2476
|
marginTop: "22%"
|
|
@@ -2485,12 +2483,12 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
2485
2483
|
this.renderer.domElement.style.pointerEvents = 'none';
|
|
2486
2484
|
document.getElementById('front') && (document.getElementById('front').style.display = 'none');
|
|
2487
2485
|
this.renderer.domElement.style.opacity = '0.4';
|
|
2488
|
-
return /*#__PURE__*/
|
|
2486
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
2489
2487
|
style: {
|
|
2490
2488
|
textAlign: 'center',
|
|
2491
2489
|
width: '100%'
|
|
2492
2490
|
}
|
|
2493
|
-
}, /*#__PURE__*/
|
|
2491
|
+
}, /*#__PURE__*/_react["default"].createElement("img", {
|
|
2494
2492
|
style: {
|
|
2495
2493
|
animation: 'spin 2s linear infinite',
|
|
2496
2494
|
position: "absolute",
|
|
@@ -2504,26 +2502,25 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
2504
2502
|
this.renderer.domElement.style.pointerEvents = 'auto';
|
|
2505
2503
|
this.renderer.domElement.style.opacity = '1';
|
|
2506
2504
|
!this.props.downloadFlag && document.getElementById('front') && (document.getElementById('front').style.display = 'block');
|
|
2507
|
-
return /*#__PURE__*/
|
|
2505
|
+
return /*#__PURE__*/_react["default"].createElement('div', {
|
|
2508
2506
|
ref: 'canvasWrapper'
|
|
2509
2507
|
});
|
|
2510
2508
|
}
|
|
2511
2509
|
}
|
|
2512
2510
|
}]);
|
|
2513
|
-
}(
|
|
2514
|
-
export { Scene3DViewer as default };
|
|
2511
|
+
}(_react["default"].Component);
|
|
2515
2512
|
Scene3DViewer.propTypes = {
|
|
2516
|
-
state:
|
|
2517
|
-
width:
|
|
2518
|
-
height:
|
|
2519
|
-
replaceCabinet:
|
|
2513
|
+
state: _propTypes["default"].object.isRequired,
|
|
2514
|
+
width: _propTypes["default"].number.isRequired,
|
|
2515
|
+
height: _propTypes["default"].number.isRequired,
|
|
2516
|
+
replaceCabinet: _propTypes["default"].func.isRequired
|
|
2520
2517
|
};
|
|
2521
2518
|
Scene3DViewer.contextTypes = {
|
|
2522
|
-
areaActions:
|
|
2523
|
-
holesActions:
|
|
2524
|
-
itemsActions:
|
|
2525
|
-
linesActions:
|
|
2526
|
-
sceneActions:
|
|
2527
|
-
projectActions:
|
|
2528
|
-
catalog:
|
|
2519
|
+
areaActions: _propTypes["default"].object.isRequired,
|
|
2520
|
+
holesActions: _propTypes["default"].object.isRequired,
|
|
2521
|
+
itemsActions: _propTypes["default"].object.isRequired,
|
|
2522
|
+
linesActions: _propTypes["default"].object.isRequired,
|
|
2523
|
+
sceneActions: _propTypes["default"].object.isRequired,
|
|
2524
|
+
projectActions: _propTypes["default"].object.isRequired,
|
|
2525
|
+
catalog: _propTypes["default"].object
|
|
2529
2526
|
};
|