kitchen-simulator 1.1.1-test.63 → 1.1.1-test.65
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 +79 -70
- package/es/KitchenConfiguratorApp.js +107 -98
- 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 +9 -2
- package/es/catalog/catalog.js +21 -15
- package/es/catalog/factories/area-factory-3d.js +31 -22
- package/es/catalog/factories/area-factory.js +20 -11
- 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 +9 -2
- 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 +31 -24
- package/es/catalog/properties/property-color.js +23 -16
- package/es/catalog/properties/property-enum.js +31 -24
- package/es/catalog/properties/property-hidden.js +16 -9
- package/es/catalog/properties/property-lenght-measure.js +45 -38
- package/es/catalog/properties/property-length-measure.js +43 -36
- package/es/catalog/properties/property-length-measure_hole.js +45 -38
- 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 -8
- package/es/catalog/utils/exporter.js +15 -8
- package/es/catalog/utils/geom-utils.js +29 -13
- package/es/catalog/utils/item-loader.js +97 -84
- package/es/catalog/utils/load-obj.js +28 -20
- package/es/catalog/utils/mtl-loader.js +8 -3
- package/es/catalog/utils/obj-loader.js +8 -3
- package/es/class/FuseUtils.js +15 -8
- package/es/class/area.js +28 -22
- package/es/class/export.js +95 -23
- package/es/class/group.js +59 -53
- package/es/class/guide.js +21 -15
- package/es/class/hole.js +89 -83
- package/es/class/item.js +147 -141
- package/es/class/layer.js +65 -59
- package/es/class/line.js +143 -135
- package/es/class/project.js +98 -90
- package/es/class/vertex.js +35 -29
- package/es/components/content.js +28 -19
- package/es/components/disclaimer/disclaimer.js +18 -10
- package/es/components/export.js +32 -8
- package/es/components/style/button.js +31 -23
- package/es/components/style/cancel-button.js +14 -7
- package/es/components/style/content-container.js +16 -9
- package/es/components/style/content-title.js +20 -11
- package/es/components/style/delete-button.js +17 -8
- package/es/components/style/export.js +120 -30
- package/es/components/style/form-block.js +15 -8
- package/es/components/style/form-color-input.js +14 -7
- package/es/components/style/form-label.js +15 -8
- package/es/components/style/form-number-input.js +49 -41
- package/es/components/style/form-number-input_2.js +44 -36
- package/es/components/style/form-select.js +24 -17
- package/es/components/style/form-slider.js +17 -10
- package/es/components/style/form-submit-button.js +17 -8
- package/es/components/style/form-text-input.js +34 -26
- 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 -10
- package/es/components/viewer2d/grids/grid-streak.js +17 -10
- package/es/components/viewer2d/grids/grid-vertical-streak.js +17 -10
- package/es/components/viewer2d/grids/grids.js +19 -10
- package/es/components/viewer2d/group.js +24 -15
- package/es/components/viewer2d/item.js +70 -61
- package/es/components/viewer2d/layer.js +30 -23
- package/es/components/viewer2d/line.js +111 -101
- package/es/components/viewer2d/ruler.js +29 -22
- package/es/components/viewer2d/rulerDist.js +28 -21
- package/es/components/viewer2d/rulerX.js +47 -39
- package/es/components/viewer2d/rulerY.js +45 -37
- package/es/components/viewer2d/scene.js +38 -30
- package/es/components/viewer2d/snap.js +22 -13
- package/es/components/viewer2d/state.js +27 -18
- package/es/components/viewer2d/utils.js +37 -24
- package/es/components/viewer2d/vertex.js +17 -8
- package/es/components/viewer2d/viewer2d.js +163 -153
- package/es/components/viewer3d/camera-controls-module/camera-controls.module.js +23 -17
- package/es/components/viewer3d/dcm.js +7 -1
- package/es/components/viewer3d/fbm.js +7 -1
- package/es/components/viewer3d/front3D.js +21 -12
- 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 +7 -1
- package/es/components/viewer3d/libs/obj-loader.js +7 -1
- package/es/components/viewer3d/libs/orbit-controls.js +8 -2
- package/es/components/viewer3d/libs/pointer-lock-controls.js +8 -2
- 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 -39
- package/es/components/viewer3d/ruler-utils/scene3D.js +17 -9
- package/es/components/viewer3d/ruler-utils/state3D.js +11 -4
- package/es/components/viewer3d/scene-creator.js +226 -191
- package/es/components/viewer3d/three-memory-cleaner.js +12 -3
- package/es/components/viewer3d/viewer3d-first-person.js +46 -40
- package/es/components/viewer3d/viewer3d.js +202 -196
- package/es/constants.js +358 -349
- package/es/index.js +15 -7
- package/es/models.js +184 -177
- package/es/plugins/SVGLoader.js +53 -48
- package/es/plugins/autosave.js +9 -3
- package/es/plugins/console-debugger.js +12 -5
- 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 -106
- 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 -5
- 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 -13
- package/es/utils/browser.js +9 -2
- package/es/utils/convert-units-lite.js +7 -1
- package/es/utils/email-validator.js +7 -1
- package/es/utils/export.js +46 -15
- package/es/utils/geometry.js +278 -181
- package/es/utils/get-edges-of-subgraphs.js +9 -2
- package/es/utils/graph-cycles.js +11 -8
- package/es/utils/graph-inner-cycles.js +18 -10
- package/es/utils/graph.js +17 -9
- package/es/utils/helper.js +63 -39
- package/es/utils/history.js +15 -8
- package/es/utils/id-broker.js +15 -8
- package/es/utils/logger.js +7 -1
- package/es/utils/math.js +12 -5
- package/es/utils/molding.js +144 -119
- package/es/utils/name-generator.js +13 -7
- package/es/utils/objects-utils.js +19 -7
- package/es/utils/phone-validator.js +7 -1
- package/es/utils/process-black-list.js +10 -3
- package/es/utils/react-if.js +12 -6
- package/es/utils/snap-scene.js +34 -27
- package/es/utils/snap.js +59 -45
- package/es/utils/summarizeCart.js +7 -1
- package/es/utils/threeCSG.es6.js +22 -13
- package/es/version.js +7 -1
- package/lib/@history.js +2 -1
- package/lib/AppContext.js +2 -1
- package/lib/KitchenConfigurator.js +2 -1
- package/lib/KitchenConfiguratorApp.js +2 -1
- package/lib/catalog/areas/area/planner-element.js +2 -1
- package/lib/catalog/catalog.js +2 -1
- package/lib/catalog/factories/area-factory.js +2 -1
- package/lib/catalog/factories/wall-factory.js +2 -1
- package/lib/catalog/holes/door-closet/planner-element.js +2 -1
- package/lib/catalog/holes/door-double/planner-element.js +2 -1
- package/lib/catalog/holes/door-exterior/planner-element.js +2 -1
- package/lib/catalog/holes/door-interior/planner-element.js +2 -1
- package/lib/catalog/holes/door-panic/planner-element.js +2 -1
- package/lib/catalog/holes/door-panic-double/planner-element.js +2 -1
- package/lib/catalog/holes/door-sliding/planner-element.js +2 -1
- package/lib/catalog/holes/doorway-framed/planner-element.js +2 -1
- package/lib/catalog/holes/doorway-frameless/planner-element.js +2 -1
- package/lib/catalog/holes/window-clear/planner-element.js +2 -1
- package/lib/catalog/holes/window-cross/planner-element.js +2 -1
- package/lib/catalog/holes/window-double-hung/planner-element.js +2 -1
- package/lib/catalog/holes/window-vertical/planner-element.js +2 -1
- package/lib/catalog/lines/wall/planner-element.js +2 -1
- package/lib/catalog/molding/molding-dcm/planner-element.js +2 -1
- package/lib/catalog/molding/molding-fbm/planner-element.js +2 -1
- package/lib/catalog/molding/molding-lrm/planner-element.js +2 -1
- package/lib/catalog/properties/property-checkbox.js +2 -1
- package/lib/catalog/properties/property-color.js +2 -1
- package/lib/catalog/properties/property-enum.js +2 -1
- package/lib/catalog/properties/property-hidden.js +2 -1
- package/lib/catalog/properties/property-lenght-measure.js +2 -1
- package/lib/catalog/properties/property-length-measure.js +2 -1
- package/lib/catalog/properties/property-length-measure_hole.js +2 -1
- package/lib/catalog/properties/property-number.js +2 -1
- package/lib/catalog/properties/property-read-only.js +2 -1
- package/lib/catalog/properties/property-string.js +2 -1
- package/lib/catalog/properties/property-toggle.js +2 -1
- package/lib/catalog/properties/shared-property-style.js +2 -1
- package/lib/catalog/utils/FuseUtils.js +2 -1
- package/lib/catalog/utils/exporter.js +2 -1
- package/lib/class/FuseUtils.js +2 -1
- package/lib/class/area.js +2 -1
- package/lib/class/group.js +2 -1
- package/lib/class/hole.js +2 -1
- package/lib/class/item.js +2 -1
- package/lib/class/layer.js +2 -1
- package/lib/class/line.js +2 -1
- package/lib/class/project.js +2 -1
- package/lib/class/vertex.js +2 -1
- package/lib/components/content.js +2 -1
- package/lib/components/disclaimer/disclaimer.js +2 -1
- package/lib/components/style/button.js +2 -1
- package/lib/components/style/cancel-button.js +2 -1
- package/lib/components/style/content-container.js +2 -1
- package/lib/components/style/content-title.js +2 -1
- package/lib/components/style/delete-button.js +2 -1
- package/lib/components/style/form-block.js +2 -1
- package/lib/components/style/form-color-input.js +2 -1
- package/lib/components/style/form-label.js +2 -1
- package/lib/components/style/form-number-input.js +2 -1
- package/lib/components/style/form-number-input_2.js +2 -1
- package/lib/components/style/form-select.js +2 -1
- package/lib/components/style/form-slider.js +2 -1
- package/lib/components/style/form-submit-button.js +2 -1
- package/lib/components/style/form-text-input.js +2 -1
- package/lib/components/viewer2d/area.js +2 -1
- package/lib/components/viewer2d/grids/grid-horizontal-streak.js +2 -1
- package/lib/components/viewer2d/grids/grid-streak.js +2 -1
- package/lib/components/viewer2d/grids/grid-vertical-streak.js +2 -1
- package/lib/components/viewer2d/grids/grids.js +2 -1
- package/lib/components/viewer2d/group.js +2 -1
- package/lib/components/viewer2d/item.js +2 -1
- package/lib/components/viewer2d/layer.js +2 -1
- package/lib/components/viewer2d/ruler.js +2 -1
- package/lib/components/viewer2d/rulerDist.js +2 -1
- package/lib/components/viewer2d/rulerX.js +2 -1
- package/lib/components/viewer2d/rulerY.js +2 -1
- package/lib/components/viewer2d/scene.js +2 -1
- package/lib/components/viewer2d/snap.js +2 -1
- package/lib/components/viewer2d/state.js +2 -1
- package/lib/components/viewer2d/vertex.js +2 -1
- package/lib/components/viewer2d/viewer2d.js +2 -1
- package/lib/components/viewer3d/dcm.js +2 -1
- package/lib/components/viewer3d/fbm.js +2 -1
- package/lib/components/viewer3d/front3D.js +2 -1
- package/lib/components/viewer3d/grid-creator.js +2 -1
- package/lib/components/viewer3d/grids/grid-horizontal-streak.js +2 -1
- package/lib/components/viewer3d/grids/grid-streak.js +2 -1
- package/lib/components/viewer3d/grids/grid-vertical-streak.js +2 -1
- package/lib/components/viewer3d/libs/mtl-loader.js +2 -1
- package/lib/components/viewer3d/libs/obj-loader.js +2 -1
- package/lib/components/viewer3d/lrm.js +2 -1
- package/lib/components/viewer3d/ruler-utils/itemRect.js +2 -1
- package/lib/components/viewer3d/ruler-utils/layer3D.js +2 -1
- package/lib/components/viewer3d/ruler-utils/ruler3D.js +2 -1
- package/lib/components/viewer3d/ruler-utils/state3D.js +2 -1
- package/lib/components/viewer3d/viewer3d-first-person.js +2 -1
- package/lib/components/viewer3d/viewer3d.js +2 -1
- package/lib/plugins/autosave.js +2 -1
- package/lib/plugins/console-debugger.js +2 -1
- package/lib/plugins/keyboard.js +2 -1
- package/lib/reducers/areas-reducer.js +2 -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 -1
- package/lib/reducers/vertices-reducer.js +2 -1
- package/lib/reducers/viewer2d-reducer.js +2 -1
- package/lib/reducers/viewer3d-reducer.js +2 -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 +2 -1
- package/lib/utils/name-generator.js +2 -1
- package/lib/utils/react-if.js +2 -1
- package/lib/utils/threeCSG.es6.js +2 -1
- package/package.json +2 -1
|
@@ -1,40 +1,47 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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/esm/readOnlyError"));
|
|
10
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/defineProperty"));
|
|
11
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck"));
|
|
12
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createClass"));
|
|
13
|
+
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/possibleConstructorReturn"));
|
|
14
|
+
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/getPrototypeOf"));
|
|
15
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/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); }
|
|
10
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; }
|
|
11
|
-
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) {
|
|
12
|
-
function _callSuper(t, o, e) { return o =
|
|
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)); }
|
|
13
37
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
14
|
-
|
|
15
|
-
import PropTypes from 'prop-types';
|
|
16
|
-
import ReactDOM from 'react-dom';
|
|
17
|
-
import * as Three from 'three';
|
|
18
|
-
import { checkCabinetOverlap, createBacksplash, deleteSpecifiedMeshObjects, fVLine, getDistances, parseData, updateScene, visibleTransformBox } from "./scene-creator";
|
|
19
|
-
import { disposeObject, disposeScene } from "./three-memory-cleaner";
|
|
20
|
-
import diff from 'immutablediff';
|
|
21
|
-
import * as SharedStyle from "../../shared-style";
|
|
22
|
-
import { BASE_CABINET_LAYOUTPOS, MODE_3D_VIEW, MODE_DRAGGING_ITEM_3D, MODE_DRAWING_HOLE_3D, MODE_DRAWING_ITEM_3D, MODE_ELEVATION_VIEW, MODE_IDLE_3D, MODE_ROTATING_ITEM_3D, SECONDARY_PURPLE_COLOR, TALL_CABINET_LAYOUTPOS, UNIT_CENTIMETER, WALL_CABINET_LAYOUTPOS } from "../../constants";
|
|
23
|
-
import { verticesDistance } from "../../utils/geometry";
|
|
24
|
-
import { convert } from "../../utils/convert-units-lite";
|
|
25
|
-
import { GeometryUtils } from "../../utils/export";
|
|
26
|
-
import { handleCamRect, isElevationView, isEmpty } from "../../utils/helper";
|
|
27
|
-
import { RGBELoader } from 'three/examples/jsm/loaders/RGBELoader';
|
|
28
|
-
import CameraControls from 'camera-controls';
|
|
29
|
-
import { returnReplaceableDeepSearchType } from "../viewer2d/utils";
|
|
30
|
-
import { getAllMeshes, vectorIntersectWithMesh } from "../../utils/objects-utils";
|
|
31
|
-
CameraControls.install({
|
|
38
|
+
_cameraControls["default"].install({
|
|
32
39
|
THREE: Three
|
|
33
40
|
});
|
|
34
|
-
var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
41
|
+
var Scene3DViewer = exports["default"] = /*#__PURE__*/function (_React$Component) {
|
|
35
42
|
function Scene3DViewer(props) {
|
|
36
43
|
var _this;
|
|
37
|
-
|
|
44
|
+
(0, _classCallCheck2["default"])(this, Scene3DViewer);
|
|
38
45
|
_this = _callSuper(this, Scene3DViewer, [props]);
|
|
39
46
|
_this.state = {
|
|
40
47
|
isLoading: false,
|
|
@@ -54,14 +61,14 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
54
61
|
window.__elevationRendererDownload = {};
|
|
55
62
|
}
|
|
56
63
|
switch (mode) {
|
|
57
|
-
case MODE_IDLE_3D:
|
|
64
|
+
case _constants.MODE_IDLE_3D:
|
|
58
65
|
_this.renderer = window.__threeRenderer || new Three.WebGLRenderer({
|
|
59
66
|
preserveDrawingBuffer: true,
|
|
60
67
|
alpha: true,
|
|
61
68
|
antialias: true
|
|
62
69
|
});
|
|
63
70
|
break;
|
|
64
|
-
case MODE_3D_VIEW:
|
|
71
|
+
case _constants.MODE_3D_VIEW:
|
|
65
72
|
_this.renderer = window.__threeRendererDownload || new Three.WebGLRenderer({
|
|
66
73
|
preserveDrawingBuffer: true,
|
|
67
74
|
alpha: true,
|
|
@@ -96,8 +103,8 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
96
103
|
_this.renderer.domElement.style.display = 'none';
|
|
97
104
|
return _this;
|
|
98
105
|
}
|
|
99
|
-
|
|
100
|
-
return
|
|
106
|
+
(0, _inherits2["default"])(Scene3DViewer, _React$Component);
|
|
107
|
+
return (0, _createClass2["default"])(Scene3DViewer, [{
|
|
101
108
|
key: "componentDidMount",
|
|
102
109
|
value: function componentDidMount(nextProps) {
|
|
103
110
|
var _this2 = this;
|
|
@@ -117,7 +124,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
117
124
|
var mode = state.mode,
|
|
118
125
|
scene = state.scene;
|
|
119
126
|
function setupLight(scene, inbBox) {
|
|
120
|
-
if (isElevationView(mode)) {
|
|
127
|
+
if ((0, _helper.isElevationView)(mode)) {
|
|
121
128
|
var ambilight = new Three.AmbientLight('0xffffff', 3);
|
|
122
129
|
scene.add(ambilight);
|
|
123
130
|
} else {
|
|
@@ -176,10 +183,10 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
176
183
|
var spotlightDis = 1.5 * Math.abs(inbBox.min.y - inbBox.max.y);
|
|
177
184
|
|
|
178
185
|
// check if spotlight is inside the room
|
|
179
|
-
vectorIntersectWithMesh(spot1, scene3D.getObjectByName('floor')) && addSpotLight('0xffffff', 0.8, spot1, spot1, spotlightDis);
|
|
180
|
-
vectorIntersectWithMesh(spot2, scene3D.getObjectByName('floor')) && addSpotLight('0xffffff', 0.8, spot2, spot2, spotlightDis);
|
|
181
|
-
vectorIntersectWithMesh(spot3, scene3D.getObjectByName('floor')) && addSpotLight('0xffffff', 0.8, spot3, spot3, spotlightDis);
|
|
182
|
-
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);
|
|
183
190
|
}
|
|
184
191
|
}
|
|
185
192
|
}
|
|
@@ -195,15 +202,15 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
195
202
|
|
|
196
203
|
// set loading bar
|
|
197
204
|
switch (self.props.state.mode) {
|
|
198
|
-
case MODE_ELEVATION_VIEW:
|
|
205
|
+
case _constants.MODE_ELEVATION_VIEW:
|
|
199
206
|
self.props.setIsLoadingElevation('front', true);
|
|
200
207
|
break;
|
|
201
|
-
case MODE_3D_VIEW:
|
|
208
|
+
case _constants.MODE_3D_VIEW:
|
|
202
209
|
self.props.setIsLoading3D(true);
|
|
203
210
|
break;
|
|
204
211
|
}
|
|
205
212
|
}
|
|
206
|
-
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),
|
|
207
214
|
promise = _parseData.promise,
|
|
208
215
|
planData = _parseData.planData;
|
|
209
216
|
promise.then(function () {
|
|
@@ -217,7 +224,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
217
224
|
obj.removeFromParent();
|
|
218
225
|
});
|
|
219
226
|
var bbox = new Three.Box3().setFromObject(planData.plan);
|
|
220
|
-
if (!isElevationView(state.mode)) {
|
|
227
|
+
if (!(0, _helper.isElevationView)(state.mode)) {
|
|
221
228
|
cameraControls.fitToBox(bbox);
|
|
222
229
|
}
|
|
223
230
|
setupLight(scene3D, planData.boundingBox);
|
|
@@ -276,7 +283,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
276
283
|
realVec.push(vec);
|
|
277
284
|
});
|
|
278
285
|
if (aVertices.includes(realVec[0]) && aVertices.includes(realVec[1])) {
|
|
279
|
-
height = convert(layer.ceilHeight).from(layer.unit).to(UNIT_CENTIMETER);
|
|
286
|
+
height = (0, _convertUnitsLite.convert)(layer.ceilHeight).from(layer.unit).to(_constants.UNIT_CENTIMETER);
|
|
280
287
|
// height = data.properties.getIn(['height', 'length']);
|
|
281
288
|
return 1; // break
|
|
282
289
|
}
|
|
@@ -374,11 +381,11 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
374
381
|
|
|
375
382
|
// end snap function variable///////////////////////
|
|
376
383
|
var backsplashVisible = false;
|
|
377
|
-
var holeItems = GeometryUtils.getHoleItems(layer);
|
|
384
|
+
var holeItems = _export.GeometryUtils.getHoleItems(layer);
|
|
378
385
|
var removeSnapBox = function removeSnapBox() {
|
|
379
386
|
if (snapBox != null) {
|
|
380
387
|
planData.plan.remove(snapBox);
|
|
381
|
-
disposeObject(snapBox);
|
|
388
|
+
(0, _threeMemoryCleaner.disposeObject)(snapBox);
|
|
382
389
|
snapBox = null;
|
|
383
390
|
targetObj = null;
|
|
384
391
|
snapFlag = false;
|
|
@@ -449,7 +456,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
449
456
|
x: shape2[j + 1].x,
|
|
450
457
|
y: shape2[j + 1].y
|
|
451
458
|
};
|
|
452
|
-
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);
|
|
453
460
|
if (flag) {
|
|
454
461
|
count++;
|
|
455
462
|
if (count > 1) return true;
|
|
@@ -496,20 +503,20 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
496
503
|
return vertices;
|
|
497
504
|
};
|
|
498
505
|
var prepareSnap = function prepareSnap(layer) {
|
|
499
|
-
allLines = GeometryUtils.getAllLines(layer);
|
|
500
|
-
allLineRects = GeometryUtils.buildRectFromLines(layer, allLines);
|
|
501
|
-
allItemRect = GeometryUtils.getAllItems(_this2.props.state.scene, actions.catalog, allLineRects);
|
|
502
|
-
allItemSnap = GeometryUtils.getAllItemSnap(allItemRect);
|
|
503
|
-
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);
|
|
504
511
|
allRect = allItemRect.others.concat(allLineRects);
|
|
505
|
-
allItemSnap = GeometryUtils.validateSnaps(allItemSnap, allRect);
|
|
506
|
-
allLineSnap = GeometryUtils.validateSnaps(allLineSnap, allRect);
|
|
507
|
-
allArea = GeometryUtils.getAllArea(layer);
|
|
512
|
+
allItemSnap = _export.GeometryUtils.validateSnaps(allItemSnap, allRect);
|
|
513
|
+
allLineSnap = _export.GeometryUtils.validateSnaps(allLineSnap, allRect);
|
|
514
|
+
allArea = _export.GeometryUtils.getAllArea(layer);
|
|
508
515
|
};
|
|
509
516
|
var prepareSnapSpec = function prepareSnapSpec(layer) {
|
|
510
|
-
allLines = GeometryUtils.getAllLines(layer);
|
|
511
|
-
allLineRects = GeometryUtils.buildRectFromLines(layer, allLines);
|
|
512
|
-
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);
|
|
513
520
|
// allItemSnap = GeometryUtils.getAllItemSnap(allItemRect);
|
|
514
521
|
};
|
|
515
522
|
|
|
@@ -562,7 +569,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
562
569
|
var ocatid = _item.type;
|
|
563
570
|
var ocat = catalog.elements[ocatid];
|
|
564
571
|
var olayoutpos = ocat.info.layoutpos;
|
|
565
|
-
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)) {
|
|
566
573
|
var tRot = _item.rotation;
|
|
567
574
|
var tPos = new Three.Vector2(_item.x, _item.y);
|
|
568
575
|
var tBounding = target.children[0].userData;
|
|
@@ -644,13 +651,13 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
644
651
|
var _item2 = layer.items.getIn([data.id]);
|
|
645
652
|
var ocatid = _item2.type;
|
|
646
653
|
var ocat = catalog.elements[ocatid];
|
|
647
|
-
if (!ocat) ocat = catalog.elements[returnReplaceableDeepSearchType(ocatid)];
|
|
654
|
+
if (!ocat) ocat = catalog.elements[(0, _utils.returnReplaceableDeepSearchType)(ocatid)];
|
|
648
655
|
var otherItem = {
|
|
649
656
|
item: _item2,
|
|
650
657
|
cat: ocat
|
|
651
658
|
};
|
|
652
659
|
console.log('currentItem =>', currentItem);
|
|
653
|
-
if (GeometryUtils.needSnap(currentItem, otherItem) && otherItem.cat.type != 'cabinet') {
|
|
660
|
+
if (_export.GeometryUtils.needSnap(currentItem, otherItem) && otherItem.cat.type != 'cabinet') {
|
|
654
661
|
var tRot = _item2.rotation;
|
|
655
662
|
var tPos = new Three.Vector2(_item2.x, _item2.y);
|
|
656
663
|
var tBounding = target.children[0].userData;
|
|
@@ -704,7 +711,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
704
711
|
// sort from distance
|
|
705
712
|
for (var _i5 = 0; _i5 < items.length - 1; _i5++) {
|
|
706
713
|
for (var j = _i5 + 1; j < items.length; j++) {
|
|
707
|
-
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))) {
|
|
708
715
|
var exchange = items[j];
|
|
709
716
|
items[j] = items[_i5];
|
|
710
717
|
items[_i5] = exchange;
|
|
@@ -822,7 +829,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
822
829
|
var tRot = layer.getIn(['items', target.userData.itemId]) ? layer.getIn(['items', target.userData.itemId]).rotation : 0;
|
|
823
830
|
var item = layer.getIn(['items', source.userData.itemId]);
|
|
824
831
|
var layoutType = item.layoutpos;
|
|
825
|
-
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');
|
|
826
833
|
var sBounding = source.children[0].userData;
|
|
827
834
|
var tBounding = target.children[0].userData;
|
|
828
835
|
var tPos = target.position.clone();
|
|
@@ -839,7 +846,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
839
846
|
var removeSnapBoxObj = function removeSnapBoxObj() {
|
|
840
847
|
if (snapBoxObj) {
|
|
841
848
|
planData.plan.remove(snapBoxObj);
|
|
842
|
-
disposeObject(snapBoxObj);
|
|
849
|
+
(0, _threeMemoryCleaner.disposeObject)(snapBoxObj);
|
|
843
850
|
}
|
|
844
851
|
snapFlag = false;
|
|
845
852
|
};
|
|
@@ -848,7 +855,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
848
855
|
box.material.depthTest = false;
|
|
849
856
|
box.renderOrder = 200;
|
|
850
857
|
snapBoxObj.add(box);
|
|
851
|
-
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);
|
|
852
859
|
snapBoxObj.rotation.set(source.rotation.x, source.rotation.y, source.rotation.z);
|
|
853
860
|
snapBoxObj.name = 'TransformBox';
|
|
854
861
|
planData.plan.add(snapBoxObj);
|
|
@@ -923,7 +930,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
923
930
|
return;
|
|
924
931
|
} else {
|
|
925
932
|
var _layoutType = _item3.layoutpos;
|
|
926
|
-
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');
|
|
927
934
|
var _sBounding = source.children[0].userData;
|
|
928
935
|
var _width = _sBounding.max.x - _sBounding.min.x;
|
|
929
936
|
var _height = _sBounding.max.y - _sBounding.min.y;
|
|
@@ -938,7 +945,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
938
945
|
var _removeSnapBoxObj = function _removeSnapBoxObj() {
|
|
939
946
|
if (_snapBoxObj) {
|
|
940
947
|
planData.plan.remove(_snapBoxObj);
|
|
941
|
-
disposeObject(_snapBoxObj);
|
|
948
|
+
(0, _threeMemoryCleaner.disposeObject)(_snapBoxObj);
|
|
942
949
|
}
|
|
943
950
|
snapFlag = false;
|
|
944
951
|
};
|
|
@@ -947,7 +954,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
947
954
|
_box.material.depthTest = false;
|
|
948
955
|
_box.renderOrder = 100;
|
|
949
956
|
_snapBoxObj.add(_box);
|
|
950
|
-
_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);
|
|
951
958
|
_snapBoxObj.rotation.set(source.rotation.x, source.rotation.y, source.rotation.z);
|
|
952
959
|
_snapBoxObj.name = 'TransformBox';
|
|
953
960
|
planData.plan.add(_snapBoxObj);
|
|
@@ -1084,7 +1091,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1084
1091
|
ctx.beginPath();
|
|
1085
1092
|
ctx.arc(50, 50, 45, 0, 2 * Math.PI);
|
|
1086
1093
|
ctx.stroke();
|
|
1087
|
-
ctx.strokeStyle = SECONDARY_PURPLE_COLOR;
|
|
1094
|
+
ctx.strokeStyle = _constants.SECONDARY_PURPLE_COLOR;
|
|
1088
1095
|
ctx.lineWidth = 6;
|
|
1089
1096
|
ctx.beginPath();
|
|
1090
1097
|
if (lastAngle < 15 && lastAngle > -15) {
|
|
@@ -1188,7 +1195,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1188
1195
|
var properties = allItemRect.cur.itemInfo.properties;
|
|
1189
1196
|
altitude = properties.getIn(['altitude', '_length']);
|
|
1190
1197
|
var unit = properties.getIn(['altitude', '_unit']) || 'in';
|
|
1191
|
-
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);
|
|
1192
1199
|
}
|
|
1193
1200
|
getPoint(event, altitude);
|
|
1194
1201
|
var state = _this2.props.state;
|
|
@@ -1253,7 +1260,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1253
1260
|
console.log('intersects[i] is undefined in viewer3d/viewer3d.js');
|
|
1254
1261
|
}
|
|
1255
1262
|
}
|
|
1256
|
-
if (_this2.props.state.mode == MODE_DRAWING_ITEM_3D) return;
|
|
1263
|
+
if (_this2.props.state.mode == _constants.MODE_DRAWING_ITEM_3D) return;
|
|
1257
1264
|
if (isSelected) {
|
|
1258
1265
|
!_this2.props.downloadFlag && _this2.props.setToolbar('');
|
|
1259
1266
|
if (intersects.length > 0 && !isNaN(intersects[0].distance)) {
|
|
@@ -1280,7 +1287,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1280
1287
|
var _properties = allItemRect.cur.itemInfo.properties;
|
|
1281
1288
|
alti = _properties.getIn(['altitude', '_length']);
|
|
1282
1289
|
var _unit = _properties.getIn(['altitude', '_unit']) || 'in';
|
|
1283
|
-
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);
|
|
1284
1291
|
}
|
|
1285
1292
|
getPoint({
|
|
1286
1293
|
offsetX: event.offsetX - 50,
|
|
@@ -1317,8 +1324,8 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1317
1324
|
for (_i1 = 0; _i1 < intersects.length; _i1++) {
|
|
1318
1325
|
if (selectedItem != undefined && intersects[_i1].object.parent && intersects[_i1].object.parent.parent.userData.itemId === selectedItem.userData.itemId) selectedFlag = true;
|
|
1319
1326
|
}
|
|
1320
|
-
if (selectedFlag || toolIntersects.length > 0 && !isElevationView(mode)) {
|
|
1321
|
-
cameraControls.mouseButtons.left =
|
|
1327
|
+
if (selectedFlag || toolIntersects.length > 0 && !(0, _helper.isElevationView)(mode)) {
|
|
1328
|
+
cameraControls.mouseButtons.left = _cameraControls["default"].ACTION.NONE;
|
|
1322
1329
|
selectedFlag = false;
|
|
1323
1330
|
} else {
|
|
1324
1331
|
isSelected = false;
|
|
@@ -1344,7 +1351,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1344
1351
|
var properties = allItemRect.cur.itemInfo.properties;
|
|
1345
1352
|
altitude = properties.getIn(['altitude', '_length']);
|
|
1346
1353
|
var unit = properties.getIn(['altitude', '_unit']) || 'in';
|
|
1347
|
-
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);
|
|
1348
1355
|
}
|
|
1349
1356
|
scene3D.remove(angleObj);
|
|
1350
1357
|
scene3D.remove(toolObj);
|
|
@@ -1352,7 +1359,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1352
1359
|
_this2.props.setToolbar('');
|
|
1353
1360
|
}
|
|
1354
1361
|
getPoint(event, altitude);
|
|
1355
|
-
if (_this2.props.state.mode == MODE_DRAWING_ITEM_3D) {
|
|
1362
|
+
if (_this2.props.state.mode == _constants.MODE_DRAWING_ITEM_3D) {
|
|
1356
1363
|
if (Point.x > _this2.props.state.scene.width) Point.x = _this2.props.state.width;
|
|
1357
1364
|
if (Point.y > _this2.props.state.scene.height) Point.y = _this2.props.state.height;
|
|
1358
1365
|
if (Point.x < 0) Point.x = 0;
|
|
@@ -1363,7 +1370,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1363
1370
|
removeSnapBox();
|
|
1364
1371
|
var polygon = lineRect(layer);
|
|
1365
1372
|
// if cursor is outside of room
|
|
1366
|
-
if (!GeometryUtils.ContainsPoint(polygon, Point.x, Point.y)) {
|
|
1373
|
+
if (!_export.GeometryUtils.ContainsPoint(polygon, Point.x, Point.y)) {
|
|
1367
1374
|
actions.itemsActions.endDrawingItem(_this2.props.state.scene.selectedLayer, sPoint.x, sPoint.y);
|
|
1368
1375
|
} else {
|
|
1369
1376
|
actions.itemsActions.updateDraggingItemChanged(targetPoint.x, -targetPoint.z, selectedObject.layerID, selectedObject.itemID);
|
|
@@ -1374,13 +1381,13 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1374
1381
|
bMove = false;
|
|
1375
1382
|
return;
|
|
1376
1383
|
}
|
|
1377
|
-
if (_this2.props.state.mode == MODE_DRAGGING_ITEM_3D) {
|
|
1384
|
+
if (_this2.props.state.mode == _constants.MODE_DRAGGING_ITEM_3D) {
|
|
1378
1385
|
_this2.context.itemsActions.endDraggingItem3D();
|
|
1379
1386
|
}
|
|
1380
|
-
if (_this2.props.state.mode == MODE_ROTATING_ITEM_3D) {
|
|
1387
|
+
if (_this2.props.state.mode == _constants.MODE_ROTATING_ITEM_3D) {
|
|
1381
1388
|
_this2.context.itemsActions.endRotatingItem3D(sPoint.x, sPoint.y);
|
|
1382
1389
|
}
|
|
1383
|
-
if (_this2.props.state.mode == MODE_DRAWING_HOLE_3D) {
|
|
1390
|
+
if (_this2.props.state.mode == _constants.MODE_DRAWING_HOLE_3D) {
|
|
1384
1391
|
gridPlanOrigin = gridPlane.position;
|
|
1385
1392
|
gridMatrix.copy(gridPlane.matrixWorld).invert();
|
|
1386
1393
|
camPos = camera.position;
|
|
@@ -1391,7 +1398,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1391
1398
|
}
|
|
1392
1399
|
event.preventDefault();
|
|
1393
1400
|
if (event.button === 0) {
|
|
1394
|
-
cameraControls.mouseButtons.left =
|
|
1401
|
+
cameraControls.mouseButtons.left = _cameraControls["default"].ACTION.ROTATE;
|
|
1395
1402
|
mouse.x = event.offsetX / _this2.width * 2 - 1;
|
|
1396
1403
|
mouse.y = -(event.offsetY / _this2.height) * 2 + 1;
|
|
1397
1404
|
raycaster.setFromCamera(mouse, camera);
|
|
@@ -1455,7 +1462,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1455
1462
|
}
|
|
1456
1463
|
isSelected = true;
|
|
1457
1464
|
setTimeout(function () {
|
|
1458
|
-
getDistances(layer);
|
|
1465
|
+
(0, _sceneCreator.getDistances)(layer);
|
|
1459
1466
|
var selectedItem = planData.sceneGraph.layers[selectedObject.layerID].items[selectedObject.itemID];
|
|
1460
1467
|
if (!selectedItem) return;
|
|
1461
1468
|
var selItem = _this2.props.state.scene.layers.get(selectedObject.layerID).items.get(selectedObject.itemID);
|
|
@@ -1472,10 +1479,10 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1472
1479
|
// showItemButtons(layer.getIn(['items', selectedObject.itemID]), currentObject, event, camera, this.renderer);
|
|
1473
1480
|
var pointArray = [],
|
|
1474
1481
|
cnt = 0;
|
|
1475
|
-
pointArray.push([fVLine[0].userData.distance, 90]);
|
|
1476
|
-
pointArray.push([fVLine[1].userData.distance, -90]);
|
|
1477
|
-
pointArray.push([fVLine[2].userData.distance, 180]);
|
|
1478
|
-
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]);
|
|
1479
1486
|
pointArray.forEach(function (pointElement, index) {
|
|
1480
1487
|
if (pointElement[0] == undefined) pointArray[index][0] = 0;
|
|
1481
1488
|
});
|
|
@@ -1527,13 +1534,13 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1527
1534
|
selectedObj = allItemRect.cur;
|
|
1528
1535
|
}
|
|
1529
1536
|
} else {
|
|
1530
|
-
visibleTransformBox(false);
|
|
1537
|
+
(0, _sceneCreator.visibleTransformBox)(false);
|
|
1531
1538
|
var alti = 0;
|
|
1532
1539
|
if (allItemRect && allItemRect.cur && allItemRect.cur.itemInfo !== undefined) {
|
|
1533
1540
|
var _properties2 = allItemRect.cur.itemInfo.properties;
|
|
1534
1541
|
alti = _properties2.getIn(['altitude', '_length']);
|
|
1535
1542
|
var _unit2 = _properties2.getIn(['altitude', '_unit']) || 'in';
|
|
1536
|
-
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);
|
|
1537
1544
|
}
|
|
1538
1545
|
getPoint(event, alti);
|
|
1539
1546
|
if (bRotate) {
|
|
@@ -1606,9 +1613,9 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1606
1613
|
var properties = allItemRect.cur.itemInfo.properties;
|
|
1607
1614
|
altitude = properties.getIn(['altitude', '_length']);
|
|
1608
1615
|
var unit = properties.getIn(['altitude', '_unit']) || 'in';
|
|
1609
|
-
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);
|
|
1610
1617
|
}
|
|
1611
|
-
if (_this2.props.state.mode === MODE_DRAWING_HOLE_3D) {
|
|
1618
|
+
if (_this2.props.state.mode === _constants.MODE_DRAWING_HOLE_3D) {
|
|
1612
1619
|
gridPlanOrigin = gridPlane.position;
|
|
1613
1620
|
gridMatrix.copy(gridPlane.matrixWorld).invert();
|
|
1614
1621
|
camPos = camera.position;
|
|
@@ -1620,7 +1627,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1620
1627
|
} else {
|
|
1621
1628
|
var layerID = _this2.props.state.scene.selectedLayer;
|
|
1622
1629
|
var holeID = _this2.props.state.drawingSupport.get('currentID');
|
|
1623
|
-
deleteSpecifiedMeshObjects('WarningBox' + holeID);
|
|
1630
|
+
(0, _sceneCreator.deleteSpecifiedMeshObjects)('WarningBox' + holeID);
|
|
1624
1631
|
prepareSnap(layer);
|
|
1625
1632
|
|
|
1626
1633
|
// let {nx, ny, rot} = GeometryUtils.calcSnap(allItemRect, allItemSnap, allLineRects, allLineSnap, allRect, Point.x, Point.y, allArea);
|
|
@@ -1630,7 +1637,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1630
1637
|
sPoint.set(nx, ny);
|
|
1631
1638
|
}
|
|
1632
1639
|
}
|
|
1633
|
-
if (_this2.props.state.mode === MODE_DRAWING_ITEM_3D) {
|
|
1640
|
+
if (_this2.props.state.mode === _constants.MODE_DRAWING_ITEM_3D) {
|
|
1634
1641
|
// We need to set cam position since when MODE_DRAWING_ITEM_3D mouse down event
|
|
1635
1642
|
// is not emited so cam position is not valid
|
|
1636
1643
|
gridPlanOrigin = gridPlane.position;
|
|
@@ -1644,7 +1651,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1644
1651
|
};
|
|
1645
1652
|
var _layer = _this2.props.state.scene.getIn(['layers', selectedObject.layerID]);
|
|
1646
1653
|
var polygon = lineRect(_layer);
|
|
1647
|
-
var isCursorInArea = GeometryUtils.ContainsPoint(polygon, Point.x, Point.y);
|
|
1654
|
+
var isCursorInArea = _export.GeometryUtils.ContainsPoint(polygon, Point.x, Point.y);
|
|
1648
1655
|
var _drawingSupport = _this2.props.state.drawingSupport;
|
|
1649
1656
|
if (!_drawingSupport.has('currentID')) {
|
|
1650
1657
|
var initialX = Point.x,
|
|
@@ -1663,7 +1670,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1663
1670
|
point = [];
|
|
1664
1671
|
}
|
|
1665
1672
|
});
|
|
1666
|
-
var centroid = GeometryUtils.getCentroidOfPolygon(points);
|
|
1673
|
+
var centroid = _export.GeometryUtils.getCentroidOfPolygon(points);
|
|
1667
1674
|
initialX = centroid[0];
|
|
1668
1675
|
initialY = centroid[1];
|
|
1669
1676
|
}
|
|
@@ -1675,8 +1682,8 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1675
1682
|
var mX = Point.x - sPoint.x;
|
|
1676
1683
|
var mY = Point.y - sPoint.y;
|
|
1677
1684
|
var item3D = planData.sceneGraph.layers[selectedObject.layerID].items[selectedObject.itemID];
|
|
1678
|
-
deleteSpecifiedMeshObjects('TransformBox');
|
|
1679
|
-
deleteSpecifiedMeshObjects('WarningBox' + itemID);
|
|
1685
|
+
(0, _sceneCreator.deleteSpecifiedMeshObjects)('TransformBox');
|
|
1686
|
+
(0, _sceneCreator.deleteSpecifiedMeshObjects)('WarningBox' + itemID);
|
|
1680
1687
|
var item = _layer.items.getIn([selectedObject.itemID]);
|
|
1681
1688
|
if (item.counterTop.uri == '') item.counterTop.uri = _layer.counterTop.uri;
|
|
1682
1689
|
var sRot = item.rotation;
|
|
@@ -1688,7 +1695,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1688
1695
|
var sdepth = sBounding.max.z - sBounding.min.z;
|
|
1689
1696
|
var sVertices = _this2.getRectPoints(swidth, sdepth, tPos.clone(), sRot % 360 / 180 * Math.PI);
|
|
1690
1697
|
prepareSnap(_layer);
|
|
1691
|
-
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),
|
|
1692
1699
|
_nx = _GeometryUtils$calcSn.nx,
|
|
1693
1700
|
_ny = _GeometryUtils$calcSn.ny,
|
|
1694
1701
|
rot = _GeometryUtils$calcSn.rot;
|
|
@@ -1702,9 +1709,9 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1702
1709
|
//return;
|
|
1703
1710
|
}
|
|
1704
1711
|
if (polygon.length > 0) {
|
|
1705
|
-
var PolygonSect = GeometryUtils.ContainsPoint(polygon, _nx, _ny);
|
|
1712
|
+
var PolygonSect = _export.GeometryUtils.ContainsPoint(polygon, _nx, _ny);
|
|
1706
1713
|
if (!PolygonSect) {
|
|
1707
|
-
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),
|
|
1708
1715
|
cx = _GeometryUtils$calcCr.cx,
|
|
1709
1716
|
cy = _GeometryUtils$calcCr.cy,
|
|
1710
1717
|
crot = _GeometryUtils$calcCr.crot;
|
|
@@ -1714,19 +1721,19 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1714
1721
|
}
|
|
1715
1722
|
}
|
|
1716
1723
|
if (polygon.length > 0) {
|
|
1717
|
-
var isSnapInArea = GeometryUtils.ContainsPoint(polygon, _nx, _ny);
|
|
1724
|
+
var isSnapInArea = _export.GeometryUtils.ContainsPoint(polygon, _nx, _ny);
|
|
1718
1725
|
if (!isSnapInArea) return;
|
|
1719
1726
|
}
|
|
1720
1727
|
actions.itemsActions.updateDraggingItemChanged(_nx, _ny, selectedObject.layerID, selectedObject.itemID);
|
|
1721
1728
|
actions.itemsActions.updateRotatingItemChanged(rot, selectedObject.layerID, selectedObject.itemID);
|
|
1722
1729
|
sPoint.set(_nx, _ny);
|
|
1723
|
-
getDistances(_layer);
|
|
1730
|
+
(0, _sceneCreator.getDistances)(_layer);
|
|
1724
1731
|
var pointArray = [],
|
|
1725
1732
|
cnt = 0;
|
|
1726
|
-
pointArray.push([fVLine[0].userData.distance, 90]);
|
|
1727
|
-
pointArray.push([fVLine[1].userData.distance, -90]);
|
|
1728
|
-
pointArray.push([fVLine[2].userData.distance, 180]);
|
|
1729
|
-
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]);
|
|
1730
1737
|
pointArray.forEach(function (pointElement, index) {
|
|
1731
1738
|
if (pointElement[0] == undefined) pointArray[index][0] = 0;
|
|
1732
1739
|
});
|
|
@@ -1738,8 +1745,8 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1738
1745
|
pointArray[1][0] = 100;
|
|
1739
1746
|
}
|
|
1740
1747
|
actions.itemsActions.storeDistArray(_layer.id, item.id, pointArray);
|
|
1741
|
-
var minDis = fVLine[0].userData.distance;
|
|
1742
|
-
var snapObj = fVLine[0];
|
|
1748
|
+
var minDis = _sceneCreator.fVLine[0].userData.distance;
|
|
1749
|
+
var snapObj = _sceneCreator.fVLine[0];
|
|
1743
1750
|
var iPos = item3D.position.clone();
|
|
1744
1751
|
var snapDis = Math.sqrt((iPos.x - targetPoint.x) * (iPos.x - targetPoint.x) + (iPos.z - targetPoint.z) * (iPos.z - targetPoint.z));
|
|
1745
1752
|
if (snapDis >= 100 && snapObj != null) {
|
|
@@ -1747,10 +1754,10 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1747
1754
|
backsplashVisible = false;
|
|
1748
1755
|
//console.log('1 snap no');
|
|
1749
1756
|
}
|
|
1750
|
-
for (var _i11 = 1; _i11 < fVLine.length; _i11++) {
|
|
1751
|
-
if (minDis > fVLine[_i11].userData.distance) {
|
|
1752
|
-
minDis = fVLine[_i11].userData.distance;
|
|
1753
|
-
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];
|
|
1754
1761
|
}
|
|
1755
1762
|
}
|
|
1756
1763
|
if (snapBox == null) {
|
|
@@ -1761,14 +1768,14 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1761
1768
|
_this2.snap(snapObj, _layer);
|
|
1762
1769
|
snapFlag = true;
|
|
1763
1770
|
//console.log('1 snap Yes')
|
|
1764
|
-
getDistances(_layer, true);
|
|
1771
|
+
(0, _sceneCreator.getDistances)(_layer, true);
|
|
1765
1772
|
var _i12 = 0;
|
|
1766
|
-
for (_i12 = 0; _i12 < fVLine.length; _i12++) {
|
|
1767
|
-
if (fVLine[_i12].userData.distance < snapDelta) {
|
|
1773
|
+
for (_i12 = 0; _i12 < _sceneCreator.fVLine.length; _i12++) {
|
|
1774
|
+
if (_sceneCreator.fVLine[_i12].userData.distance < snapDelta) {
|
|
1768
1775
|
break;
|
|
1769
1776
|
}
|
|
1770
1777
|
}
|
|
1771
|
-
if (_i12 === fVLine.length) backsplashVisible = false;else backsplashVisible = true;
|
|
1778
|
+
if (_i12 === _sceneCreator.fVLine.length) backsplashVisible = false;else backsplashVisible = true;
|
|
1772
1779
|
}
|
|
1773
1780
|
actions.itemsActions.setBacksplashVisible(selectedObject.itemID, backsplashVisible);
|
|
1774
1781
|
}
|
|
@@ -1781,8 +1788,8 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1781
1788
|
var orginRot = _this2.props.state.rotatingSupport.get('originRotation');
|
|
1782
1789
|
angleTexture.image = createAngleObject((orginRot < 0 ? 360 - orginRot : orginRot) - _item4.rotation);
|
|
1783
1790
|
angleTexture.needsUpdate = true;
|
|
1784
|
-
deleteSpecifiedMeshObjects('WarningBox' + selectedObject.itemID);
|
|
1785
|
-
deleteSpecifiedMeshObjects('backsplash' + selectedObject.itemID);
|
|
1791
|
+
(0, _sceneCreator.deleteSpecifiedMeshObjects)('WarningBox' + selectedObject.itemID);
|
|
1792
|
+
(0, _sceneCreator.deleteSpecifiedMeshObjects)('backsplash' + selectedObject.itemID);
|
|
1786
1793
|
actions.sceneActions.updateMovingState(false);
|
|
1787
1794
|
}
|
|
1788
1795
|
if (bMoveUP) {
|
|
@@ -1800,7 +1807,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1800
1807
|
sPoint.set(Point.x, Point.y);
|
|
1801
1808
|
} else {
|
|
1802
1809
|
var _holeID = _this2.props.state.draggingSupport.get('currentID');
|
|
1803
|
-
deleteSpecifiedMeshObjects('WarningBox' + _holeID);
|
|
1810
|
+
(0, _sceneCreator.deleteSpecifiedMeshObjects)('WarningBox' + _holeID);
|
|
1804
1811
|
var _nx2 = Point.x;
|
|
1805
1812
|
var _ny2 = Point.y;
|
|
1806
1813
|
actions.holesActions.updateDraggingHole(_nx2, _ny2);
|
|
@@ -1815,8 +1822,8 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1815
1822
|
var _sRot2 = _item5.rotation;
|
|
1816
1823
|
var _mX = Point.x - sPoint.x;
|
|
1817
1824
|
var _mY = Point.y - sPoint.y;
|
|
1818
|
-
deleteSpecifiedMeshObjects('WarningBox' + selectedObject.itemID);
|
|
1819
|
-
deleteSpecifiedMeshObjects('backsplash' + selectedObject.itemID);
|
|
1825
|
+
(0, _sceneCreator.deleteSpecifiedMeshObjects)('WarningBox' + selectedObject.itemID);
|
|
1826
|
+
(0, _sceneCreator.deleteSpecifiedMeshObjects)('backsplash' + selectedObject.itemID);
|
|
1820
1827
|
prepareSnap(_layer3);
|
|
1821
1828
|
getPoint(event, altitude);
|
|
1822
1829
|
var _originPos = _item3D2.position.clone();
|
|
@@ -1825,7 +1832,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1825
1832
|
var _swidth = _sBounding2.max.x - _sBounding2.min.x;
|
|
1826
1833
|
var _sdepth = _sBounding2.max.z - _sBounding2.min.z;
|
|
1827
1834
|
var _sVertices = _this2.getRectPoints(_swidth, _sdepth, _tPos4.clone(), _sRot2 % 360 / 180 * Math.PI);
|
|
1828
|
-
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),
|
|
1829
1836
|
_nx3 = _GeometryUtils$calcSn2.nx,
|
|
1830
1837
|
_ny3 = _GeometryUtils$calcSn2.ny,
|
|
1831
1838
|
_rot = _GeometryUtils$calcSn2.rot;
|
|
@@ -1840,9 +1847,9 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1840
1847
|
}
|
|
1841
1848
|
var polygonPoint = lineRect(_layer3);
|
|
1842
1849
|
if (polygonPoint.length > 0) {
|
|
1843
|
-
var _PolygonSect = GeometryUtils.ContainsPoint(polygonPoint, _nx3, _ny3);
|
|
1850
|
+
var _PolygonSect = _export.GeometryUtils.ContainsPoint(polygonPoint, _nx3, _ny3);
|
|
1844
1851
|
if (!_PolygonSect) {
|
|
1845
|
-
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),
|
|
1846
1853
|
_cx3 = _GeometryUtils$calcCr2.cx,
|
|
1847
1854
|
_cy = _GeometryUtils$calcCr2.cy,
|
|
1848
1855
|
_crot = _GeometryUtils$calcCr2.crot;
|
|
@@ -1853,19 +1860,19 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1853
1860
|
}
|
|
1854
1861
|
var _polygon = lineRect(_layer3);
|
|
1855
1862
|
if (_polygon.length > 0) {
|
|
1856
|
-
var Sect = GeometryUtils.ContainsPoint(_polygon, _nx3, _ny3);
|
|
1863
|
+
var Sect = _export.GeometryUtils.ContainsPoint(_polygon, _nx3, _ny3);
|
|
1857
1864
|
if (!Sect) return;
|
|
1858
1865
|
}
|
|
1859
1866
|
actions.itemsActions.updateDraggingItemChanged(_nx3, _ny3, selectedObject.layerID, selectedObject.itemID);
|
|
1860
1867
|
actions.itemsActions.updateRotatingItemChanged(_rot, selectedObject.layerID, selectedObject.itemID);
|
|
1861
1868
|
sPoint.set(_nx3, _ny3);
|
|
1862
|
-
getDistances(_layer3);
|
|
1869
|
+
(0, _sceneCreator.getDistances)(_layer3);
|
|
1863
1870
|
var _pointArray = [],
|
|
1864
1871
|
_cnt = 0;
|
|
1865
|
-
_pointArray.push([fVLine[0].userData.distance, 90]);
|
|
1866
|
-
_pointArray.push([fVLine[1].userData.distance, -90]);
|
|
1867
|
-
_pointArray.push([fVLine[2].userData.distance, 180]);
|
|
1868
|
-
_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]);
|
|
1869
1876
|
_pointArray.forEach(function (pointElement, index) {
|
|
1870
1877
|
if (pointElement[0] == undefined) _pointArray[index][0] = 0;
|
|
1871
1878
|
});
|
|
@@ -1877,8 +1884,8 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1877
1884
|
_pointArray[1][0] = 100;
|
|
1878
1885
|
}
|
|
1879
1886
|
actions.itemsActions.storeDistArray(_layer3.id, _item5.id, _pointArray);
|
|
1880
|
-
var _minDis = fVLine[0].userData.distance;
|
|
1881
|
-
var _snapObj = fVLine[0];
|
|
1887
|
+
var _minDis = _sceneCreator.fVLine[0].userData.distance;
|
|
1888
|
+
var _snapObj = _sceneCreator.fVLine[0];
|
|
1882
1889
|
var _iPos = _item3D2.position.clone();
|
|
1883
1890
|
var _snapDis = Math.sqrt((_iPos.x - targetPoint.x) * (_iPos.x - targetPoint.x) + (_iPos.z - targetPoint.z) * (_iPos.z - targetPoint.z));
|
|
1884
1891
|
if (_snapDis >= 100 && _snapObj != null) {
|
|
@@ -1886,10 +1893,10 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1886
1893
|
backsplashVisible = false;
|
|
1887
1894
|
//console.log('1 snap no');
|
|
1888
1895
|
}
|
|
1889
|
-
for (var _i13 = 1; _i13 < fVLine.length; _i13++) {
|
|
1890
|
-
if (_minDis > fVLine[_i13].userData.distance) {
|
|
1891
|
-
_minDis = fVLine[_i13].userData.distance;
|
|
1892
|
-
_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];
|
|
1893
1900
|
}
|
|
1894
1901
|
}
|
|
1895
1902
|
if (snapBox == null) {
|
|
@@ -1900,14 +1907,14 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1900
1907
|
_this2.snap(_snapObj, _layer3);
|
|
1901
1908
|
snapFlag = true;
|
|
1902
1909
|
//console.log('1 snap Yes')
|
|
1903
|
-
getDistances(_layer3, true);
|
|
1910
|
+
(0, _sceneCreator.getDistances)(_layer3, true);
|
|
1904
1911
|
var _i14 = 0;
|
|
1905
|
-
for (_i14 = 0; _i14 < fVLine.length; _i14++) {
|
|
1906
|
-
if (fVLine[_i14].userData.distance < snapDelta) {
|
|
1912
|
+
for (_i14 = 0; _i14 < _sceneCreator.fVLine.length; _i14++) {
|
|
1913
|
+
if (_sceneCreator.fVLine[_i14].userData.distance < snapDelta) {
|
|
1907
1914
|
break;
|
|
1908
1915
|
}
|
|
1909
1916
|
}
|
|
1910
|
-
if (_i14 === fVLine.length) backsplashVisible = false;else backsplashVisible = true;
|
|
1917
|
+
if (_i14 === _sceneCreator.fVLine.length) backsplashVisible = false;else backsplashVisible = true;
|
|
1911
1918
|
}
|
|
1912
1919
|
actions.itemsActions.setBacksplashVisible(selectedObject.itemID, backsplashVisible);
|
|
1913
1920
|
}
|
|
@@ -1920,7 +1927,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1920
1927
|
raycaster.setFromCamera(curPos, camera);
|
|
1921
1928
|
rayDirection = raycaster.ray.direction;
|
|
1922
1929
|
rayDirection = rayDirection.normalize();
|
|
1923
|
-
var meshes = getAllMeshes(toIntersect);
|
|
1930
|
+
var meshes = (0, _objectsUtils.getAllMeshes)(toIntersect);
|
|
1924
1931
|
var intersects = raycaster.intersectObjects(meshes, true);
|
|
1925
1932
|
var _i15;
|
|
1926
1933
|
if (intersects.length > 0 && !isNaN(intersects[0].distance)) {
|
|
@@ -1955,7 +1962,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
1955
1962
|
document.getElementById('warning_box_2d').style.display = 'none';
|
|
1956
1963
|
};
|
|
1957
1964
|
this.onkeydown = function (event) {
|
|
1958
|
-
if (_this2.props.keyDownEnable && !isElevationView(state.mode)) {
|
|
1965
|
+
if (_this2.props.keyDownEnable && !(0, _helper.isElevationView)(state.mode)) {
|
|
1959
1966
|
switch (event.keyCode) {
|
|
1960
1967
|
case 27:
|
|
1961
1968
|
// escape key
|
|
@@ -2024,7 +2031,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
2024
2031
|
}
|
|
2025
2032
|
|
|
2026
2033
|
// Add the output of the renderer to the html element
|
|
2027
|
-
var canvasWrapper =
|
|
2034
|
+
var canvasWrapper = _reactDom["default"].findDOMNode(this.refs.canvasWrapper);
|
|
2028
2035
|
canvasWrapper && canvasWrapper.appendChild(this.renderer.domElement);
|
|
2029
2036
|
|
|
2030
2037
|
//
|
|
@@ -2056,17 +2063,17 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
2056
2063
|
function init() {
|
|
2057
2064
|
clock = new Three.Clock();
|
|
2058
2065
|
scene3D = new Three.Scene();
|
|
2059
|
-
if (isElevationView(state.mode)) scene3D.background = new Three.Color(0xffffff);
|
|
2066
|
+
if ((0, _helper.isElevationView)(state.mode)) scene3D.background = new Three.Color(0xffffff);
|
|
2060
2067
|
// change color about v1: 0x8791AB, v2: 0xC2C2C2, v3: 0xC3CADC
|
|
2061
2068
|
else scene3D.background = new Three.Color(0xc3cadc); // change color about v1: 0x8791AB, v2: 0xC2C2C2, v3: 0xC3CADC
|
|
2062
2069
|
// scene3D.fog = new Three.Fog(0xC3CADC, 2000, 3500);
|
|
2063
2070
|
window.scene3D = scene3D;
|
|
2064
2071
|
// Camera
|
|
2065
|
-
if (isElevationView(state.mode)) {
|
|
2072
|
+
if ((0, _helper.isElevationView)(state.mode)) {
|
|
2066
2073
|
// In elevation view, set Orthographic camera's position, angle and rotation about selected line
|
|
2067
2074
|
var layers = scene.layers;
|
|
2068
2075
|
var selectedLayer = layers.get(scene.selectedLayer);
|
|
2069
|
-
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);
|
|
2070
2077
|
var lines = [];
|
|
2071
2078
|
var selectedLine = selectedLayer.lines.get(selectedLayer.selected.lines.toJS()[0]);
|
|
2072
2079
|
var vertex0 = selectedLayer.vertices.get(selectedLine.vertices.get(0));
|
|
@@ -2075,7 +2082,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
2075
2082
|
y1 = vertex0.y;
|
|
2076
2083
|
var x2 = vertex1.x,
|
|
2077
2084
|
y2 = vertex1.y;
|
|
2078
|
-
if (GeometryUtils.compareVertices(vertex0, vertex1) >= 0 && vertex0.x !== vertex1.x) {
|
|
2085
|
+
if (_export.GeometryUtils.compareVertices(vertex0, vertex1) >= 0 && vertex0.x !== vertex1.x) {
|
|
2079
2086
|
x1 = vertex1.x;
|
|
2080
2087
|
y1 = vertex1.y;
|
|
2081
2088
|
x2 = vertex0.x;
|
|
@@ -2097,11 +2104,11 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
2097
2104
|
lines.push(data);
|
|
2098
2105
|
}
|
|
2099
2106
|
});
|
|
2100
|
-
var lineLength = GeometryUtils.pointsDistance(x1, y1, x2, y2);
|
|
2107
|
+
var lineLength = _export.GeometryUtils.pointsDistance(x1, y1, x2, y2);
|
|
2101
2108
|
self.setState({
|
|
2102
2109
|
lineLength: lineLength
|
|
2103
2110
|
});
|
|
2104
|
-
var cameraRect = handleCamRect(self.width, self.height, ceilHeight, lineLength);
|
|
2111
|
+
var cameraRect = (0, _helper.handleCamRect)(self.width, self.height, ceilHeight, lineLength);
|
|
2105
2112
|
camera = new Three.OrthographicCamera(-cameraRect.width / 2, cameraRect.width / 2, cameraRect.height / 2, -cameraRect.height / 2, 1, 1000);
|
|
2106
2113
|
var angle = Math.atan((y1 - y2) / (x1 - x2));
|
|
2107
2114
|
var r = 300;
|
|
@@ -2122,15 +2129,15 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
2122
2129
|
}
|
|
2123
2130
|
camera.layers.enable(1);
|
|
2124
2131
|
function loadENV() {
|
|
2125
|
-
new RGBELoader().load('/assets/brown_photostudio_02_1k.hdr', function (texture) {
|
|
2132
|
+
new _RGBELoader.RGBELoader().load('/assets/brown_photostudio_02_1k.hdr', function (texture) {
|
|
2126
2133
|
texture.mapping = Three.EquirectangularReflectionMapping;
|
|
2127
2134
|
scene3D.environment = texture;
|
|
2128
2135
|
texture.dispose();
|
|
2129
2136
|
});
|
|
2130
2137
|
}
|
|
2131
2138
|
// Camera Controls
|
|
2132
|
-
if (!isElevationView(state.mode)) {
|
|
2133
|
-
cameraControls = new
|
|
2139
|
+
if (!(0, _helper.isElevationView)(state.mode)) {
|
|
2140
|
+
cameraControls = new _cameraControls["default"](camera, self.renderer.domElement);
|
|
2134
2141
|
cameraControls.dollyToCursor = true;
|
|
2135
2142
|
cameraControls.infinityDolly = true;
|
|
2136
2143
|
cameraControls.minDistance = 50;
|
|
@@ -2141,7 +2148,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
2141
2148
|
scene3D.add(planData.plan);
|
|
2142
2149
|
scene3D.add(planData.grid);
|
|
2143
2150
|
scene3D.add(camera);
|
|
2144
|
-
if (isElevationView(state.mode)) {
|
|
2151
|
+
if ((0, _helper.isElevationView)(state.mode)) {
|
|
2145
2152
|
planData.cam.add(camera);
|
|
2146
2153
|
scene3D.add(planData.cam);
|
|
2147
2154
|
} else {
|
|
@@ -2156,7 +2163,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
2156
2163
|
}
|
|
2157
2164
|
function render() {
|
|
2158
2165
|
var delta = clock.getDelta(); // Get time delta for smooth updates
|
|
2159
|
-
if (!isElevationView(state.mode)) cameraControls.update(delta);
|
|
2166
|
+
if (!(0, _helper.isElevationView)(state.mode)) cameraControls.update(delta);
|
|
2160
2167
|
for (var _i16 = 0; _i16 < lights.length; _i16++) {
|
|
2161
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);
|
|
2162
2169
|
lights[_i16].target.position.set(planData.plan.position.x + lights[_i16].x, planData.plan.position.y, planData.plan.position.z - lights[_i16].y);
|
|
@@ -2203,7 +2210,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
2203
2210
|
var indexAttribute = line.geometry.getIndex();
|
|
2204
2211
|
var firstFaceIndices = undefined;
|
|
2205
2212
|
if (indexAttribute && indexAttribute.length > 0) {
|
|
2206
|
-
[indexAttribute.getX(0), indexAttribute.getX(1), indexAttribute.getX(2)],
|
|
2213
|
+
[indexAttribute.getX(0), indexAttribute.getX(1), indexAttribute.getX(2)], (0, _readOnlyError2["default"])("firstFaceIndices");
|
|
2207
2214
|
}
|
|
2208
2215
|
if (firstFaceIndices == undefined) return;
|
|
2209
2216
|
// normal vector of the line
|
|
@@ -2252,7 +2259,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
2252
2259
|
isLoading: false,
|
|
2253
2260
|
waitForRender: 0
|
|
2254
2261
|
});
|
|
2255
|
-
if (isElevationView(self.props.state.mode)) {
|
|
2262
|
+
if ((0, _helper.isElevationView)(self.props.state.mode)) {
|
|
2256
2263
|
setTimeout(function () {
|
|
2257
2264
|
self.props.setIsLoadingElevation('front', false);
|
|
2258
2265
|
}, 100);
|
|
@@ -2276,14 +2283,14 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
2276
2283
|
key: "componentWillUnmount",
|
|
2277
2284
|
value: function componentWillUnmount() {
|
|
2278
2285
|
cancelAnimationFrame(this.renderingID);
|
|
2279
|
-
if (!isElevationView(this.props.state.mode)) {
|
|
2286
|
+
if (!(0, _helper.isElevationView)(this.props.state.mode)) {
|
|
2280
2287
|
if (this.cameraControls !== undefined) this.cameraControls.dispose();
|
|
2281
2288
|
}
|
|
2282
2289
|
if (!this.props.downloadFlag) {
|
|
2283
2290
|
this.renderer.domElement.removeEventListener('mousedown', this.mouseDownEvent);
|
|
2284
2291
|
this.renderer.domElement.removeEventListener('mouseup', this.mouseUpEvent);
|
|
2285
2292
|
}
|
|
2286
|
-
disposeScene(this.scene3D);
|
|
2293
|
+
(0, _threeMemoryCleaner.disposeScene)(this.scene3D);
|
|
2287
2294
|
this.scene3D.remove(this.planData.plan);
|
|
2288
2295
|
this.scene3D.remove(this.planData.grid);
|
|
2289
2296
|
this.scene3D = null;
|
|
@@ -2296,11 +2303,11 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
2296
2303
|
key: "componentWillReceiveProps",
|
|
2297
2304
|
value: function componentWillReceiveProps(nextProps) {
|
|
2298
2305
|
var _this4 = this;
|
|
2299
|
-
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;
|
|
2300
2307
|
var width = nextProps.width,
|
|
2301
2308
|
height = nextProps.height;
|
|
2302
2309
|
var selectedLayer = nextProps.state.getIn(['scene', 'layers', nextProps.state.scene.selectedLayer]);
|
|
2303
|
-
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);
|
|
2304
2311
|
var actions = {
|
|
2305
2312
|
areaActions: this.context.areaActions,
|
|
2306
2313
|
holesActions: this.context.holesActions,
|
|
@@ -2322,9 +2329,9 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
2322
2329
|
|
|
2323
2330
|
// handle camera setting
|
|
2324
2331
|
switch (this.props.state.mode) {
|
|
2325
|
-
case MODE_ELEVATION_VIEW:
|
|
2332
|
+
case _constants.MODE_ELEVATION_VIEW:
|
|
2326
2333
|
// when Elevation mode (camera: Orthographic)
|
|
2327
|
-
var cameraRect = handleCamRect(width, height, ceilHeight, this.state.lineLength);
|
|
2334
|
+
var cameraRect = (0, _helper.handleCamRect)(width, height, ceilHeight, this.state.lineLength);
|
|
2328
2335
|
// camera size
|
|
2329
2336
|
this.camera.left = -cameraRect.width / 2;
|
|
2330
2337
|
this.camera.right = cameraRect.width / 2;
|
|
@@ -2333,7 +2340,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
2333
2340
|
//camera position
|
|
2334
2341
|
this.camera.position.y = ceilHeight / 2;
|
|
2335
2342
|
break;
|
|
2336
|
-
case MODE_3D_VIEW:
|
|
2343
|
+
case _constants.MODE_3D_VIEW:
|
|
2337
2344
|
// when 3D mode (camera: Perspective)
|
|
2338
2345
|
this.camera.aspect = width / height;
|
|
2339
2346
|
break;
|
|
@@ -2343,34 +2350,34 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
2343
2350
|
var layer = data.getIn(['layers', data.selectedLayer]);
|
|
2344
2351
|
var self = this;
|
|
2345
2352
|
function implementBacksplash() {
|
|
2346
|
-
if (isElevationView(self.props.state.mode)) return; // apply backsplash when just 3D_mode, not elevation_mode
|
|
2347
|
-
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);
|
|
2348
2355
|
var i,
|
|
2349
2356
|
items = [];
|
|
2350
2357
|
for (i = 0; i < allItems.others.length; i++) items.push(allItems.others[i]);
|
|
2351
2358
|
if (allItems.cur) items.push(allItems.cur);
|
|
2352
2359
|
for (i = 0; i < items.length; i++) {
|
|
2353
|
-
var calcRect = GeometryUtils.getCalcRectFromItem3D(items[i]);
|
|
2354
|
-
var visible = GeometryUtils.isSnappedLine(calcRect, allLineRects);
|
|
2360
|
+
var calcRect = _export.GeometryUtils.getCalcRectFromItem3D(items[i]);
|
|
2361
|
+
var visible = _export.GeometryUtils.isSnappedLine(calcRect, allLineRects);
|
|
2355
2362
|
actions.itemsActions.setBacksplashVisible(items[i].itemInfo.id, visible);
|
|
2356
|
-
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);
|
|
2357
2364
|
}
|
|
2358
2365
|
}
|
|
2359
2366
|
function implementWarningBox() {
|
|
2360
|
-
var holeItems = GeometryUtils.getHoleItems(layer);
|
|
2367
|
+
var holeItems = _export.GeometryUtils.getHoleItems(layer);
|
|
2361
2368
|
var i,
|
|
2362
2369
|
items = [];
|
|
2363
2370
|
for (i = 0; i < allItemRect.others.length; i++) items.push(allItemRect.others[i]);
|
|
2364
2371
|
if (allItemRect.cur) items.push(allItemRect.cur);
|
|
2365
|
-
for (i = 0; i < items.length; i++) checkCabinetOverlap({
|
|
2372
|
+
for (i = 0; i < items.length; i++) (0, _sceneCreator.checkCabinetOverlap)({
|
|
2366
2373
|
x: items[i].pos.x,
|
|
2367
2374
|
y: items[i].pos.y
|
|
2368
2375
|
}, items[i], holeItems, planData);
|
|
2369
2376
|
}
|
|
2370
2377
|
var prepareSnapSpec = function prepareSnapSpec(layer) {
|
|
2371
|
-
allLines = GeometryUtils.getAllLines(layer);
|
|
2372
|
-
allLineRects = GeometryUtils.buildRectFromLines(layer, allLines);
|
|
2373
|
-
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]);
|
|
2374
2381
|
};
|
|
2375
2382
|
var layer1 = this.props.state.scene.getIn(['layers', data.selectedLayer]);
|
|
2376
2383
|
if (this.state.showflag) {
|
|
@@ -2382,7 +2389,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
2382
2389
|
});
|
|
2383
2390
|
}
|
|
2384
2391
|
if (nextProps.state.scene !== this.props.state.scene || nextProps.state.doorStyle && nextProps.state.doorStyle.get('name') !== this.props.state.doorStyle.get('name')) {
|
|
2385
|
-
var changedValues =
|
|
2392
|
+
var changedValues = (0, _immutablediff["default"])(this.props.state.scene, nextProps.state.scene);
|
|
2386
2393
|
prepareSnapSpec(layer);
|
|
2387
2394
|
if (nextProps.state.doorStyle && nextProps.state.doorStyle.get('name') === this.props.state.doorStyle.get('name')) {
|
|
2388
2395
|
self.setState({
|
|
@@ -2393,10 +2400,10 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
2393
2400
|
waitForRender: 0
|
|
2394
2401
|
});
|
|
2395
2402
|
switch (self.props.state.mode) {
|
|
2396
|
-
case MODE_ELEVATION_VIEW:
|
|
2403
|
+
case _constants.MODE_ELEVATION_VIEW:
|
|
2397
2404
|
self.props.setIsLoadingElevation('front', true);
|
|
2398
2405
|
break;
|
|
2399
|
-
case MODE_3D_VIEW:
|
|
2406
|
+
case _constants.MODE_3D_VIEW:
|
|
2400
2407
|
self.props.setIsLoading3D(true);
|
|
2401
2408
|
break;
|
|
2402
2409
|
}
|
|
@@ -2407,12 +2414,12 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
2407
2414
|
implementBacksplash();
|
|
2408
2415
|
implementWarningBox();
|
|
2409
2416
|
} else {
|
|
2410
|
-
deleteSpecifiedMeshObjects('TransformBox');
|
|
2417
|
+
(0, _sceneCreator.deleteSpecifiedMeshObjects)('TransformBox');
|
|
2411
2418
|
}
|
|
2412
2419
|
var _this$state = this.state,
|
|
2413
2420
|
toolObj = _this$state.toolObj,
|
|
2414
2421
|
angleObj = _this$state.angleObj;
|
|
2415
|
-
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),
|
|
2416
2423
|
promise = _updateScene.promise;
|
|
2417
2424
|
self.setState();
|
|
2418
2425
|
promise.then(function (p1Value) {
|
|
@@ -2439,7 +2446,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
2439
2446
|
if (isLoading) {
|
|
2440
2447
|
if (this.props.downloadFlag) {
|
|
2441
2448
|
this.renderer.domElement.style.display = 'none';
|
|
2442
|
-
return /*#__PURE__*/
|
|
2449
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
2443
2450
|
style: {
|
|
2444
2451
|
alignItems: ' center',
|
|
2445
2452
|
width: this.props.width,
|
|
@@ -2447,7 +2454,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
2447
2454
|
display: 'inline-flex',
|
|
2448
2455
|
justifyContent: 'center'
|
|
2449
2456
|
}
|
|
2450
|
-
}, /*#__PURE__*/
|
|
2457
|
+
}, /*#__PURE__*/_react["default"].createElement("img", {
|
|
2451
2458
|
style: {
|
|
2452
2459
|
width: '70px',
|
|
2453
2460
|
height: '70px',
|
|
@@ -2460,12 +2467,12 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
2460
2467
|
document.getElementById('front') && (document.getElementById('front').style.display = 'none');
|
|
2461
2468
|
document.getElementById('error').style.display = 'none';
|
|
2462
2469
|
this.renderer.domElement.style.display = 'none';
|
|
2463
|
-
return /*#__PURE__*/
|
|
2470
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
2464
2471
|
style: {
|
|
2465
2472
|
textAlign: 'center',
|
|
2466
2473
|
width: '100%'
|
|
2467
2474
|
}
|
|
2468
|
-
}, /*#__PURE__*/
|
|
2475
|
+
}, /*#__PURE__*/_react["default"].createElement("img", {
|
|
2469
2476
|
style: {
|
|
2470
2477
|
animation: 'spin 2s linear infinite',
|
|
2471
2478
|
marginTop: "22%"
|
|
@@ -2478,12 +2485,12 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
2478
2485
|
this.renderer.domElement.style.pointerEvents = 'none';
|
|
2479
2486
|
document.getElementById('front') && (document.getElementById('front').style.display = 'none');
|
|
2480
2487
|
this.renderer.domElement.style.opacity = '0.4';
|
|
2481
|
-
return /*#__PURE__*/
|
|
2488
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
2482
2489
|
style: {
|
|
2483
2490
|
textAlign: 'center',
|
|
2484
2491
|
width: '100%'
|
|
2485
2492
|
}
|
|
2486
|
-
}, /*#__PURE__*/
|
|
2493
|
+
}, /*#__PURE__*/_react["default"].createElement("img", {
|
|
2487
2494
|
style: {
|
|
2488
2495
|
animation: 'spin 2s linear infinite',
|
|
2489
2496
|
position: "absolute",
|
|
@@ -2497,26 +2504,25 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
2497
2504
|
this.renderer.domElement.style.pointerEvents = 'auto';
|
|
2498
2505
|
this.renderer.domElement.style.opacity = '1';
|
|
2499
2506
|
!this.props.downloadFlag && document.getElementById('front') && (document.getElementById('front').style.display = 'block');
|
|
2500
|
-
return /*#__PURE__*/
|
|
2507
|
+
return /*#__PURE__*/_react["default"].createElement('div', {
|
|
2501
2508
|
ref: 'canvasWrapper'
|
|
2502
2509
|
});
|
|
2503
2510
|
}
|
|
2504
2511
|
}
|
|
2505
2512
|
}]);
|
|
2506
|
-
}(
|
|
2507
|
-
export { Scene3DViewer as default };
|
|
2513
|
+
}(_react["default"].Component);
|
|
2508
2514
|
Scene3DViewer.propTypes = {
|
|
2509
|
-
state:
|
|
2510
|
-
width:
|
|
2511
|
-
height:
|
|
2512
|
-
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
|
|
2513
2519
|
};
|
|
2514
2520
|
Scene3DViewer.contextTypes = {
|
|
2515
|
-
areaActions:
|
|
2516
|
-
holesActions:
|
|
2517
|
-
itemsActions:
|
|
2518
|
-
linesActions:
|
|
2519
|
-
sceneActions:
|
|
2520
|
-
projectActions:
|
|
2521
|
-
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
|
|
2522
2528
|
};
|