kitchen-simulator 1.1.1-test.64 → 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/package.json +1 -1
|
@@ -1,27 +1,62 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.addMolding = addMolding;
|
|
9
|
+
exports.addWarningBox = addWarningBox;
|
|
10
|
+
exports.checkCabinetOverlap = checkCabinetOverlap;
|
|
11
|
+
exports.createBacksplash = createBacksplash;
|
|
12
|
+
exports.createMDFromItem = createMDFromItem;
|
|
13
|
+
exports.createWarningObject = createWarningObject;
|
|
14
|
+
exports.deleteAllMolding = deleteAllMolding;
|
|
15
|
+
exports.deleteCountertop = deleteCountertop;
|
|
16
|
+
exports.deleteMGMesh = deleteMGMesh;
|
|
17
|
+
exports.deleteSpecifiedMeshObjects = deleteSpecifiedMeshObjects;
|
|
18
|
+
exports.fVLine = void 0;
|
|
19
|
+
exports.getDistanceBetweenLineSegment = getDistanceBetweenLineSegment;
|
|
20
|
+
exports.getDistances = getDistances;
|
|
21
|
+
exports.getIntersectPoint = getIntersectPoint;
|
|
22
|
+
exports.getMeshesFromScene = getMeshesFromScene;
|
|
23
|
+
exports.getTotalDistance = getTotalDistance;
|
|
24
|
+
exports.parseData = parseData;
|
|
25
|
+
exports.removeItem = removeItem;
|
|
26
|
+
exports.removeSelItemMesh = removeSelItemMesh;
|
|
27
|
+
exports.sameSign = sameSign;
|
|
28
|
+
exports.showYelloBox = showYelloBox;
|
|
29
|
+
exports.threedfabs = threedfabs;
|
|
30
|
+
exports.tryAdjacentMD = tryAdjacentMD;
|
|
31
|
+
exports.updateDoorHandleMesh = updateDoorHandleMesh;
|
|
32
|
+
exports.updateMoldingGroupArray = updateMoldingGroupArray;
|
|
33
|
+
exports.updateScene = updateScene;
|
|
34
|
+
exports.visibleTransformBox = visibleTransformBox;
|
|
35
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/defineProperty"));
|
|
36
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/toConsumableArray"));
|
|
37
|
+
var _three = _interopRequireWildcard(require("three"));
|
|
38
|
+
var Three = _three;
|
|
39
|
+
var _gridCreator = _interopRequireDefault(require("./grid-creator"));
|
|
40
|
+
var _threeMemoryCleaner = require("./three-memory-cleaner");
|
|
41
|
+
var _constants = require("../../constants");
|
|
42
|
+
var _export = require("../../utils/export");
|
|
43
|
+
var _convertUnitsLite = require("../../utils/convert-units-lite");
|
|
44
|
+
var _geometry2 = require("../../utils/geometry");
|
|
45
|
+
var GeomUtils = _interopRequireWildcard(require("../../catalog/utils/geom-utils"));
|
|
46
|
+
var _itemLoader = require("../../catalog/utils/item-loader");
|
|
47
|
+
var _utils = require("../viewer2d/utils");
|
|
48
|
+
var _helper = require("../../utils/helper");
|
|
49
|
+
var _math = require("../../utils/math");
|
|
50
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
3
51
|
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
|
|
4
52
|
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
5
53
|
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
6
54
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
7
|
-
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) {
|
|
8
|
-
import * as Three from 'three';
|
|
9
|
-
import { Color, Group } from 'three';
|
|
10
|
-
import createGrid from "./grid-creator";
|
|
11
|
-
import { disposeObject } from "./three-memory-cleaner";
|
|
12
|
-
import { ANIMATE_STEP_MAX, ANIMATE_STEP_MIN, ARRAY_3D_MODES, ARROW_TEXT_BACKCOLOR, ARROW_TEXT_FONTFACE, ARROW_TEXT_FORECOLOR, BASE_CABINET_LAYOUTPOS, BOTTOM_MOLDING_LOCATION, DECIMAL_PLACES_2, DIFFERENT_VALUES_PATH_LENGTH, DISTANCE_EPSILON, EPSILON, MIDDLE_MOLDING_LOCATION, MODE_DRAGGING_ITEM_3D, MODE_DRAWING_ITEM_3D, MODE_IDLE, MODE_IDLE_3D, MODE_ROTATING_ITEM_3D, OBJTYPE_MESH, SHADE_DARK_PURPLE_COLOR, TOP_MOLDING_LOCATION, UNIT_CENTIMETER, WALL_CABINET_LAYOUTPOS } from "../../constants";
|
|
13
|
-
import { GeometryUtils, IDBroker, MoldingUtils } from "../../utils/export";
|
|
14
|
-
import { convert } from "../../utils/convert-units-lite";
|
|
15
|
-
import { verticesDistance } from "../../utils/geometry";
|
|
16
|
-
import * as GeomUtils from "../../catalog/utils/geom-utils";
|
|
17
|
-
import { loadTexture } from "../../catalog/utils/item-loader";
|
|
18
|
-
import { returnReplaceableDeepSearchType } from "../viewer2d/utils";
|
|
19
|
-
import { animateDoor, isElevationView, isEmpty, replaceMeshesWithLineSegments, translateDrawer } from "../../utils/helper";
|
|
20
|
-
import { formatNumber } from "../../utils/math";
|
|
55
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
21
56
|
var transformBox;
|
|
22
|
-
|
|
57
|
+
var fVLine = exports.fVLine = [];
|
|
23
58
|
var scene_mode = null;
|
|
24
|
-
|
|
59
|
+
function parseData(sceneData, actions, catalog, camera, renderer, mode) {
|
|
25
60
|
var planData = {
|
|
26
61
|
catalog: catalog,
|
|
27
62
|
sceneData: sceneData
|
|
@@ -43,7 +78,7 @@ export function parseData(sceneData, actions, catalog, camera, renderer, mode) {
|
|
|
43
78
|
planData.cam.name = 'cam';
|
|
44
79
|
|
|
45
80
|
// Add a grid to the plan
|
|
46
|
-
planData.grid =
|
|
81
|
+
planData.grid = (0, _gridCreator["default"])(sceneData);
|
|
47
82
|
planData.grid.name = 'grid';
|
|
48
83
|
planData.boundingBox = new Three.Box3().setFromObject(planData.grid);
|
|
49
84
|
planData.boundingBox.name = 'boundingBox';
|
|
@@ -59,7 +94,7 @@ export function parseData(sceneData, actions, catalog, camera, renderer, mode) {
|
|
|
59
94
|
updateBoundingBox(planData, false, mode);
|
|
60
95
|
|
|
61
96
|
// if mode is elevation, build elevation scene
|
|
62
|
-
if (isElevationView(mode)) buildElevationScene(planData, mode);
|
|
97
|
+
if ((0, _helper.isElevationView)(mode)) buildElevationScene(planData, mode);
|
|
63
98
|
}
|
|
64
99
|
resolve('success');
|
|
65
100
|
});
|
|
@@ -71,7 +106,7 @@ export function parseData(sceneData, actions, catalog, camera, renderer, mode) {
|
|
|
71
106
|
|
|
72
107
|
// return planData;
|
|
73
108
|
}
|
|
74
|
-
|
|
109
|
+
function visibleTransformBox(flag) {
|
|
75
110
|
// if (transformBox instanceof Three.Mesh)
|
|
76
111
|
// transformBox.visible = flag;
|
|
77
112
|
}
|
|
@@ -96,14 +131,14 @@ var buildElevationScene = function buildElevationScene(planData, mode) {
|
|
|
96
131
|
planData.elevationGroup = elevationGroup;
|
|
97
132
|
scene.traverse(function (obj) {
|
|
98
133
|
if (obj.name == 'MainObject') {
|
|
99
|
-
replaceMeshesWithLineSegments(obj);
|
|
134
|
+
(0, _helper.replaceMeshesWithLineSegments)(obj);
|
|
100
135
|
}
|
|
101
136
|
});
|
|
102
137
|
scene.add(elevationGroup);
|
|
103
138
|
};
|
|
104
139
|
function createLayerObjects(layer, planData, sceneData, actions, catalog, mode, camera, renderer) {
|
|
105
140
|
var promises = [];
|
|
106
|
-
var moldingGroups = MoldingUtils.getAllMoldingGroups(layer);
|
|
141
|
+
var moldingGroups = _export.MoldingUtils.getAllMoldingGroups(layer);
|
|
107
142
|
planData.sceneGraph.layers[layer.id] = {
|
|
108
143
|
id: layer.id,
|
|
109
144
|
lines: {},
|
|
@@ -173,7 +208,7 @@ img2.src = '/assets/img/svg/3d_item_warning_edit.svg';
|
|
|
173
208
|
img2.onload = function () {
|
|
174
209
|
ctx.drawImage(img2, 8, 58, 34, 34);
|
|
175
210
|
};
|
|
176
|
-
|
|
211
|
+
function createWarningObject() {
|
|
177
212
|
var warningTexture = new Three.Texture(canvas);
|
|
178
213
|
warningTexture.needsUpdate = true;
|
|
179
214
|
var warningObj = new Three.Sprite(new Three.SpriteMaterial({
|
|
@@ -187,7 +222,7 @@ export function createWarningObject() {
|
|
|
187
222
|
warningObj.name = 'warningObj';
|
|
188
223
|
return warningObj;
|
|
189
224
|
}
|
|
190
|
-
|
|
225
|
+
function updateScene(planData, sceneData, oldSceneData, diffArray, actions, catalog) {
|
|
191
226
|
var _draggingItem$toJS, _filteredDiffs, _filteredDiffs2;
|
|
192
227
|
var mode = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : null;
|
|
193
228
|
var toolObj = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : null;
|
|
@@ -216,7 +251,7 @@ export function updateScene(planData, sceneData, oldSceneData, diffArray, action
|
|
|
216
251
|
});
|
|
217
252
|
//*******************************
|
|
218
253
|
//This is executed when dragging item is end and performs the updateing filteredDiffs.
|
|
219
|
-
if ((sceneData === null || sceneData === void 0 ? void 0 : sceneData.isEndDragging) === true && draggingItem && !isEmpty((_draggingItem$toJS = draggingItem.toJS) === null || _draggingItem$toJS === void 0 ? void 0 : _draggingItem$toJS.call(draggingItem)) && ((_filteredDiffs = filteredDiffs) === null || _filteredDiffs === void 0 || (_filteredDiffs = _filteredDiffs[0]) === null || _filteredDiffs === void 0 || (_filteredDiffs = _filteredDiffs.path) === null || _filteredDiffs === void 0 ? void 0 : _filteredDiffs.length) < DIFFERENT_VALUES_PATH_LENGTH && (_filteredDiffs2 = filteredDiffs) !== null && _filteredDiffs2 !== void 0 && (_filteredDiffs2 = _filteredDiffs2[0]) !== null && _filteredDiffs2 !== void 0 && (_filteredDiffs2 = _filteredDiffs2.path) !== null && _filteredDiffs2 !== void 0 && _filteredDiffs2.includes('showfg')) {
|
|
254
|
+
if ((sceneData === null || sceneData === void 0 ? void 0 : sceneData.isEndDragging) === true && draggingItem && !(0, _helper.isEmpty)((_draggingItem$toJS = draggingItem.toJS) === null || _draggingItem$toJS === void 0 ? void 0 : _draggingItem$toJS.call(draggingItem)) && ((_filteredDiffs = filteredDiffs) === null || _filteredDiffs === void 0 || (_filteredDiffs = _filteredDiffs[0]) === null || _filteredDiffs === void 0 || (_filteredDiffs = _filteredDiffs.path) === null || _filteredDiffs === void 0 ? void 0 : _filteredDiffs.length) < _constants.DIFFERENT_VALUES_PATH_LENGTH && (_filteredDiffs2 = filteredDiffs) !== null && _filteredDiffs2 !== void 0 && (_filteredDiffs2 = _filteredDiffs2[0]) !== null && _filteredDiffs2 !== void 0 && (_filteredDiffs2 = _filteredDiffs2.path) !== null && _filteredDiffs2 !== void 0 && _filteredDiffs2.includes('showfg')) {
|
|
220
255
|
var _draggingItem$getIn, _draggingItem$getIn2;
|
|
221
256
|
var layerID = (_draggingItem$getIn = draggingItem.getIn) === null || _draggingItem$getIn === void 0 ? void 0 : _draggingItem$getIn.call(draggingItem, ['layerID']);
|
|
222
257
|
var itemID = (_draggingItem$getIn2 = draggingItem.getIn) === null || _draggingItem$getIn2 === void 0 ? void 0 : _draggingItem$getIn2.call(draggingItem, ['itemID']);
|
|
@@ -312,7 +347,7 @@ export function updateScene(planData, sceneData, oldSceneData, diffArray, action
|
|
|
312
347
|
Promise.all(result).then(function (replaceValue) {
|
|
313
348
|
// if mode is elevation, build elevation scene
|
|
314
349
|
// When scene is updated, replaceValue is not empty.
|
|
315
|
-
if (isElevationView(mode) && !isEmpty(replaceValue)) buildElevationScene(planData, mode);
|
|
350
|
+
if ((0, _helper.isElevationView)(mode) && !(0, _helper.isEmpty)(replaceValue)) buildElevationScene(planData, mode);
|
|
316
351
|
resolve('successPromise');
|
|
317
352
|
});
|
|
318
353
|
});
|
|
@@ -329,22 +364,22 @@ function myAnimRotate(obj, open_doors, item, isCorner) {
|
|
|
329
364
|
animateStep = open_doors ? animateStep + 1 : animateStep - 1;
|
|
330
365
|
|
|
331
366
|
// clear interval when the opening or closing door is ended.
|
|
332
|
-
if (animateStep > ANIMATE_STEP_MAX || animateStep < ANIMATE_STEP_MIN) {
|
|
367
|
+
if (animateStep > _constants.ANIMATE_STEP_MAX || animateStep < _constants.ANIMATE_STEP_MIN) {
|
|
333
368
|
clearInterval(animate_objects[obj.name].animate_intervalID);
|
|
334
369
|
return;
|
|
335
370
|
}
|
|
336
371
|
animate_objects[obj.name].animateStep = animateStep;
|
|
337
|
-
animateDoor(animate_objects[obj.name].offset, obj, open_doors, item, isCorner, 'Opened3D');
|
|
372
|
+
(0, _helper.animateDoor)(animate_objects[obj.name].offset, obj, open_doors, item, isCorner, 'Opened3D');
|
|
338
373
|
}
|
|
339
374
|
function myAnimTranslate(obj, open_doors, item) {
|
|
340
375
|
var animateStep = animate_objects[obj.name].animateStep;
|
|
341
376
|
animateStep = open_doors ? animateStep + 1 : animateStep - 1;
|
|
342
|
-
if (animateStep > ANIMATE_STEP_MAX || animateStep < ANIMATE_STEP_MIN) {
|
|
377
|
+
if (animateStep > _constants.ANIMATE_STEP_MAX || animateStep < _constants.ANIMATE_STEP_MIN) {
|
|
343
378
|
clearInterval(animate_objects[obj.name].animate_intervalID);
|
|
344
379
|
return;
|
|
345
380
|
}
|
|
346
381
|
animate_objects[obj.name].animateStep = animateStep;
|
|
347
|
-
translateDrawer(item, obj, open_doors, 'Opened3D');
|
|
382
|
+
(0, _helper.translateDrawer)(item, obj, open_doors, 'Opened3D');
|
|
348
383
|
}
|
|
349
384
|
function replaceObject(modifiedPath, layer, planData, actions, sceneData, oldSceneData, catalog) {
|
|
350
385
|
var mode = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : null;
|
|
@@ -430,7 +465,7 @@ function replaceObject(modifiedPath, layer, planData, actions, sceneData, oldSce
|
|
|
430
465
|
case 'items':
|
|
431
466
|
var item = layer.getIn(['items', modifiedPath[4]]);
|
|
432
467
|
deleteCountertop(planData.sceneGraph.layers[layer.id].countertops, item, planData, layer);
|
|
433
|
-
var tmpMoldings =
|
|
468
|
+
var tmpMoldings = (0, _toConsumableArray2["default"])(planData.sceneGraph.layers[layer.id].moldingGroups);
|
|
434
469
|
if (catalog.getElement(item.type).updateRender3D) {
|
|
435
470
|
promises.push(updateItem(sceneData, oldSceneData, planData, layer, modifiedPath[4], modifiedPath.slice(5), catalog, actions.itemsActions, function () {
|
|
436
471
|
return removeItem(planData, layer.id, modifiedPath[4], oldSceneData.getIn(['layers', layer.id]), layer);
|
|
@@ -466,7 +501,7 @@ function replaceObject(modifiedPath, layer, planData, actions, sceneData, oldSce
|
|
|
466
501
|
}, 50);
|
|
467
502
|
removeSelItemMesh(tmpMoldings, item, planData, mode);
|
|
468
503
|
} else if (modifiedPath[keyIndex] == 'selected') {
|
|
469
|
-
var itemType = !!catalog.elements[item.type] ? catalog.elements[item.type].type : catalog.elements[returnReplaceableDeepSearchType(item.type)].type;
|
|
504
|
+
var itemType = !!catalog.elements[item.type] ? catalog.elements[item.type].type : catalog.elements[(0, _utils.returnReplaceableDeepSearchType)(item.type)].type;
|
|
470
505
|
if (value == false) {
|
|
471
506
|
item3D.children[0].children = item3D.children[0].children.filter(function (item3DElement) {
|
|
472
507
|
return item3DElement.name !== 'TransformBox' && item3DElement.name !== 'TransformGizmo';
|
|
@@ -506,17 +541,17 @@ function replaceObject(modifiedPath, layer, planData, actions, sceneData, oldSce
|
|
|
506
541
|
var posVec = new Three.Vector3(object.position.x, object.position.y, object.position.z);
|
|
507
542
|
var newAltitude = item.properties.get('altitude').get('_length');
|
|
508
543
|
var newUnit = item.properties.get('altitude').get('_unit') || 'in';
|
|
509
|
-
newAltitude = convert(newAltitude).from(newUnit).to(sceneData.unit);
|
|
544
|
+
newAltitude = (0, _convertUnitsLite.convert)(newAltitude).from(newUnit).to(sceneData.unit);
|
|
510
545
|
var newWidth = item.properties.get('width').get('_length');
|
|
511
546
|
var newWidthUnit = item.properties.get('width').get('_unit') || 'in';
|
|
512
|
-
newWidth = convert(newWidth).from(newWidthUnit).to('in');
|
|
547
|
+
newWidth = (0, _convertUnitsLite.convert)(newWidth).from(newWidthUnit).to('in');
|
|
513
548
|
var newHeight = item.properties.get('height').get('_length');
|
|
514
549
|
var newHeightUnit = item.properties.get('height').get('_unit') || 'in';
|
|
515
|
-
newHeight = convert(newHeight).from(newHeightUnit).to('in');
|
|
550
|
+
newHeight = (0, _convertUnitsLite.convert)(newHeight).from(newHeightUnit).to('in');
|
|
516
551
|
var newDepth = item.properties.get('depth').get('_length');
|
|
517
552
|
var newDepthUnit = item.properties.get('depth').get('_unit') || 'in';
|
|
518
|
-
newDepth = convert(newDepth).from(newDepthUnit).to('in');
|
|
519
|
-
var sizeinfo = !!catalog.elements[item.type] ? catalog.elements[item.type].info.sizeinfo : catalog.elements[returnReplaceableDeepSearchType(item.type)].info.sizeinfo;
|
|
553
|
+
newDepth = (0, _convertUnitsLite.convert)(newDepth).from(newDepthUnit).to('in');
|
|
554
|
+
var sizeinfo = !!catalog.elements[item.type] ? catalog.elements[item.type].info.sizeinfo : catalog.elements[(0, _utils.returnReplaceableDeepSearchType)(item.type)].info.sizeinfo;
|
|
520
555
|
object.scale.set(1 * newWidth / sizeinfo.width, 1 * newHeight / sizeinfo.height, 1 * newDepth / sizeinfo.depth);
|
|
521
556
|
object.position.set(0, 0, 0);
|
|
522
557
|
object.rotation.set(0, 0, 0);
|
|
@@ -573,10 +608,10 @@ function replaceObject(modifiedPath, layer, planData, actions, sceneData, oldSce
|
|
|
573
608
|
upObj.name = 'transUp';
|
|
574
609
|
var upwardbox = new Three.BoxHelper(upObj, 0x326780);
|
|
575
610
|
upwardbox.material.lineWidth = 0.01;
|
|
576
|
-
fVLine = [];
|
|
611
|
+
exports.fVLine = fVLine = [];
|
|
577
612
|
// let obj = new Three.Mesh(controlGeom, new Three.MeshPhongMaterial({ color: 0xffffff, side: Three.DoubleSide, colorWrite: true }));
|
|
578
613
|
// obj.name = "translateX";
|
|
579
|
-
var color = SHADE_DARK_PURPLE_COLOR;
|
|
614
|
+
var color = _constants.SHADE_DARK_PURPLE_COLOR;
|
|
580
615
|
var _mBox = new Three.Mesh(moveBox, new Three.MeshBasicMaterial({
|
|
581
616
|
color: 0xdd6699,
|
|
582
617
|
side: Three.DoubleSide,
|
|
@@ -748,7 +783,7 @@ function replaceObject(modifiedPath, layer, planData, actions, sceneData, oldSce
|
|
|
748
783
|
moveObjectChildrens.forEach(function (element) {
|
|
749
784
|
var _animate_objects$elem, _animate_objects$elem2;
|
|
750
785
|
if (((_animate_objects$elem = animate_objects[element.obj.name]) === null || _animate_objects$elem === void 0 ? void 0 : _animate_objects$elem.animateStep) === undefined) {
|
|
751
|
-
animate_objects[element.obj.name].animateStep = selectedItem.properties.open_doors ? ANIMATE_STEP_MIN : ANIMATE_STEP_MAX;
|
|
786
|
+
animate_objects[element.obj.name].animateStep = selectedItem.properties.open_doors ? _constants.ANIMATE_STEP_MIN : _constants.ANIMATE_STEP_MAX;
|
|
752
787
|
}
|
|
753
788
|
|
|
754
789
|
// clear origin Interval.
|
|
@@ -824,7 +859,7 @@ function replaceObject(modifiedPath, layer, planData, actions, sceneData, oldSce
|
|
|
824
859
|
addCountertop(planData.sceneGraph.layers[layer.id].countertops, item, planData, layer);
|
|
825
860
|
// Toggle selection should not update molding
|
|
826
861
|
if (item.category === 'cabinet' && modifiedPath[modifiedPath.length - 1] !== 'selected') {
|
|
827
|
-
planData.sceneGraph.layers[layer.id].moldingGroups = addMolding(tmpMoldings, item, planData, layer, actions.itemsActions, mode) ||
|
|
862
|
+
planData.sceneGraph.layers[layer.id].moldingGroups = addMolding(tmpMoldings, item, planData, layer, actions.itemsActions, mode) || (0, _toConsumableArray2["default"])(tmpMoldings);
|
|
828
863
|
}
|
|
829
864
|
break;
|
|
830
865
|
case 'visible':
|
|
@@ -860,7 +895,7 @@ function replaceObject(modifiedPath, layer, planData, actions, sceneData, oldSce
|
|
|
860
895
|
promise: p1
|
|
861
896
|
};
|
|
862
897
|
}
|
|
863
|
-
|
|
898
|
+
function getDistances(layer, isCalcWall) {
|
|
864
899
|
fVLine.forEach(function (line, index) {
|
|
865
900
|
getLineDistance(line, layer, isCalcWall === undefined ? false : isCalcWall, index);
|
|
866
901
|
});
|
|
@@ -920,7 +955,7 @@ function getLineDistance(obj, layer, isCalcWall, index) {
|
|
|
920
955
|
obj.geometry.attributes.position.needsUpdate = true;
|
|
921
956
|
obj.geometry.computeBoundingSphere();
|
|
922
957
|
obj.geometry.computeBoundingBox();
|
|
923
|
-
var dist = formatNumber(convert(intersects[i].distance).from('cm').to('in'), DECIMAL_PLACES_2);
|
|
958
|
+
var dist = (0, _math.formatNumber)((0, _convertUnitsLite.convert)(intersects[i].distance).from('cm').to('in'), _constants.DECIMAL_PLACES_2);
|
|
924
959
|
if (dist > 3) {
|
|
925
960
|
var _canvas = getTextCanvas(dist);
|
|
926
961
|
var wid = _canvas.width / window.innerWidth * 30;
|
|
@@ -937,7 +972,7 @@ function getLineDistance(obj, layer, isCalcWall, index) {
|
|
|
937
972
|
var textMesh = new Three.Mesh(geometry, material);
|
|
938
973
|
for (; obj.children.length != 0;) {
|
|
939
974
|
var temp = obj.children.pop();
|
|
940
|
-
disposeObject(temp);
|
|
975
|
+
(0, _threeMemoryCleaner.disposeObject)(temp);
|
|
941
976
|
}
|
|
942
977
|
textMesh.rotation.set(Math.PI / 2, Math.PI, 0);
|
|
943
978
|
// obj.add(textMesh);
|
|
@@ -963,10 +998,10 @@ function getLineDistance(obj, layer, isCalcWall, index) {
|
|
|
963
998
|
var objW = (max.x - min.x) / 100,
|
|
964
999
|
objL = (max.z - min.z) / 100;
|
|
965
1000
|
var triangle = new Three.Mesh(geom, new Three.MeshBasicMaterial({
|
|
966
|
-
color: SHADE_DARK_PURPLE_COLOR
|
|
1001
|
+
color: _constants.SHADE_DARK_PURPLE_COLOR
|
|
967
1002
|
}));
|
|
968
1003
|
var triangle1 = new Three.Mesh(geom, new Three.MeshBasicMaterial({
|
|
969
|
-
color: SHADE_DARK_PURPLE_COLOR
|
|
1004
|
+
color: _constants.SHADE_DARK_PURPLE_COLOR
|
|
970
1005
|
}));
|
|
971
1006
|
triangle.position.set((index < 2 ? 0 : Math.sin((index === 2 ? 1 : -1) * Math.PI / 2)) * (obj.geometry.attributes.position.array[0] + h / 4 + (index % 2 === 0 ? 0 : objW)), newVec.y, (index < 2 ? Math.cos(index * Math.PI) : 0) * (obj.geometry.attributes.position.array[2] + h / 4 + (index % 2 === 0 ? 0 : objL)));
|
|
972
1007
|
triangle1.position.set(newVec.x - (index < 2 ? 0 : Math.sin((index === 2 ? 1 : -1) * Math.PI / 2)) * h / 4, newVec.y, newVec.z - (index < 2 ? Math.cos(index * Math.PI) : 0) * h / 4);
|
|
@@ -1042,7 +1077,7 @@ function getLineDistance(obj, layer, isCalcWall, index) {
|
|
|
1042
1077
|
obj.geometry.attributes.position.array[4] = _newVec.y;
|
|
1043
1078
|
obj.geometry.attributes.position.array[5] = _newVec.z;
|
|
1044
1079
|
obj.geometry.attributes.position.needsUpdate = true;
|
|
1045
|
-
var _dist = formatNumber(distance, DECIMAL_PLACES_2);
|
|
1080
|
+
var _dist = (0, _math.formatNumber)(distance, _constants.DECIMAL_PLACES_2);
|
|
1046
1081
|
if (_dist > 3) {
|
|
1047
1082
|
var _canvas2 = getTextCanvas(_dist);
|
|
1048
1083
|
var _wid = _canvas2.width / window.innerWidth * 30;
|
|
@@ -1058,7 +1093,7 @@ function getLineDistance(obj, layer, isCalcWall, index) {
|
|
|
1058
1093
|
var _textMesh = new Three.Mesh(_geometry, _material);
|
|
1059
1094
|
for (; obj.children.length != 0;) {
|
|
1060
1095
|
var _temp = obj.children.pop();
|
|
1061
|
-
disposeObject(_temp);
|
|
1096
|
+
(0, _threeMemoryCleaner.disposeObject)(_temp);
|
|
1062
1097
|
}
|
|
1063
1098
|
_textMesh.rotation.set(Math.PI / 2, Math.PI, 0);
|
|
1064
1099
|
// obj.add(textMesh);
|
|
@@ -1081,10 +1116,10 @@ function getLineDistance(obj, layer, isCalcWall, index) {
|
|
|
1081
1116
|
var _objW = (_max.x - _min.x) / 100,
|
|
1082
1117
|
_objL = (_max.z - _min.z) / 100;
|
|
1083
1118
|
var triangle = new Three.Mesh(geom, new Three.MeshBasicMaterial({
|
|
1084
|
-
color: SHADE_DARK_PURPLE_COLOR
|
|
1119
|
+
color: _constants.SHADE_DARK_PURPLE_COLOR
|
|
1085
1120
|
}));
|
|
1086
1121
|
var triangle1 = new Three.Mesh(geom, new Three.MeshBasicMaterial({
|
|
1087
|
-
color: SHADE_DARK_PURPLE_COLOR
|
|
1122
|
+
color: _constants.SHADE_DARK_PURPLE_COLOR
|
|
1088
1123
|
}));
|
|
1089
1124
|
triangle.position.set((index < 2 ? 0 : Math.sin((index === 2 ? 1 : -1) * Math.PI / 2)) * (obj.geometry.attributes.position.array[0] + h / 4 + (index % 2 === 0 ? 0 : _objW)), _newVec.y, (index < 2 ? Math.cos(index * Math.PI) : 0) * (obj.geometry.attributes.position.array[2] + h / 4 + (index % 2 === 0 ? 0 : _objL)) - 0.02);
|
|
1090
1125
|
triangle1.position.set(_newVec.x - (index < 2 ? 0 : Math.sin((index === 2 ? 1 : -1) * Math.PI / 2)) * h / 4, _newVec.y, _newVec.z - (index < 2 ? Math.cos(index * Math.PI) : 0) * h / 4);
|
|
@@ -1124,7 +1159,7 @@ function getLineDistance(obj, layer, isCalcWall, index) {
|
|
|
1124
1159
|
obj.visible = false;
|
|
1125
1160
|
return obj;
|
|
1126
1161
|
}
|
|
1127
|
-
|
|
1162
|
+
function getIntersectPoint(opX, opY, pX, pY) {
|
|
1128
1163
|
var oA;
|
|
1129
1164
|
if (opX[1] == opX[0]) oA = null;else oA = (opY[1] - opY[0]) / (opX[1] - opX[0]);
|
|
1130
1165
|
var A;
|
|
@@ -1178,7 +1213,7 @@ function getTextCanvas(text) {
|
|
|
1178
1213
|
var ctx = canvas.getContext('2d');
|
|
1179
1214
|
var fontSize = 16;
|
|
1180
1215
|
var integral = String(text) + "''";
|
|
1181
|
-
parameters.fontName = parameters.fontName || ARROW_TEXT_FONTFACE;
|
|
1216
|
+
parameters.fontName = parameters.fontName || _constants.ARROW_TEXT_FONTFACE;
|
|
1182
1217
|
|
|
1183
1218
|
// Prepare the font to be able to measure
|
|
1184
1219
|
ctx.font = "".concat(fontSize, "px ") + parameters.fontName;
|
|
@@ -1216,7 +1251,7 @@ function getTextCanvas(text) {
|
|
|
1216
1251
|
ctx.textBaseline = parameters.baseline || 'middle';
|
|
1217
1252
|
var r = 10;
|
|
1218
1253
|
// Make the canvas transparent for simplicity
|
|
1219
|
-
ctx.fillStyle = ARROW_TEXT_BACKCOLOR;
|
|
1254
|
+
ctx.fillStyle = _constants.ARROW_TEXT_BACKCOLOR;
|
|
1220
1255
|
// ctx.fillRect(0, 0, ctx.canvas.width, ctx.canvas.height);
|
|
1221
1256
|
var w = ctx.canvas.width;
|
|
1222
1257
|
var h = ctx.canvas.height;
|
|
@@ -1232,9 +1267,9 @@ function getTextCanvas(text) {
|
|
|
1232
1267
|
ctx.arcTo(0, 0, r, 0, r);
|
|
1233
1268
|
// ctx.arcTo(w+r, h+2*r, w+r, 0, r);
|
|
1234
1269
|
ctx.fill();
|
|
1235
|
-
ctx.fillStyle = parameters.fillColor || ARROW_TEXT_FORECOLOR;
|
|
1270
|
+
ctx.fillStyle = parameters.fillColor || _constants.ARROW_TEXT_FORECOLOR;
|
|
1236
1271
|
ctx.fillText(integral, (width - textMetrics.width) / 2, height / 2);
|
|
1237
|
-
ctx.strokeStyle = parameters.strokeColor || ARROW_TEXT_FORECOLOR;
|
|
1272
|
+
ctx.strokeStyle = parameters.strokeColor || _constants.ARROW_TEXT_FORECOLOR;
|
|
1238
1273
|
ctx.strokeText(integral, (width - textMetrics.width) / 2, height / 2);
|
|
1239
1274
|
|
|
1240
1275
|
// ctx.font = `${fontSize - 5}px ` + parameters.fontName;
|
|
@@ -1295,7 +1330,7 @@ function removeObject(modifiedPath, layer, planData, actions, sceneData, oldScen
|
|
|
1295
1330
|
});
|
|
1296
1331
|
removeLine(planData, layer.id, lineID);
|
|
1297
1332
|
var mode = oldSceneData.mode;
|
|
1298
|
-
if (ARRAY_3D_MODES.includes(mode)) mode = MODE_IDLE_3D;else mode = MODE_IDLE;
|
|
1333
|
+
if (_constants.ARRAY_3D_MODES.includes(mode)) mode = _constants.MODE_IDLE_3D;else mode = _constants.MODE_IDLE;
|
|
1299
1334
|
if (modifiedPath.length > 5) {
|
|
1300
1335
|
// I removed an hole, so I should add the new line
|
|
1301
1336
|
promises.push(addLine(sceneData, planData, layer, lineID, catalog, actions.linesActions));
|
|
@@ -1340,7 +1375,7 @@ function removeHole(planData, layerId, holeID) {
|
|
|
1340
1375
|
var hole3D = planData.sceneGraph.layers[layerId].holes[holeID];
|
|
1341
1376
|
if (hole3D) {
|
|
1342
1377
|
planData.plan.remove(hole3D);
|
|
1343
|
-
disposeObject(hole3D);
|
|
1378
|
+
(0, _threeMemoryCleaner.disposeObject)(hole3D);
|
|
1344
1379
|
delete planData.sceneGraph.layers[layerId].holes[holeID];
|
|
1345
1380
|
delete planData.sceneGraph.LODs[holeID];
|
|
1346
1381
|
hole3D = null;
|
|
@@ -1359,7 +1394,7 @@ function removeLine(planData, layerId, lineID) {
|
|
|
1359
1394
|
var line3D = planData.sceneGraph.layers[layerId].lines[lineID];
|
|
1360
1395
|
if (line3D) {
|
|
1361
1396
|
planData.plan.remove(line3D);
|
|
1362
|
-
disposeObject(line3D);
|
|
1397
|
+
(0, _threeMemoryCleaner.disposeObject)(line3D);
|
|
1363
1398
|
delete planData.sceneGraph.layers[layerId].lines[lineID];
|
|
1364
1399
|
delete planData.sceneGraph.LODs[lineID];
|
|
1365
1400
|
line3D = null;
|
|
@@ -1378,7 +1413,7 @@ function removeArea(planData, layerId, areaID) {
|
|
|
1378
1413
|
var area3D = planData.sceneGraph.layers[layerId].areas[areaID];
|
|
1379
1414
|
if (area3D) {
|
|
1380
1415
|
planData.plan.remove(area3D);
|
|
1381
|
-
disposeObject(area3D);
|
|
1416
|
+
(0, _threeMemoryCleaner.disposeObject)(area3D);
|
|
1382
1417
|
delete planData.sceneGraph.layers[layerId].areas[areaID];
|
|
1383
1418
|
delete planData.sceneGraph.LODs[areaID];
|
|
1384
1419
|
area3D = null;
|
|
@@ -1386,7 +1421,7 @@ function removeArea(planData, layerId, areaID) {
|
|
|
1386
1421
|
}
|
|
1387
1422
|
planData.sceneGraph.busyResources.layers[layerId].areas[areaID] = false;
|
|
1388
1423
|
}
|
|
1389
|
-
|
|
1424
|
+
function removeItem(planData, layerId, itemID) {
|
|
1390
1425
|
var oldSceneLayer = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
|
|
1391
1426
|
var newSceneLayer = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
|
|
1392
1427
|
if (planData.sceneGraph.busyResources.layers[layerId].items[itemID]) {
|
|
@@ -1405,7 +1440,7 @@ export function removeItem(planData, layerId, itemID) {
|
|
|
1405
1440
|
var item3D = planData.sceneGraph.layers[layerId].items[itemID];
|
|
1406
1441
|
if (item3D) {
|
|
1407
1442
|
planData.plan.remove(item3D);
|
|
1408
|
-
disposeObject(item3D);
|
|
1443
|
+
(0, _threeMemoryCleaner.disposeObject)(item3D);
|
|
1409
1444
|
delete planData.sceneGraph.layers[layerId].items[itemID];
|
|
1410
1445
|
delete planData.sceneGraph.LODs[itemID];
|
|
1411
1446
|
item3D = null;
|
|
@@ -1427,7 +1462,7 @@ function removeItemWithoutItem(planData, layerId, itemID) {
|
|
|
1427
1462
|
var item3D = planData.sceneGraph.layers[layerId].items[itemID];
|
|
1428
1463
|
if (item3D) {
|
|
1429
1464
|
planData.plan.remove(item3D);
|
|
1430
|
-
disposeObject(item3D);
|
|
1465
|
+
(0, _threeMemoryCleaner.disposeObject)(item3D);
|
|
1431
1466
|
item3D = null;
|
|
1432
1467
|
updateBoundingBox(planData);
|
|
1433
1468
|
delete planData.sceneGraph.layers[layerId].items[itemID];
|
|
@@ -1488,7 +1523,7 @@ function addHole(sceneData, planData, layer, holeID, catalog, holesActions, mode
|
|
|
1488
1523
|
item.castShadow = true;
|
|
1489
1524
|
var texture;
|
|
1490
1525
|
if (name.includes('_wood')) {
|
|
1491
|
-
texture = loadTexture('/assets/img/texture/white1px.jpg');
|
|
1526
|
+
texture = (0, _itemLoader.loadTexture)('/assets/img/texture/white1px.jpg');
|
|
1492
1527
|
} else if (name.includes('_glass')) {
|
|
1493
1528
|
var material = new Three.MeshPhysicalMaterial({
|
|
1494
1529
|
roughness: 0.5,
|
|
@@ -1500,7 +1535,7 @@ function addHole(sceneData, planData, layer, holeID, catalog, holesActions, mode
|
|
|
1500
1535
|
item.material = material;
|
|
1501
1536
|
return item;
|
|
1502
1537
|
} else if (name.includes('_steel')) {
|
|
1503
|
-
texture = loadTexture('/assets/img/texture/steel.jpg');
|
|
1538
|
+
texture = (0, _itemLoader.loadTexture)('/assets/img/texture/steel.jpg');
|
|
1504
1539
|
} else if (name.includes('_glass')) {
|
|
1505
1540
|
var _material2 = new Three.MeshPhysicalMaterial({
|
|
1506
1541
|
roughness: 0.5,
|
|
@@ -1574,7 +1609,7 @@ function addHole(sceneData, planData, layer, holeID, catalog, holesActions, mode
|
|
|
1574
1609
|
}
|
|
1575
1610
|
var pivot = new Three.Object3D();
|
|
1576
1611
|
pivot.name = 'pivot';
|
|
1577
|
-
if (isElevationView(mode)) {
|
|
1612
|
+
if ((0, _helper.isElevationView)(mode)) {
|
|
1578
1613
|
var lineID = holeData.getIn(['line']);
|
|
1579
1614
|
if (planData.sceneGraph.layers['layer-1'].lines[lineID].visible) {
|
|
1580
1615
|
pivot.visible = true;
|
|
@@ -1582,7 +1617,7 @@ function addHole(sceneData, planData, layer, holeID, catalog, holesActions, mode
|
|
|
1582
1617
|
pivot.visible = false;
|
|
1583
1618
|
}
|
|
1584
1619
|
object.traverse(function (obj) {
|
|
1585
|
-
replaceMeshesWithLineSegments(obj);
|
|
1620
|
+
(0, _helper.replaceMeshesWithLineSegments)(obj);
|
|
1586
1621
|
});
|
|
1587
1622
|
}
|
|
1588
1623
|
pivot.add(object);
|
|
@@ -1676,11 +1711,11 @@ function addLine(sceneData, planData, layer, lineID, catalog, linesActions) {
|
|
|
1676
1711
|
pivot.userData.type = 'line';
|
|
1677
1712
|
|
|
1678
1713
|
// In elevation view, show(visible = true) just selected wall pivot. If not, hidden(visible = false)
|
|
1679
|
-
if (isElevationView(mode)) {
|
|
1714
|
+
if ((0, _helper.isElevationView)(mode)) {
|
|
1680
1715
|
var lineVisible;
|
|
1681
1716
|
if (line.selected) {
|
|
1682
1717
|
pivot.traverse(function (obj) {
|
|
1683
|
-
replaceMeshesWithLineSegments(obj);
|
|
1718
|
+
(0, _helper.replaceMeshesWithLineSegments)(obj);
|
|
1684
1719
|
});
|
|
1685
1720
|
lineVisible = true;
|
|
1686
1721
|
} else {
|
|
@@ -1774,7 +1809,7 @@ function addArea(sceneData, planData, layer, areaID, catalog, areaActions, mode)
|
|
|
1774
1809
|
realVec.push(vec);
|
|
1775
1810
|
});
|
|
1776
1811
|
if (vertices.includes(realVec[0]) && vertices.includes(realVec[1])) {
|
|
1777
|
-
height = convert(layer.ceilHeight).from(layer.unit).to(UNIT_CENTIMETER);
|
|
1812
|
+
height = (0, _convertUnitsLite.convert)(layer.ceilHeight).from(layer.unit).to(_constants.UNIT_CENTIMETER);
|
|
1778
1813
|
// height = data.properties.getIn(["height", "length"]);
|
|
1779
1814
|
return 1; // break
|
|
1780
1815
|
}
|
|
@@ -1782,7 +1817,7 @@ function addArea(sceneData, planData, layer, areaID, catalog, areaActions, mode)
|
|
|
1782
1817
|
for (var i = 0; i < lines.length; i++) {
|
|
1783
1818
|
if (_loop2()) break;
|
|
1784
1819
|
}
|
|
1785
|
-
ceil.translateZ(convert(layer.ceilHeight).from(layer.unit).to(UNIT_CENTIMETER));
|
|
1820
|
+
ceil.translateZ((0, _convertUnitsLite.convert)(layer.ceilHeight).from(layer.unit).to(_constants.UNIT_CENTIMETER));
|
|
1786
1821
|
pivot.name = 'pivot';
|
|
1787
1822
|
pivot.add(area3D);
|
|
1788
1823
|
pivot.add(area3D.userData.floorSupport);
|
|
@@ -1790,7 +1825,7 @@ function addArea(sceneData, planData, layer, areaID, catalog, areaActions, mode)
|
|
|
1790
1825
|
pivot.position.y = layer.altitude;
|
|
1791
1826
|
|
|
1792
1827
|
// if elevation view, show just wall - not show floor and ceil
|
|
1793
|
-
if (isElevationView(mode)) pivot.visible = false;
|
|
1828
|
+
if ((0, _helper.isElevationView)(mode)) pivot.visible = false;
|
|
1794
1829
|
planData.plan.add(pivot);
|
|
1795
1830
|
planData.sceneGraph.layers[layer.id].areas[areaID] = pivot;
|
|
1796
1831
|
// document.getElementById('setting_dialog').style.display = 'none';
|
|
@@ -1826,11 +1861,11 @@ function addItem(sceneData, planData, layer, itemID, catalog, itemsActions) {
|
|
|
1826
1861
|
console.log(item.name + 's doorStyle is null!');
|
|
1827
1862
|
return;
|
|
1828
1863
|
}
|
|
1829
|
-
if (!sceneData.loadFlag && scene_mode == MODE_DRAWING_ITEM_3D) {
|
|
1864
|
+
if (!sceneData.loadFlag && scene_mode == _constants.MODE_DRAWING_ITEM_3D) {
|
|
1830
1865
|
itemsActions.toggleLoadingCabinet();
|
|
1831
1866
|
}
|
|
1832
1867
|
var catalogElement = catalog.getElement(item.type);
|
|
1833
|
-
if (!catalogElement) catalogElement = catalog.getElement(returnReplaceableDeepSearchType(item.type));
|
|
1868
|
+
if (!catalogElement) catalogElement = catalog.getElement((0, _utils.returnReplaceableDeepSearchType)(item.type));
|
|
1834
1869
|
if (!catalogElement) return false;
|
|
1835
1870
|
return catalogElement.render3D(item, layer, sceneData, mode).then(function (item3D) {
|
|
1836
1871
|
if (item3D instanceof Three.LOD) {
|
|
@@ -1838,7 +1873,7 @@ function addItem(sceneData, planData, layer, itemID, catalog, itemsActions) {
|
|
|
1838
1873
|
}
|
|
1839
1874
|
if (rItem !== null) {
|
|
1840
1875
|
planData.plan.remove(rItem);
|
|
1841
|
-
disposeObject(rItem);
|
|
1876
|
+
(0, _threeMemoryCleaner.disposeObject)(rItem);
|
|
1842
1877
|
rItem = null;
|
|
1843
1878
|
}
|
|
1844
1879
|
var pivot = new Three.Object3D();
|
|
@@ -1881,7 +1916,7 @@ function addItem(sceneData, planData, layer, itemID, catalog, itemsActions) {
|
|
|
1881
1916
|
var opacity = layer.opacity;
|
|
1882
1917
|
if (item.selected) {
|
|
1883
1918
|
opacity = 1;
|
|
1884
|
-
fVLine = [];
|
|
1919
|
+
exports.fVLine = fVLine = [];
|
|
1885
1920
|
var TransformGizmo = item3D.children[item3D.children.length - 1];
|
|
1886
1921
|
TransformGizmo.children.forEach(function (child) {
|
|
1887
1922
|
if (child.type === 'Line' && child.geometry.attributes !== undefined) fVLine.push(child);
|
|
@@ -1927,11 +1962,11 @@ function addItem(sceneData, planData, layer, itemID, catalog, itemsActions) {
|
|
|
1927
1962
|
var r3 = itemRect.rect[3];
|
|
1928
1963
|
|
|
1929
1964
|
// it doesn't need consider distance between item's line01 (frontside - it has door) and wall
|
|
1930
|
-
var delta12 = GeometryUtils.distancePointFromLineSegment(l0, l1, (r1.x + r2.x) / 2, (r1.y + r2.y) / 2); // distance between item's line12 and wall
|
|
1931
|
-
var delta23 = GeometryUtils.distancePointFromLineSegment(l0, l1, (r2.x + r3.x) / 2, (r2.y + r3.y) / 2); // distance between item's line23 and wall
|
|
1932
|
-
var delta30 = GeometryUtils.distancePointFromLineSegment(l0, l1, (r3.x + r0.x) / 2, (r3.y + r0.y) / 2); // distance between item's line30 and wall
|
|
1965
|
+
var delta12 = _export.GeometryUtils.distancePointFromLineSegment(l0, l1, (r1.x + r2.x) / 2, (r1.y + r2.y) / 2); // distance between item's line12 and wall
|
|
1966
|
+
var delta23 = _export.GeometryUtils.distancePointFromLineSegment(l0, l1, (r2.x + r3.x) / 2, (r2.y + r3.y) / 2); // distance between item's line23 and wall
|
|
1967
|
+
var delta30 = _export.GeometryUtils.distancePointFromLineSegment(l0, l1, (r3.x + r0.x) / 2, (r3.y + r0.y) / 2); // distance between item's line30 and wall
|
|
1933
1968
|
|
|
1934
|
-
if (delta12 < DISTANCE_EPSILON || delta23 < DISTANCE_EPSILON || delta30 < DISTANCE_EPSILON) {
|
|
1969
|
+
if (delta12 < _constants.DISTANCE_EPSILON || delta23 < _constants.DISTANCE_EPSILON || delta30 < _constants.DISTANCE_EPSILON) {
|
|
1935
1970
|
itemVisible = true;
|
|
1936
1971
|
}
|
|
1937
1972
|
return itemVisible;
|
|
@@ -1945,10 +1980,10 @@ function addItem(sceneData, planData, layer, itemID, catalog, itemsActions) {
|
|
|
1945
1980
|
};
|
|
1946
1981
|
var catid = item.type;
|
|
1947
1982
|
var cat = catalog.elements[catid];
|
|
1948
|
-
if (!cat) cat = catalog.elements[returnReplaceableDeepSearchType(catid)];
|
|
1949
|
-
var width = convert(item.properties.getIn(['width', '_length'])).from('in').to(sceneData.unit);
|
|
1950
|
-
var height = convert(item.properties.getIn(['height', '_length'])).from('in').to(sceneData.unit);
|
|
1951
|
-
var depth = convert(item.properties.getIn(['depth', '_length'])).from('in').to(sceneData.unit);
|
|
1983
|
+
if (!cat) cat = catalog.elements[(0, _utils.returnReplaceableDeepSearchType)(catid)];
|
|
1984
|
+
var width = (0, _convertUnitsLite.convert)(item.properties.getIn(['width', '_length'])).from('in').to(sceneData.unit);
|
|
1985
|
+
var height = (0, _convertUnitsLite.convert)(item.properties.getIn(['height', '_length'])).from('in').to(sceneData.unit);
|
|
1986
|
+
var depth = (0, _convertUnitsLite.convert)(item.properties.getIn(['depth', '_length'])).from('in').to(sceneData.unit);
|
|
1952
1987
|
val.size = {
|
|
1953
1988
|
width: width,
|
|
1954
1989
|
height: height,
|
|
@@ -1957,24 +1992,24 @@ function addItem(sceneData, planData, layer, itemID, catalog, itemsActions) {
|
|
|
1957
1992
|
val.layoutpos = cat.info.layoutpos;
|
|
1958
1993
|
val.is_corner = cat.info.is_corner;
|
|
1959
1994
|
val.item = item;
|
|
1960
|
-
var calcrect = GeometryUtils.getCalcRectFromItem3D(val);
|
|
1995
|
+
var calcrect = _export.GeometryUtils.getCalcRectFromItem3D(val);
|
|
1961
1996
|
|
|
1962
1997
|
// In elevation view, determin if item show or not
|
|
1963
|
-
if (isElevationView(mode)) pivot.visible = getItemVisible(calcrect);
|
|
1998
|
+
if ((0, _helper.isElevationView)(mode)) pivot.visible = getItemVisible(calcrect);
|
|
1964
1999
|
planData.plan.add(pivot);
|
|
1965
2000
|
planData.sceneGraph.layers[layer.id].items[item.id] = pivot;
|
|
1966
2001
|
//In a 3D view, merge each couterTop of equal height into a single conuterTop.
|
|
1967
|
-
if (!isElevationView(mode)) {
|
|
2002
|
+
if (!(0, _helper.isElevationView)(mode)) {
|
|
1968
2003
|
addCountertop(planData.sceneGraph.layers[layer.id].countertops, item, planData, layer);
|
|
1969
2004
|
}
|
|
1970
|
-
if (bAddMolding && item.category === 'cabinet' && (isElevationView(mode) && getItemVisible(calcrect) || !isElevationView(mode))) {
|
|
2005
|
+
if (bAddMolding && item.category === 'cabinet' && ((0, _helper.isElevationView)(mode) && getItemVisible(calcrect) || !(0, _helper.isElevationView)(mode))) {
|
|
1971
2006
|
planData.sceneGraph.layers[layer.id].moldingGroups = addMolding(planData.sceneGraph.layers[layer.id].moldingGroups, item, planData, layer, itemsActions, mode) || planData.sceneGraph.layers[layer.id].moldingGroups;
|
|
1972
2007
|
}
|
|
1973
2008
|
if (pivot) {
|
|
1974
2009
|
// update the tool object's position to selected object's position
|
|
1975
2010
|
var selectedItem = planData.sceneGraph.layers[sceneData.selectedLayer].items[itemID];
|
|
1976
2011
|
var itemPos = selectedItem.position.clone();
|
|
1977
|
-
if (!isEmpty(toolObj)) {
|
|
2012
|
+
if (!(0, _helper.isEmpty)(toolObj)) {
|
|
1978
2013
|
toolObj.position.set(planData.plan.position.x + itemPos.x, selectedItem.category === 'lighting' ? -planData.plan.position.y - selectedItem.properties.get('height').get('length') : planData.plan.position.y + selectedItem.children[0].position.y, planData.plan.position.z + itemPos.z);
|
|
1979
2014
|
}
|
|
1980
2015
|
pivot.children[0].children.forEach(function (pivotElement) {
|
|
@@ -2002,7 +2037,7 @@ function addItem(sceneData, planData, layer, itemID, catalog, itemsActions) {
|
|
|
2002
2037
|
setTimeout(function () {
|
|
2003
2038
|
return getDistances(layer);
|
|
2004
2039
|
}, 100);
|
|
2005
|
-
if (!sceneData.loadFlag && scene_mode == MODE_DRAWING_ITEM_3D) {
|
|
2040
|
+
if (!sceneData.loadFlag && scene_mode == _constants.MODE_DRAWING_ITEM_3D) {
|
|
2006
2041
|
itemsActions.endLoading();
|
|
2007
2042
|
itemsActions.toggleLoadingCabinet();
|
|
2008
2043
|
}
|
|
@@ -2065,14 +2100,14 @@ function applyOpacity(object, opacity) {
|
|
|
2065
2100
|
function updateBoundingBox(planData) {
|
|
2066
2101
|
var flag = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
2067
2102
|
var mode = arguments.length > 2 ? arguments[2] : undefined;
|
|
2068
|
-
if (scene_mode == MODE_DRAWING_ITEM_3D) return;
|
|
2103
|
+
if (scene_mode == _constants.MODE_DRAWING_ITEM_3D) return;
|
|
2069
2104
|
var newBoundingBox = new Three.Box3().setFromObject(planData.plan);
|
|
2070
2105
|
if (isFinite(newBoundingBox.max.x) && isFinite(newBoundingBox.min.x) && isFinite(newBoundingBox.max.y) && isFinite(newBoundingBox.min.y) && isFinite(newBoundingBox.max.z) && isFinite(newBoundingBox.min.z)) {
|
|
2071
2106
|
var newCenter = new Three.Vector3((newBoundingBox.max.x - newBoundingBox.min.x) / 2 + newBoundingBox.min.x, (newBoundingBox.max.y - newBoundingBox.min.y) / 2 + newBoundingBox.min.y, (newBoundingBox.max.z - newBoundingBox.min.z) / 2 + newBoundingBox.min.z);
|
|
2072
2107
|
if (!flag) {
|
|
2073
2108
|
planData.plan.position.sub(newCenter);
|
|
2074
2109
|
planData.grid.position.sub(newCenter);
|
|
2075
|
-
if (isElevationView(mode)) {
|
|
2110
|
+
if ((0, _helper.isElevationView)(mode)) {
|
|
2076
2111
|
planData.cam.position.sub(newCenter);
|
|
2077
2112
|
}
|
|
2078
2113
|
}
|
|
@@ -2179,7 +2214,7 @@ function createCTFromItem(item, unit, catalog) {
|
|
|
2179
2214
|
function createCTFromItems(items, unit, catalog) {
|
|
2180
2215
|
var item0 = items[0];
|
|
2181
2216
|
var item1 = items[items.length - 1];
|
|
2182
|
-
var CTId = IDBroker.acquireID();
|
|
2217
|
+
var CTId = _export.IDBroker.acquireID();
|
|
2183
2218
|
var ct3d = null;
|
|
2184
2219
|
var catid = item0.type;
|
|
2185
2220
|
var pos = {
|
|
@@ -2193,13 +2228,13 @@ function createCTFromItems(items, unit, catalog) {
|
|
|
2193
2228
|
// let height = convert(item0.properties.getIn(['height', '_length'])).from('in').to('cm');
|
|
2194
2229
|
var width = item0.properties.get('width').get('_length');
|
|
2195
2230
|
var widthUnit = item0.properties.get('width').get('_unit') || 'cm';
|
|
2196
|
-
width = convert(width).from(widthUnit).to('cm');
|
|
2231
|
+
width = (0, _convertUnitsLite.convert)(width).from(widthUnit).to('cm');
|
|
2197
2232
|
var depth = item0.properties.get('depth').get('_length');
|
|
2198
2233
|
var depthUnit = item0.properties.get('depth').get('_unit') || 'cm';
|
|
2199
|
-
depth = convert(depth).from(depthUnit).to('cm');
|
|
2234
|
+
depth = (0, _convertUnitsLite.convert)(depth).from(depthUnit).to('cm');
|
|
2200
2235
|
var height = item0.properties.get('height').get('_length');
|
|
2201
2236
|
var heightUnit = item0.properties.get('height').get('_unit') || 'cm';
|
|
2202
|
-
height = convert(height).from(heightUnit).to('cm');
|
|
2237
|
+
height = (0, _convertUnitsLite.convert)(height).from(heightUnit).to('cm');
|
|
2203
2238
|
var size = {
|
|
2204
2239
|
width: width * items.length,
|
|
2205
2240
|
depth: depth,
|
|
@@ -2215,22 +2250,22 @@ function createCTFromItems(items, unit, catalog) {
|
|
|
2215
2250
|
size: size
|
|
2216
2251
|
};
|
|
2217
2252
|
}
|
|
2218
|
-
|
|
2219
|
-
var MDId = IDBroker.acquireID();
|
|
2253
|
+
function createMDFromItem(item, lines, molding) {
|
|
2254
|
+
var MDId = _export.IDBroker.acquireID();
|
|
2220
2255
|
var z = item.properties.get('altitude').get('_length');
|
|
2221
2256
|
var zUnit = item.properties.get('altitude').get('_unit') || 'cm';
|
|
2222
|
-
z = convert(z).from(zUnit).to('cm');
|
|
2257
|
+
z = (0, _convertUnitsLite.convert)(z).from(zUnit).to('cm');
|
|
2223
2258
|
var height = item.properties.get('height').get('_length');
|
|
2224
2259
|
var heightUnit = item.properties.get('height').get('_unit') || 'cm';
|
|
2225
|
-
height = convert(height).from(heightUnit).to('cm');
|
|
2260
|
+
height = (0, _convertUnitsLite.convert)(height).from(heightUnit).to('cm');
|
|
2226
2261
|
switch (molding.location_type) {
|
|
2227
|
-
case TOP_MOLDING_LOCATION:
|
|
2262
|
+
case _constants.TOP_MOLDING_LOCATION:
|
|
2228
2263
|
z += height;
|
|
2229
2264
|
break;
|
|
2230
|
-
case MIDDLE_MOLDING_LOCATION:
|
|
2265
|
+
case _constants.MIDDLE_MOLDING_LOCATION:
|
|
2231
2266
|
z += height / 2;
|
|
2232
2267
|
break;
|
|
2233
|
-
case BOTTOM_MOLDING_LOCATION:
|
|
2268
|
+
case _constants.BOTTOM_MOLDING_LOCATION:
|
|
2234
2269
|
z += 0;
|
|
2235
2270
|
break;
|
|
2236
2271
|
default:
|
|
@@ -2266,7 +2301,7 @@ function tryAdjacent(ct1, ct2) {
|
|
|
2266
2301
|
if (ct1.rotRad != ct2.rotRad) return false;
|
|
2267
2302
|
log('ct1', ct1.pos.x, ct1.pos.y, ct1.size.width);
|
|
2268
2303
|
log('ct2', ct2.pos.x, ct2.pos.y, ct2.size.width);
|
|
2269
|
-
var dist = GeometryUtils.verticesDistance(ct1.pos, ct2.pos);
|
|
2304
|
+
var dist = _export.GeometryUtils.verticesDistance(ct1.pos, ct2.pos);
|
|
2270
2305
|
var totalwidth = ct1.size.width + ct2.size.width;
|
|
2271
2306
|
log('epsilon', dist, totalwidth, Math.abs(2 * dist - totalwidth));
|
|
2272
2307
|
if (Math.abs(2 * dist - totalwidth) / totalwidth > 1e-3) return false;
|
|
@@ -2280,8 +2315,8 @@ function tryAdjacent(ct1, ct2) {
|
|
|
2280
2315
|
depth: ct1.size.depth,
|
|
2281
2316
|
height: ct1.size.height
|
|
2282
2317
|
};
|
|
2283
|
-
var CTId = IDBroker.acquireID();
|
|
2284
|
-
var items = GeometryUtils.compareVertices(ct1.pos, ct2.pos) > 0 ? [].concat(
|
|
2318
|
+
var CTId = _export.IDBroker.acquireID();
|
|
2319
|
+
var items = _export.GeometryUtils.compareVertices(ct1.pos, ct2.pos) > 0 ? [].concat((0, _toConsumableArray2["default"])(ct1.items), (0, _toConsumableArray2["default"])(ct2.items)) : [].concat((0, _toConsumableArray2["default"])(ct2.items), (0, _toConsumableArray2["default"])(ct1.items));
|
|
2285
2320
|
var ct3d = null;
|
|
2286
2321
|
var catid = ct1.catid;
|
|
2287
2322
|
return {
|
|
@@ -2296,17 +2331,17 @@ function tryAdjacent(ct1, ct2) {
|
|
|
2296
2331
|
}
|
|
2297
2332
|
function isParallelLines(line1, line2) {
|
|
2298
2333
|
var isParallel = false;
|
|
2299
|
-
if (Math.abs(line1[0].y - line1[1].y) <= EPSILON && Math.abs(line2[0].y - line2[1].y) <= EPSILON) isParallel = true;
|
|
2300
|
-
if (Math.abs(line1[0].x - line1[1].x) <= EPSILON && Math.abs(line2[0].x - line2[1].x) <= EPSILON) isParallel = true;
|
|
2301
|
-
if (Math.abs((line1[0].x - line1[1].x) / (line1[0].y - line1[1].y) - (line2[0].x - line2[1].x) / (line2[0].y - line2[1].y)) <= EPSILON) isParallel = true;
|
|
2334
|
+
if (Math.abs(line1[0].y - line1[1].y) <= _constants.EPSILON && Math.abs(line2[0].y - line2[1].y) <= _constants.EPSILON) isParallel = true;
|
|
2335
|
+
if (Math.abs(line1[0].x - line1[1].x) <= _constants.EPSILON && Math.abs(line2[0].x - line2[1].x) <= _constants.EPSILON) isParallel = true;
|
|
2336
|
+
if (Math.abs((line1[0].x - line1[1].x) / (line1[0].y - line1[1].y) - (line2[0].x - line2[1].x) / (line2[0].y - line2[1].y)) <= _constants.EPSILON) isParallel = true;
|
|
2302
2337
|
if (isParallel) {
|
|
2303
2338
|
return true;
|
|
2304
2339
|
}
|
|
2305
2340
|
return false;
|
|
2306
2341
|
}
|
|
2307
|
-
|
|
2342
|
+
function tryAdjacentMD(md1, md2, molding) {
|
|
2308
2343
|
log('----tryAdjacent', md1.id, md2.id);
|
|
2309
|
-
if (Math.abs(md1.pos.z - md2.pos.z) > EPSILON) return false;
|
|
2344
|
+
if (Math.abs(md1.pos.z - md2.pos.z) > _constants.EPSILON) return false;
|
|
2310
2345
|
var id1 = md1.items[0].doorStyle.hasOwnProperty('id') ? md1.items[0].doorStyle.id : md1.items[0].doorStyle.toJS().id,
|
|
2311
2346
|
id2 = md2.items[0].doorStyle.hasOwnProperty('id') ? md2.items[0].doorStyle.id : md2.items[0].doorStyle.toJS().id;
|
|
2312
2347
|
if (id1 !== id2) return false;
|
|
@@ -2322,30 +2357,30 @@ export function tryAdjacentMD(md1, md2, molding) {
|
|
|
2322
2357
|
}) === -1) return false;
|
|
2323
2358
|
// is parallel two lines
|
|
2324
2359
|
if (isParallelLines(line1, line2)) {
|
|
2325
|
-
var disLine1 = GeometryUtils.verticesDistance(line1[0], line1[1]);
|
|
2326
|
-
var disLine2 = GeometryUtils.verticesDistance(line2[0], line2[1]);
|
|
2327
|
-
if (GeometryUtils.sameMDistances(GeometryUtils.verticesDistance(line2[0], line1[0]) + GeometryUtils.verticesDistance(line1[1], line2[1]), Math.abs(disLine2 - disLine1))) {
|
|
2360
|
+
var disLine1 = _export.GeometryUtils.verticesDistance(line1[0], line1[1]);
|
|
2361
|
+
var disLine2 = _export.GeometryUtils.verticesDistance(line2[0], line2[1]);
|
|
2362
|
+
if (_export.GeometryUtils.sameMDistances(_export.GeometryUtils.verticesDistance(line2[0], line1[0]) + _export.GeometryUtils.verticesDistance(line1[1], line2[1]), Math.abs(disLine2 - disLine1))) {
|
|
2328
2363
|
newLines = newLines.filter(function (a) {
|
|
2329
2364
|
return !(a[2] === line1[2] || a[2] === line2[2]);
|
|
2330
2365
|
});
|
|
2331
|
-
if (!GeometryUtils.sameMPoints(line1[0], line2[0])) newLines.push([line1[0], line2[0], IDBroker.acquireID()]);
|
|
2332
|
-
if (!GeometryUtils.sameMPoints(line1[1], line2[1])) newLines.push([line1[1], line2[1], IDBroker.acquireID()]);
|
|
2366
|
+
if (!_export.GeometryUtils.sameMPoints(line1[0], line2[0])) newLines.push([line1[0], line2[0], _export.IDBroker.acquireID()]);
|
|
2367
|
+
if (!_export.GeometryUtils.sameMPoints(line1[1], line2[1])) newLines.push([line1[1], line2[1], _export.IDBroker.acquireID()]);
|
|
2333
2368
|
isMerge = true;
|
|
2334
2369
|
return false;
|
|
2335
2370
|
}
|
|
2336
|
-
if (GeometryUtils.sameMDistances(GeometryUtils.verticesDistance(line2[0], line1[1]) + GeometryUtils.verticesDistance(line1[0], line2[1]), Math.abs(disLine2 - disLine1))) {
|
|
2371
|
+
if (_export.GeometryUtils.sameMDistances(_export.GeometryUtils.verticesDistance(line2[0], line1[1]) + _export.GeometryUtils.verticesDistance(line1[0], line2[1]), Math.abs(disLine2 - disLine1))) {
|
|
2337
2372
|
newLines = newLines.filter(function (a) {
|
|
2338
2373
|
return !(a[2] === line1[2] || a[2] === line2[2]);
|
|
2339
2374
|
});
|
|
2340
|
-
if (!GeometryUtils.sameMPoints(line1[1], line2[0])) newLines.push([line1[1], line2[0], IDBroker.acquireID()]);
|
|
2341
|
-
if (!GeometryUtils.sameMPoints(line1[0], line2[1])) newLines.push([line1[0], line2[1], IDBroker.acquireID()]);
|
|
2375
|
+
if (!_export.GeometryUtils.sameMPoints(line1[1], line2[0])) newLines.push([line1[1], line2[0], _export.IDBroker.acquireID()]);
|
|
2376
|
+
if (!_export.GeometryUtils.sameMPoints(line1[0], line2[1])) newLines.push([line1[0], line2[1], _export.IDBroker.acquireID()]);
|
|
2342
2377
|
isMerge = true;
|
|
2343
2378
|
return false;
|
|
2344
2379
|
}
|
|
2345
2380
|
var samePointNum = -1,
|
|
2346
2381
|
i = 0;
|
|
2347
2382
|
while (i < 4 && samePointNum === -1) {
|
|
2348
|
-
if (GeometryUtils.sameMPoints(line1[Math.floor(i / 2)], line2[i % 2]) && GeometryUtils.sameMDistances(disLine1 + disLine2, GeometryUtils.verticesDistance(line1[Math.floor((3 - i) / 2)], line2[(3 - i) % 2]))) {
|
|
2383
|
+
if (_export.GeometryUtils.sameMPoints(line1[Math.floor(i / 2)], line2[i % 2]) && _export.GeometryUtils.sameMDistances(disLine1 + disLine2, _export.GeometryUtils.verticesDistance(line1[Math.floor((3 - i) / 2)], line2[(3 - i) % 2]))) {
|
|
2349
2384
|
samePointNum = 3 - i;
|
|
2350
2385
|
} else {
|
|
2351
2386
|
i++;
|
|
@@ -2355,14 +2390,14 @@ export function tryAdjacentMD(md1, md2, molding) {
|
|
|
2355
2390
|
newLines = newLines.filter(function (a) {
|
|
2356
2391
|
return !(a[2] === line1[2] || a[2] === line2[2]);
|
|
2357
2392
|
});
|
|
2358
|
-
newLines.push([_objectSpread({}, line1[Math.floor(samePointNum / 2)]), _objectSpread({}, line2[samePointNum % 2]), IDBroker.acquireID()]);
|
|
2393
|
+
newLines.push([_objectSpread({}, line1[Math.floor(samePointNum / 2)]), _objectSpread({}, line2[samePointNum % 2]), _export.IDBroker.acquireID()]);
|
|
2359
2394
|
isMerge = true;
|
|
2360
2395
|
return false;
|
|
2361
2396
|
}
|
|
2362
2397
|
var pointNum = -1,
|
|
2363
2398
|
k = 0;
|
|
2364
2399
|
while (k < 4 && pointNum === -1) {
|
|
2365
|
-
if (GeometryUtils.sameMDistances(GeometryUtils.verticesDistance(line1[Math.floor(k / 2)], line2[k % 2]) + GeometryUtils.verticesDistance(line1[1 - Math.floor(k / 2)], line2[k % 2]), disLine1) && GeometryUtils.sameMDistances(GeometryUtils.verticesDistance(line1[1 - Math.floor(k / 2)], line2[k % 2]) + GeometryUtils.verticesDistance(line1[1 - Math.floor(k / 2)], line2[1 - k % 2]), disLine2)) {
|
|
2400
|
+
if (_export.GeometryUtils.sameMDistances(_export.GeometryUtils.verticesDistance(line1[Math.floor(k / 2)], line2[k % 2]) + _export.GeometryUtils.verticesDistance(line1[1 - Math.floor(k / 2)], line2[k % 2]), disLine1) && _export.GeometryUtils.sameMDistances(_export.GeometryUtils.verticesDistance(line1[1 - Math.floor(k / 2)], line2[k % 2]) + _export.GeometryUtils.verticesDistance(line1[1 - Math.floor(k / 2)], line2[1 - k % 2]), disLine2)) {
|
|
2366
2401
|
pointNum = k;
|
|
2367
2402
|
} else {
|
|
2368
2403
|
k++;
|
|
@@ -2375,12 +2410,12 @@ export function tryAdjacentMD(md1, md2, molding) {
|
|
|
2375
2410
|
if (!newLines.length) return _objectSpread({}, md2);
|
|
2376
2411
|
if (!isMerge) return false;
|
|
2377
2412
|
return {
|
|
2378
|
-
id: IDBroker.acquireID(),
|
|
2379
|
-
items: [].concat(
|
|
2413
|
+
id: _export.IDBroker.acquireID(),
|
|
2414
|
+
items: [].concat((0, _toConsumableArray2["default"])(md2.items.filter(function (item) {
|
|
2380
2415
|
return md1.items.findIndex(function (it) {
|
|
2381
2416
|
return it.id === item.id;
|
|
2382
2417
|
}) === -1;
|
|
2383
|
-
})),
|
|
2418
|
+
})), (0, _toConsumableArray2["default"])(md1.items)),
|
|
2384
2419
|
meshes: [],
|
|
2385
2420
|
pos: md1.pos,
|
|
2386
2421
|
size: md1.size,
|
|
@@ -2396,9 +2431,9 @@ function showItemCT(item, CT, visible, planData, layer) {
|
|
|
2396
2431
|
child.visible = visible;
|
|
2397
2432
|
if (child.material.map === null) {
|
|
2398
2433
|
var normalMap = item.counterTop.uri;
|
|
2399
|
-
var interiortexture = loadTexture(normalMap);
|
|
2434
|
+
var interiortexture = (0, _itemLoader.loadTexture)(normalMap);
|
|
2400
2435
|
applyTexture(child.material, interiortexture, 100, 100);
|
|
2401
|
-
child.material.color = new Color(1, 1, 1);
|
|
2436
|
+
child.material.color = new _three.Color(1, 1, 1);
|
|
2402
2437
|
return;
|
|
2403
2438
|
}
|
|
2404
2439
|
child.material.map.repeat.x = 1;
|
|
@@ -2431,7 +2466,7 @@ function getDoorStyleMaterial(items, planData, layer, name) {
|
|
|
2431
2466
|
var door_mesh = null;
|
|
2432
2467
|
if (!item3D) return undefined;
|
|
2433
2468
|
item3D.traverse(function (child) {
|
|
2434
|
-
if (!door_mesh && !child.name.includes('countertop') && !child.name.includes('_interior_') && !child.name.includes('handle') && child.type === OBJTYPE_MESH) {
|
|
2469
|
+
if (!door_mesh && !child.name.includes('countertop') && !child.name.includes('_interior_') && !child.name.includes('handle') && child.type === _constants.OBJTYPE_MESH) {
|
|
2435
2470
|
door_mesh = child;
|
|
2436
2471
|
}
|
|
2437
2472
|
});
|
|
@@ -2481,7 +2516,7 @@ function addCTMesh(countertop, planData, layer) {
|
|
|
2481
2516
|
var unit_width = countertop.items.find(function (ct) {
|
|
2482
2517
|
return !ct.type.includes('Dishwasher') && !ct.type.includes('BF');
|
|
2483
2518
|
}).properties.get('width').get('_unit') || 'cm';
|
|
2484
|
-
width = convert(width).from(unit_width).to('cm');
|
|
2519
|
+
width = (0, _convertUnitsLite.convert)(width).from(unit_width).to('cm');
|
|
2485
2520
|
pivotMat.scale(new Three.Vector3(countertop.size.width / width, 1, 1));
|
|
2486
2521
|
var finalMat = objMat.premultiply(pivotMat);
|
|
2487
2522
|
_ct3d.applyMatrix4(finalMat);
|
|
@@ -2510,7 +2545,7 @@ function moldingVertices(mPointGroup, mdGeo, MDV, model, svg_width, svg_height,
|
|
|
2510
2545
|
|
|
2511
2546
|
// Point O
|
|
2512
2547
|
var o = new Three.Vector2(0, 0);
|
|
2513
|
-
if (GeometryUtils.samePoints(pointGroup[0], pointGroup[length - 1])) {
|
|
2548
|
+
if (_export.GeometryUtils.samePoints(pointGroup[0], pointGroup[length - 1])) {
|
|
2514
2549
|
pointGroup = pointGroup.slice(0, length - 1);
|
|
2515
2550
|
length--;
|
|
2516
2551
|
isSnap = false;
|
|
@@ -2679,7 +2714,7 @@ var assignUVsA = function assignUVsA(geometry) {
|
|
|
2679
2714
|
/*
|
|
2680
2715
|
Remove specified type of 3d object easily
|
|
2681
2716
|
*/
|
|
2682
|
-
|
|
2717
|
+
function deleteSpecifiedMeshObjects(type) {
|
|
2683
2718
|
var childLen = planData.plan.children.length;
|
|
2684
2719
|
var children = [];
|
|
2685
2720
|
for (var i = 0; i < childLen; i++) {
|
|
@@ -2687,18 +2722,18 @@ export function deleteSpecifiedMeshObjects(type) {
|
|
|
2687
2722
|
}
|
|
2688
2723
|
planData.plan.children = children;
|
|
2689
2724
|
}
|
|
2690
|
-
|
|
2725
|
+
function getMeshesFromScene() {
|
|
2691
2726
|
var childLen = planData.plan.children.length;
|
|
2692
2727
|
var children = [];
|
|
2693
2728
|
for (var i = 0; i < childLen; i++) {
|
|
2694
|
-
if (planData.plan.children[i].type == OBJTYPE_MESH) children.push(planData.plan.children[i]);
|
|
2729
|
+
if (planData.plan.children[i].type == _constants.OBJTYPE_MESH) children.push(planData.plan.children[i]);
|
|
2695
2730
|
}
|
|
2696
2731
|
return children;
|
|
2697
2732
|
}
|
|
2698
|
-
|
|
2733
|
+
function threedfabs(a) {
|
|
2699
2734
|
return a > 0 ? a : -a;
|
|
2700
2735
|
}
|
|
2701
|
-
|
|
2736
|
+
function getDistanceBetweenLineSegment(pos1, pos2, pos3, pos4) {
|
|
2702
2737
|
if (pos1.x == pos2.x && pos3.x == pos4.x) return pos3.x - pos1.x;else if (pos1.y == pos2.y && pos3.y == pos4.y) return pos3.y - pos1.y;else return -1;
|
|
2703
2738
|
}
|
|
2704
2739
|
|
|
@@ -2707,7 +2742,7 @@ export function getDistanceBetweenLineSegment(pos1, pos2, pos3, pos4) {
|
|
|
2707
2742
|
* @param _item
|
|
2708
2743
|
* @returns true if it's not suitable.
|
|
2709
2744
|
*/
|
|
2710
|
-
|
|
2745
|
+
function showYelloBox(_item) {
|
|
2711
2746
|
var _doorStyle;
|
|
2712
2747
|
var doorStyle = _item === null || _item === void 0 ? void 0 : _item.doorStyle;
|
|
2713
2748
|
|
|
@@ -2730,7 +2765,7 @@ function isSimilar(a, b) {
|
|
|
2730
2765
|
if (threedfabs(a - b) <= 0.01) return 1;
|
|
2731
2766
|
return 0;
|
|
2732
2767
|
}
|
|
2733
|
-
|
|
2768
|
+
function sameSign(pos1, pos2, pos3) {
|
|
2734
2769
|
var ch1 = 0.0;
|
|
2735
2770
|
var ch2 = 1.0;
|
|
2736
2771
|
if (isSimilar(pos1.x, pos2.x) && isSimilar(pos1.x, pos3.x)) {
|
|
@@ -2744,10 +2779,10 @@ export function sameSign(pos1, pos2, pos3) {
|
|
|
2744
2779
|
if (ch1 * ch2 >= 0) return 1;
|
|
2745
2780
|
return 0;
|
|
2746
2781
|
}
|
|
2747
|
-
|
|
2782
|
+
function getTotalDistance(pos, rect) {
|
|
2748
2783
|
var sum = 0;
|
|
2749
2784
|
for (var i = 0; i < rect.length; i++) {
|
|
2750
|
-
sum += verticesDistance(pos, rect[i]);
|
|
2785
|
+
sum += (0, _geometry2.verticesDistance)(pos, rect[i]);
|
|
2751
2786
|
}
|
|
2752
2787
|
return sum;
|
|
2753
2788
|
}
|
|
@@ -2759,7 +2794,7 @@ var applyTexture = function applyTexture(material, texture, length, height) {
|
|
|
2759
2794
|
material.map.wrapT = Three.RepeatWrapping;
|
|
2760
2795
|
material.map.repeat.set(length * 0.01, height * 0.01);
|
|
2761
2796
|
if (texture.normal) {
|
|
2762
|
-
material.normalMap = loadTexture(texture.normal.uri);
|
|
2797
|
+
material.normalMap = (0, _itemLoader.loadTexture)(texture.normal.uri);
|
|
2763
2798
|
material.normalScale = new Vector2(texture.normal.normalScaleX, texture.normal.normalScaleY);
|
|
2764
2799
|
material.normalMap.wrapS = Three.RepeatWrapping;
|
|
2765
2800
|
material.normalMap.wrapT = Three.RepeatWrapping;
|
|
@@ -2776,7 +2811,7 @@ var applyTexture = function applyTexture(material, texture, length, height) {
|
|
|
2776
2811
|
* @param {{boundingBox:Box3,catalog:Catalog,grid: Object3D,plan: Object3D,sceneData: Scene,sceneGraph}} planData
|
|
2777
2812
|
* @param {Scene} scene
|
|
2778
2813
|
*/
|
|
2779
|
-
|
|
2814
|
+
function createBacksplash(item, layer, planData, scene) {
|
|
2780
2815
|
var sceneGraph = planData.sceneGraph;
|
|
2781
2816
|
var selectedLayer = planData.sceneData.selectedLayer;
|
|
2782
2817
|
/**
|
|
@@ -2804,7 +2839,7 @@ export function createBacksplash(item, layer, planData, scene) {
|
|
|
2804
2839
|
|
|
2805
2840
|
var i,
|
|
2806
2841
|
wallItems = [];
|
|
2807
|
-
var allWallItems = GeometryUtils.getAllItemSpecified(scene, planData.catalog, WALL_CABINET_LAYOUTPOS);
|
|
2842
|
+
var allWallItems = _export.GeometryUtils.getAllItemSpecified(scene, planData.catalog, _constants.WALL_CABINET_LAYOUTPOS);
|
|
2808
2843
|
for (i = 0; i < allWallItems.others.length; i++) wallItems.push(allWallItems.others[i]);
|
|
2809
2844
|
if (allWallItems.cur) wallItems.push(allWallItems.cur);
|
|
2810
2845
|
|
|
@@ -2812,7 +2847,7 @@ export function createBacksplash(item, layer, planData, scene) {
|
|
|
2812
2847
|
|
|
2813
2848
|
var altitude = item.itemInfo.properties.get('altitude').get('_length');
|
|
2814
2849
|
var altitudeUnit = item.itemInfo.properties.get('altitude').get('_unit') || 'cm';
|
|
2815
|
-
altitude = convert(altitude).from(altitudeUnit).to('cm');
|
|
2850
|
+
altitude = (0, _convertUnitsLite.convert)(altitude).from(altitudeUnit).to('cm');
|
|
2816
2851
|
var thickness = 1,
|
|
2817
2852
|
/** Height --- altitude */depth;
|
|
2818
2853
|
|
|
@@ -2827,7 +2862,7 @@ export function createBacksplash(item, layer, planData, scene) {
|
|
|
2827
2862
|
wallItems.map(function (wallItem) {
|
|
2828
2863
|
var altitude = wallItem.itemInfo.properties.get('altitude').get('_length');
|
|
2829
2864
|
var altitudeUnit = wallItem.itemInfo.properties.get('altitude').get('_unit') || 'cm';
|
|
2830
|
-
altitude = convert(altitude).from(altitudeUnit).to('cm');
|
|
2865
|
+
altitude = (0, _convertUnitsLite.convert)(altitude).from(altitudeUnit).to('cm');
|
|
2831
2866
|
altItems.push({
|
|
2832
2867
|
x: wallItem.pos.x,
|
|
2833
2868
|
width: wallItem.size.width,
|
|
@@ -2923,7 +2958,7 @@ export function createBacksplash(item, layer, planData, scene) {
|
|
|
2923
2958
|
metalness: texture.metalness,
|
|
2924
2959
|
roughness: texture.roughness
|
|
2925
2960
|
});
|
|
2926
|
-
var interiortexture = loadTexture(texture.uri);
|
|
2961
|
+
var interiortexture = (0, _itemLoader.loadTexture)(texture.uri);
|
|
2927
2962
|
applyTexture(areaMaterial, interiortexture, splashWidth * 1.5, splashHeight * 1.5);
|
|
2928
2963
|
|
|
2929
2964
|
// Make geometry
|
|
@@ -2936,9 +2971,9 @@ export function createBacksplash(item, layer, planData, scene) {
|
|
|
2936
2971
|
backsplash.position.y = itemToSave.info.posY;
|
|
2937
2972
|
backsplash.position.z = itemToSave.info.posZ;
|
|
2938
2973
|
backsplash.rotation.y = itemToSave.info.rotY;
|
|
2939
|
-
var allLines = GeometryUtils.getAllLines(layer);
|
|
2940
|
-
var allLineRects = GeometryUtils.buildRectFromLines(layer, allLines);
|
|
2941
|
-
if (item.is_corner && GeometryUtils.isSnappedSideLine(item, allLineRects)) {
|
|
2974
|
+
var allLines = _export.GeometryUtils.getAllLines(layer);
|
|
2975
|
+
var allLineRects = _export.GeometryUtils.buildRectFromLines(layer, allLines);
|
|
2976
|
+
if (item.is_corner && _export.GeometryUtils.isSnappedSideLine(item, allLineRects)) {
|
|
2942
2977
|
// corner cabinet item.itemInfo.getIn(["cabinet_category"]) === "Corner Base Cabinets"
|
|
2943
2978
|
var geometry1 = new Three.BoxGeometry(splashWidth, splashHeight, splashDepth);
|
|
2944
2979
|
// Make backsplash mesh
|
|
@@ -2948,7 +2983,7 @@ export function createBacksplash(item, layer, planData, scene) {
|
|
|
2948
2983
|
backsplash1.position.y = posY1;
|
|
2949
2984
|
backsplash1.position.z = posZ1;
|
|
2950
2985
|
backsplash1.rotation.y = rotY1;
|
|
2951
|
-
var newBacksplash = new Group();
|
|
2986
|
+
var newBacksplash = new _three.Group();
|
|
2952
2987
|
newBacksplash.add(backsplash);
|
|
2953
2988
|
newBacksplash.add(backsplash1);
|
|
2954
2989
|
backsplash = newBacksplash;
|
|
@@ -2964,7 +2999,7 @@ export function createBacksplash(item, layer, planData, scene) {
|
|
|
2964
2999
|
if (index < 0) {
|
|
2965
3000
|
backsplashes.push(itemToSave);
|
|
2966
3001
|
} else {
|
|
2967
|
-
disposeObject(backsplashes[index].backsplash);
|
|
3002
|
+
(0, _threeMemoryCleaner.disposeObject)(backsplashes[index].backsplash);
|
|
2968
3003
|
backsplashes.splice(index, 1, itemToSave);
|
|
2969
3004
|
}
|
|
2970
3005
|
}
|
|
@@ -2977,7 +3012,7 @@ function addMGMesh(molding, planData, layer) {
|
|
|
2977
3012
|
var flag = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
2978
3013
|
var point = [];
|
|
2979
3014
|
var data = molding === null || molding === void 0 || (_molding$molding = molding.molding) === null || _molding$molding === void 0 ? void 0 : _molding$molding.data;
|
|
2980
|
-
if (isEmpty(data)) return;
|
|
3015
|
+
if ((0, _helper.isEmpty)(data)) return;
|
|
2981
3016
|
var paths = data.paths,
|
|
2982
3017
|
svg_width = data.svg_width,
|
|
2983
3018
|
svg_height = data.svg_height;
|
|
@@ -2996,7 +3031,7 @@ function addMGMesh(molding, planData, layer) {
|
|
|
2996
3031
|
_addMGMesh(molding, planData, layer, point, svg_width, svg_height, flag);
|
|
2997
3032
|
}
|
|
2998
3033
|
var isBaseCabinet = function isBaseCabinet(item) {
|
|
2999
|
-
return item.layoutpos === BASE_CABINET_LAYOUTPOS;
|
|
3034
|
+
return item.layoutpos === _constants.BASE_CABINET_LAYOUTPOS;
|
|
3000
3035
|
};
|
|
3001
3036
|
|
|
3002
3037
|
/**
|
|
@@ -3019,24 +3054,24 @@ function _addMGMesh(molding, planData, layer, data, svg_width, svg_height, flag)
|
|
|
3019
3054
|
var length = data.length; //point array
|
|
3020
3055
|
var temp_unit = child.height_unit;
|
|
3021
3056
|
if (temp_unit === 'inch') {
|
|
3022
|
-
child.height = convert(child.height).from('in').to('cm');
|
|
3057
|
+
child.height = (0, _convertUnitsLite.convert)(child.height).from('in').to('cm');
|
|
3023
3058
|
child.height_unit = 'cm';
|
|
3024
3059
|
}
|
|
3025
3060
|
temp_unit = child.width_unit;
|
|
3026
3061
|
if (temp_unit === 'inch') {
|
|
3027
|
-
child.width = convert(child.width).from('in').to('cm');
|
|
3062
|
+
child.width = (0, _convertUnitsLite.convert)(child.width).from('in').to('cm');
|
|
3028
3063
|
child.width_unit = 'cm';
|
|
3029
3064
|
}
|
|
3030
3065
|
temp_unit = child.length_unit;
|
|
3031
3066
|
if (temp_unit === 'inch') {
|
|
3032
|
-
child.length = convert(child.length).from('in').to('cm');
|
|
3067
|
+
child.length = (0, _convertUnitsLite.convert)(child.length).from('in').to('cm');
|
|
3033
3068
|
child.length_unit = 'cm';
|
|
3034
3069
|
}
|
|
3035
3070
|
geometry.needsUpdate = true;
|
|
3036
3071
|
geometry = moldingVertices(pointGroup, geometry, data, child, svg_width, svg_height, molding.pointGroups.length);
|
|
3037
3072
|
var total = geometry.attributes.position.count;
|
|
3038
3073
|
var len = geometry.attributes.position.count / length;
|
|
3039
|
-
if (!GeometryUtils.samePoints(pointGroup[0], pointGroup[pointGroup.length - 1])) {
|
|
3074
|
+
if (!_export.GeometryUtils.samePoints(pointGroup[0], pointGroup[pointGroup.length - 1])) {
|
|
3040
3075
|
len--;
|
|
3041
3076
|
}
|
|
3042
3077
|
for (var i = 0; i < len; i++) {
|
|
@@ -3077,7 +3112,7 @@ function _addMGMesh(molding, planData, layer, data, svg_width, svg_height, flag)
|
|
|
3077
3112
|
x: data[_i2 + 1].x,
|
|
3078
3113
|
y: data[_i2 + 1].y
|
|
3079
3114
|
};
|
|
3080
|
-
var posDistance = verticesDistance(v1, v2);
|
|
3115
|
+
var posDistance = (0, _geometry2.verticesDistance)(v1, v2);
|
|
3081
3116
|
sumDistance += posDistance;
|
|
3082
3117
|
if (_i2 === data.length - 2) finalDistance = sumDistance;
|
|
3083
3118
|
sumDistanceArray.push(sumDistance);
|
|
@@ -3089,7 +3124,7 @@ function _addMGMesh(molding, planData, layer, data, svg_width, svg_height, flag)
|
|
|
3089
3124
|
var uvs_item = [];
|
|
3090
3125
|
for (var _i4 = 0; _i4 < uvs_element_array.length - 1; _i4++) {
|
|
3091
3126
|
uvs_item = [0, uvs_element_array[_i4], 1, uvs_element_array[_i4], 1, uvs_element_array[_i4 + 1], 1, uvs_element_array[_i4 + 1], 0, uvs_element_array[_i4 + 1], 0, uvs_element_array[_i4]];
|
|
3092
|
-
uvs.push.apply(uvs,
|
|
3127
|
+
uvs.push.apply(uvs, (0, _toConsumableArray2["default"])(uvs_item));
|
|
3093
3128
|
}
|
|
3094
3129
|
var all_uvs = [];
|
|
3095
3130
|
for (var _i5 = 0; _i5 < pointGroup.length; _i5++) {
|
|
@@ -3116,15 +3151,15 @@ function deleteCTMesh(countertop, planData, layer) {
|
|
|
3116
3151
|
var ct3d = countertop.ct3d;
|
|
3117
3152
|
if (ct3d) {
|
|
3118
3153
|
planData.plan.remove(ct3d);
|
|
3119
|
-
disposeObject(ct3d);
|
|
3154
|
+
(0, _threeMemoryCleaner.disposeObject)(ct3d);
|
|
3120
3155
|
}
|
|
3121
3156
|
}
|
|
3122
3157
|
}
|
|
3123
|
-
|
|
3158
|
+
function deleteMGMesh(molding, planData) {
|
|
3124
3159
|
var mode = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
3125
3160
|
// mode is 3D or elevation
|
|
3126
3161
|
molding.meshes.forEach(function (mesh) {
|
|
3127
|
-
if (isElevationView(mode)) {
|
|
3162
|
+
if ((0, _helper.isElevationView)(mode)) {
|
|
3128
3163
|
var _planData$plan$childr;
|
|
3129
3164
|
// when elevation mode, remove obj same as selected global molding_name in platnData.plan
|
|
3130
3165
|
(_planData$plan$childr = planData.plan.children) === null || _planData$plan$childr === void 0 || _planData$plan$childr.forEach(function (obj) {
|
|
@@ -3134,7 +3169,7 @@ export function deleteMGMesh(molding, planData) {
|
|
|
3134
3169
|
} else {
|
|
3135
3170
|
// when 3D mode
|
|
3136
3171
|
planData.plan.remove(mesh);
|
|
3137
|
-
disposeObject(mesh);
|
|
3172
|
+
(0, _threeMemoryCleaner.disposeObject)(mesh);
|
|
3138
3173
|
}
|
|
3139
3174
|
});
|
|
3140
3175
|
molding.meshes = [];
|
|
@@ -3143,10 +3178,10 @@ function log() {
|
|
|
3143
3178
|
// console.log(...arguments);
|
|
3144
3179
|
}
|
|
3145
3180
|
function addCountertop(CTArray, addItem, planData, layer) {
|
|
3146
|
-
log('addCountertop',
|
|
3181
|
+
log('addCountertop', (0, _toConsumableArray2["default"])(CTArray), addItem.id);
|
|
3147
3182
|
var tmp = planData;
|
|
3148
3183
|
tmp = tmp && tmp.catalog.getElement(addItem.type);
|
|
3149
|
-
if (!tmp) tmp = planData.catalog.getElement(returnReplaceableDeepSearchType(addItem.type));
|
|
3184
|
+
if (!tmp) tmp = planData.catalog.getElement((0, _utils.returnReplaceableDeepSearchType)(addItem.type));
|
|
3150
3185
|
var long_name = tmp && tmp.long_name;
|
|
3151
3186
|
if (long_name.includes('Sink ')) return;
|
|
3152
3187
|
var newCT = createCTFromItem(addItem, planData.sceneGraph.unit, planData.catalog);
|
|
@@ -3169,11 +3204,11 @@ function addCountertop(CTArray, addItem, planData, layer) {
|
|
|
3169
3204
|
addCTMesh(newCT, planData, layer);
|
|
3170
3205
|
CTArray.push(newCT);
|
|
3171
3206
|
}
|
|
3172
|
-
|
|
3207
|
+
function deleteCountertop(CTArray, delItem, planData, layer) {
|
|
3173
3208
|
if (delItem == undefined) {
|
|
3174
3209
|
return;
|
|
3175
3210
|
}
|
|
3176
|
-
log('deleteCountertop',
|
|
3211
|
+
log('deleteCountertop', (0, _toConsumableArray2["default"])(CTArray), delItem.id);
|
|
3177
3212
|
var delCT = null;
|
|
3178
3213
|
var delItemIndex = -1;
|
|
3179
3214
|
var delCTIndex = CTArray.findIndex(function (el) {
|
|
@@ -3196,9 +3231,9 @@ export function deleteCountertop(CTArray, delItem, planData, layer) {
|
|
|
3196
3231
|
});
|
|
3197
3232
|
}
|
|
3198
3233
|
}
|
|
3199
|
-
|
|
3200
|
-
var tempMGArray =
|
|
3201
|
-
if (isEmpty(delItem)) {
|
|
3234
|
+
function deleteAllMolding(MGArray, delItem, planData, oldSceneLayer, newSceneLayer) {
|
|
3235
|
+
var tempMGArray = (0, _toConsumableArray2["default"])(MGArray);
|
|
3236
|
+
if ((0, _helper.isEmpty)(delItem)) {
|
|
3202
3237
|
return tempMGArray;
|
|
3203
3238
|
}
|
|
3204
3239
|
|
|
@@ -3215,7 +3250,7 @@ export function deleteAllMolding(MGArray, delItem, planData, oldSceneLayer, newS
|
|
|
3215
3250
|
// find the snapped items with delItem
|
|
3216
3251
|
var snappedItems = [];
|
|
3217
3252
|
oldSceneLayer.items.toArray().forEach(function (oItem) {
|
|
3218
|
-
if (oItem.category === 'cabinet' && oItem.id !== delItem.id && MoldingUtils.isItemSnappedItem(delItem, oItem)) {
|
|
3253
|
+
if (oItem.category === 'cabinet' && oItem.id !== delItem.id && _export.MoldingUtils.isItemSnappedItem(delItem, oItem)) {
|
|
3219
3254
|
snappedItems.push(oItem);
|
|
3220
3255
|
}
|
|
3221
3256
|
});
|
|
@@ -3227,8 +3262,8 @@ export function deleteAllMolding(MGArray, delItem, planData, oldSceneLayer, newS
|
|
|
3227
3262
|
}
|
|
3228
3263
|
return tempMGArray;
|
|
3229
3264
|
}
|
|
3230
|
-
|
|
3231
|
-
if (addItem.selected && [MODE_DRAGGING_ITEM_3D, MODE_ROTATING_ITEM_3D].includes(mode)) return false;
|
|
3265
|
+
function addMolding(MGArray, addItem, planData, layer, itemActions, mode) {
|
|
3266
|
+
if (addItem.selected && [_constants.MODE_DRAGGING_ITEM_3D, _constants.MODE_ROTATING_ITEM_3D].includes(mode)) return false;
|
|
3232
3267
|
|
|
3233
3268
|
// If the item is not available for current doorStyle
|
|
3234
3269
|
if (showYelloBox(addItem))
|
|
@@ -3262,15 +3297,15 @@ export function addMolding(MGArray, addItem, planData, layer, itemActions, mode)
|
|
|
3262
3297
|
var temp_MGArray = updateMoldingGroupArray(MGArray, addItem, planData, layer, itemActions, mode, 0);
|
|
3263
3298
|
temp_MGArray.forEach(function (mg) {
|
|
3264
3299
|
var moldingMesh = mg.meshes[0];
|
|
3265
|
-
if (isElevationView(mode)) {
|
|
3266
|
-
if (!isEmpty(moldingMesh)) {
|
|
3267
|
-
replaceMeshesWithLineSegments(moldingMesh);
|
|
3300
|
+
if ((0, _helper.isElevationView)(mode)) {
|
|
3301
|
+
if (!(0, _helper.isEmpty)(moldingMesh)) {
|
|
3302
|
+
(0, _helper.replaceMeshesWithLineSegments)(moldingMesh);
|
|
3268
3303
|
}
|
|
3269
3304
|
}
|
|
3270
3305
|
});
|
|
3271
3306
|
return temp_MGArray;
|
|
3272
3307
|
}
|
|
3273
|
-
|
|
3308
|
+
function updateMoldingGroupArray(MGArray, selItem, planData, layer) {
|
|
3274
3309
|
var itemActions = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
|
|
3275
3310
|
var mode = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : null;
|
|
3276
3311
|
var cnt = arguments.length > 6 ? arguments[6] : undefined;
|
|
@@ -3280,9 +3315,9 @@ export function updateMoldingGroupArray(MGArray, selItem, planData, layer) {
|
|
|
3280
3315
|
console.log('updateMoldingGroupArray has limited!');
|
|
3281
3316
|
return MGArray;
|
|
3282
3317
|
}
|
|
3283
|
-
var temp_MGArray =
|
|
3284
|
-
if (isEmpty(selItem)) return temp_MGArray;
|
|
3285
|
-
var isEnableMolding = MoldingUtils.isEnableItemForMolding(layer, selItem);
|
|
3318
|
+
var temp_MGArray = (0, _toConsumableArray2["default"])(MGArray);
|
|
3319
|
+
if ((0, _helper.isEmpty)(selItem)) return temp_MGArray;
|
|
3320
|
+
var isEnableMolding = _export.MoldingUtils.isEnableItemForMolding(layer, selItem);
|
|
3286
3321
|
// Make a items group with selItem to create the new MG(molding group) array of selItem
|
|
3287
3322
|
var itemsForGroup = [selItem];
|
|
3288
3323
|
var i = 0;
|
|
@@ -3290,7 +3325,7 @@ export function updateMoldingGroupArray(MGArray, selItem, planData, layer) {
|
|
|
3290
3325
|
layer.items.toArray().forEach(function (curItem) {
|
|
3291
3326
|
if (!itemsForGroup.some(function (it) {
|
|
3292
3327
|
return it.id === curItem.id;
|
|
3293
|
-
}) && curItem.category === 'cabinet' && MoldingUtils.isSameMoldingLayoutpos(curItem, itemsForGroup[i]) && MoldingUtils.isItemSnappedItem(itemsForGroup[i], curItem)) {
|
|
3328
|
+
}) && curItem.category === 'cabinet' && _export.MoldingUtils.isSameMoldingLayoutpos(curItem, itemsForGroup[i]) && _export.MoldingUtils.isItemSnappedItem(itemsForGroup[i], curItem)) {
|
|
3294
3329
|
itemsForGroup.push(curItem);
|
|
3295
3330
|
}
|
|
3296
3331
|
});
|
|
@@ -3298,7 +3333,7 @@ export function updateMoldingGroupArray(MGArray, selItem, planData, layer) {
|
|
|
3298
3333
|
}
|
|
3299
3334
|
|
|
3300
3335
|
// Create the new MG(molding group) array of selItem
|
|
3301
|
-
var new_MGArray = MoldingUtils.getAllMoldingGroups(layer, itemsForGroup);
|
|
3336
|
+
var new_MGArray = _export.MoldingUtils.getAllMoldingGroups(layer, itemsForGroup);
|
|
3302
3337
|
|
|
3303
3338
|
// get molding settings of update molding from adjoined item's molding
|
|
3304
3339
|
var changeMoldings = [];
|
|
@@ -3314,13 +3349,13 @@ export function updateMoldingGroupArray(MGArray, selItem, planData, layer) {
|
|
|
3314
3349
|
});
|
|
3315
3350
|
|
|
3316
3351
|
// if current item has not destination molding then set it to the current molding
|
|
3317
|
-
if (!isEmpty(destMolding) && !selItem.molding.some(function (md) {
|
|
3352
|
+
if (!(0, _helper.isEmpty)(destMolding) && !selItem.molding.some(function (md) {
|
|
3318
3353
|
return md.location_type === destMolding.location_type;
|
|
3319
3354
|
})) {
|
|
3320
3355
|
// only update with the same height cabinet or update the bottom molding setting
|
|
3321
3356
|
// itemActions.setMolding(destMoldings[i], false);
|
|
3322
3357
|
changeMoldings.push(destMolding);
|
|
3323
|
-
} else if (isEmpty(destMolding) && selItem.molding.some(function (md) {
|
|
3358
|
+
} else if ((0, _helper.isEmpty)(destMolding) && selItem.molding.some(function (md) {
|
|
3324
3359
|
return md.location_type === mg.location_type;
|
|
3325
3360
|
})) {
|
|
3326
3361
|
// if current item has more molding than adjoined then remove theses moldings
|
|
@@ -3338,7 +3373,7 @@ export function updateMoldingGroupArray(MGArray, selItem, planData, layer) {
|
|
|
3338
3373
|
var filteredNewMGList = new_MGArray.filter(function (mg) {
|
|
3339
3374
|
return mg.location_type === oldMG.location_type;
|
|
3340
3375
|
});
|
|
3341
|
-
if (isEmpty(filteredNewMGList)) {
|
|
3376
|
+
if ((0, _helper.isEmpty)(filteredNewMGList)) {
|
|
3342
3377
|
return true;
|
|
3343
3378
|
}
|
|
3344
3379
|
var _loop3 = function _loop3() {
|
|
@@ -3412,7 +3447,7 @@ export function updateMoldingGroupArray(MGArray, selItem, planData, layer) {
|
|
|
3412
3447
|
if (mg.molding !== null && mg.molding.itemID !== molding.itemID) {
|
|
3413
3448
|
deleteMGMesh(mg, planData, mode);
|
|
3414
3449
|
}
|
|
3415
|
-
mg = MoldingUtils.createMonldingGroup(mg, layer, molding, planData.catalog);
|
|
3450
|
+
mg = _export.MoldingUtils.createMonldingGroup(mg, layer, molding, planData.catalog);
|
|
3416
3451
|
}
|
|
3417
3452
|
if (!mg.meshes.length) {
|
|
3418
3453
|
addMGMesh(mg, planData, layer);
|
|
@@ -3441,7 +3476,7 @@ export function updateMoldingGroupArray(MGArray, selItem, planData, layer) {
|
|
|
3441
3476
|
return MGArray;
|
|
3442
3477
|
}
|
|
3443
3478
|
}
|
|
3444
|
-
|
|
3479
|
+
function removeSelItemMesh(MGArray, selItem, planData, mode) {
|
|
3445
3480
|
if (selItem) {
|
|
3446
3481
|
if (!selItem.selected) {
|
|
3447
3482
|
return;
|
|
@@ -3471,7 +3506,7 @@ export function removeSelItemMesh(MGArray, selItem, planData, mode) {
|
|
|
3471
3506
|
*
|
|
3472
3507
|
* And one-door-cabinet is the same case with the left door of two-door-cabinet
|
|
3473
3508
|
*/
|
|
3474
|
-
|
|
3509
|
+
function updateDoorHandleMesh(_, item3D, flip) {
|
|
3475
3510
|
if (!item3D) {
|
|
3476
3511
|
console.error('Item mesh is undefined.');
|
|
3477
3512
|
return;
|
|
@@ -3552,11 +3587,11 @@ export function updateDoorHandleMesh(_, item3D, flip) {
|
|
|
3552
3587
|
}
|
|
3553
3588
|
});
|
|
3554
3589
|
}
|
|
3555
|
-
|
|
3590
|
+
function addWarningBox(itemId, altitude, planData) {
|
|
3556
3591
|
deleteSpecifiedMeshObjects('WarningBox' + itemId);
|
|
3557
3592
|
var item3D = planData.sceneGraph.layers[planData.sceneData.selectedLayer].items[itemId];
|
|
3558
3593
|
if (item3D == undefined) return;
|
|
3559
|
-
var altitudeLength = convert(altitude).from('in').to('cm');
|
|
3594
|
+
var altitudeLength = (0, _convertUnitsLite.convert)(altitude).from('in').to('cm');
|
|
3560
3595
|
var sBounding = item3D.children[0].userData;
|
|
3561
3596
|
var width = sBounding.max.x - sBounding.min.x;
|
|
3562
3597
|
var height = sBounding.max.y - sBounding.min.y;
|
|
@@ -3578,7 +3613,7 @@ export function addWarningBox(itemId, altitude, planData) {
|
|
|
3578
3613
|
warnBoxObj.name = 'WarningBox' + itemId;
|
|
3579
3614
|
// planData.plan.add(warnBoxObj);
|
|
3580
3615
|
}
|
|
3581
|
-
|
|
3616
|
+
function checkCabinetOverlap(itemPos, itemRect, holeItems, planData) {
|
|
3582
3617
|
if (holeItems.length) {
|
|
3583
3618
|
var depth = itemRect.size.depth;
|
|
3584
3619
|
var i;
|
|
@@ -3595,7 +3630,7 @@ export function checkCabinetOverlap(itemPos, itemRect, holeItems, planData) {
|
|
|
3595
3630
|
if (i != holeItems.length) {
|
|
3596
3631
|
var altitude = itemRect.itemInfo.properties.get('altitude').get('_length');
|
|
3597
3632
|
var altitudeUnit = itemRect.itemInfo.properties.get('altitude').get('_unit') || 'cm';
|
|
3598
|
-
altitude = convert(altitude).from(altitudeUnit).to('cm');
|
|
3633
|
+
altitude = (0, _convertUnitsLite.convert)(altitude).from(altitudeUnit).to('cm');
|
|
3599
3634
|
addWarningBox(itemRect.itemInfo.id, altitude, planData);
|
|
3600
3635
|
}
|
|
3601
3636
|
}
|