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,48 +1,47 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports["default"] = void 0;
|
|
9
|
+
var _readOnlyError2 = _interopRequireDefault(require("@babel/runtime/helpers/readOnlyError"));
|
|
10
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
12
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
13
|
+
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
14
|
+
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
15
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
16
|
+
var _react = _interopRequireDefault(require("react"));
|
|
17
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
18
|
+
var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
19
|
+
var Three = _interopRequireWildcard(require("three"));
|
|
20
|
+
var _sceneCreator = require("./scene-creator");
|
|
21
|
+
var _threeMemoryCleaner = require("./three-memory-cleaner");
|
|
22
|
+
var _immutablediff = _interopRequireDefault(require("immutablediff"));
|
|
23
|
+
var SharedStyle = _interopRequireWildcard(require("../../shared-style"));
|
|
24
|
+
var _constants = require("../../constants");
|
|
25
|
+
var _geometry = require("../../utils/geometry");
|
|
26
|
+
var _convertUnitsLite = require("../../utils/convert-units-lite");
|
|
27
|
+
var _export = require("../../utils/export");
|
|
28
|
+
var _helper = require("../../utils/helper");
|
|
29
|
+
var _RGBELoader = require("three/examples/jsm/loaders/RGBELoader");
|
|
30
|
+
var _cameraControls = _interopRequireDefault(require("camera-controls"));
|
|
31
|
+
var _utils = require("../viewer2d/utils");
|
|
32
|
+
var _objectsUtils = require("../../utils/objects-utils");
|
|
33
|
+
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
34
|
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; }
|
|
35
|
+
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; }
|
|
36
|
+
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
37
|
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({
|
|
38
|
+
_cameraControls["default"].install({
|
|
38
39
|
THREE: Three
|
|
39
40
|
});
|
|
40
|
-
|
|
41
|
-
import { getAllMeshes, vectorIntersectWithMesh } from "../../utils/objects-utils";
|
|
42
|
-
var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
41
|
+
var Scene3DViewer = exports["default"] = /*#__PURE__*/function (_React$Component) {
|
|
43
42
|
function Scene3DViewer(props) {
|
|
44
43
|
var _this;
|
|
45
|
-
|
|
44
|
+
(0, _classCallCheck2["default"])(this, Scene3DViewer);
|
|
46
45
|
_this = _callSuper(this, Scene3DViewer, [props]);
|
|
47
46
|
_this.state = {
|
|
48
47
|
isLoading: false,
|
|
@@ -62,14 +61,14 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
62
61
|
window.__elevationRendererDownload = {};
|
|
63
62
|
}
|
|
64
63
|
switch (mode) {
|
|
65
|
-
case MODE_IDLE_3D:
|
|
64
|
+
case _constants.MODE_IDLE_3D:
|
|
66
65
|
_this.renderer = window.__threeRenderer || new Three.WebGLRenderer({
|
|
67
66
|
preserveDrawingBuffer: true,
|
|
68
67
|
alpha: true,
|
|
69
68
|
antialias: true
|
|
70
69
|
});
|
|
71
70
|
break;
|
|
72
|
-
case MODE_3D_VIEW:
|
|
71
|
+
case _constants.MODE_3D_VIEW:
|
|
73
72
|
_this.renderer = window.__threeRendererDownload || new Three.WebGLRenderer({
|
|
74
73
|
preserveDrawingBuffer: true,
|
|
75
74
|
alpha: true,
|
|
@@ -104,8 +103,8 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
104
103
|
_this.renderer.domElement.style.display = 'none';
|
|
105
104
|
return _this;
|
|
106
105
|
}
|
|
107
|
-
|
|
108
|
-
return
|
|
106
|
+
(0, _inherits2["default"])(Scene3DViewer, _React$Component);
|
|
107
|
+
return (0, _createClass2["default"])(Scene3DViewer, [{
|
|
109
108
|
key: "componentDidMount",
|
|
110
109
|
value: function componentDidMount(nextProps) {
|
|
111
110
|
var _this2 = this;
|
|
@@ -125,7 +124,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
125
124
|
var mode = state.mode,
|
|
126
125
|
scene = state.scene;
|
|
127
126
|
function setupLight(scene, inbBox) {
|
|
128
|
-
if (isElevationView(mode)) {
|
|
127
|
+
if ((0, _helper.isElevationView)(mode)) {
|
|
129
128
|
var ambilight = new Three.AmbientLight('0xffffff', 3);
|
|
130
129
|
scene.add(ambilight);
|
|
131
130
|
} else {
|
|
@@ -184,10 +183,10 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
184
183
|
var spotlightDis = 1.5 * Math.abs(inbBox.min.y - inbBox.max.y);
|
|
185
184
|
|
|
186
185
|
// 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);
|
|
186
|
+
(0, _objectsUtils.vectorIntersectWithMesh)(spot1, scene3D.getObjectByName('floor')) && addSpotLight('0xffffff', 0.8, spot1, spot1, spotlightDis);
|
|
187
|
+
(0, _objectsUtils.vectorIntersectWithMesh)(spot2, scene3D.getObjectByName('floor')) && addSpotLight('0xffffff', 0.8, spot2, spot2, spotlightDis);
|
|
188
|
+
(0, _objectsUtils.vectorIntersectWithMesh)(spot3, scene3D.getObjectByName('floor')) && addSpotLight('0xffffff', 0.8, spot3, spot3, spotlightDis);
|
|
189
|
+
(0, _objectsUtils.vectorIntersectWithMesh)(spot4, scene3D.getObjectByName('floor')) && addSpotLight('0xffffff', 0.8, spot4, spot4, spotlightDis);
|
|
191
190
|
}
|
|
192
191
|
}
|
|
193
192
|
}
|
|
@@ -203,15 +202,15 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
203
202
|
|
|
204
203
|
// set loading bar
|
|
205
204
|
switch (self.props.state.mode) {
|
|
206
|
-
case MODE_ELEVATION_VIEW:
|
|
205
|
+
case _constants.MODE_ELEVATION_VIEW:
|
|
207
206
|
self.props.setIsLoadingElevation('front', true);
|
|
208
207
|
break;
|
|
209
|
-
case MODE_3D_VIEW:
|
|
208
|
+
case _constants.MODE_3D_VIEW:
|
|
210
209
|
self.props.setIsLoading3D(true);
|
|
211
210
|
break;
|
|
212
211
|
}
|
|
213
212
|
}
|
|
214
|
-
var _parseData = parseData(scene, actions, this.context.catalog, camera, this.renderer, state.mode),
|
|
213
|
+
var _parseData = (0, _sceneCreator.parseData)(scene, actions, this.context.catalog, camera, this.renderer, state.mode),
|
|
215
214
|
promise = _parseData.promise,
|
|
216
215
|
planData = _parseData.planData;
|
|
217
216
|
promise.then(function () {
|
|
@@ -225,7 +224,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
225
224
|
obj.removeFromParent();
|
|
226
225
|
});
|
|
227
226
|
var bbox = new Three.Box3().setFromObject(planData.plan);
|
|
228
|
-
if (!isElevationView(state.mode)) {
|
|
227
|
+
if (!(0, _helper.isElevationView)(state.mode)) {
|
|
229
228
|
cameraControls.fitToBox(bbox);
|
|
230
229
|
}
|
|
231
230
|
setupLight(scene3D, planData.boundingBox);
|
|
@@ -284,7 +283,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
284
283
|
realVec.push(vec);
|
|
285
284
|
});
|
|
286
285
|
if (aVertices.includes(realVec[0]) && aVertices.includes(realVec[1])) {
|
|
287
|
-
height = convert(layer.ceilHeight).from(layer.unit).to(UNIT_CENTIMETER);
|
|
286
|
+
height = (0, _convertUnitsLite.convert)(layer.ceilHeight).from(layer.unit).to(_constants.UNIT_CENTIMETER);
|
|
288
287
|
// height = data.properties.getIn(['height', 'length']);
|
|
289
288
|
return 1; // break
|
|
290
289
|
}
|
|
@@ -382,11 +381,11 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
382
381
|
|
|
383
382
|
// end snap function variable///////////////////////
|
|
384
383
|
var backsplashVisible = false;
|
|
385
|
-
var holeItems = GeometryUtils.getHoleItems(layer);
|
|
384
|
+
var holeItems = _export.GeometryUtils.getHoleItems(layer);
|
|
386
385
|
var removeSnapBox = function removeSnapBox() {
|
|
387
386
|
if (snapBox != null) {
|
|
388
387
|
planData.plan.remove(snapBox);
|
|
389
|
-
disposeObject(snapBox);
|
|
388
|
+
(0, _threeMemoryCleaner.disposeObject)(snapBox);
|
|
390
389
|
snapBox = null;
|
|
391
390
|
targetObj = null;
|
|
392
391
|
snapFlag = false;
|
|
@@ -457,7 +456,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
457
456
|
x: shape2[j + 1].x,
|
|
458
457
|
y: shape2[j + 1].y
|
|
459
458
|
};
|
|
460
|
-
var flag = GeometryUtils.getLineInterSect(sl1.x, sl1.y, sl2.x, sl2.y, el1.x, el1.y, el2.x, el2.y);
|
|
459
|
+
var flag = _export.GeometryUtils.getLineInterSect(sl1.x, sl1.y, sl2.x, sl2.y, el1.x, el1.y, el2.x, el2.y);
|
|
461
460
|
if (flag) {
|
|
462
461
|
count++;
|
|
463
462
|
if (count > 1) return true;
|
|
@@ -504,20 +503,20 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
504
503
|
return vertices;
|
|
505
504
|
};
|
|
506
505
|
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);
|
|
506
|
+
allLines = _export.GeometryUtils.getAllLines(layer);
|
|
507
|
+
allLineRects = _export.GeometryUtils.buildRectFromLines(layer, allLines);
|
|
508
|
+
allItemRect = _export.GeometryUtils.getAllItems(_this2.props.state.scene, actions.catalog, allLineRects);
|
|
509
|
+
allItemSnap = _export.GeometryUtils.getAllItemSnap(allItemRect);
|
|
510
|
+
allLineSnap = _export.GeometryUtils.getAllLineSnap(allLineRects, allItemRect.cur);
|
|
512
511
|
allRect = allItemRect.others.concat(allLineRects);
|
|
513
|
-
allItemSnap = GeometryUtils.validateSnaps(allItemSnap, allRect);
|
|
514
|
-
allLineSnap = GeometryUtils.validateSnaps(allLineSnap, allRect);
|
|
515
|
-
allArea = GeometryUtils.getAllArea(layer);
|
|
512
|
+
allItemSnap = _export.GeometryUtils.validateSnaps(allItemSnap, allRect);
|
|
513
|
+
allLineSnap = _export.GeometryUtils.validateSnaps(allLineSnap, allRect);
|
|
514
|
+
allArea = _export.GeometryUtils.getAllArea(layer);
|
|
516
515
|
};
|
|
517
516
|
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);
|
|
517
|
+
allLines = _export.GeometryUtils.getAllLines(layer);
|
|
518
|
+
allLineRects = _export.GeometryUtils.buildRectFromLines(layer, allLines);
|
|
519
|
+
allItemRect = _export.GeometryUtils.getAllItemSpecified(_this2.props.state.scene, actions.catalog, _constants.WALL_CABINET_LAYOUTPOS);
|
|
521
520
|
// allItemSnap = GeometryUtils.getAllItemSnap(allItemRect);
|
|
522
521
|
};
|
|
523
522
|
|
|
@@ -570,7 +569,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
570
569
|
var ocatid = _item.type;
|
|
571
570
|
var ocat = catalog.elements[ocatid];
|
|
572
571
|
var olayoutpos = ocat.info.layoutpos;
|
|
573
|
-
if (!(layoutpos === BASE_CABINET_LAYOUTPOS && olayoutpos === WALL_CABINET_LAYOUTPOS || layoutpos === WALL_CABINET_LAYOUTPOS && olayoutpos === BASE_CABINET_LAYOUTPOS)) {
|
|
572
|
+
if (!(layoutpos === _constants.BASE_CABINET_LAYOUTPOS && olayoutpos === _constants.WALL_CABINET_LAYOUTPOS || layoutpos === _constants.WALL_CABINET_LAYOUTPOS && olayoutpos === _constants.BASE_CABINET_LAYOUTPOS)) {
|
|
574
573
|
var tRot = _item.rotation;
|
|
575
574
|
var tPos = new Three.Vector2(_item.x, _item.y);
|
|
576
575
|
var tBounding = target.children[0].userData;
|
|
@@ -652,12 +651,13 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
652
651
|
var _item2 = layer.items.getIn([data.id]);
|
|
653
652
|
var ocatid = _item2.type;
|
|
654
653
|
var ocat = catalog.elements[ocatid];
|
|
655
|
-
if (!ocat) ocat = catalog.elements[returnReplaceableDeepSearchType(ocatid)];
|
|
654
|
+
if (!ocat) ocat = catalog.elements[(0, _utils.returnReplaceableDeepSearchType)(ocatid)];
|
|
656
655
|
var otherItem = {
|
|
657
656
|
item: _item2,
|
|
658
657
|
cat: ocat
|
|
659
658
|
};
|
|
660
|
-
|
|
659
|
+
console.log('currentItem =>', currentItem);
|
|
660
|
+
if (_export.GeometryUtils.needSnap(currentItem, otherItem) && otherItem.cat.type != 'cabinet') {
|
|
661
661
|
var tRot = _item2.rotation;
|
|
662
662
|
var tPos = new Three.Vector2(_item2.x, _item2.y);
|
|
663
663
|
var tBounding = target.children[0].userData;
|
|
@@ -711,7 +711,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
711
711
|
// sort from distance
|
|
712
712
|
for (var _i5 = 0; _i5 < items.length - 1; _i5++) {
|
|
713
713
|
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))) {
|
|
714
|
+
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
715
|
var exchange = items[j];
|
|
716
716
|
items[j] = items[_i5];
|
|
717
717
|
items[_i5] = exchange;
|
|
@@ -829,7 +829,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
829
829
|
var tRot = layer.getIn(['items', target.userData.itemId]) ? layer.getIn(['items', target.userData.itemId]).rotation : 0;
|
|
830
830
|
var item = layer.getIn(['items', source.userData.itemId]);
|
|
831
831
|
var layoutType = item.layoutpos;
|
|
832
|
-
var altitudeLength = convert(item.properties.getIn(['altitude', '_length'])).from('in').to('cm');
|
|
832
|
+
var altitudeLength = (0, _convertUnitsLite.convert)(item.properties.getIn(['altitude', '_length'])).from('in').to('cm');
|
|
833
833
|
var sBounding = source.children[0].userData;
|
|
834
834
|
var tBounding = target.children[0].userData;
|
|
835
835
|
var tPos = target.position.clone();
|
|
@@ -846,7 +846,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
846
846
|
var removeSnapBoxObj = function removeSnapBoxObj() {
|
|
847
847
|
if (snapBoxObj) {
|
|
848
848
|
planData.plan.remove(snapBoxObj);
|
|
849
|
-
disposeObject(snapBoxObj);
|
|
849
|
+
(0, _threeMemoryCleaner.disposeObject)(snapBoxObj);
|
|
850
850
|
}
|
|
851
851
|
snapFlag = false;
|
|
852
852
|
};
|
|
@@ -855,7 +855,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
855
855
|
box.material.depthTest = false;
|
|
856
856
|
box.renderOrder = 200;
|
|
857
857
|
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);
|
|
858
|
+
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
859
|
snapBoxObj.rotation.set(source.rotation.x, source.rotation.y, source.rotation.z);
|
|
860
860
|
snapBoxObj.name = 'TransformBox';
|
|
861
861
|
planData.plan.add(snapBoxObj);
|
|
@@ -930,7 +930,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
930
930
|
return;
|
|
931
931
|
} else {
|
|
932
932
|
var _layoutType = _item3.layoutpos;
|
|
933
|
-
var _altitudeLength = convert(_item3.properties.getIn(['altitude', '_length'])).from('in').to('cm');
|
|
933
|
+
var _altitudeLength = (0, _convertUnitsLite.convert)(_item3.properties.getIn(['altitude', '_length'])).from('in').to('cm');
|
|
934
934
|
var _sBounding = source.children[0].userData;
|
|
935
935
|
var _width = _sBounding.max.x - _sBounding.min.x;
|
|
936
936
|
var _height = _sBounding.max.y - _sBounding.min.y;
|
|
@@ -945,7 +945,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
945
945
|
var _removeSnapBoxObj = function _removeSnapBoxObj() {
|
|
946
946
|
if (_snapBoxObj) {
|
|
947
947
|
planData.plan.remove(_snapBoxObj);
|
|
948
|
-
disposeObject(_snapBoxObj);
|
|
948
|
+
(0, _threeMemoryCleaner.disposeObject)(_snapBoxObj);
|
|
949
949
|
}
|
|
950
950
|
snapFlag = false;
|
|
951
951
|
};
|
|
@@ -954,7 +954,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
954
954
|
_box.material.depthTest = false;
|
|
955
955
|
_box.renderOrder = 100;
|
|
956
956
|
_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);
|
|
957
|
+
_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
958
|
_snapBoxObj.rotation.set(source.rotation.x, source.rotation.y, source.rotation.z);
|
|
959
959
|
_snapBoxObj.name = 'TransformBox';
|
|
960
960
|
planData.plan.add(_snapBoxObj);
|
|
@@ -1091,7 +1091,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1091
1091
|
ctx.beginPath();
|
|
1092
1092
|
ctx.arc(50, 50, 45, 0, 2 * Math.PI);
|
|
1093
1093
|
ctx.stroke();
|
|
1094
|
-
ctx.strokeStyle = SECONDARY_PURPLE_COLOR;
|
|
1094
|
+
ctx.strokeStyle = _constants.SECONDARY_PURPLE_COLOR;
|
|
1095
1095
|
ctx.lineWidth = 6;
|
|
1096
1096
|
ctx.beginPath();
|
|
1097
1097
|
if (lastAngle < 15 && lastAngle > -15) {
|
|
@@ -1195,7 +1195,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1195
1195
|
var properties = allItemRect.cur.itemInfo.properties;
|
|
1196
1196
|
altitude = properties.getIn(['altitude', '_length']);
|
|
1197
1197
|
var unit = properties.getIn(['altitude', '_unit']) || 'in';
|
|
1198
|
-
altitude = convert(altitude).from(unit).to(_this2.props.state.scene.unit);
|
|
1198
|
+
altitude = (0, _convertUnitsLite.convert)(altitude).from(unit).to(_this2.props.state.scene.unit);
|
|
1199
1199
|
}
|
|
1200
1200
|
getPoint(event, altitude);
|
|
1201
1201
|
var state = _this2.props.state;
|
|
@@ -1260,7 +1260,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1260
1260
|
console.log('intersects[i] is undefined in viewer3d/viewer3d.js');
|
|
1261
1261
|
}
|
|
1262
1262
|
}
|
|
1263
|
-
if (_this2.props.state.mode == MODE_DRAWING_ITEM_3D) return;
|
|
1263
|
+
if (_this2.props.state.mode == _constants.MODE_DRAWING_ITEM_3D) return;
|
|
1264
1264
|
if (isSelected) {
|
|
1265
1265
|
!_this2.props.downloadFlag && _this2.props.setToolbar('');
|
|
1266
1266
|
if (intersects.length > 0 && !isNaN(intersects[0].distance)) {
|
|
@@ -1287,13 +1287,13 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1287
1287
|
var _properties = allItemRect.cur.itemInfo.properties;
|
|
1288
1288
|
alti = _properties.getIn(['altitude', '_length']);
|
|
1289
1289
|
var _unit = _properties.getIn(['altitude', '_unit']) || 'in';
|
|
1290
|
-
alti = convert(alti).from(_unit).to(_this2.props.state.scene.unit);
|
|
1290
|
+
alti = (0, _convertUnitsLite.convert)(alti).from(_unit).to(_this2.props.state.scene.unit);
|
|
1291
1291
|
}
|
|
1292
1292
|
getPoint({
|
|
1293
1293
|
offsetX: event.offsetX - 50,
|
|
1294
1294
|
offsetY: event.offsetY
|
|
1295
1295
|
}, alti);
|
|
1296
|
-
if (
|
|
1296
|
+
if (!selectedItem) return;
|
|
1297
1297
|
var selItem = _this2.props.state.scene.layers.get(selectedObject.layerID).items.get(selectedObject.itemID);
|
|
1298
1298
|
lastAngle = 0;
|
|
1299
1299
|
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 +1324,8 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1324
1324
|
for (_i1 = 0; _i1 < intersects.length; _i1++) {
|
|
1325
1325
|
if (selectedItem != undefined && intersects[_i1].object.parent && intersects[_i1].object.parent.parent.userData.itemId === selectedItem.userData.itemId) selectedFlag = true;
|
|
1326
1326
|
}
|
|
1327
|
-
if (selectedFlag || toolIntersects.length > 0 && !isElevationView(mode)) {
|
|
1328
|
-
cameraControls.mouseButtons.left =
|
|
1327
|
+
if (selectedFlag || toolIntersects.length > 0 && !(0, _helper.isElevationView)(mode)) {
|
|
1328
|
+
cameraControls.mouseButtons.left = _cameraControls["default"].ACTION.NONE;
|
|
1329
1329
|
selectedFlag = false;
|
|
1330
1330
|
} else {
|
|
1331
1331
|
isSelected = false;
|
|
@@ -1351,7 +1351,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1351
1351
|
var properties = allItemRect.cur.itemInfo.properties;
|
|
1352
1352
|
altitude = properties.getIn(['altitude', '_length']);
|
|
1353
1353
|
var unit = properties.getIn(['altitude', '_unit']) || 'in';
|
|
1354
|
-
altitude = convert(altitude).from(unit).to(_this2.props.state.scene.unit);
|
|
1354
|
+
altitude = (0, _convertUnitsLite.convert)(altitude).from(unit).to(_this2.props.state.scene.unit);
|
|
1355
1355
|
}
|
|
1356
1356
|
scene3D.remove(angleObj);
|
|
1357
1357
|
scene3D.remove(toolObj);
|
|
@@ -1359,7 +1359,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1359
1359
|
_this2.props.setToolbar('');
|
|
1360
1360
|
}
|
|
1361
1361
|
getPoint(event, altitude);
|
|
1362
|
-
if (_this2.props.state.mode == MODE_DRAWING_ITEM_3D) {
|
|
1362
|
+
if (_this2.props.state.mode == _constants.MODE_DRAWING_ITEM_3D) {
|
|
1363
1363
|
if (Point.x > _this2.props.state.scene.width) Point.x = _this2.props.state.width;
|
|
1364
1364
|
if (Point.y > _this2.props.state.scene.height) Point.y = _this2.props.state.height;
|
|
1365
1365
|
if (Point.x < 0) Point.x = 0;
|
|
@@ -1370,7 +1370,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1370
1370
|
removeSnapBox();
|
|
1371
1371
|
var polygon = lineRect(layer);
|
|
1372
1372
|
// if cursor is outside of room
|
|
1373
|
-
if (!GeometryUtils.ContainsPoint(polygon, Point.x, Point.y)) {
|
|
1373
|
+
if (!_export.GeometryUtils.ContainsPoint(polygon, Point.x, Point.y)) {
|
|
1374
1374
|
actions.itemsActions.endDrawingItem(_this2.props.state.scene.selectedLayer, sPoint.x, sPoint.y);
|
|
1375
1375
|
} else {
|
|
1376
1376
|
actions.itemsActions.updateDraggingItemChanged(targetPoint.x, -targetPoint.z, selectedObject.layerID, selectedObject.itemID);
|
|
@@ -1381,13 +1381,13 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1381
1381
|
bMove = false;
|
|
1382
1382
|
return;
|
|
1383
1383
|
}
|
|
1384
|
-
if (_this2.props.state.mode == MODE_DRAGGING_ITEM_3D) {
|
|
1384
|
+
if (_this2.props.state.mode == _constants.MODE_DRAGGING_ITEM_3D) {
|
|
1385
1385
|
_this2.context.itemsActions.endDraggingItem3D();
|
|
1386
1386
|
}
|
|
1387
|
-
if (_this2.props.state.mode == MODE_ROTATING_ITEM_3D) {
|
|
1387
|
+
if (_this2.props.state.mode == _constants.MODE_ROTATING_ITEM_3D) {
|
|
1388
1388
|
_this2.context.itemsActions.endRotatingItem3D(sPoint.x, sPoint.y);
|
|
1389
1389
|
}
|
|
1390
|
-
if (_this2.props.state.mode == MODE_DRAWING_HOLE_3D) {
|
|
1390
|
+
if (_this2.props.state.mode == _constants.MODE_DRAWING_HOLE_3D) {
|
|
1391
1391
|
gridPlanOrigin = gridPlane.position;
|
|
1392
1392
|
gridMatrix.copy(gridPlane.matrixWorld).invert();
|
|
1393
1393
|
camPos = camera.position;
|
|
@@ -1398,7 +1398,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1398
1398
|
}
|
|
1399
1399
|
event.preventDefault();
|
|
1400
1400
|
if (event.button === 0) {
|
|
1401
|
-
cameraControls.mouseButtons.left =
|
|
1401
|
+
cameraControls.mouseButtons.left = _cameraControls["default"].ACTION.ROTATE;
|
|
1402
1402
|
mouse.x = event.offsetX / _this2.width * 2 - 1;
|
|
1403
1403
|
mouse.y = -(event.offsetY / _this2.height) * 2 + 1;
|
|
1404
1404
|
raycaster.setFromCamera(mouse, camera);
|
|
@@ -1462,9 +1462,9 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1462
1462
|
}
|
|
1463
1463
|
isSelected = true;
|
|
1464
1464
|
setTimeout(function () {
|
|
1465
|
-
getDistances(layer);
|
|
1465
|
+
(0, _sceneCreator.getDistances)(layer);
|
|
1466
1466
|
var selectedItem = planData.sceneGraph.layers[selectedObject.layerID].items[selectedObject.itemID];
|
|
1467
|
-
if (
|
|
1467
|
+
if (!selectedItem) return;
|
|
1468
1468
|
var selItem = _this2.props.state.scene.layers.get(selectedObject.layerID).items.get(selectedObject.itemID);
|
|
1469
1469
|
var itemPos = selectedItem.position.clone();
|
|
1470
1470
|
if (intersects[_i10].object.parent && intersects[_i10].object.parent.parent.userData.itemId === selectedItem.userData.itemId) {
|
|
@@ -1479,10 +1479,10 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1479
1479
|
// showItemButtons(layer.getIn(['items', selectedObject.itemID]), currentObject, event, camera, this.renderer);
|
|
1480
1480
|
var pointArray = [],
|
|
1481
1481
|
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]);
|
|
1482
|
+
pointArray.push([_sceneCreator.fVLine[0].userData.distance, 90]);
|
|
1483
|
+
pointArray.push([_sceneCreator.fVLine[1].userData.distance, -90]);
|
|
1484
|
+
pointArray.push([_sceneCreator.fVLine[2].userData.distance, 180]);
|
|
1485
|
+
pointArray.push([_sceneCreator.fVLine[3].userData.distance, 0]);
|
|
1486
1486
|
pointArray.forEach(function (pointElement, index) {
|
|
1487
1487
|
if (pointElement[0] == undefined) pointArray[index][0] = 0;
|
|
1488
1488
|
});
|
|
@@ -1534,19 +1534,19 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1534
1534
|
selectedObj = allItemRect.cur;
|
|
1535
1535
|
}
|
|
1536
1536
|
} else {
|
|
1537
|
-
visibleTransformBox(false);
|
|
1537
|
+
(0, _sceneCreator.visibleTransformBox)(false);
|
|
1538
1538
|
var alti = 0;
|
|
1539
1539
|
if (allItemRect && allItemRect.cur && allItemRect.cur.itemInfo !== undefined) {
|
|
1540
1540
|
var _properties2 = allItemRect.cur.itemInfo.properties;
|
|
1541
1541
|
alti = _properties2.getIn(['altitude', '_length']);
|
|
1542
1542
|
var _unit2 = _properties2.getIn(['altitude', '_unit']) || 'in';
|
|
1543
|
-
alti = convert(alti).from(_unit2).to(_this2.props.state.scene.unit);
|
|
1543
|
+
alti = (0, _convertUnitsLite.convert)(alti).from(_unit2).to(_this2.props.state.scene.unit);
|
|
1544
1544
|
}
|
|
1545
1545
|
getPoint(event, alti);
|
|
1546
1546
|
if (bRotate) {
|
|
1547
1547
|
var _intersects$_i;
|
|
1548
1548
|
var selectedItem = planData.sceneGraph.layers[selectedObject.layerID].items[selectedObject.itemID];
|
|
1549
|
-
if (
|
|
1549
|
+
if (!selectedItem) return;
|
|
1550
1550
|
var selItem = _this2.props.state.scene.layers.get(selectedObject.layerID).items.get(selectedObject.itemID);
|
|
1551
1551
|
var itemPos = selectedItem.position.clone();
|
|
1552
1552
|
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 +1564,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1564
1564
|
if (bMove) {
|
|
1565
1565
|
bMove = false;
|
|
1566
1566
|
var _selectedItem = planData.sceneGraph.layers[selectedObject.layerID].items[selectedObject.itemID];
|
|
1567
|
-
if (
|
|
1567
|
+
if (!_selectedItem) return;
|
|
1568
1568
|
var _selItem = _this2.props.state.scene.layers.get(selectedObject.layerID).items.get(selectedObject.itemID);
|
|
1569
1569
|
var _itemPos = _selectedItem.position.clone();
|
|
1570
1570
|
if (intersects[_i10].object.parent.parent.userData.itemId === _selectedItem.userData.itemId) {
|
|
@@ -1613,9 +1613,9 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1613
1613
|
var properties = allItemRect.cur.itemInfo.properties;
|
|
1614
1614
|
altitude = properties.getIn(['altitude', '_length']);
|
|
1615
1615
|
var unit = properties.getIn(['altitude', '_unit']) || 'in';
|
|
1616
|
-
altitude = convert(altitude).from(unit).to(_this2.props.state.scene.unit);
|
|
1616
|
+
altitude = (0, _convertUnitsLite.convert)(altitude).from(unit).to(_this2.props.state.scene.unit);
|
|
1617
1617
|
}
|
|
1618
|
-
if (_this2.props.state.mode === MODE_DRAWING_HOLE_3D) {
|
|
1618
|
+
if (_this2.props.state.mode === _constants.MODE_DRAWING_HOLE_3D) {
|
|
1619
1619
|
gridPlanOrigin = gridPlane.position;
|
|
1620
1620
|
gridMatrix.copy(gridPlane.matrixWorld).invert();
|
|
1621
1621
|
camPos = camera.position;
|
|
@@ -1627,7 +1627,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1627
1627
|
} else {
|
|
1628
1628
|
var layerID = _this2.props.state.scene.selectedLayer;
|
|
1629
1629
|
var holeID = _this2.props.state.drawingSupport.get('currentID');
|
|
1630
|
-
deleteSpecifiedMeshObjects('WarningBox' + holeID);
|
|
1630
|
+
(0, _sceneCreator.deleteSpecifiedMeshObjects)('WarningBox' + holeID);
|
|
1631
1631
|
prepareSnap(layer);
|
|
1632
1632
|
|
|
1633
1633
|
// let {nx, ny, rot} = GeometryUtils.calcSnap(allItemRect, allItemSnap, allLineRects, allLineSnap, allRect, Point.x, Point.y, allArea);
|
|
@@ -1637,7 +1637,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1637
1637
|
sPoint.set(nx, ny);
|
|
1638
1638
|
}
|
|
1639
1639
|
}
|
|
1640
|
-
if (_this2.props.state.mode === MODE_DRAWING_ITEM_3D) {
|
|
1640
|
+
if (_this2.props.state.mode === _constants.MODE_DRAWING_ITEM_3D) {
|
|
1641
1641
|
// We need to set cam position since when MODE_DRAWING_ITEM_3D mouse down event
|
|
1642
1642
|
// is not emited so cam position is not valid
|
|
1643
1643
|
gridPlanOrigin = gridPlane.position;
|
|
@@ -1651,7 +1651,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1651
1651
|
};
|
|
1652
1652
|
var _layer = _this2.props.state.scene.getIn(['layers', selectedObject.layerID]);
|
|
1653
1653
|
var polygon = lineRect(_layer);
|
|
1654
|
-
var isCursorInArea = GeometryUtils.ContainsPoint(polygon, Point.x, Point.y);
|
|
1654
|
+
var isCursorInArea = _export.GeometryUtils.ContainsPoint(polygon, Point.x, Point.y);
|
|
1655
1655
|
var _drawingSupport = _this2.props.state.drawingSupport;
|
|
1656
1656
|
if (!_drawingSupport.has('currentID')) {
|
|
1657
1657
|
var initialX = Point.x,
|
|
@@ -1670,7 +1670,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1670
1670
|
point = [];
|
|
1671
1671
|
}
|
|
1672
1672
|
});
|
|
1673
|
-
var centroid = GeometryUtils.getCentroidOfPolygon(points);
|
|
1673
|
+
var centroid = _export.GeometryUtils.getCentroidOfPolygon(points);
|
|
1674
1674
|
initialX = centroid[0];
|
|
1675
1675
|
initialY = centroid[1];
|
|
1676
1676
|
}
|
|
@@ -1682,8 +1682,8 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1682
1682
|
var mX = Point.x - sPoint.x;
|
|
1683
1683
|
var mY = Point.y - sPoint.y;
|
|
1684
1684
|
var item3D = planData.sceneGraph.layers[selectedObject.layerID].items[selectedObject.itemID];
|
|
1685
|
-
deleteSpecifiedMeshObjects('TransformBox');
|
|
1686
|
-
deleteSpecifiedMeshObjects('WarningBox' + itemID);
|
|
1685
|
+
(0, _sceneCreator.deleteSpecifiedMeshObjects)('TransformBox');
|
|
1686
|
+
(0, _sceneCreator.deleteSpecifiedMeshObjects)('WarningBox' + itemID);
|
|
1687
1687
|
var item = _layer.items.getIn([selectedObject.itemID]);
|
|
1688
1688
|
if (item.counterTop.uri == '') item.counterTop.uri = _layer.counterTop.uri;
|
|
1689
1689
|
var sRot = item.rotation;
|
|
@@ -1695,7 +1695,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1695
1695
|
var sdepth = sBounding.max.z - sBounding.min.z;
|
|
1696
1696
|
var sVertices = _this2.getRectPoints(swidth, sdepth, tPos.clone(), sRot % 360 / 180 * Math.PI);
|
|
1697
1697
|
prepareSnap(_layer);
|
|
1698
|
-
var _GeometryUtils$calcSn = GeometryUtils.calcSnap(allItemRect, allItemSnap, allLineRects, allLineSnap, allRect, Point.x, Point.y, allArea),
|
|
1698
|
+
var _GeometryUtils$calcSn = _export.GeometryUtils.calcSnap(allItemRect, allItemSnap, allLineRects, allLineSnap, allRect, Point.x, Point.y, allArea),
|
|
1699
1699
|
_nx = _GeometryUtils$calcSn.nx,
|
|
1700
1700
|
_ny = _GeometryUtils$calcSn.ny,
|
|
1701
1701
|
rot = _GeometryUtils$calcSn.rot;
|
|
@@ -1709,9 +1709,9 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1709
1709
|
//return;
|
|
1710
1710
|
}
|
|
1711
1711
|
if (polygon.length > 0) {
|
|
1712
|
-
var PolygonSect = GeometryUtils.ContainsPoint(polygon, _nx, _ny);
|
|
1712
|
+
var PolygonSect = _export.GeometryUtils.ContainsPoint(polygon, _nx, _ny);
|
|
1713
1713
|
if (!PolygonSect) {
|
|
1714
|
-
var _GeometryUtils$calcCr = GeometryUtils.calcCreateSnap(allItemRect, allItemSnap, allLineRects, allLineSnap, allRect, Point.x, Point.y, polygon),
|
|
1714
|
+
var _GeometryUtils$calcCr = _export.GeometryUtils.calcCreateSnap(allItemRect, allItemSnap, allLineRects, allLineSnap, allRect, Point.x, Point.y, polygon),
|
|
1715
1715
|
cx = _GeometryUtils$calcCr.cx,
|
|
1716
1716
|
cy = _GeometryUtils$calcCr.cy,
|
|
1717
1717
|
crot = _GeometryUtils$calcCr.crot;
|
|
@@ -1721,19 +1721,19 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1721
1721
|
}
|
|
1722
1722
|
}
|
|
1723
1723
|
if (polygon.length > 0) {
|
|
1724
|
-
var isSnapInArea = GeometryUtils.ContainsPoint(polygon, _nx, _ny);
|
|
1724
|
+
var isSnapInArea = _export.GeometryUtils.ContainsPoint(polygon, _nx, _ny);
|
|
1725
1725
|
if (!isSnapInArea) return;
|
|
1726
1726
|
}
|
|
1727
1727
|
actions.itemsActions.updateDraggingItemChanged(_nx, _ny, selectedObject.layerID, selectedObject.itemID);
|
|
1728
1728
|
actions.itemsActions.updateRotatingItemChanged(rot, selectedObject.layerID, selectedObject.itemID);
|
|
1729
1729
|
sPoint.set(_nx, _ny);
|
|
1730
|
-
getDistances(_layer);
|
|
1730
|
+
(0, _sceneCreator.getDistances)(_layer);
|
|
1731
1731
|
var pointArray = [],
|
|
1732
1732
|
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]);
|
|
1733
|
+
pointArray.push([_sceneCreator.fVLine[0].userData.distance, 90]);
|
|
1734
|
+
pointArray.push([_sceneCreator.fVLine[1].userData.distance, -90]);
|
|
1735
|
+
pointArray.push([_sceneCreator.fVLine[2].userData.distance, 180]);
|
|
1736
|
+
pointArray.push([_sceneCreator.fVLine[3].userData.distance, 0]);
|
|
1737
1737
|
pointArray.forEach(function (pointElement, index) {
|
|
1738
1738
|
if (pointElement[0] == undefined) pointArray[index][0] = 0;
|
|
1739
1739
|
});
|
|
@@ -1745,8 +1745,8 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1745
1745
|
pointArray[1][0] = 100;
|
|
1746
1746
|
}
|
|
1747
1747
|
actions.itemsActions.storeDistArray(_layer.id, item.id, pointArray);
|
|
1748
|
-
var minDis = fVLine[0].userData.distance;
|
|
1749
|
-
var snapObj = fVLine[0];
|
|
1748
|
+
var minDis = _sceneCreator.fVLine[0].userData.distance;
|
|
1749
|
+
var snapObj = _sceneCreator.fVLine[0];
|
|
1750
1750
|
var iPos = item3D.position.clone();
|
|
1751
1751
|
var snapDis = Math.sqrt((iPos.x - targetPoint.x) * (iPos.x - targetPoint.x) + (iPos.z - targetPoint.z) * (iPos.z - targetPoint.z));
|
|
1752
1752
|
if (snapDis >= 100 && snapObj != null) {
|
|
@@ -1754,10 +1754,10 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1754
1754
|
backsplashVisible = false;
|
|
1755
1755
|
//console.log('1 snap no');
|
|
1756
1756
|
}
|
|
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];
|
|
1757
|
+
for (var _i11 = 1; _i11 < _sceneCreator.fVLine.length; _i11++) {
|
|
1758
|
+
if (minDis > _sceneCreator.fVLine[_i11].userData.distance) {
|
|
1759
|
+
minDis = _sceneCreator.fVLine[_i11].userData.distance;
|
|
1760
|
+
snapObj = _sceneCreator.fVLine[_i11];
|
|
1761
1761
|
}
|
|
1762
1762
|
}
|
|
1763
1763
|
if (snapBox == null) {
|
|
@@ -1768,14 +1768,14 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1768
1768
|
_this2.snap(snapObj, _layer);
|
|
1769
1769
|
snapFlag = true;
|
|
1770
1770
|
//console.log('1 snap Yes')
|
|
1771
|
-
getDistances(_layer, true);
|
|
1771
|
+
(0, _sceneCreator.getDistances)(_layer, true);
|
|
1772
1772
|
var _i12 = 0;
|
|
1773
|
-
for (_i12 = 0; _i12 < fVLine.length; _i12++) {
|
|
1774
|
-
if (fVLine[_i12].userData.distance < snapDelta) {
|
|
1773
|
+
for (_i12 = 0; _i12 < _sceneCreator.fVLine.length; _i12++) {
|
|
1774
|
+
if (_sceneCreator.fVLine[_i12].userData.distance < snapDelta) {
|
|
1775
1775
|
break;
|
|
1776
1776
|
}
|
|
1777
1777
|
}
|
|
1778
|
-
if (_i12 === fVLine.length) backsplashVisible = false;else backsplashVisible = true;
|
|
1778
|
+
if (_i12 === _sceneCreator.fVLine.length) backsplashVisible = false;else backsplashVisible = true;
|
|
1779
1779
|
}
|
|
1780
1780
|
actions.itemsActions.setBacksplashVisible(selectedObject.itemID, backsplashVisible);
|
|
1781
1781
|
}
|
|
@@ -1788,8 +1788,8 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1788
1788
|
var orginRot = _this2.props.state.rotatingSupport.get('originRotation');
|
|
1789
1789
|
angleTexture.image = createAngleObject((orginRot < 0 ? 360 - orginRot : orginRot) - _item4.rotation);
|
|
1790
1790
|
angleTexture.needsUpdate = true;
|
|
1791
|
-
deleteSpecifiedMeshObjects('WarningBox' + selectedObject.itemID);
|
|
1792
|
-
deleteSpecifiedMeshObjects('backsplash' + selectedObject.itemID);
|
|
1791
|
+
(0, _sceneCreator.deleteSpecifiedMeshObjects)('WarningBox' + selectedObject.itemID);
|
|
1792
|
+
(0, _sceneCreator.deleteSpecifiedMeshObjects)('backsplash' + selectedObject.itemID);
|
|
1793
1793
|
actions.sceneActions.updateMovingState(false);
|
|
1794
1794
|
}
|
|
1795
1795
|
if (bMoveUP) {
|
|
@@ -1807,7 +1807,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1807
1807
|
sPoint.set(Point.x, Point.y);
|
|
1808
1808
|
} else {
|
|
1809
1809
|
var _holeID = _this2.props.state.draggingSupport.get('currentID');
|
|
1810
|
-
deleteSpecifiedMeshObjects('WarningBox' + _holeID);
|
|
1810
|
+
(0, _sceneCreator.deleteSpecifiedMeshObjects)('WarningBox' + _holeID);
|
|
1811
1811
|
var _nx2 = Point.x;
|
|
1812
1812
|
var _ny2 = Point.y;
|
|
1813
1813
|
actions.holesActions.updateDraggingHole(_nx2, _ny2);
|
|
@@ -1822,8 +1822,8 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1822
1822
|
var _sRot2 = _item5.rotation;
|
|
1823
1823
|
var _mX = Point.x - sPoint.x;
|
|
1824
1824
|
var _mY = Point.y - sPoint.y;
|
|
1825
|
-
deleteSpecifiedMeshObjects('WarningBox' + selectedObject.itemID);
|
|
1826
|
-
deleteSpecifiedMeshObjects('backsplash' + selectedObject.itemID);
|
|
1825
|
+
(0, _sceneCreator.deleteSpecifiedMeshObjects)('WarningBox' + selectedObject.itemID);
|
|
1826
|
+
(0, _sceneCreator.deleteSpecifiedMeshObjects)('backsplash' + selectedObject.itemID);
|
|
1827
1827
|
prepareSnap(_layer3);
|
|
1828
1828
|
getPoint(event, altitude);
|
|
1829
1829
|
var _originPos = _item3D2.position.clone();
|
|
@@ -1832,7 +1832,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1832
1832
|
var _swidth = _sBounding2.max.x - _sBounding2.min.x;
|
|
1833
1833
|
var _sdepth = _sBounding2.max.z - _sBounding2.min.z;
|
|
1834
1834
|
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),
|
|
1835
|
+
var _GeometryUtils$calcSn2 = _export.GeometryUtils.calcSnap(allItemRect, allItemSnap, allLineRects, allLineSnap, allRect, Point.x, Point.y, allArea),
|
|
1836
1836
|
_nx3 = _GeometryUtils$calcSn2.nx,
|
|
1837
1837
|
_ny3 = _GeometryUtils$calcSn2.ny,
|
|
1838
1838
|
_rot = _GeometryUtils$calcSn2.rot;
|
|
@@ -1847,9 +1847,9 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1847
1847
|
}
|
|
1848
1848
|
var polygonPoint = lineRect(_layer3);
|
|
1849
1849
|
if (polygonPoint.length > 0) {
|
|
1850
|
-
var _PolygonSect = GeometryUtils.ContainsPoint(polygonPoint, _nx3, _ny3);
|
|
1850
|
+
var _PolygonSect = _export.GeometryUtils.ContainsPoint(polygonPoint, _nx3, _ny3);
|
|
1851
1851
|
if (!_PolygonSect) {
|
|
1852
|
-
var _GeometryUtils$calcCr2 = GeometryUtils.calcCreateSnap(allItemRect, allItemSnap, allLineRects, allLineSnap, allRect, Point.x, Point.y, polygonPoint),
|
|
1852
|
+
var _GeometryUtils$calcCr2 = _export.GeometryUtils.calcCreateSnap(allItemRect, allItemSnap, allLineRects, allLineSnap, allRect, Point.x, Point.y, polygonPoint),
|
|
1853
1853
|
_cx3 = _GeometryUtils$calcCr2.cx,
|
|
1854
1854
|
_cy = _GeometryUtils$calcCr2.cy,
|
|
1855
1855
|
_crot = _GeometryUtils$calcCr2.crot;
|
|
@@ -1860,19 +1860,19 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1860
1860
|
}
|
|
1861
1861
|
var _polygon = lineRect(_layer3);
|
|
1862
1862
|
if (_polygon.length > 0) {
|
|
1863
|
-
var Sect = GeometryUtils.ContainsPoint(_polygon, _nx3, _ny3);
|
|
1863
|
+
var Sect = _export.GeometryUtils.ContainsPoint(_polygon, _nx3, _ny3);
|
|
1864
1864
|
if (!Sect) return;
|
|
1865
1865
|
}
|
|
1866
1866
|
actions.itemsActions.updateDraggingItemChanged(_nx3, _ny3, selectedObject.layerID, selectedObject.itemID);
|
|
1867
1867
|
actions.itemsActions.updateRotatingItemChanged(_rot, selectedObject.layerID, selectedObject.itemID);
|
|
1868
1868
|
sPoint.set(_nx3, _ny3);
|
|
1869
|
-
getDistances(_layer3);
|
|
1869
|
+
(0, _sceneCreator.getDistances)(_layer3);
|
|
1870
1870
|
var _pointArray = [],
|
|
1871
1871
|
_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]);
|
|
1872
|
+
_pointArray.push([_sceneCreator.fVLine[0].userData.distance, 90]);
|
|
1873
|
+
_pointArray.push([_sceneCreator.fVLine[1].userData.distance, -90]);
|
|
1874
|
+
_pointArray.push([_sceneCreator.fVLine[2].userData.distance, 180]);
|
|
1875
|
+
_pointArray.push([_sceneCreator.fVLine[3].userData.distance, 0]);
|
|
1876
1876
|
_pointArray.forEach(function (pointElement, index) {
|
|
1877
1877
|
if (pointElement[0] == undefined) _pointArray[index][0] = 0;
|
|
1878
1878
|
});
|
|
@@ -1884,8 +1884,8 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1884
1884
|
_pointArray[1][0] = 100;
|
|
1885
1885
|
}
|
|
1886
1886
|
actions.itemsActions.storeDistArray(_layer3.id, _item5.id, _pointArray);
|
|
1887
|
-
var _minDis = fVLine[0].userData.distance;
|
|
1888
|
-
var _snapObj = fVLine[0];
|
|
1887
|
+
var _minDis = _sceneCreator.fVLine[0].userData.distance;
|
|
1888
|
+
var _snapObj = _sceneCreator.fVLine[0];
|
|
1889
1889
|
var _iPos = _item3D2.position.clone();
|
|
1890
1890
|
var _snapDis = Math.sqrt((_iPos.x - targetPoint.x) * (_iPos.x - targetPoint.x) + (_iPos.z - targetPoint.z) * (_iPos.z - targetPoint.z));
|
|
1891
1891
|
if (_snapDis >= 100 && _snapObj != null) {
|
|
@@ -1893,10 +1893,10 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1893
1893
|
backsplashVisible = false;
|
|
1894
1894
|
//console.log('1 snap no');
|
|
1895
1895
|
}
|
|
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];
|
|
1896
|
+
for (var _i13 = 1; _i13 < _sceneCreator.fVLine.length; _i13++) {
|
|
1897
|
+
if (_minDis > _sceneCreator.fVLine[_i13].userData.distance) {
|
|
1898
|
+
_minDis = _sceneCreator.fVLine[_i13].userData.distance;
|
|
1899
|
+
_snapObj = _sceneCreator.fVLine[_i13];
|
|
1900
1900
|
}
|
|
1901
1901
|
}
|
|
1902
1902
|
if (snapBox == null) {
|
|
@@ -1907,14 +1907,14 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1907
1907
|
_this2.snap(_snapObj, _layer3);
|
|
1908
1908
|
snapFlag = true;
|
|
1909
1909
|
//console.log('1 snap Yes')
|
|
1910
|
-
getDistances(_layer3, true);
|
|
1910
|
+
(0, _sceneCreator.getDistances)(_layer3, true);
|
|
1911
1911
|
var _i14 = 0;
|
|
1912
|
-
for (_i14 = 0; _i14 < fVLine.length; _i14++) {
|
|
1913
|
-
if (fVLine[_i14].userData.distance < snapDelta) {
|
|
1912
|
+
for (_i14 = 0; _i14 < _sceneCreator.fVLine.length; _i14++) {
|
|
1913
|
+
if (_sceneCreator.fVLine[_i14].userData.distance < snapDelta) {
|
|
1914
1914
|
break;
|
|
1915
1915
|
}
|
|
1916
1916
|
}
|
|
1917
|
-
if (_i14 === fVLine.length) backsplashVisible = false;else backsplashVisible = true;
|
|
1917
|
+
if (_i14 === _sceneCreator.fVLine.length) backsplashVisible = false;else backsplashVisible = true;
|
|
1918
1918
|
}
|
|
1919
1919
|
actions.itemsActions.setBacksplashVisible(selectedObject.itemID, backsplashVisible);
|
|
1920
1920
|
}
|
|
@@ -1927,7 +1927,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1927
1927
|
raycaster.setFromCamera(curPos, camera);
|
|
1928
1928
|
rayDirection = raycaster.ray.direction;
|
|
1929
1929
|
rayDirection = rayDirection.normalize();
|
|
1930
|
-
var meshes = getAllMeshes(toIntersect);
|
|
1930
|
+
var meshes = (0, _objectsUtils.getAllMeshes)(toIntersect);
|
|
1931
1931
|
var intersects = raycaster.intersectObjects(meshes, true);
|
|
1932
1932
|
var _i15;
|
|
1933
1933
|
if (intersects.length > 0 && !isNaN(intersects[0].distance)) {
|
|
@@ -1962,7 +1962,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1962
1962
|
document.getElementById('warning_box_2d').style.display = 'none';
|
|
1963
1963
|
};
|
|
1964
1964
|
this.onkeydown = function (event) {
|
|
1965
|
-
if (_this2.props.keyDownEnable && !isElevationView(state.mode)) {
|
|
1965
|
+
if (_this2.props.keyDownEnable && !(0, _helper.isElevationView)(state.mode)) {
|
|
1966
1966
|
switch (event.keyCode) {
|
|
1967
1967
|
case 27:
|
|
1968
1968
|
// escape key
|
|
@@ -2031,7 +2031,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
2031
2031
|
}
|
|
2032
2032
|
|
|
2033
2033
|
// Add the output of the renderer to the html element
|
|
2034
|
-
var canvasWrapper =
|
|
2034
|
+
var canvasWrapper = _reactDom["default"].findDOMNode(this.refs.canvasWrapper);
|
|
2035
2035
|
canvasWrapper && canvasWrapper.appendChild(this.renderer.domElement);
|
|
2036
2036
|
|
|
2037
2037
|
//
|
|
@@ -2044,7 +2044,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
2044
2044
|
setTimeout(function () {
|
|
2045
2045
|
try {
|
|
2046
2046
|
currentObject = planData.sceneGraph.layers[selectedObject.layerID].items[selectedObject.itemID];
|
|
2047
|
-
if (
|
|
2047
|
+
if (!currentObject) return;
|
|
2048
2048
|
var selItem = _this2.props.state.scene.layers.get(selectedObject.layerID).items.get(selectedObject.itemID);
|
|
2049
2049
|
var itemPos = currentObject.position.clone();
|
|
2050
2050
|
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 +2063,17 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
2063
2063
|
function init() {
|
|
2064
2064
|
clock = new Three.Clock();
|
|
2065
2065
|
scene3D = new Three.Scene();
|
|
2066
|
-
if (isElevationView(state.mode)) scene3D.background = new Three.Color(0xffffff);
|
|
2066
|
+
if ((0, _helper.isElevationView)(state.mode)) scene3D.background = new Three.Color(0xffffff);
|
|
2067
2067
|
// change color about v1: 0x8791AB, v2: 0xC2C2C2, v3: 0xC3CADC
|
|
2068
2068
|
else scene3D.background = new Three.Color(0xc3cadc); // change color about v1: 0x8791AB, v2: 0xC2C2C2, v3: 0xC3CADC
|
|
2069
2069
|
// scene3D.fog = new Three.Fog(0xC3CADC, 2000, 3500);
|
|
2070
2070
|
window.scene3D = scene3D;
|
|
2071
2071
|
// Camera
|
|
2072
|
-
if (isElevationView(state.mode)) {
|
|
2072
|
+
if ((0, _helper.isElevationView)(state.mode)) {
|
|
2073
2073
|
// In elevation view, set Orthographic camera's position, angle and rotation about selected line
|
|
2074
2074
|
var layers = scene.layers;
|
|
2075
2075
|
var selectedLayer = layers.get(scene.selectedLayer);
|
|
2076
|
-
var ceilHeight = convert(selectedLayer.ceilHeight).from(selectedLayer.unit).to(scene.unit);
|
|
2076
|
+
var ceilHeight = (0, _convertUnitsLite.convert)(selectedLayer.ceilHeight).from(selectedLayer.unit).to(scene.unit);
|
|
2077
2077
|
var lines = [];
|
|
2078
2078
|
var selectedLine = selectedLayer.lines.get(selectedLayer.selected.lines.toJS()[0]);
|
|
2079
2079
|
var vertex0 = selectedLayer.vertices.get(selectedLine.vertices.get(0));
|
|
@@ -2082,7 +2082,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
2082
2082
|
y1 = vertex0.y;
|
|
2083
2083
|
var x2 = vertex1.x,
|
|
2084
2084
|
y2 = vertex1.y;
|
|
2085
|
-
if (GeometryUtils.compareVertices(vertex0, vertex1) >= 0 && vertex0.x !== vertex1.x) {
|
|
2085
|
+
if (_export.GeometryUtils.compareVertices(vertex0, vertex1) >= 0 && vertex0.x !== vertex1.x) {
|
|
2086
2086
|
x1 = vertex1.x;
|
|
2087
2087
|
y1 = vertex1.y;
|
|
2088
2088
|
x2 = vertex0.x;
|
|
@@ -2104,11 +2104,11 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
2104
2104
|
lines.push(data);
|
|
2105
2105
|
}
|
|
2106
2106
|
});
|
|
2107
|
-
var lineLength = GeometryUtils.pointsDistance(x1, y1, x2, y2);
|
|
2107
|
+
var lineLength = _export.GeometryUtils.pointsDistance(x1, y1, x2, y2);
|
|
2108
2108
|
self.setState({
|
|
2109
2109
|
lineLength: lineLength
|
|
2110
2110
|
});
|
|
2111
|
-
var cameraRect = handleCamRect(self.width, self.height, ceilHeight, lineLength);
|
|
2111
|
+
var cameraRect = (0, _helper.handleCamRect)(self.width, self.height, ceilHeight, lineLength);
|
|
2112
2112
|
camera = new Three.OrthographicCamera(-cameraRect.width / 2, cameraRect.width / 2, cameraRect.height / 2, -cameraRect.height / 2, 1, 1000);
|
|
2113
2113
|
var angle = Math.atan((y1 - y2) / (x1 - x2));
|
|
2114
2114
|
var r = 300;
|
|
@@ -2129,15 +2129,15 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
2129
2129
|
}
|
|
2130
2130
|
camera.layers.enable(1);
|
|
2131
2131
|
function loadENV() {
|
|
2132
|
-
new RGBELoader().load('/assets/brown_photostudio_02_1k.hdr', function (texture) {
|
|
2132
|
+
new _RGBELoader.RGBELoader().load('/assets/brown_photostudio_02_1k.hdr', function (texture) {
|
|
2133
2133
|
texture.mapping = Three.EquirectangularReflectionMapping;
|
|
2134
2134
|
scene3D.environment = texture;
|
|
2135
2135
|
texture.dispose();
|
|
2136
2136
|
});
|
|
2137
2137
|
}
|
|
2138
2138
|
// Camera Controls
|
|
2139
|
-
if (!isElevationView(state.mode)) {
|
|
2140
|
-
cameraControls = new
|
|
2139
|
+
if (!(0, _helper.isElevationView)(state.mode)) {
|
|
2140
|
+
cameraControls = new _cameraControls["default"](camera, self.renderer.domElement);
|
|
2141
2141
|
cameraControls.dollyToCursor = true;
|
|
2142
2142
|
cameraControls.infinityDolly = true;
|
|
2143
2143
|
cameraControls.minDistance = 50;
|
|
@@ -2148,7 +2148,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
2148
2148
|
scene3D.add(planData.plan);
|
|
2149
2149
|
scene3D.add(planData.grid);
|
|
2150
2150
|
scene3D.add(camera);
|
|
2151
|
-
if (isElevationView(state.mode)) {
|
|
2151
|
+
if ((0, _helper.isElevationView)(state.mode)) {
|
|
2152
2152
|
planData.cam.add(camera);
|
|
2153
2153
|
scene3D.add(planData.cam);
|
|
2154
2154
|
} else {
|
|
@@ -2163,7 +2163,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
2163
2163
|
}
|
|
2164
2164
|
function render() {
|
|
2165
2165
|
var delta = clock.getDelta(); // Get time delta for smooth updates
|
|
2166
|
-
if (!isElevationView(state.mode)) cameraControls.update(delta);
|
|
2166
|
+
if (!(0, _helper.isElevationView)(state.mode)) cameraControls.update(delta);
|
|
2167
2167
|
for (var _i16 = 0; _i16 < lights.length; _i16++) {
|
|
2168
2168
|
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
2169
|
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 +2210,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
2210
2210
|
var indexAttribute = line.geometry.getIndex();
|
|
2211
2211
|
var firstFaceIndices = undefined;
|
|
2212
2212
|
if (indexAttribute && indexAttribute.length > 0) {
|
|
2213
|
-
[indexAttribute.getX(0), indexAttribute.getX(1), indexAttribute.getX(2)],
|
|
2213
|
+
[indexAttribute.getX(0), indexAttribute.getX(1), indexAttribute.getX(2)], (0, _readOnlyError2["default"])("firstFaceIndices");
|
|
2214
2214
|
}
|
|
2215
2215
|
if (firstFaceIndices == undefined) return;
|
|
2216
2216
|
// normal vector of the line
|
|
@@ -2259,7 +2259,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
2259
2259
|
isLoading: false,
|
|
2260
2260
|
waitForRender: 0
|
|
2261
2261
|
});
|
|
2262
|
-
if (isElevationView(self.props.state.mode)) {
|
|
2262
|
+
if ((0, _helper.isElevationView)(self.props.state.mode)) {
|
|
2263
2263
|
setTimeout(function () {
|
|
2264
2264
|
self.props.setIsLoadingElevation('front', false);
|
|
2265
2265
|
}, 100);
|
|
@@ -2283,14 +2283,14 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
2283
2283
|
key: "componentWillUnmount",
|
|
2284
2284
|
value: function componentWillUnmount() {
|
|
2285
2285
|
cancelAnimationFrame(this.renderingID);
|
|
2286
|
-
if (!isElevationView(this.props.state.mode)) {
|
|
2286
|
+
if (!(0, _helper.isElevationView)(this.props.state.mode)) {
|
|
2287
2287
|
if (this.cameraControls !== undefined) this.cameraControls.dispose();
|
|
2288
2288
|
}
|
|
2289
2289
|
if (!this.props.downloadFlag) {
|
|
2290
2290
|
this.renderer.domElement.removeEventListener('mousedown', this.mouseDownEvent);
|
|
2291
2291
|
this.renderer.domElement.removeEventListener('mouseup', this.mouseUpEvent);
|
|
2292
2292
|
}
|
|
2293
|
-
disposeScene(this.scene3D);
|
|
2293
|
+
(0, _threeMemoryCleaner.disposeScene)(this.scene3D);
|
|
2294
2294
|
this.scene3D.remove(this.planData.plan);
|
|
2295
2295
|
this.scene3D.remove(this.planData.grid);
|
|
2296
2296
|
this.scene3D = null;
|
|
@@ -2303,11 +2303,11 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
2303
2303
|
key: "componentWillReceiveProps",
|
|
2304
2304
|
value: function componentWillReceiveProps(nextProps) {
|
|
2305
2305
|
var _this4 = this;
|
|
2306
|
-
if (this.props.downloadFlag &&
|
|
2306
|
+
if (this.props.downloadFlag && (0, _immutablediff["default"])(this.props.state, nextProps.state).toJS().length == 0 || (0, _helper.isEmpty)(nextProps.state.scene)) return;
|
|
2307
2307
|
var width = nextProps.width,
|
|
2308
2308
|
height = nextProps.height;
|
|
2309
2309
|
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);
|
|
2310
|
+
var ceilHeight = (0, _convertUnitsLite.convert)(selectedLayer.ceilHeight).from(selectedLayer.unit).to(nextProps.state.scene.unit);
|
|
2311
2311
|
var actions = {
|
|
2312
2312
|
areaActions: this.context.areaActions,
|
|
2313
2313
|
holesActions: this.context.holesActions,
|
|
@@ -2329,9 +2329,9 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
2329
2329
|
|
|
2330
2330
|
// handle camera setting
|
|
2331
2331
|
switch (this.props.state.mode) {
|
|
2332
|
-
case MODE_ELEVATION_VIEW:
|
|
2332
|
+
case _constants.MODE_ELEVATION_VIEW:
|
|
2333
2333
|
// when Elevation mode (camera: Orthographic)
|
|
2334
|
-
var cameraRect = handleCamRect(width, height, ceilHeight, this.state.lineLength);
|
|
2334
|
+
var cameraRect = (0, _helper.handleCamRect)(width, height, ceilHeight, this.state.lineLength);
|
|
2335
2335
|
// camera size
|
|
2336
2336
|
this.camera.left = -cameraRect.width / 2;
|
|
2337
2337
|
this.camera.right = cameraRect.width / 2;
|
|
@@ -2340,7 +2340,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
2340
2340
|
//camera position
|
|
2341
2341
|
this.camera.position.y = ceilHeight / 2;
|
|
2342
2342
|
break;
|
|
2343
|
-
case MODE_3D_VIEW:
|
|
2343
|
+
case _constants.MODE_3D_VIEW:
|
|
2344
2344
|
// when 3D mode (camera: Perspective)
|
|
2345
2345
|
this.camera.aspect = width / height;
|
|
2346
2346
|
break;
|
|
@@ -2350,34 +2350,34 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
2350
2350
|
var layer = data.getIn(['layers', data.selectedLayer]);
|
|
2351
2351
|
var self = this;
|
|
2352
2352
|
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);
|
|
2353
|
+
if ((0, _helper.isElevationView)(self.props.state.mode)) return; // apply backsplash when just 3D_mode, not elevation_mode
|
|
2354
|
+
var allItems = _export.GeometryUtils.getAllItemSpecified(nextProps.state.scene, actions.catalog, _constants.BASE_CABINET_LAYOUTPOS);
|
|
2355
2355
|
var i,
|
|
2356
2356
|
items = [];
|
|
2357
2357
|
for (i = 0; i < allItems.others.length; i++) items.push(allItems.others[i]);
|
|
2358
2358
|
if (allItems.cur) items.push(allItems.cur);
|
|
2359
2359
|
for (i = 0; i < items.length; i++) {
|
|
2360
|
-
var calcRect = GeometryUtils.getCalcRectFromItem3D(items[i]);
|
|
2361
|
-
var visible = GeometryUtils.isSnappedLine(calcRect, allLineRects);
|
|
2360
|
+
var calcRect = _export.GeometryUtils.getCalcRectFromItem3D(items[i]);
|
|
2361
|
+
var visible = _export.GeometryUtils.isSnappedLine(calcRect, allLineRects);
|
|
2362
2362
|
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);
|
|
2363
|
+
(0, _sceneCreator.createBacksplash)(items[i], nextProps.state.scene.getIn(['layers', nextProps.state.scene.selectedLayer]), planData, nextProps.state.scene);
|
|
2364
2364
|
}
|
|
2365
2365
|
}
|
|
2366
2366
|
function implementWarningBox() {
|
|
2367
|
-
var holeItems = GeometryUtils.getHoleItems(layer);
|
|
2367
|
+
var holeItems = _export.GeometryUtils.getHoleItems(layer);
|
|
2368
2368
|
var i,
|
|
2369
2369
|
items = [];
|
|
2370
2370
|
for (i = 0; i < allItemRect.others.length; i++) items.push(allItemRect.others[i]);
|
|
2371
2371
|
if (allItemRect.cur) items.push(allItemRect.cur);
|
|
2372
|
-
for (i = 0; i < items.length; i++) checkCabinetOverlap({
|
|
2372
|
+
for (i = 0; i < items.length; i++) (0, _sceneCreator.checkCabinetOverlap)({
|
|
2373
2373
|
x: items[i].pos.x,
|
|
2374
2374
|
y: items[i].pos.y
|
|
2375
2375
|
}, items[i], holeItems, planData);
|
|
2376
2376
|
}
|
|
2377
2377
|
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]);
|
|
2378
|
+
allLines = _export.GeometryUtils.getAllLines(layer);
|
|
2379
|
+
allLineRects = _export.GeometryUtils.buildRectFromLines(layer, allLines);
|
|
2380
|
+
allItemRect = _export.GeometryUtils.getAllItemSpecified(_this4.props.state.scene, actions.catalog, [_constants.WALL_CABINET_LAYOUTPOS, _constants.TALL_CABINET_LAYOUTPOS]);
|
|
2381
2381
|
};
|
|
2382
2382
|
var layer1 = this.props.state.scene.getIn(['layers', data.selectedLayer]);
|
|
2383
2383
|
if (this.state.showflag) {
|
|
@@ -2389,7 +2389,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
2389
2389
|
});
|
|
2390
2390
|
}
|
|
2391
2391
|
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 =
|
|
2392
|
+
var changedValues = (0, _immutablediff["default"])(this.props.state.scene, nextProps.state.scene);
|
|
2393
2393
|
prepareSnapSpec(layer);
|
|
2394
2394
|
if (nextProps.state.doorStyle && nextProps.state.doorStyle.get('name') === this.props.state.doorStyle.get('name')) {
|
|
2395
2395
|
self.setState({
|
|
@@ -2400,10 +2400,10 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
2400
2400
|
waitForRender: 0
|
|
2401
2401
|
});
|
|
2402
2402
|
switch (self.props.state.mode) {
|
|
2403
|
-
case MODE_ELEVATION_VIEW:
|
|
2403
|
+
case _constants.MODE_ELEVATION_VIEW:
|
|
2404
2404
|
self.props.setIsLoadingElevation('front', true);
|
|
2405
2405
|
break;
|
|
2406
|
-
case MODE_3D_VIEW:
|
|
2406
|
+
case _constants.MODE_3D_VIEW:
|
|
2407
2407
|
self.props.setIsLoading3D(true);
|
|
2408
2408
|
break;
|
|
2409
2409
|
}
|
|
@@ -2414,12 +2414,12 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
2414
2414
|
implementBacksplash();
|
|
2415
2415
|
implementWarningBox();
|
|
2416
2416
|
} else {
|
|
2417
|
-
deleteSpecifiedMeshObjects('TransformBox');
|
|
2417
|
+
(0, _sceneCreator.deleteSpecifiedMeshObjects)('TransformBox');
|
|
2418
2418
|
}
|
|
2419
2419
|
var _this$state = this.state,
|
|
2420
2420
|
toolObj = _this$state.toolObj,
|
|
2421
2421
|
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),
|
|
2422
|
+
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
2423
|
promise = _updateScene.promise;
|
|
2424
2424
|
self.setState();
|
|
2425
2425
|
promise.then(function (p1Value) {
|
|
@@ -2446,7 +2446,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
2446
2446
|
if (isLoading) {
|
|
2447
2447
|
if (this.props.downloadFlag) {
|
|
2448
2448
|
this.renderer.domElement.style.display = 'none';
|
|
2449
|
-
return /*#__PURE__*/
|
|
2449
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
2450
2450
|
style: {
|
|
2451
2451
|
alignItems: ' center',
|
|
2452
2452
|
width: this.props.width,
|
|
@@ -2454,7 +2454,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
2454
2454
|
display: 'inline-flex',
|
|
2455
2455
|
justifyContent: 'center'
|
|
2456
2456
|
}
|
|
2457
|
-
}, /*#__PURE__*/
|
|
2457
|
+
}, /*#__PURE__*/_react["default"].createElement("img", {
|
|
2458
2458
|
style: {
|
|
2459
2459
|
width: '70px',
|
|
2460
2460
|
height: '70px',
|
|
@@ -2467,12 +2467,12 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
2467
2467
|
document.getElementById('front') && (document.getElementById('front').style.display = 'none');
|
|
2468
2468
|
document.getElementById('error').style.display = 'none';
|
|
2469
2469
|
this.renderer.domElement.style.display = 'none';
|
|
2470
|
-
return /*#__PURE__*/
|
|
2470
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
2471
2471
|
style: {
|
|
2472
2472
|
textAlign: 'center',
|
|
2473
2473
|
width: '100%'
|
|
2474
2474
|
}
|
|
2475
|
-
}, /*#__PURE__*/
|
|
2475
|
+
}, /*#__PURE__*/_react["default"].createElement("img", {
|
|
2476
2476
|
style: {
|
|
2477
2477
|
animation: 'spin 2s linear infinite',
|
|
2478
2478
|
marginTop: "22%"
|
|
@@ -2485,12 +2485,12 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
2485
2485
|
this.renderer.domElement.style.pointerEvents = 'none';
|
|
2486
2486
|
document.getElementById('front') && (document.getElementById('front').style.display = 'none');
|
|
2487
2487
|
this.renderer.domElement.style.opacity = '0.4';
|
|
2488
|
-
return /*#__PURE__*/
|
|
2488
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
2489
2489
|
style: {
|
|
2490
2490
|
textAlign: 'center',
|
|
2491
2491
|
width: '100%'
|
|
2492
2492
|
}
|
|
2493
|
-
}, /*#__PURE__*/
|
|
2493
|
+
}, /*#__PURE__*/_react["default"].createElement("img", {
|
|
2494
2494
|
style: {
|
|
2495
2495
|
animation: 'spin 2s linear infinite',
|
|
2496
2496
|
position: "absolute",
|
|
@@ -2504,26 +2504,25 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
2504
2504
|
this.renderer.domElement.style.pointerEvents = 'auto';
|
|
2505
2505
|
this.renderer.domElement.style.opacity = '1';
|
|
2506
2506
|
!this.props.downloadFlag && document.getElementById('front') && (document.getElementById('front').style.display = 'block');
|
|
2507
|
-
return /*#__PURE__*/
|
|
2507
|
+
return /*#__PURE__*/_react["default"].createElement('div', {
|
|
2508
2508
|
ref: 'canvasWrapper'
|
|
2509
2509
|
});
|
|
2510
2510
|
}
|
|
2511
2511
|
}
|
|
2512
2512
|
}]);
|
|
2513
|
-
}(
|
|
2514
|
-
export { Scene3DViewer as default };
|
|
2513
|
+
}(_react["default"].Component);
|
|
2515
2514
|
Scene3DViewer.propTypes = {
|
|
2516
|
-
state:
|
|
2517
|
-
width:
|
|
2518
|
-
height:
|
|
2519
|
-
replaceCabinet:
|
|
2515
|
+
state: _propTypes["default"].object.isRequired,
|
|
2516
|
+
width: _propTypes["default"].number.isRequired,
|
|
2517
|
+
height: _propTypes["default"].number.isRequired,
|
|
2518
|
+
replaceCabinet: _propTypes["default"].func.isRequired
|
|
2520
2519
|
};
|
|
2521
2520
|
Scene3DViewer.contextTypes = {
|
|
2522
|
-
areaActions:
|
|
2523
|
-
holesActions:
|
|
2524
|
-
itemsActions:
|
|
2525
|
-
linesActions:
|
|
2526
|
-
sceneActions:
|
|
2527
|
-
projectActions:
|
|
2528
|
-
catalog:
|
|
2521
|
+
areaActions: _propTypes["default"].object.isRequired,
|
|
2522
|
+
holesActions: _propTypes["default"].object.isRequired,
|
|
2523
|
+
itemsActions: _propTypes["default"].object.isRequired,
|
|
2524
|
+
linesActions: _propTypes["default"].object.isRequired,
|
|
2525
|
+
sceneActions: _propTypes["default"].object.isRequired,
|
|
2526
|
+
projectActions: _propTypes["default"].object.isRequired,
|
|
2527
|
+
catalog: _propTypes["default"].object
|
|
2529
2528
|
};
|