kitchen-simulator 1.1.1-test.72 → 1.1.1-test.74
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 +2 -5
- package/es/AppContext.js +3 -6
- package/es/KitchenConfigurator.js +86 -86
- package/es/KitchenConfiguratorApp.js +134 -128
- package/es/actions/area-actions.js +5 -8
- package/es/actions/export.js +12 -24
- package/es/actions/groups-actions.js +27 -41
- package/es/actions/holes-actions.js +34 -51
- package/es/actions/items-actions.js +94 -141
- package/es/actions/lines-actions.js +21 -32
- package/es/actions/project-actions.js +94 -141
- package/es/actions/scene-actions.js +11 -17
- package/es/actions/vertices-actions.js +7 -11
- package/es/actions/viewer2d-actions.js +21 -32
- package/es/actions/viewer3d-actions.js +9 -14
- package/es/catalog/areas/area/planner-element.js +2 -5
- package/es/catalog/catalog.js +15 -17
- package/es/catalog/factories/area-factory-3d.js +22 -26
- package/es/catalog/factories/area-factory.js +13 -15
- package/es/catalog/factories/export.js +6 -10
- package/es/catalog/factories/wall-factory-3d.js +31 -36
- package/es/catalog/factories/wall-factory.js +21 -26
- package/es/catalog/holes/door-closet/planner-element.js +15 -19
- package/es/catalog/holes/door-double/planner-element.js +15 -19
- package/es/catalog/holes/door-exterior/planner-element.js +16 -20
- package/es/catalog/holes/door-interior/planner-element.js +16 -20
- package/es/catalog/holes/door-panic/planner-element.js +7 -11
- package/es/catalog/holes/door-panic-double/planner-element.js +15 -19
- package/es/catalog/holes/door-sliding/planner-element.js +17 -21
- package/es/catalog/holes/doorway-framed/planner-element.js +11 -15
- package/es/catalog/holes/doorway-frameless/planner-element.js +7 -11
- package/es/catalog/holes/export.js +13 -29
- package/es/catalog/holes/window-clear/planner-element.js +10 -14
- package/es/catalog/holes/window-cross/planner-element.js +10 -14
- package/es/catalog/holes/window-double-hung/planner-element.js +10 -14
- package/es/catalog/holes/window-vertical/planner-element.js +10 -14
- package/es/catalog/lines/wall/planner-element.js +2 -5
- package/es/catalog/molding/molding-dcm/planner-element.js +5 -9
- package/es/catalog/molding/molding-fbm/planner-element.js +5 -9
- package/es/catalog/molding/molding-lrm/planner-element.js +5 -9
- package/es/catalog/properties/export.js +20 -31
- package/es/catalog/properties/property-checkbox.js +28 -29
- package/es/catalog/properties/property-color.js +16 -19
- package/es/catalog/properties/property-enum.js +24 -27
- package/es/catalog/properties/property-hidden.js +9 -12
- package/es/catalog/properties/property-lenght-measure.js +38 -41
- package/es/catalog/properties/property-length-measure.js +36 -39
- package/es/catalog/properties/property-length-measure_hole.js +38 -41
- package/es/catalog/properties/property-number.js +17 -20
- package/es/catalog/properties/property-read-only.js +16 -19
- package/es/catalog/properties/property-string.js +16 -19
- package/es/catalog/properties/property-toggle.js +16 -19
- package/es/catalog/properties/shared-property-style.js +1 -3
- package/es/catalog/utils/FuseUtils.js +12 -13
- package/es/catalog/utils/exporter.js +10 -11
- package/es/catalog/utils/geom-utils.js +13 -24
- package/es/catalog/utils/item-loader.js +86 -92
- package/es/catalog/utils/load-obj.js +20 -24
- package/es/catalog/utils/mtl-loader.js +3 -4
- package/es/catalog/utils/obj-loader.js +3 -4
- package/es/class/FuseUtils.js +12 -13
- package/es/class/area.js +24 -24
- package/es/class/export.js +23 -36
- package/es/class/group.js +53 -55
- package/es/class/guide.js +15 -17
- package/es/class/hole.js +83 -85
- package/es/class/item.js +155 -155
- package/es/class/layer.js +59 -61
- package/es/class/line.js +135 -138
- package/es/class/project.js +93 -94
- package/es/class/vertex.js +29 -31
- package/es/components/content.js +19 -23
- package/es/components/disclaimer/disclaimer.js +10 -13
- package/es/components/export.js +8 -13
- package/es/components/style/button.js +25 -25
- package/es/components/style/cancel-button.js +7 -10
- package/es/components/style/content-container.js +11 -12
- package/es/components/style/content-title.js +13 -15
- package/es/components/style/delete-button.js +8 -12
- package/es/components/style/export.js +30 -46
- package/es/components/style/form-block.js +10 -11
- package/es/components/style/form-color-input.js +7 -10
- package/es/components/style/form-label.js +10 -11
- package/es/components/style/form-number-input.js +45 -43
- package/es/components/style/form-number-input_2.js +41 -39
- package/es/components/style/form-select.js +19 -20
- package/es/components/style/form-slider.js +10 -13
- package/es/components/style/form-submit-button.js +8 -12
- package/es/components/style/form-text-input.js +30 -28
- package/es/components/viewer2d/area.js +17 -20
- package/es/components/viewer2d/export.js +30 -46
- package/es/components/viewer2d/grids/grid-horizontal-streak.js +10 -13
- package/es/components/viewer2d/grids/grid-streak.js +10 -13
- package/es/components/viewer2d/grids/grid-vertical-streak.js +10 -13
- package/es/components/viewer2d/grids/grids.js +10 -14
- package/es/components/viewer2d/group.js +15 -19
- package/es/components/viewer2d/item.js +61 -65
- package/es/components/viewer2d/layer.js +23 -26
- package/es/components/viewer2d/line.js +101 -106
- package/es/components/viewer2d/ruler.js +22 -25
- package/es/components/viewer2d/rulerDist.js +21 -24
- package/es/components/viewer2d/rulerX.js +46 -44
- package/es/components/viewer2d/rulerY.js +44 -42
- package/es/components/viewer2d/scene.js +34 -34
- package/es/components/viewer2d/snap.js +13 -17
- package/es/components/viewer2d/state.js +18 -22
- package/es/components/viewer2d/utils.js +24 -33
- package/es/components/viewer2d/vertex.js +8 -12
- package/es/components/viewer2d/viewer2d.js +156 -159
- package/es/components/viewer3d/camera-controls-module/camera-controls.module.js +21 -19
- package/es/components/viewer3d/dcm.js +1 -3
- package/es/components/viewer3d/fbm.js +1 -3
- package/es/components/viewer3d/front3D.js +12 -16
- package/es/components/viewer3d/grid-creator.js +8 -12
- package/es/components/viewer3d/grids/grid-horizontal-streak.js +6 -9
- package/es/components/viewer3d/grids/grid-streak.js +5 -8
- package/es/components/viewer3d/grids/grid-vertical-streak.js +6 -9
- package/es/components/viewer3d/libs/first-person-controls.js +2 -5
- package/es/components/viewer3d/libs/helvetiker_regular.typeface.js +1 -3
- package/es/components/viewer3d/libs/mtl-loader.js +1 -3
- package/es/components/viewer3d/libs/obj-loader.js +1 -3
- package/es/components/viewer3d/libs/orbit-controls.js +2 -4
- package/es/components/viewer3d/libs/pointer-lock-controls.js +2 -4
- package/es/components/viewer3d/lrm.js +1 -3
- package/es/components/viewer3d/model.js +1 -3
- package/es/components/viewer3d/pointer-lock-navigation.js +3 -6
- package/es/components/viewer3d/ruler-utils/itemRect.js +18 -21
- package/es/components/viewer3d/ruler-utils/layer3D.js +59 -62
- package/es/components/viewer3d/ruler-utils/ruler3D.js +42 -43
- package/es/components/viewer3d/ruler-utils/scene3D.js +9 -13
- package/es/components/viewer3d/ruler-utils/state3D.js +4 -7
- package/es/components/viewer3d/scene-creator.js +197 -223
- package/es/components/viewer3d/three-memory-cleaner.js +3 -7
- package/es/components/viewer3d/viewer3d-first-person.js +42 -42
- package/es/components/viewer3d/viewer3d.js +200 -198
- package/es/constants.js +349 -354
- package/es/index.js +7 -11
- package/es/models.js +193 -191
- package/es/plugins/SVGLoader.js +48 -49
- package/es/plugins/autosave.js +3 -5
- package/es/plugins/console-debugger.js +6 -7
- package/es/plugins/export.js +8 -13
- package/es/plugins/keyboard.js +29 -31
- package/es/reducers/areas-reducer.js +7 -9
- package/es/reducers/export.js +24 -37
- package/es/reducers/groups-reducer.js +31 -33
- package/es/reducers/holes-reducer.js +43 -45
- package/es/reducers/items-reducer.js +106 -108
- package/es/reducers/lines-reducer.js +28 -30
- package/es/reducers/project-reducer.js +105 -107
- package/es/reducers/reducer.js +16 -19
- package/es/reducers/scene-reducer.js +15 -17
- package/es/reducers/user-reducer.js +5 -7
- package/es/reducers/vertices-reducer.js +11 -13
- package/es/reducers/viewer2d-reducer.js +18 -20
- package/es/reducers/viewer3d-reducer.js +16 -18
- package/es/shared-style.js +10 -12
- package/es/styles/export.js +3 -6
- package/es/translator/en.js +1 -3
- package/es/translator/it.js +1 -3
- package/es/translator/ru.js +1 -3
- package/es/translator/translator.js +13 -15
- package/es/utils/browser.js +2 -5
- package/es/utils/convert-units-lite.js +1 -3
- package/es/utils/email-validator.js +1 -3
- package/es/utils/export.js +15 -29
- package/es/utils/geometry.js +190 -280
- package/es/utils/get-edges-of-subgraphs.js +2 -5
- package/es/utils/graph-cycles.js +8 -7
- package/es/utils/graph-inner-cycles.js +10 -14
- package/es/utils/graph.js +9 -13
- package/es/utils/helper.js +41 -58
- package/es/utils/history.js +8 -11
- package/es/utils/id-broker.js +8 -11
- package/es/utils/logger.js +1 -3
- package/es/utils/math.js +5 -8
- package/es/utils/molding.js +130 -146
- package/es/utils/name-generator.js +7 -9
- package/es/utils/objects-utils.js +7 -14
- package/es/utils/phone-validator.js +1 -3
- package/es/utils/process-black-list.js +5 -6
- package/es/utils/react-if.js +7 -9
- package/es/utils/snap-scene.js +27 -30
- package/es/utils/snap.js +53 -57
- package/es/utils/summarizeCart.js +1 -3
- package/es/utils/threeCSG.es6.js +13 -17
- package/es/version.js +1 -3
- package/package.json +1 -1
|
@@ -1,53 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
exports.removeItem = removeItem;
|
|
22
|
-
exports.removeSelItemMesh = removeSelItemMesh;
|
|
23
|
-
exports.sameSign = sameSign;
|
|
24
|
-
exports.showYelloBox = showYelloBox;
|
|
25
|
-
exports.threedfabs = threedfabs;
|
|
26
|
-
exports.tryAdjacentMD = tryAdjacentMD;
|
|
27
|
-
exports.updateDoorHandleMesh = updateDoorHandleMesh;
|
|
28
|
-
exports.updateMoldingGroupArray = updateMoldingGroupArray;
|
|
29
|
-
exports.updateScene = updateScene;
|
|
30
|
-
exports.visibleTransformBox = visibleTransformBox;
|
|
31
|
-
var _createForOfIteratorHelper2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createForOfIteratorHelper"));
|
|
32
|
-
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
|
|
33
|
-
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/toConsumableArray"));
|
|
34
|
-
var _three = _interopRequireWildcard(require("three"));
|
|
35
|
-
var Three = _three;
|
|
36
|
-
var _gridCreator = _interopRequireDefault(require("./grid-creator"));
|
|
37
|
-
var _threeMemoryCleaner = require("./three-memory-cleaner");
|
|
38
|
-
var _constants = require("../../constants");
|
|
39
|
-
var _export = require("../../utils/export");
|
|
40
|
-
var _convertUnitsLite = require("../../utils/convert-units-lite");
|
|
41
|
-
var _geometry2 = require("../../utils/geometry");
|
|
42
|
-
var GeomUtils = _interopRequireWildcard(require("../../catalog/utils/geom-utils"));
|
|
43
|
-
var _itemLoader = require("../../catalog/utils/item-loader");
|
|
44
|
-
var _utils = require("../viewer2d/utils");
|
|
45
|
-
var _helper = require("../../utils/helper");
|
|
46
|
-
var _math = require("../../utils/math");
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
+
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
3
|
+
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
|
+
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
|
+
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
|
+
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) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
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";
|
|
47
21
|
var transformBox;
|
|
48
|
-
var fVLine =
|
|
22
|
+
export var fVLine = [];
|
|
49
23
|
var scene_mode = null;
|
|
50
|
-
function parseData(sceneData, actions, catalog, camera, renderer, mode) {
|
|
24
|
+
export function parseData(sceneData, actions, catalog, camera, renderer, mode) {
|
|
51
25
|
var planData = {
|
|
52
26
|
catalog: catalog,
|
|
53
27
|
sceneData: sceneData
|
|
@@ -69,7 +43,7 @@ function parseData(sceneData, actions, catalog, camera, renderer, mode) {
|
|
|
69
43
|
planData.cam.name = 'cam';
|
|
70
44
|
|
|
71
45
|
// Add a grid to the plan
|
|
72
|
-
planData.grid = (
|
|
46
|
+
planData.grid = createGrid(sceneData);
|
|
73
47
|
planData.grid.name = 'grid';
|
|
74
48
|
planData.boundingBox = new Three.Box3().setFromObject(planData.grid);
|
|
75
49
|
planData.boundingBox.name = 'boundingBox';
|
|
@@ -85,7 +59,7 @@ function parseData(sceneData, actions, catalog, camera, renderer, mode) {
|
|
|
85
59
|
updateBoundingBox(planData, false, mode);
|
|
86
60
|
|
|
87
61
|
// if mode is elevation, build elevation scene
|
|
88
|
-
if (
|
|
62
|
+
if (isElevationView(mode)) buildElevationScene(planData, mode);
|
|
89
63
|
}
|
|
90
64
|
resolve('success');
|
|
91
65
|
});
|
|
@@ -97,7 +71,7 @@ function parseData(sceneData, actions, catalog, camera, renderer, mode) {
|
|
|
97
71
|
|
|
98
72
|
// return planData;
|
|
99
73
|
}
|
|
100
|
-
function visibleTransformBox(flag) {
|
|
74
|
+
export function visibleTransformBox(flag) {
|
|
101
75
|
// if (transformBox instanceof Three.Mesh)
|
|
102
76
|
// transformBox.visible = flag;
|
|
103
77
|
}
|
|
@@ -122,14 +96,14 @@ var buildElevationScene = function buildElevationScene(planData, mode) {
|
|
|
122
96
|
planData.elevationGroup = elevationGroup;
|
|
123
97
|
scene.traverse(function (obj) {
|
|
124
98
|
if (obj.name == 'MainObject') {
|
|
125
|
-
|
|
99
|
+
replaceMeshesWithLineSegments(obj);
|
|
126
100
|
}
|
|
127
101
|
});
|
|
128
102
|
scene.add(elevationGroup);
|
|
129
103
|
};
|
|
130
104
|
function createLayerObjects(layer, planData, sceneData, actions, catalog, mode, camera, renderer) {
|
|
131
105
|
var promises = [];
|
|
132
|
-
var moldingGroups =
|
|
106
|
+
var moldingGroups = MoldingUtils.getAllMoldingGroups(layer);
|
|
133
107
|
planData.sceneGraph.layers[layer.id] = {
|
|
134
108
|
id: layer.id,
|
|
135
109
|
lines: {},
|
|
@@ -199,7 +173,7 @@ img2.src = '/assets/img/svg/3d_item_warning_edit.svg';
|
|
|
199
173
|
img2.onload = function () {
|
|
200
174
|
ctx.drawImage(img2, 8, 58, 34, 34);
|
|
201
175
|
};
|
|
202
|
-
function createWarningObject() {
|
|
176
|
+
export function createWarningObject() {
|
|
203
177
|
var warningTexture = new Three.Texture(canvas);
|
|
204
178
|
warningTexture.needsUpdate = true;
|
|
205
179
|
var warningObj = new Three.Sprite(new Three.SpriteMaterial({
|
|
@@ -213,7 +187,7 @@ function createWarningObject() {
|
|
|
213
187
|
warningObj.name = 'warningObj';
|
|
214
188
|
return warningObj;
|
|
215
189
|
}
|
|
216
|
-
function updateScene(planData, sceneData, oldSceneData, diffArray, actions, catalog) {
|
|
190
|
+
export function updateScene(planData, sceneData, oldSceneData, diffArray, actions, catalog) {
|
|
217
191
|
var _draggingItem$toJS, _filteredDiffs, _filteredDiffs2;
|
|
218
192
|
var mode = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : null;
|
|
219
193
|
var toolObj = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : null;
|
|
@@ -242,7 +216,7 @@ function updateScene(planData, sceneData, oldSceneData, diffArray, actions, cata
|
|
|
242
216
|
});
|
|
243
217
|
//*******************************
|
|
244
218
|
//This is executed when dragging item is end and performs the updateing filteredDiffs.
|
|
245
|
-
if ((sceneData === null || sceneData === void 0 ? void 0 : sceneData.isEndDragging) === true && draggingItem && !
|
|
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')) {
|
|
246
220
|
var _draggingItem$getIn, _draggingItem$getIn2;
|
|
247
221
|
var layerID = (_draggingItem$getIn = draggingItem.getIn) === null || _draggingItem$getIn === void 0 ? void 0 : _draggingItem$getIn.call(draggingItem, ['layerID']);
|
|
248
222
|
var itemID = (_draggingItem$getIn2 = draggingItem.getIn) === null || _draggingItem$getIn2 === void 0 ? void 0 : _draggingItem$getIn2.call(draggingItem, ['itemID']);
|
|
@@ -338,7 +312,7 @@ function updateScene(planData, sceneData, oldSceneData, diffArray, actions, cata
|
|
|
338
312
|
Promise.all(result).then(function (replaceValue) {
|
|
339
313
|
// if mode is elevation, build elevation scene
|
|
340
314
|
// When scene is updated, replaceValue is not empty.
|
|
341
|
-
if (
|
|
315
|
+
if (isElevationView(mode) && !isEmpty(replaceValue)) buildElevationScene(planData, mode);
|
|
342
316
|
resolve('successPromise');
|
|
343
317
|
});
|
|
344
318
|
});
|
|
@@ -355,22 +329,22 @@ function myAnimRotate(obj, open_doors, item, isCorner) {
|
|
|
355
329
|
animateStep = open_doors ? animateStep + 1 : animateStep - 1;
|
|
356
330
|
|
|
357
331
|
// clear interval when the opening or closing door is ended.
|
|
358
|
-
if (animateStep >
|
|
332
|
+
if (animateStep > ANIMATE_STEP_MAX || animateStep < ANIMATE_STEP_MIN) {
|
|
359
333
|
clearInterval(animate_objects[obj.name].animate_intervalID);
|
|
360
334
|
return;
|
|
361
335
|
}
|
|
362
336
|
animate_objects[obj.name].animateStep = animateStep;
|
|
363
|
-
|
|
337
|
+
animateDoor(animate_objects[obj.name].offset, obj, open_doors, item, isCorner, 'Opened3D');
|
|
364
338
|
}
|
|
365
339
|
function myAnimTranslate(obj, open_doors, item) {
|
|
366
340
|
var animateStep = animate_objects[obj.name].animateStep;
|
|
367
341
|
animateStep = open_doors ? animateStep + 1 : animateStep - 1;
|
|
368
|
-
if (animateStep >
|
|
342
|
+
if (animateStep > ANIMATE_STEP_MAX || animateStep < ANIMATE_STEP_MIN) {
|
|
369
343
|
clearInterval(animate_objects[obj.name].animate_intervalID);
|
|
370
344
|
return;
|
|
371
345
|
}
|
|
372
346
|
animate_objects[obj.name].animateStep = animateStep;
|
|
373
|
-
|
|
347
|
+
translateDrawer(item, obj, open_doors, 'Opened3D');
|
|
374
348
|
}
|
|
375
349
|
function replaceObject(modifiedPath, layer, planData, actions, sceneData, oldSceneData, catalog) {
|
|
376
350
|
var mode = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : null;
|
|
@@ -456,7 +430,7 @@ function replaceObject(modifiedPath, layer, planData, actions, sceneData, oldSce
|
|
|
456
430
|
case 'items':
|
|
457
431
|
var item = layer.getIn(['items', modifiedPath[4]]);
|
|
458
432
|
deleteCountertop(planData.sceneGraph.layers[layer.id].countertops, item, planData, layer);
|
|
459
|
-
var tmpMoldings = (
|
|
433
|
+
var tmpMoldings = _toConsumableArray(planData.sceneGraph.layers[layer.id].moldingGroups);
|
|
460
434
|
if (catalog.getElement(item.type).updateRender3D) {
|
|
461
435
|
promises.push(updateItem(sceneData, oldSceneData, planData, layer, modifiedPath[4], modifiedPath.slice(5), catalog, actions.itemsActions, function () {
|
|
462
436
|
return removeItem(planData, layer.id, modifiedPath[4], oldSceneData.getIn(['layers', layer.id]), layer);
|
|
@@ -492,7 +466,7 @@ function replaceObject(modifiedPath, layer, planData, actions, sceneData, oldSce
|
|
|
492
466
|
}, 50);
|
|
493
467
|
removeSelItemMesh(tmpMoldings, item, planData, mode);
|
|
494
468
|
} else if (modifiedPath[keyIndex] == 'selected') {
|
|
495
|
-
var itemType = !!catalog.elements[item.type] ? catalog.elements[item.type].type : catalog.elements[
|
|
469
|
+
var itemType = !!catalog.elements[item.type] ? catalog.elements[item.type].type : catalog.elements[returnReplaceableDeepSearchType(item.type)].type;
|
|
496
470
|
if (value == false) {
|
|
497
471
|
item3D.children[0].children = item3D.children[0].children.filter(function (item3DElement) {
|
|
498
472
|
return item3DElement.name !== 'TransformBox' && item3DElement.name !== 'TransformGizmo';
|
|
@@ -532,17 +506,17 @@ function replaceObject(modifiedPath, layer, planData, actions, sceneData, oldSce
|
|
|
532
506
|
var posVec = new Three.Vector3(object.position.x, object.position.y, object.position.z);
|
|
533
507
|
var newAltitude = item.properties.get('altitude').get('_length');
|
|
534
508
|
var newUnit = item.properties.get('altitude').get('_unit') || 'in';
|
|
535
|
-
newAltitude =
|
|
509
|
+
newAltitude = convert(newAltitude).from(newUnit).to(sceneData.unit);
|
|
536
510
|
var newWidth = item.properties.get('width').get('_length');
|
|
537
511
|
var newWidthUnit = item.properties.get('width').get('_unit') || 'in';
|
|
538
|
-
newWidth =
|
|
512
|
+
newWidth = convert(newWidth).from(newWidthUnit).to('in');
|
|
539
513
|
var newHeight = item.properties.get('height').get('_length');
|
|
540
514
|
var newHeightUnit = item.properties.get('height').get('_unit') || 'in';
|
|
541
|
-
newHeight =
|
|
515
|
+
newHeight = convert(newHeight).from(newHeightUnit).to('in');
|
|
542
516
|
var newDepth = item.properties.get('depth').get('_length');
|
|
543
517
|
var newDepthUnit = item.properties.get('depth').get('_unit') || 'in';
|
|
544
|
-
newDepth =
|
|
545
|
-
var sizeinfo = !!catalog.elements[item.type] ? catalog.elements[item.type].info.sizeinfo : catalog.elements[
|
|
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;
|
|
546
520
|
object.scale.set(1 * newWidth / sizeinfo.width, 1 * newHeight / sizeinfo.height, 1 * newDepth / sizeinfo.depth);
|
|
547
521
|
object.position.set(0, 0, 0);
|
|
548
522
|
object.rotation.set(0, 0, 0);
|
|
@@ -599,10 +573,10 @@ function replaceObject(modifiedPath, layer, planData, actions, sceneData, oldSce
|
|
|
599
573
|
upObj.name = 'transUp';
|
|
600
574
|
var upwardbox = new Three.BoxHelper(upObj, 0x326780);
|
|
601
575
|
upwardbox.material.lineWidth = 0.01;
|
|
602
|
-
|
|
576
|
+
fVLine = [];
|
|
603
577
|
// let obj = new Three.Mesh(controlGeom, new Three.MeshPhongMaterial({ color: 0xffffff, side: Three.DoubleSide, colorWrite: true }));
|
|
604
578
|
// obj.name = "translateX";
|
|
605
|
-
var color =
|
|
579
|
+
var color = SHADE_DARK_PURPLE_COLOR;
|
|
606
580
|
var _mBox = new Three.Mesh(moveBox, new Three.MeshBasicMaterial({
|
|
607
581
|
color: 0xdd6699,
|
|
608
582
|
side: Three.DoubleSide,
|
|
@@ -774,7 +748,7 @@ function replaceObject(modifiedPath, layer, planData, actions, sceneData, oldSce
|
|
|
774
748
|
moveObjectChildrens.forEach(function (element) {
|
|
775
749
|
var _animate_objects$elem, _animate_objects$elem2;
|
|
776
750
|
if (((_animate_objects$elem = animate_objects[element.obj.name]) === null || _animate_objects$elem === void 0 ? void 0 : _animate_objects$elem.animateStep) === undefined) {
|
|
777
|
-
animate_objects[element.obj.name].animateStep = selectedItem.properties.open_doors ?
|
|
751
|
+
animate_objects[element.obj.name].animateStep = selectedItem.properties.open_doors ? ANIMATE_STEP_MIN : ANIMATE_STEP_MAX;
|
|
778
752
|
}
|
|
779
753
|
|
|
780
754
|
// clear origin Interval.
|
|
@@ -850,7 +824,7 @@ function replaceObject(modifiedPath, layer, planData, actions, sceneData, oldSce
|
|
|
850
824
|
addCountertop(planData.sceneGraph.layers[layer.id].countertops, item, planData, layer);
|
|
851
825
|
// Toggle selection should not update molding
|
|
852
826
|
if (item.category === 'cabinet' && modifiedPath[modifiedPath.length - 1] !== 'selected') {
|
|
853
|
-
planData.sceneGraph.layers[layer.id].moldingGroups = addMolding(tmpMoldings, item, planData, layer, actions.itemsActions, mode) || (
|
|
827
|
+
planData.sceneGraph.layers[layer.id].moldingGroups = addMolding(tmpMoldings, item, planData, layer, actions.itemsActions, mode) || _toConsumableArray(tmpMoldings);
|
|
854
828
|
}
|
|
855
829
|
break;
|
|
856
830
|
case 'visible':
|
|
@@ -886,7 +860,7 @@ function replaceObject(modifiedPath, layer, planData, actions, sceneData, oldSce
|
|
|
886
860
|
promise: p1
|
|
887
861
|
};
|
|
888
862
|
}
|
|
889
|
-
function getDistances(layer, isCalcWall) {
|
|
863
|
+
export function getDistances(layer, isCalcWall) {
|
|
890
864
|
fVLine.forEach(function (line, index) {
|
|
891
865
|
getLineDistance(line, layer, isCalcWall === undefined ? false : isCalcWall, index);
|
|
892
866
|
});
|
|
@@ -946,7 +920,7 @@ function getLineDistance(obj, layer, isCalcWall, index) {
|
|
|
946
920
|
obj.geometry.attributes.position.needsUpdate = true;
|
|
947
921
|
obj.geometry.computeBoundingSphere();
|
|
948
922
|
obj.geometry.computeBoundingBox();
|
|
949
|
-
var dist =
|
|
923
|
+
var dist = formatNumber(convert(intersects[i].distance).from('cm').to('in'), DECIMAL_PLACES_2);
|
|
950
924
|
if (dist > 3) {
|
|
951
925
|
var _canvas = getTextCanvas(dist);
|
|
952
926
|
var wid = _canvas.width / window.innerWidth * 30;
|
|
@@ -963,7 +937,7 @@ function getLineDistance(obj, layer, isCalcWall, index) {
|
|
|
963
937
|
var textMesh = new Three.Mesh(geometry, material);
|
|
964
938
|
for (; obj.children.length != 0;) {
|
|
965
939
|
var temp = obj.children.pop();
|
|
966
|
-
|
|
940
|
+
disposeObject(temp);
|
|
967
941
|
}
|
|
968
942
|
textMesh.rotation.set(Math.PI / 2, Math.PI, 0);
|
|
969
943
|
// obj.add(textMesh);
|
|
@@ -989,10 +963,10 @@ function getLineDistance(obj, layer, isCalcWall, index) {
|
|
|
989
963
|
var objW = (max.x - min.x) / 100,
|
|
990
964
|
objL = (max.z - min.z) / 100;
|
|
991
965
|
var triangle = new Three.Mesh(geom, new Three.MeshBasicMaterial({
|
|
992
|
-
color:
|
|
966
|
+
color: SHADE_DARK_PURPLE_COLOR
|
|
993
967
|
}));
|
|
994
968
|
var triangle1 = new Three.Mesh(geom, new Three.MeshBasicMaterial({
|
|
995
|
-
color:
|
|
969
|
+
color: SHADE_DARK_PURPLE_COLOR
|
|
996
970
|
}));
|
|
997
971
|
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)));
|
|
998
972
|
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);
|
|
@@ -1068,7 +1042,7 @@ function getLineDistance(obj, layer, isCalcWall, index) {
|
|
|
1068
1042
|
obj.geometry.attributes.position.array[4] = _newVec.y;
|
|
1069
1043
|
obj.geometry.attributes.position.array[5] = _newVec.z;
|
|
1070
1044
|
obj.geometry.attributes.position.needsUpdate = true;
|
|
1071
|
-
var _dist =
|
|
1045
|
+
var _dist = formatNumber(distance, DECIMAL_PLACES_2);
|
|
1072
1046
|
if (_dist > 3) {
|
|
1073
1047
|
var _canvas2 = getTextCanvas(_dist);
|
|
1074
1048
|
var _wid = _canvas2.width / window.innerWidth * 30;
|
|
@@ -1084,7 +1058,7 @@ function getLineDistance(obj, layer, isCalcWall, index) {
|
|
|
1084
1058
|
var _textMesh = new Three.Mesh(_geometry, _material);
|
|
1085
1059
|
for (; obj.children.length != 0;) {
|
|
1086
1060
|
var _temp = obj.children.pop();
|
|
1087
|
-
|
|
1061
|
+
disposeObject(_temp);
|
|
1088
1062
|
}
|
|
1089
1063
|
_textMesh.rotation.set(Math.PI / 2, Math.PI, 0);
|
|
1090
1064
|
// obj.add(textMesh);
|
|
@@ -1107,10 +1081,10 @@ function getLineDistance(obj, layer, isCalcWall, index) {
|
|
|
1107
1081
|
var _objW = (_max.x - _min.x) / 100,
|
|
1108
1082
|
_objL = (_max.z - _min.z) / 100;
|
|
1109
1083
|
var triangle = new Three.Mesh(geom, new Three.MeshBasicMaterial({
|
|
1110
|
-
color:
|
|
1084
|
+
color: SHADE_DARK_PURPLE_COLOR
|
|
1111
1085
|
}));
|
|
1112
1086
|
var triangle1 = new Three.Mesh(geom, new Three.MeshBasicMaterial({
|
|
1113
|
-
color:
|
|
1087
|
+
color: SHADE_DARK_PURPLE_COLOR
|
|
1114
1088
|
}));
|
|
1115
1089
|
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);
|
|
1116
1090
|
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);
|
|
@@ -1150,7 +1124,7 @@ function getLineDistance(obj, layer, isCalcWall, index) {
|
|
|
1150
1124
|
obj.visible = false;
|
|
1151
1125
|
return obj;
|
|
1152
1126
|
}
|
|
1153
|
-
function getIntersectPoint(opX, opY, pX, pY) {
|
|
1127
|
+
export function getIntersectPoint(opX, opY, pX, pY) {
|
|
1154
1128
|
var oA;
|
|
1155
1129
|
if (opX[1] == opX[0]) oA = null;else oA = (opY[1] - opY[0]) / (opX[1] - opX[0]);
|
|
1156
1130
|
var A;
|
|
@@ -1204,7 +1178,7 @@ function getTextCanvas(text) {
|
|
|
1204
1178
|
var ctx = canvas.getContext('2d');
|
|
1205
1179
|
var fontSize = 16;
|
|
1206
1180
|
var integral = String(text) + "''";
|
|
1207
|
-
parameters.fontName = parameters.fontName ||
|
|
1181
|
+
parameters.fontName = parameters.fontName || ARROW_TEXT_FONTFACE;
|
|
1208
1182
|
|
|
1209
1183
|
// Prepare the font to be able to measure
|
|
1210
1184
|
ctx.font = "".concat(fontSize, "px ") + parameters.fontName;
|
|
@@ -1242,7 +1216,7 @@ function getTextCanvas(text) {
|
|
|
1242
1216
|
ctx.textBaseline = parameters.baseline || 'middle';
|
|
1243
1217
|
var r = 10;
|
|
1244
1218
|
// Make the canvas transparent for simplicity
|
|
1245
|
-
ctx.fillStyle =
|
|
1219
|
+
ctx.fillStyle = ARROW_TEXT_BACKCOLOR;
|
|
1246
1220
|
// ctx.fillRect(0, 0, ctx.canvas.width, ctx.canvas.height);
|
|
1247
1221
|
var w = ctx.canvas.width;
|
|
1248
1222
|
var h = ctx.canvas.height;
|
|
@@ -1258,9 +1232,9 @@ function getTextCanvas(text) {
|
|
|
1258
1232
|
ctx.arcTo(0, 0, r, 0, r);
|
|
1259
1233
|
// ctx.arcTo(w+r, h+2*r, w+r, 0, r);
|
|
1260
1234
|
ctx.fill();
|
|
1261
|
-
ctx.fillStyle = parameters.fillColor ||
|
|
1235
|
+
ctx.fillStyle = parameters.fillColor || ARROW_TEXT_FORECOLOR;
|
|
1262
1236
|
ctx.fillText(integral, (width - textMetrics.width) / 2, height / 2);
|
|
1263
|
-
ctx.strokeStyle = parameters.strokeColor ||
|
|
1237
|
+
ctx.strokeStyle = parameters.strokeColor || ARROW_TEXT_FORECOLOR;
|
|
1264
1238
|
ctx.strokeText(integral, (width - textMetrics.width) / 2, height / 2);
|
|
1265
1239
|
|
|
1266
1240
|
// ctx.font = `${fontSize - 5}px ` + parameters.fontName;
|
|
@@ -1321,7 +1295,7 @@ function removeObject(modifiedPath, layer, planData, actions, sceneData, oldScen
|
|
|
1321
1295
|
});
|
|
1322
1296
|
removeLine(planData, layer.id, lineID);
|
|
1323
1297
|
var mode = oldSceneData.mode;
|
|
1324
|
-
if (
|
|
1298
|
+
if (ARRAY_3D_MODES.includes(mode)) mode = MODE_IDLE_3D;else mode = MODE_IDLE;
|
|
1325
1299
|
if (modifiedPath.length > 5) {
|
|
1326
1300
|
// I removed an hole, so I should add the new line
|
|
1327
1301
|
promises.push(addLine(sceneData, planData, layer, lineID, catalog, actions.linesActions));
|
|
@@ -1366,7 +1340,7 @@ function removeHole(planData, layerId, holeID) {
|
|
|
1366
1340
|
var hole3D = planData.sceneGraph.layers[layerId].holes[holeID];
|
|
1367
1341
|
if (hole3D) {
|
|
1368
1342
|
planData.plan.remove(hole3D);
|
|
1369
|
-
|
|
1343
|
+
disposeObject(hole3D);
|
|
1370
1344
|
delete planData.sceneGraph.layers[layerId].holes[holeID];
|
|
1371
1345
|
delete planData.sceneGraph.LODs[holeID];
|
|
1372
1346
|
hole3D = null;
|
|
@@ -1385,7 +1359,7 @@ function removeLine(planData, layerId, lineID) {
|
|
|
1385
1359
|
var line3D = planData.sceneGraph.layers[layerId].lines[lineID];
|
|
1386
1360
|
if (line3D) {
|
|
1387
1361
|
planData.plan.remove(line3D);
|
|
1388
|
-
|
|
1362
|
+
disposeObject(line3D);
|
|
1389
1363
|
delete planData.sceneGraph.layers[layerId].lines[lineID];
|
|
1390
1364
|
delete planData.sceneGraph.LODs[lineID];
|
|
1391
1365
|
line3D = null;
|
|
@@ -1404,7 +1378,7 @@ function removeArea(planData, layerId, areaID) {
|
|
|
1404
1378
|
var area3D = planData.sceneGraph.layers[layerId].areas[areaID];
|
|
1405
1379
|
if (area3D) {
|
|
1406
1380
|
planData.plan.remove(area3D);
|
|
1407
|
-
|
|
1381
|
+
disposeObject(area3D);
|
|
1408
1382
|
delete planData.sceneGraph.layers[layerId].areas[areaID];
|
|
1409
1383
|
delete planData.sceneGraph.LODs[areaID];
|
|
1410
1384
|
area3D = null;
|
|
@@ -1412,7 +1386,7 @@ function removeArea(planData, layerId, areaID) {
|
|
|
1412
1386
|
}
|
|
1413
1387
|
planData.sceneGraph.busyResources.layers[layerId].areas[areaID] = false;
|
|
1414
1388
|
}
|
|
1415
|
-
function removeItem(planData, layerId, itemID) {
|
|
1389
|
+
export function removeItem(planData, layerId, itemID) {
|
|
1416
1390
|
var oldSceneLayer = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
|
|
1417
1391
|
var newSceneLayer = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
|
|
1418
1392
|
if (planData.sceneGraph.busyResources.layers[layerId].items[itemID]) {
|
|
@@ -1431,7 +1405,7 @@ function removeItem(planData, layerId, itemID) {
|
|
|
1431
1405
|
var item3D = planData.sceneGraph.layers[layerId].items[itemID];
|
|
1432
1406
|
if (item3D) {
|
|
1433
1407
|
planData.plan.remove(item3D);
|
|
1434
|
-
|
|
1408
|
+
disposeObject(item3D);
|
|
1435
1409
|
delete planData.sceneGraph.layers[layerId].items[itemID];
|
|
1436
1410
|
delete planData.sceneGraph.LODs[itemID];
|
|
1437
1411
|
item3D = null;
|
|
@@ -1453,7 +1427,7 @@ function removeItemWithoutItem(planData, layerId, itemID) {
|
|
|
1453
1427
|
var item3D = planData.sceneGraph.layers[layerId].items[itemID];
|
|
1454
1428
|
if (item3D) {
|
|
1455
1429
|
planData.plan.remove(item3D);
|
|
1456
|
-
|
|
1430
|
+
disposeObject(item3D);
|
|
1457
1431
|
item3D = null;
|
|
1458
1432
|
updateBoundingBox(planData);
|
|
1459
1433
|
delete planData.sceneGraph.layers[layerId].items[itemID];
|
|
@@ -1514,7 +1488,7 @@ function addHole(sceneData, planData, layer, holeID, catalog, holesActions, mode
|
|
|
1514
1488
|
item.castShadow = true;
|
|
1515
1489
|
var texture;
|
|
1516
1490
|
if (name.includes('_wood')) {
|
|
1517
|
-
texture =
|
|
1491
|
+
texture = loadTexture('/assets/img/texture/white1px.jpg');
|
|
1518
1492
|
} else if (name.includes('_glass')) {
|
|
1519
1493
|
var material = new Three.MeshPhysicalMaterial({
|
|
1520
1494
|
roughness: 0.5,
|
|
@@ -1526,7 +1500,7 @@ function addHole(sceneData, planData, layer, holeID, catalog, holesActions, mode
|
|
|
1526
1500
|
item.material = material;
|
|
1527
1501
|
return item;
|
|
1528
1502
|
} else if (name.includes('_steel')) {
|
|
1529
|
-
texture =
|
|
1503
|
+
texture = loadTexture('/assets/img/texture/steel.jpg');
|
|
1530
1504
|
} else if (name.includes('_glass')) {
|
|
1531
1505
|
var _material2 = new Three.MeshPhysicalMaterial({
|
|
1532
1506
|
roughness: 0.5,
|
|
@@ -1600,7 +1574,7 @@ function addHole(sceneData, planData, layer, holeID, catalog, holesActions, mode
|
|
|
1600
1574
|
}
|
|
1601
1575
|
var pivot = new Three.Object3D();
|
|
1602
1576
|
pivot.name = 'pivot';
|
|
1603
|
-
if (
|
|
1577
|
+
if (isElevationView(mode)) {
|
|
1604
1578
|
var lineID = holeData.getIn(['line']);
|
|
1605
1579
|
if (planData.sceneGraph.layers['layer-1'].lines[lineID].visible) {
|
|
1606
1580
|
pivot.visible = true;
|
|
@@ -1608,7 +1582,7 @@ function addHole(sceneData, planData, layer, holeID, catalog, holesActions, mode
|
|
|
1608
1582
|
pivot.visible = false;
|
|
1609
1583
|
}
|
|
1610
1584
|
object.traverse(function (obj) {
|
|
1611
|
-
|
|
1585
|
+
replaceMeshesWithLineSegments(obj);
|
|
1612
1586
|
});
|
|
1613
1587
|
}
|
|
1614
1588
|
pivot.add(object);
|
|
@@ -1702,11 +1676,11 @@ function addLine(sceneData, planData, layer, lineID, catalog, linesActions) {
|
|
|
1702
1676
|
pivot.userData.type = 'line';
|
|
1703
1677
|
|
|
1704
1678
|
// In elevation view, show(visible = true) just selected wall pivot. If not, hidden(visible = false)
|
|
1705
|
-
if (
|
|
1679
|
+
if (isElevationView(mode)) {
|
|
1706
1680
|
var lineVisible;
|
|
1707
1681
|
if (line.selected) {
|
|
1708
1682
|
pivot.traverse(function (obj) {
|
|
1709
|
-
|
|
1683
|
+
replaceMeshesWithLineSegments(obj);
|
|
1710
1684
|
});
|
|
1711
1685
|
lineVisible = true;
|
|
1712
1686
|
} else {
|
|
@@ -1800,7 +1774,7 @@ function addArea(sceneData, planData, layer, areaID, catalog, areaActions, mode)
|
|
|
1800
1774
|
realVec.push(vec);
|
|
1801
1775
|
});
|
|
1802
1776
|
if (vertices.includes(realVec[0]) && vertices.includes(realVec[1])) {
|
|
1803
|
-
height =
|
|
1777
|
+
height = convert(layer.ceilHeight).from(layer.unit).to(UNIT_CENTIMETER);
|
|
1804
1778
|
// height = data.properties.getIn(["height", "length"]);
|
|
1805
1779
|
return 1; // break
|
|
1806
1780
|
}
|
|
@@ -1808,7 +1782,7 @@ function addArea(sceneData, planData, layer, areaID, catalog, areaActions, mode)
|
|
|
1808
1782
|
for (var i = 0; i < lines.length; i++) {
|
|
1809
1783
|
if (_loop2()) break;
|
|
1810
1784
|
}
|
|
1811
|
-
ceil.translateZ(
|
|
1785
|
+
ceil.translateZ(convert(layer.ceilHeight).from(layer.unit).to(UNIT_CENTIMETER));
|
|
1812
1786
|
pivot.name = 'pivot';
|
|
1813
1787
|
pivot.add(area3D);
|
|
1814
1788
|
pivot.add(area3D.userData.floorSupport);
|
|
@@ -1816,7 +1790,7 @@ function addArea(sceneData, planData, layer, areaID, catalog, areaActions, mode)
|
|
|
1816
1790
|
pivot.position.y = layer.altitude;
|
|
1817
1791
|
|
|
1818
1792
|
// if elevation view, show just wall - not show floor and ceil
|
|
1819
|
-
if (
|
|
1793
|
+
if (isElevationView(mode)) pivot.visible = false;
|
|
1820
1794
|
planData.plan.add(pivot);
|
|
1821
1795
|
planData.sceneGraph.layers[layer.id].areas[areaID] = pivot;
|
|
1822
1796
|
// document.getElementById('setting_dialog').style.display = 'none';
|
|
@@ -1852,11 +1826,11 @@ function addItem(sceneData, planData, layer, itemID, catalog, itemsActions) {
|
|
|
1852
1826
|
console.log(item.name + 's doorStyle is null!');
|
|
1853
1827
|
return;
|
|
1854
1828
|
}
|
|
1855
|
-
if (!sceneData.loadFlag && scene_mode ==
|
|
1829
|
+
if (!sceneData.loadFlag && scene_mode == MODE_DRAWING_ITEM_3D) {
|
|
1856
1830
|
itemsActions.toggleLoadingCabinet();
|
|
1857
1831
|
}
|
|
1858
1832
|
var catalogElement = catalog.getElement(item.type);
|
|
1859
|
-
if (!catalogElement) catalogElement = catalog.getElement(
|
|
1833
|
+
if (!catalogElement) catalogElement = catalog.getElement(returnReplaceableDeepSearchType(item.type));
|
|
1860
1834
|
if (!catalogElement) return false;
|
|
1861
1835
|
return catalogElement.render3D(item, layer, sceneData, mode).then(function (item3D) {
|
|
1862
1836
|
if (item3D instanceof Three.LOD) {
|
|
@@ -1864,7 +1838,7 @@ function addItem(sceneData, planData, layer, itemID, catalog, itemsActions) {
|
|
|
1864
1838
|
}
|
|
1865
1839
|
if (rItem !== null) {
|
|
1866
1840
|
planData.plan.remove(rItem);
|
|
1867
|
-
|
|
1841
|
+
disposeObject(rItem);
|
|
1868
1842
|
rItem = null;
|
|
1869
1843
|
}
|
|
1870
1844
|
var pivot = new Three.Object3D();
|
|
@@ -1907,7 +1881,7 @@ function addItem(sceneData, planData, layer, itemID, catalog, itemsActions) {
|
|
|
1907
1881
|
var opacity = layer.opacity;
|
|
1908
1882
|
if (item.selected) {
|
|
1909
1883
|
opacity = 1;
|
|
1910
|
-
|
|
1884
|
+
fVLine = [];
|
|
1911
1885
|
var TransformGizmo = item3D.children[item3D.children.length - 1];
|
|
1912
1886
|
TransformGizmo.children.forEach(function (child) {
|
|
1913
1887
|
if (child.type === 'Line' && child.geometry.attributes !== undefined) fVLine.push(child);
|
|
@@ -1953,11 +1927,11 @@ function addItem(sceneData, planData, layer, itemID, catalog, itemsActions) {
|
|
|
1953
1927
|
var r3 = itemRect.rect[3];
|
|
1954
1928
|
|
|
1955
1929
|
// it doesn't need consider distance between item's line01 (frontside - it has door) and wall
|
|
1956
|
-
var delta12 =
|
|
1957
|
-
var delta23 =
|
|
1958
|
-
var delta30 =
|
|
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
|
|
1959
1933
|
|
|
1960
|
-
if (delta12 <
|
|
1934
|
+
if (delta12 < DISTANCE_EPSILON || delta23 < DISTANCE_EPSILON || delta30 < DISTANCE_EPSILON) {
|
|
1961
1935
|
itemVisible = true;
|
|
1962
1936
|
}
|
|
1963
1937
|
return itemVisible;
|
|
@@ -1971,10 +1945,10 @@ function addItem(sceneData, planData, layer, itemID, catalog, itemsActions) {
|
|
|
1971
1945
|
};
|
|
1972
1946
|
var catid = item.type;
|
|
1973
1947
|
var cat = catalog.elements[catid];
|
|
1974
|
-
if (!cat) cat = catalog.elements[
|
|
1975
|
-
var width =
|
|
1976
|
-
var height =
|
|
1977
|
-
var depth =
|
|
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);
|
|
1978
1952
|
val.size = {
|
|
1979
1953
|
width: width,
|
|
1980
1954
|
height: height,
|
|
@@ -1983,24 +1957,24 @@ function addItem(sceneData, planData, layer, itemID, catalog, itemsActions) {
|
|
|
1983
1957
|
val.layoutpos = cat.info.layoutpos;
|
|
1984
1958
|
val.is_corner = cat.info.is_corner;
|
|
1985
1959
|
val.item = item;
|
|
1986
|
-
var calcrect =
|
|
1960
|
+
var calcrect = GeometryUtils.getCalcRectFromItem3D(val);
|
|
1987
1961
|
|
|
1988
1962
|
// In elevation view, determin if item show or not
|
|
1989
|
-
if (
|
|
1963
|
+
if (isElevationView(mode)) pivot.visible = getItemVisible(calcrect);
|
|
1990
1964
|
planData.plan.add(pivot);
|
|
1991
1965
|
planData.sceneGraph.layers[layer.id].items[item.id] = pivot;
|
|
1992
1966
|
//In a 3D view, merge each couterTop of equal height into a single conuterTop.
|
|
1993
|
-
if (!
|
|
1967
|
+
if (!isElevationView(mode)) {
|
|
1994
1968
|
addCountertop(planData.sceneGraph.layers[layer.id].countertops, item, planData, layer);
|
|
1995
1969
|
}
|
|
1996
|
-
if (bAddMolding && item.category === 'cabinet' && (
|
|
1970
|
+
if (bAddMolding && item.category === 'cabinet' && (isElevationView(mode) && getItemVisible(calcrect) || !isElevationView(mode))) {
|
|
1997
1971
|
planData.sceneGraph.layers[layer.id].moldingGroups = addMolding(planData.sceneGraph.layers[layer.id].moldingGroups, item, planData, layer, itemsActions, mode) || planData.sceneGraph.layers[layer.id].moldingGroups;
|
|
1998
1972
|
}
|
|
1999
1973
|
if (pivot) {
|
|
2000
1974
|
// update the tool object's position to selected object's position
|
|
2001
1975
|
var selectedItem = planData.sceneGraph.layers[sceneData.selectedLayer].items[itemID];
|
|
2002
1976
|
var itemPos = selectedItem.position.clone();
|
|
2003
|
-
if (!
|
|
1977
|
+
if (!isEmpty(toolObj)) {
|
|
2004
1978
|
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);
|
|
2005
1979
|
}
|
|
2006
1980
|
pivot.children[0].children.forEach(function (pivotElement) {
|
|
@@ -2028,7 +2002,7 @@ function addItem(sceneData, planData, layer, itemID, catalog, itemsActions) {
|
|
|
2028
2002
|
setTimeout(function () {
|
|
2029
2003
|
return getDistances(layer);
|
|
2030
2004
|
}, 100);
|
|
2031
|
-
if (!sceneData.loadFlag && scene_mode ==
|
|
2005
|
+
if (!sceneData.loadFlag && scene_mode == MODE_DRAWING_ITEM_3D) {
|
|
2032
2006
|
itemsActions.endLoading();
|
|
2033
2007
|
itemsActions.toggleLoadingCabinet();
|
|
2034
2008
|
}
|
|
@@ -2091,14 +2065,14 @@ function applyOpacity(object, opacity) {
|
|
|
2091
2065
|
function updateBoundingBox(planData) {
|
|
2092
2066
|
var flag = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
2093
2067
|
var mode = arguments.length > 2 ? arguments[2] : undefined;
|
|
2094
|
-
if (scene_mode ==
|
|
2068
|
+
if (scene_mode == MODE_DRAWING_ITEM_3D) return;
|
|
2095
2069
|
var newBoundingBox = new Three.Box3().setFromObject(planData.plan);
|
|
2096
2070
|
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)) {
|
|
2097
2071
|
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);
|
|
2098
2072
|
if (!flag) {
|
|
2099
2073
|
planData.plan.position.sub(newCenter);
|
|
2100
2074
|
planData.grid.position.sub(newCenter);
|
|
2101
|
-
if (
|
|
2075
|
+
if (isElevationView(mode)) {
|
|
2102
2076
|
planData.cam.position.sub(newCenter);
|
|
2103
2077
|
}
|
|
2104
2078
|
}
|
|
@@ -2205,7 +2179,7 @@ function createCTFromItem(item, unit, catalog) {
|
|
|
2205
2179
|
function createCTFromItems(items, unit, catalog) {
|
|
2206
2180
|
var item0 = items[0];
|
|
2207
2181
|
var item1 = items[items.length - 1];
|
|
2208
|
-
var CTId =
|
|
2182
|
+
var CTId = IDBroker.acquireID();
|
|
2209
2183
|
var ct3d = null;
|
|
2210
2184
|
var catid = item0.type;
|
|
2211
2185
|
var pos = {
|
|
@@ -2219,13 +2193,13 @@ function createCTFromItems(items, unit, catalog) {
|
|
|
2219
2193
|
// let height = convert(item0.properties.getIn(['height', '_length'])).from('in').to('cm');
|
|
2220
2194
|
var width = item0.properties.get('width').get('_length');
|
|
2221
2195
|
var widthUnit = item0.properties.get('width').get('_unit') || 'cm';
|
|
2222
|
-
width =
|
|
2196
|
+
width = convert(width).from(widthUnit).to('cm');
|
|
2223
2197
|
var depth = item0.properties.get('depth').get('_length');
|
|
2224
2198
|
var depthUnit = item0.properties.get('depth').get('_unit') || 'cm';
|
|
2225
|
-
depth =
|
|
2199
|
+
depth = convert(depth).from(depthUnit).to('cm');
|
|
2226
2200
|
var height = item0.properties.get('height').get('_length');
|
|
2227
2201
|
var heightUnit = item0.properties.get('height').get('_unit') || 'cm';
|
|
2228
|
-
height =
|
|
2202
|
+
height = convert(height).from(heightUnit).to('cm');
|
|
2229
2203
|
var size = {
|
|
2230
2204
|
width: width * items.length,
|
|
2231
2205
|
depth: depth,
|
|
@@ -2241,22 +2215,22 @@ function createCTFromItems(items, unit, catalog) {
|
|
|
2241
2215
|
size: size
|
|
2242
2216
|
};
|
|
2243
2217
|
}
|
|
2244
|
-
function createMDFromItem(item, lines, molding) {
|
|
2245
|
-
var MDId =
|
|
2218
|
+
export function createMDFromItem(item, lines, molding) {
|
|
2219
|
+
var MDId = IDBroker.acquireID();
|
|
2246
2220
|
var z = item.properties.get('altitude').get('_length');
|
|
2247
2221
|
var zUnit = item.properties.get('altitude').get('_unit') || 'cm';
|
|
2248
|
-
z =
|
|
2222
|
+
z = convert(z).from(zUnit).to('cm');
|
|
2249
2223
|
var height = item.properties.get('height').get('_length');
|
|
2250
2224
|
var heightUnit = item.properties.get('height').get('_unit') || 'cm';
|
|
2251
|
-
height =
|
|
2225
|
+
height = convert(height).from(heightUnit).to('cm');
|
|
2252
2226
|
switch (molding.location_type) {
|
|
2253
|
-
case
|
|
2227
|
+
case TOP_MOLDING_LOCATION:
|
|
2254
2228
|
z += height;
|
|
2255
2229
|
break;
|
|
2256
|
-
case
|
|
2230
|
+
case MIDDLE_MOLDING_LOCATION:
|
|
2257
2231
|
z += height / 2;
|
|
2258
2232
|
break;
|
|
2259
|
-
case
|
|
2233
|
+
case BOTTOM_MOLDING_LOCATION:
|
|
2260
2234
|
z += 0;
|
|
2261
2235
|
break;
|
|
2262
2236
|
default:
|
|
@@ -2292,7 +2266,7 @@ function tryAdjacent(ct1, ct2) {
|
|
|
2292
2266
|
if (ct1.rotRad != ct2.rotRad) return false;
|
|
2293
2267
|
log('ct1', ct1.pos.x, ct1.pos.y, ct1.size.width);
|
|
2294
2268
|
log('ct2', ct2.pos.x, ct2.pos.y, ct2.size.width);
|
|
2295
|
-
var dist =
|
|
2269
|
+
var dist = GeometryUtils.verticesDistance(ct1.pos, ct2.pos);
|
|
2296
2270
|
var totalwidth = ct1.size.width + ct2.size.width;
|
|
2297
2271
|
log('epsilon', dist, totalwidth, Math.abs(2 * dist - totalwidth));
|
|
2298
2272
|
if (Math.abs(2 * dist - totalwidth) / totalwidth > 1e-3) return false;
|
|
@@ -2306,8 +2280,8 @@ function tryAdjacent(ct1, ct2) {
|
|
|
2306
2280
|
depth: ct1.size.depth,
|
|
2307
2281
|
height: ct1.size.height
|
|
2308
2282
|
};
|
|
2309
|
-
var CTId =
|
|
2310
|
-
var items =
|
|
2283
|
+
var CTId = IDBroker.acquireID();
|
|
2284
|
+
var items = GeometryUtils.compareVertices(ct1.pos, ct2.pos) > 0 ? [].concat(_toConsumableArray(ct1.items), _toConsumableArray(ct2.items)) : [].concat(_toConsumableArray(ct2.items), _toConsumableArray(ct1.items));
|
|
2311
2285
|
var ct3d = null;
|
|
2312
2286
|
var catid = ct1.catid;
|
|
2313
2287
|
return {
|
|
@@ -2322,17 +2296,17 @@ function tryAdjacent(ct1, ct2) {
|
|
|
2322
2296
|
}
|
|
2323
2297
|
function isParallelLines(line1, line2) {
|
|
2324
2298
|
var isParallel = false;
|
|
2325
|
-
if (Math.abs(line1[0].y - line1[1].y) <=
|
|
2326
|
-
if (Math.abs(line1[0].x - line1[1].x) <=
|
|
2327
|
-
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)) <=
|
|
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;
|
|
2328
2302
|
if (isParallel) {
|
|
2329
2303
|
return true;
|
|
2330
2304
|
}
|
|
2331
2305
|
return false;
|
|
2332
2306
|
}
|
|
2333
|
-
function tryAdjacentMD(md1, md2, molding) {
|
|
2307
|
+
export function tryAdjacentMD(md1, md2, molding) {
|
|
2334
2308
|
log('----tryAdjacent', md1.id, md2.id);
|
|
2335
|
-
if (Math.abs(md1.pos.z - md2.pos.z) >
|
|
2309
|
+
if (Math.abs(md1.pos.z - md2.pos.z) > EPSILON) return false;
|
|
2336
2310
|
var id1 = md1.items[0].doorStyle.hasOwnProperty('id') ? md1.items[0].doorStyle.id : md1.items[0].doorStyle.toJS().id,
|
|
2337
2311
|
id2 = md2.items[0].doorStyle.hasOwnProperty('id') ? md2.items[0].doorStyle.id : md2.items[0].doorStyle.toJS().id;
|
|
2338
2312
|
if (id1 !== id2) return false;
|
|
@@ -2348,30 +2322,30 @@ function tryAdjacentMD(md1, md2, molding) {
|
|
|
2348
2322
|
}) === -1) return false;
|
|
2349
2323
|
// is parallel two lines
|
|
2350
2324
|
if (isParallelLines(line1, line2)) {
|
|
2351
|
-
var disLine1 =
|
|
2352
|
-
var disLine2 =
|
|
2353
|
-
if (
|
|
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))) {
|
|
2354
2328
|
newLines = newLines.filter(function (a) {
|
|
2355
2329
|
return !(a[2] === line1[2] || a[2] === line2[2]);
|
|
2356
2330
|
});
|
|
2357
|
-
if (!
|
|
2358
|
-
if (!
|
|
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()]);
|
|
2359
2333
|
isMerge = true;
|
|
2360
2334
|
return false;
|
|
2361
2335
|
}
|
|
2362
|
-
if (
|
|
2336
|
+
if (GeometryUtils.sameMDistances(GeometryUtils.verticesDistance(line2[0], line1[1]) + GeometryUtils.verticesDistance(line1[0], line2[1]), Math.abs(disLine2 - disLine1))) {
|
|
2363
2337
|
newLines = newLines.filter(function (a) {
|
|
2364
2338
|
return !(a[2] === line1[2] || a[2] === line2[2]);
|
|
2365
2339
|
});
|
|
2366
|
-
if (!
|
|
2367
|
-
if (!
|
|
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()]);
|
|
2368
2342
|
isMerge = true;
|
|
2369
2343
|
return false;
|
|
2370
2344
|
}
|
|
2371
2345
|
var samePointNum = -1,
|
|
2372
2346
|
i = 0;
|
|
2373
2347
|
while (i < 4 && samePointNum === -1) {
|
|
2374
|
-
if (
|
|
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]))) {
|
|
2375
2349
|
samePointNum = 3 - i;
|
|
2376
2350
|
} else {
|
|
2377
2351
|
i++;
|
|
@@ -2381,14 +2355,14 @@ function tryAdjacentMD(md1, md2, molding) {
|
|
|
2381
2355
|
newLines = newLines.filter(function (a) {
|
|
2382
2356
|
return !(a[2] === line1[2] || a[2] === line2[2]);
|
|
2383
2357
|
});
|
|
2384
|
-
newLines.push([(
|
|
2358
|
+
newLines.push([_objectSpread({}, line1[Math.floor(samePointNum / 2)]), _objectSpread({}, line2[samePointNum % 2]), IDBroker.acquireID()]);
|
|
2385
2359
|
isMerge = true;
|
|
2386
2360
|
return false;
|
|
2387
2361
|
}
|
|
2388
2362
|
var pointNum = -1,
|
|
2389
2363
|
k = 0;
|
|
2390
2364
|
while (k < 4 && pointNum === -1) {
|
|
2391
|
-
if (
|
|
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)) {
|
|
2392
2366
|
pointNum = k;
|
|
2393
2367
|
} else {
|
|
2394
2368
|
k++;
|
|
@@ -2398,15 +2372,15 @@ function tryAdjacentMD(md1, md2, molding) {
|
|
|
2398
2372
|
return false;
|
|
2399
2373
|
});
|
|
2400
2374
|
});
|
|
2401
|
-
if (!newLines.length) return (
|
|
2375
|
+
if (!newLines.length) return _objectSpread({}, md2);
|
|
2402
2376
|
if (!isMerge) return false;
|
|
2403
2377
|
return {
|
|
2404
|
-
id:
|
|
2405
|
-
items: [].concat((
|
|
2378
|
+
id: IDBroker.acquireID(),
|
|
2379
|
+
items: [].concat(_toConsumableArray(md2.items.filter(function (item) {
|
|
2406
2380
|
return md1.items.findIndex(function (it) {
|
|
2407
2381
|
return it.id === item.id;
|
|
2408
2382
|
}) === -1;
|
|
2409
|
-
})), (
|
|
2383
|
+
})), _toConsumableArray(md1.items)),
|
|
2410
2384
|
meshes: [],
|
|
2411
2385
|
pos: md1.pos,
|
|
2412
2386
|
size: md1.size,
|
|
@@ -2422,9 +2396,9 @@ function showItemCT(item, CT, visible, planData, layer) {
|
|
|
2422
2396
|
child.visible = visible;
|
|
2423
2397
|
if (child.material.map === null) {
|
|
2424
2398
|
var normalMap = item.counterTop.uri;
|
|
2425
|
-
var interiortexture =
|
|
2399
|
+
var interiortexture = loadTexture(normalMap);
|
|
2426
2400
|
applyTexture(child.material, interiortexture, 100, 100);
|
|
2427
|
-
child.material.color = new
|
|
2401
|
+
child.material.color = new Color(1, 1, 1);
|
|
2428
2402
|
return;
|
|
2429
2403
|
}
|
|
2430
2404
|
child.material.map.repeat.x = 1;
|
|
@@ -2457,7 +2431,7 @@ function getDoorStyleMaterial(items, planData, layer, name) {
|
|
|
2457
2431
|
var door_mesh = null;
|
|
2458
2432
|
if (!item3D) return undefined;
|
|
2459
2433
|
item3D.traverse(function (child) {
|
|
2460
|
-
if (!door_mesh && !child.name.includes('countertop') && !child.name.includes('_interior_') && !child.name.includes('handle') && child.type ===
|
|
2434
|
+
if (!door_mesh && !child.name.includes('countertop') && !child.name.includes('_interior_') && !child.name.includes('handle') && child.type === OBJTYPE_MESH) {
|
|
2461
2435
|
door_mesh = child;
|
|
2462
2436
|
}
|
|
2463
2437
|
});
|
|
@@ -2507,7 +2481,7 @@ function addCTMesh(countertop, planData, layer) {
|
|
|
2507
2481
|
var unit_width = countertop.items.find(function (ct) {
|
|
2508
2482
|
return !ct.type.includes('Dishwasher') && !ct.type.includes('BF');
|
|
2509
2483
|
}).properties.get('width').get('_unit') || 'cm';
|
|
2510
|
-
width =
|
|
2484
|
+
width = convert(width).from(unit_width).to('cm');
|
|
2511
2485
|
pivotMat.scale(new Three.Vector3(countertop.size.width / width, 1, 1));
|
|
2512
2486
|
var finalMat = objMat.premultiply(pivotMat);
|
|
2513
2487
|
_ct3d.applyMatrix4(finalMat);
|
|
@@ -2536,7 +2510,7 @@ function moldingVertices(mPointGroup, mdGeo, MDV, model, svg_width, svg_height,
|
|
|
2536
2510
|
|
|
2537
2511
|
// Point O
|
|
2538
2512
|
var o = new Three.Vector2(0, 0);
|
|
2539
|
-
if (
|
|
2513
|
+
if (GeometryUtils.samePoints(pointGroup[0], pointGroup[length - 1])) {
|
|
2540
2514
|
pointGroup = pointGroup.slice(0, length - 1);
|
|
2541
2515
|
length--;
|
|
2542
2516
|
isSnap = false;
|
|
@@ -2705,7 +2679,7 @@ var assignUVsA = function assignUVsA(geometry) {
|
|
|
2705
2679
|
/*
|
|
2706
2680
|
Remove specified type of 3d object easily
|
|
2707
2681
|
*/
|
|
2708
|
-
function deleteSpecifiedMeshObjects(type) {
|
|
2682
|
+
export function deleteSpecifiedMeshObjects(type) {
|
|
2709
2683
|
var childLen = planData.plan.children.length;
|
|
2710
2684
|
var children = [];
|
|
2711
2685
|
for (var i = 0; i < childLen; i++) {
|
|
@@ -2713,18 +2687,18 @@ function deleteSpecifiedMeshObjects(type) {
|
|
|
2713
2687
|
}
|
|
2714
2688
|
planData.plan.children = children;
|
|
2715
2689
|
}
|
|
2716
|
-
function getMeshesFromScene() {
|
|
2690
|
+
export function getMeshesFromScene() {
|
|
2717
2691
|
var childLen = planData.plan.children.length;
|
|
2718
2692
|
var children = [];
|
|
2719
2693
|
for (var i = 0; i < childLen; i++) {
|
|
2720
|
-
if (planData.plan.children[i].type ==
|
|
2694
|
+
if (planData.plan.children[i].type == OBJTYPE_MESH) children.push(planData.plan.children[i]);
|
|
2721
2695
|
}
|
|
2722
2696
|
return children;
|
|
2723
2697
|
}
|
|
2724
|
-
function threedfabs(a) {
|
|
2698
|
+
export function threedfabs(a) {
|
|
2725
2699
|
return a > 0 ? a : -a;
|
|
2726
2700
|
}
|
|
2727
|
-
function getDistanceBetweenLineSegment(pos1, pos2, pos3, pos4) {
|
|
2701
|
+
export function getDistanceBetweenLineSegment(pos1, pos2, pos3, pos4) {
|
|
2728
2702
|
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;
|
|
2729
2703
|
}
|
|
2730
2704
|
|
|
@@ -2733,7 +2707,7 @@ function getDistanceBetweenLineSegment(pos1, pos2, pos3, pos4) {
|
|
|
2733
2707
|
* @param _item
|
|
2734
2708
|
* @returns true if it's not suitable.
|
|
2735
2709
|
*/
|
|
2736
|
-
function showYelloBox(_item) {
|
|
2710
|
+
export function showYelloBox(_item) {
|
|
2737
2711
|
var _doorStyle;
|
|
2738
2712
|
var doorStyle = _item === null || _item === void 0 ? void 0 : _item.doorStyle;
|
|
2739
2713
|
|
|
@@ -2756,7 +2730,7 @@ function isSimilar(a, b) {
|
|
|
2756
2730
|
if (threedfabs(a - b) <= 0.01) return 1;
|
|
2757
2731
|
return 0;
|
|
2758
2732
|
}
|
|
2759
|
-
function sameSign(pos1, pos2, pos3) {
|
|
2733
|
+
export function sameSign(pos1, pos2, pos3) {
|
|
2760
2734
|
var ch1 = 0.0;
|
|
2761
2735
|
var ch2 = 1.0;
|
|
2762
2736
|
if (isSimilar(pos1.x, pos2.x) && isSimilar(pos1.x, pos3.x)) {
|
|
@@ -2770,10 +2744,10 @@ function sameSign(pos1, pos2, pos3) {
|
|
|
2770
2744
|
if (ch1 * ch2 >= 0) return 1;
|
|
2771
2745
|
return 0;
|
|
2772
2746
|
}
|
|
2773
|
-
function getTotalDistance(pos, rect) {
|
|
2747
|
+
export function getTotalDistance(pos, rect) {
|
|
2774
2748
|
var sum = 0;
|
|
2775
2749
|
for (var i = 0; i < rect.length; i++) {
|
|
2776
|
-
sum +=
|
|
2750
|
+
sum += verticesDistance(pos, rect[i]);
|
|
2777
2751
|
}
|
|
2778
2752
|
return sum;
|
|
2779
2753
|
}
|
|
@@ -2785,7 +2759,7 @@ var applyTexture = function applyTexture(material, texture, length, height) {
|
|
|
2785
2759
|
material.map.wrapT = Three.RepeatWrapping;
|
|
2786
2760
|
material.map.repeat.set(length * 0.01, height * 0.01);
|
|
2787
2761
|
if (texture.normal) {
|
|
2788
|
-
material.normalMap =
|
|
2762
|
+
material.normalMap = loadTexture(texture.normal.uri);
|
|
2789
2763
|
material.normalScale = new Vector2(texture.normal.normalScaleX, texture.normal.normalScaleY);
|
|
2790
2764
|
material.normalMap.wrapS = Three.RepeatWrapping;
|
|
2791
2765
|
material.normalMap.wrapT = Three.RepeatWrapping;
|
|
@@ -2802,7 +2776,7 @@ var applyTexture = function applyTexture(material, texture, length, height) {
|
|
|
2802
2776
|
* @param {{boundingBox:Box3,catalog:Catalog,grid: Object3D,plan: Object3D,sceneData: Scene,sceneGraph}} planData
|
|
2803
2777
|
* @param {Scene} scene
|
|
2804
2778
|
*/
|
|
2805
|
-
function createBacksplash(item, layer, planData, scene) {
|
|
2779
|
+
export function createBacksplash(item, layer, planData, scene) {
|
|
2806
2780
|
var sceneGraph = planData.sceneGraph;
|
|
2807
2781
|
var selectedLayer = planData.sceneData.selectedLayer;
|
|
2808
2782
|
/**
|
|
@@ -2830,7 +2804,7 @@ function createBacksplash(item, layer, planData, scene) {
|
|
|
2830
2804
|
|
|
2831
2805
|
var i,
|
|
2832
2806
|
wallItems = [];
|
|
2833
|
-
var allWallItems =
|
|
2807
|
+
var allWallItems = GeometryUtils.getAllItemSpecified(scene, planData.catalog, WALL_CABINET_LAYOUTPOS);
|
|
2834
2808
|
for (i = 0; i < allWallItems.others.length; i++) wallItems.push(allWallItems.others[i]);
|
|
2835
2809
|
if (allWallItems.cur) wallItems.push(allWallItems.cur);
|
|
2836
2810
|
|
|
@@ -2838,7 +2812,7 @@ function createBacksplash(item, layer, planData, scene) {
|
|
|
2838
2812
|
|
|
2839
2813
|
var altitude = item.itemInfo.properties.get('altitude').get('_length');
|
|
2840
2814
|
var altitudeUnit = item.itemInfo.properties.get('altitude').get('_unit') || 'cm';
|
|
2841
|
-
altitude =
|
|
2815
|
+
altitude = convert(altitude).from(altitudeUnit).to('cm');
|
|
2842
2816
|
var thickness = 1,
|
|
2843
2817
|
/** Height --- altitude */depth;
|
|
2844
2818
|
|
|
@@ -2853,7 +2827,7 @@ function createBacksplash(item, layer, planData, scene) {
|
|
|
2853
2827
|
wallItems.map(function (wallItem) {
|
|
2854
2828
|
var altitude = wallItem.itemInfo.properties.get('altitude').get('_length');
|
|
2855
2829
|
var altitudeUnit = wallItem.itemInfo.properties.get('altitude').get('_unit') || 'cm';
|
|
2856
|
-
altitude =
|
|
2830
|
+
altitude = convert(altitude).from(altitudeUnit).to('cm');
|
|
2857
2831
|
altItems.push({
|
|
2858
2832
|
x: wallItem.pos.x,
|
|
2859
2833
|
width: wallItem.size.width,
|
|
@@ -2903,7 +2877,7 @@ function createBacksplash(item, layer, planData, scene) {
|
|
|
2903
2877
|
// Find mergeable other backsplashes
|
|
2904
2878
|
|
|
2905
2879
|
var info, wholeWidth, /** Width factor */factor, distance, halfWidth, /** To get new center */centerFactor;
|
|
2906
|
-
var _iterator = (
|
|
2880
|
+
var _iterator = _createForOfIteratorHelper(backsplashes),
|
|
2907
2881
|
_step;
|
|
2908
2882
|
try {
|
|
2909
2883
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
@@ -2949,7 +2923,7 @@ function createBacksplash(item, layer, planData, scene) {
|
|
|
2949
2923
|
metalness: texture.metalness,
|
|
2950
2924
|
roughness: texture.roughness
|
|
2951
2925
|
});
|
|
2952
|
-
var interiortexture =
|
|
2926
|
+
var interiortexture = loadTexture(texture.uri);
|
|
2953
2927
|
applyTexture(areaMaterial, interiortexture, splashWidth * 1.5, splashHeight * 1.5);
|
|
2954
2928
|
|
|
2955
2929
|
// Make geometry
|
|
@@ -2962,9 +2936,9 @@ function createBacksplash(item, layer, planData, scene) {
|
|
|
2962
2936
|
backsplash.position.y = itemToSave.info.posY;
|
|
2963
2937
|
backsplash.position.z = itemToSave.info.posZ;
|
|
2964
2938
|
backsplash.rotation.y = itemToSave.info.rotY;
|
|
2965
|
-
var allLines =
|
|
2966
|
-
var allLineRects =
|
|
2967
|
-
if (item.is_corner &&
|
|
2939
|
+
var allLines = GeometryUtils.getAllLines(layer);
|
|
2940
|
+
var allLineRects = GeometryUtils.buildRectFromLines(layer, allLines);
|
|
2941
|
+
if (item.is_corner && GeometryUtils.isSnappedSideLine(item, allLineRects)) {
|
|
2968
2942
|
// corner cabinet item.itemInfo.getIn(["cabinet_category"]) === "Corner Base Cabinets"
|
|
2969
2943
|
var geometry1 = new Three.BoxGeometry(splashWidth, splashHeight, splashDepth);
|
|
2970
2944
|
// Make backsplash mesh
|
|
@@ -2974,7 +2948,7 @@ function createBacksplash(item, layer, planData, scene) {
|
|
|
2974
2948
|
backsplash1.position.y = posY1;
|
|
2975
2949
|
backsplash1.position.z = posZ1;
|
|
2976
2950
|
backsplash1.rotation.y = rotY1;
|
|
2977
|
-
var newBacksplash = new
|
|
2951
|
+
var newBacksplash = new Group();
|
|
2978
2952
|
newBacksplash.add(backsplash);
|
|
2979
2953
|
newBacksplash.add(backsplash1);
|
|
2980
2954
|
backsplash = newBacksplash;
|
|
@@ -2990,7 +2964,7 @@ function createBacksplash(item, layer, planData, scene) {
|
|
|
2990
2964
|
if (index < 0) {
|
|
2991
2965
|
backsplashes.push(itemToSave);
|
|
2992
2966
|
} else {
|
|
2993
|
-
|
|
2967
|
+
disposeObject(backsplashes[index].backsplash);
|
|
2994
2968
|
backsplashes.splice(index, 1, itemToSave);
|
|
2995
2969
|
}
|
|
2996
2970
|
}
|
|
@@ -3003,7 +2977,7 @@ function addMGMesh(molding, planData, layer) {
|
|
|
3003
2977
|
var flag = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
3004
2978
|
var point = [];
|
|
3005
2979
|
var data = molding === null || molding === void 0 || (_molding$molding = molding.molding) === null || _molding$molding === void 0 ? void 0 : _molding$molding.data;
|
|
3006
|
-
if (
|
|
2980
|
+
if (isEmpty(data)) return;
|
|
3007
2981
|
var paths = data.paths,
|
|
3008
2982
|
svg_width = data.svg_width,
|
|
3009
2983
|
svg_height = data.svg_height;
|
|
@@ -3022,7 +2996,7 @@ function addMGMesh(molding, planData, layer) {
|
|
|
3022
2996
|
_addMGMesh(molding, planData, layer, point, svg_width, svg_height, flag);
|
|
3023
2997
|
}
|
|
3024
2998
|
var isBaseCabinet = function isBaseCabinet(item) {
|
|
3025
|
-
return item.layoutpos ===
|
|
2999
|
+
return item.layoutpos === BASE_CABINET_LAYOUTPOS;
|
|
3026
3000
|
};
|
|
3027
3001
|
|
|
3028
3002
|
/**
|
|
@@ -3045,24 +3019,24 @@ function _addMGMesh(molding, planData, layer, data, svg_width, svg_height, flag)
|
|
|
3045
3019
|
var length = data.length; //point array
|
|
3046
3020
|
var temp_unit = child.height_unit;
|
|
3047
3021
|
if (temp_unit === 'inch') {
|
|
3048
|
-
child.height =
|
|
3022
|
+
child.height = convert(child.height).from('in').to('cm');
|
|
3049
3023
|
child.height_unit = 'cm';
|
|
3050
3024
|
}
|
|
3051
3025
|
temp_unit = child.width_unit;
|
|
3052
3026
|
if (temp_unit === 'inch') {
|
|
3053
|
-
child.width =
|
|
3027
|
+
child.width = convert(child.width).from('in').to('cm');
|
|
3054
3028
|
child.width_unit = 'cm';
|
|
3055
3029
|
}
|
|
3056
3030
|
temp_unit = child.length_unit;
|
|
3057
3031
|
if (temp_unit === 'inch') {
|
|
3058
|
-
child.length =
|
|
3032
|
+
child.length = convert(child.length).from('in').to('cm');
|
|
3059
3033
|
child.length_unit = 'cm';
|
|
3060
3034
|
}
|
|
3061
3035
|
geometry.needsUpdate = true;
|
|
3062
3036
|
geometry = moldingVertices(pointGroup, geometry, data, child, svg_width, svg_height, molding.pointGroups.length);
|
|
3063
3037
|
var total = geometry.attributes.position.count;
|
|
3064
3038
|
var len = geometry.attributes.position.count / length;
|
|
3065
|
-
if (!
|
|
3039
|
+
if (!GeometryUtils.samePoints(pointGroup[0], pointGroup[pointGroup.length - 1])) {
|
|
3066
3040
|
len--;
|
|
3067
3041
|
}
|
|
3068
3042
|
for (var i = 0; i < len; i++) {
|
|
@@ -3103,7 +3077,7 @@ function _addMGMesh(molding, planData, layer, data, svg_width, svg_height, flag)
|
|
|
3103
3077
|
x: data[_i2 + 1].x,
|
|
3104
3078
|
y: data[_i2 + 1].y
|
|
3105
3079
|
};
|
|
3106
|
-
var posDistance =
|
|
3080
|
+
var posDistance = verticesDistance(v1, v2);
|
|
3107
3081
|
sumDistance += posDistance;
|
|
3108
3082
|
if (_i2 === data.length - 2) finalDistance = sumDistance;
|
|
3109
3083
|
sumDistanceArray.push(sumDistance);
|
|
@@ -3115,7 +3089,7 @@ function _addMGMesh(molding, planData, layer, data, svg_width, svg_height, flag)
|
|
|
3115
3089
|
var uvs_item = [];
|
|
3116
3090
|
for (var _i4 = 0; _i4 < uvs_element_array.length - 1; _i4++) {
|
|
3117
3091
|
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]];
|
|
3118
|
-
uvs.push.apply(uvs, (
|
|
3092
|
+
uvs.push.apply(uvs, _toConsumableArray(uvs_item));
|
|
3119
3093
|
}
|
|
3120
3094
|
var all_uvs = [];
|
|
3121
3095
|
for (var _i5 = 0; _i5 < pointGroup.length; _i5++) {
|
|
@@ -3142,15 +3116,15 @@ function deleteCTMesh(countertop, planData, layer) {
|
|
|
3142
3116
|
var ct3d = countertop.ct3d;
|
|
3143
3117
|
if (ct3d) {
|
|
3144
3118
|
planData.plan.remove(ct3d);
|
|
3145
|
-
|
|
3119
|
+
disposeObject(ct3d);
|
|
3146
3120
|
}
|
|
3147
3121
|
}
|
|
3148
3122
|
}
|
|
3149
|
-
function deleteMGMesh(molding, planData) {
|
|
3123
|
+
export function deleteMGMesh(molding, planData) {
|
|
3150
3124
|
var mode = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
3151
3125
|
// mode is 3D or elevation
|
|
3152
3126
|
molding.meshes.forEach(function (mesh) {
|
|
3153
|
-
if (
|
|
3127
|
+
if (isElevationView(mode)) {
|
|
3154
3128
|
var _planData$plan$childr;
|
|
3155
3129
|
// when elevation mode, remove obj same as selected global molding_name in platnData.plan
|
|
3156
3130
|
(_planData$plan$childr = planData.plan.children) === null || _planData$plan$childr === void 0 || _planData$plan$childr.forEach(function (obj) {
|
|
@@ -3160,7 +3134,7 @@ function deleteMGMesh(molding, planData) {
|
|
|
3160
3134
|
} else {
|
|
3161
3135
|
// when 3D mode
|
|
3162
3136
|
planData.plan.remove(mesh);
|
|
3163
|
-
|
|
3137
|
+
disposeObject(mesh);
|
|
3164
3138
|
}
|
|
3165
3139
|
});
|
|
3166
3140
|
molding.meshes = [];
|
|
@@ -3169,10 +3143,10 @@ function log() {
|
|
|
3169
3143
|
// console.log(...arguments);
|
|
3170
3144
|
}
|
|
3171
3145
|
function addCountertop(CTArray, addItem, planData, layer) {
|
|
3172
|
-
log('addCountertop', (
|
|
3146
|
+
log('addCountertop', _toConsumableArray(CTArray), addItem.id);
|
|
3173
3147
|
var tmp = planData;
|
|
3174
3148
|
tmp = tmp && tmp.catalog.getElement(addItem.type);
|
|
3175
|
-
if (!tmp) tmp = planData.catalog.getElement(
|
|
3149
|
+
if (!tmp) tmp = planData.catalog.getElement(returnReplaceableDeepSearchType(addItem.type));
|
|
3176
3150
|
var long_name = tmp && tmp.long_name;
|
|
3177
3151
|
if (long_name.includes('Sink ')) return;
|
|
3178
3152
|
var newCT = createCTFromItem(addItem, planData.sceneGraph.unit, planData.catalog);
|
|
@@ -3195,11 +3169,11 @@ function addCountertop(CTArray, addItem, planData, layer) {
|
|
|
3195
3169
|
addCTMesh(newCT, planData, layer);
|
|
3196
3170
|
CTArray.push(newCT);
|
|
3197
3171
|
}
|
|
3198
|
-
function deleteCountertop(CTArray, delItem, planData, layer) {
|
|
3172
|
+
export function deleteCountertop(CTArray, delItem, planData, layer) {
|
|
3199
3173
|
if (delItem == undefined) {
|
|
3200
3174
|
return;
|
|
3201
3175
|
}
|
|
3202
|
-
log('deleteCountertop', (
|
|
3176
|
+
log('deleteCountertop', _toConsumableArray(CTArray), delItem.id);
|
|
3203
3177
|
var delCT = null;
|
|
3204
3178
|
var delItemIndex = -1;
|
|
3205
3179
|
var delCTIndex = CTArray.findIndex(function (el) {
|
|
@@ -3222,9 +3196,9 @@ function deleteCountertop(CTArray, delItem, planData, layer) {
|
|
|
3222
3196
|
});
|
|
3223
3197
|
}
|
|
3224
3198
|
}
|
|
3225
|
-
function deleteAllMolding(MGArray, delItem, planData, oldSceneLayer, newSceneLayer) {
|
|
3226
|
-
var tempMGArray = (
|
|
3227
|
-
if (
|
|
3199
|
+
export function deleteAllMolding(MGArray, delItem, planData, oldSceneLayer, newSceneLayer) {
|
|
3200
|
+
var tempMGArray = _toConsumableArray(MGArray);
|
|
3201
|
+
if (isEmpty(delItem)) {
|
|
3228
3202
|
return tempMGArray;
|
|
3229
3203
|
}
|
|
3230
3204
|
|
|
@@ -3241,7 +3215,7 @@ function deleteAllMolding(MGArray, delItem, planData, oldSceneLayer, newSceneLay
|
|
|
3241
3215
|
// find the snapped items with delItem
|
|
3242
3216
|
var snappedItems = [];
|
|
3243
3217
|
oldSceneLayer.items.toArray().forEach(function (oItem) {
|
|
3244
|
-
if (oItem.category === 'cabinet' && oItem.id !== delItem.id &&
|
|
3218
|
+
if (oItem.category === 'cabinet' && oItem.id !== delItem.id && MoldingUtils.isItemSnappedItem(delItem, oItem)) {
|
|
3245
3219
|
snappedItems.push(oItem);
|
|
3246
3220
|
}
|
|
3247
3221
|
});
|
|
@@ -3253,8 +3227,8 @@ function deleteAllMolding(MGArray, delItem, planData, oldSceneLayer, newSceneLay
|
|
|
3253
3227
|
}
|
|
3254
3228
|
return tempMGArray;
|
|
3255
3229
|
}
|
|
3256
|
-
function addMolding(MGArray, addItem, planData, layer, itemActions, mode) {
|
|
3257
|
-
if (addItem.selected && [
|
|
3230
|
+
export function addMolding(MGArray, addItem, planData, layer, itemActions, mode) {
|
|
3231
|
+
if (addItem.selected && [MODE_DRAGGING_ITEM_3D, MODE_ROTATING_ITEM_3D].includes(mode)) return false;
|
|
3258
3232
|
|
|
3259
3233
|
// If the item is not available for current doorStyle
|
|
3260
3234
|
if (showYelloBox(addItem))
|
|
@@ -3288,15 +3262,15 @@ function addMolding(MGArray, addItem, planData, layer, itemActions, mode) {
|
|
|
3288
3262
|
var temp_MGArray = updateMoldingGroupArray(MGArray, addItem, planData, layer, itemActions, mode, 0);
|
|
3289
3263
|
temp_MGArray.forEach(function (mg) {
|
|
3290
3264
|
var moldingMesh = mg.meshes[0];
|
|
3291
|
-
if (
|
|
3292
|
-
if (!
|
|
3293
|
-
|
|
3265
|
+
if (isElevationView(mode)) {
|
|
3266
|
+
if (!isEmpty(moldingMesh)) {
|
|
3267
|
+
replaceMeshesWithLineSegments(moldingMesh);
|
|
3294
3268
|
}
|
|
3295
3269
|
}
|
|
3296
3270
|
});
|
|
3297
3271
|
return temp_MGArray;
|
|
3298
3272
|
}
|
|
3299
|
-
function updateMoldingGroupArray(MGArray, selItem, planData, layer) {
|
|
3273
|
+
export function updateMoldingGroupArray(MGArray, selItem, planData, layer) {
|
|
3300
3274
|
var itemActions = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
|
|
3301
3275
|
var mode = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : null;
|
|
3302
3276
|
var cnt = arguments.length > 6 ? arguments[6] : undefined;
|
|
@@ -3306,9 +3280,9 @@ function updateMoldingGroupArray(MGArray, selItem, planData, layer) {
|
|
|
3306
3280
|
console.log('updateMoldingGroupArray has limited!');
|
|
3307
3281
|
return MGArray;
|
|
3308
3282
|
}
|
|
3309
|
-
var temp_MGArray = (
|
|
3310
|
-
if (
|
|
3311
|
-
var isEnableMolding =
|
|
3283
|
+
var temp_MGArray = _toConsumableArray(MGArray);
|
|
3284
|
+
if (isEmpty(selItem)) return temp_MGArray;
|
|
3285
|
+
var isEnableMolding = MoldingUtils.isEnableItemForMolding(layer, selItem);
|
|
3312
3286
|
// Make a items group with selItem to create the new MG(molding group) array of selItem
|
|
3313
3287
|
var itemsForGroup = [selItem];
|
|
3314
3288
|
var i = 0;
|
|
@@ -3316,7 +3290,7 @@ function updateMoldingGroupArray(MGArray, selItem, planData, layer) {
|
|
|
3316
3290
|
layer.items.toArray().forEach(function (curItem) {
|
|
3317
3291
|
if (!itemsForGroup.some(function (it) {
|
|
3318
3292
|
return it.id === curItem.id;
|
|
3319
|
-
}) && curItem.category === 'cabinet' &&
|
|
3293
|
+
}) && curItem.category === 'cabinet' && MoldingUtils.isSameMoldingLayoutpos(curItem, itemsForGroup[i]) && MoldingUtils.isItemSnappedItem(itemsForGroup[i], curItem)) {
|
|
3320
3294
|
itemsForGroup.push(curItem);
|
|
3321
3295
|
}
|
|
3322
3296
|
});
|
|
@@ -3324,7 +3298,7 @@ function updateMoldingGroupArray(MGArray, selItem, planData, layer) {
|
|
|
3324
3298
|
}
|
|
3325
3299
|
|
|
3326
3300
|
// Create the new MG(molding group) array of selItem
|
|
3327
|
-
var new_MGArray =
|
|
3301
|
+
var new_MGArray = MoldingUtils.getAllMoldingGroups(layer, itemsForGroup);
|
|
3328
3302
|
|
|
3329
3303
|
// get molding settings of update molding from adjoined item's molding
|
|
3330
3304
|
var changeMoldings = [];
|
|
@@ -3340,13 +3314,13 @@ function updateMoldingGroupArray(MGArray, selItem, planData, layer) {
|
|
|
3340
3314
|
});
|
|
3341
3315
|
|
|
3342
3316
|
// if current item has not destination molding then set it to the current molding
|
|
3343
|
-
if (!
|
|
3317
|
+
if (!isEmpty(destMolding) && !selItem.molding.some(function (md) {
|
|
3344
3318
|
return md.location_type === destMolding.location_type;
|
|
3345
3319
|
})) {
|
|
3346
3320
|
// only update with the same height cabinet or update the bottom molding setting
|
|
3347
3321
|
// itemActions.setMolding(destMoldings[i], false);
|
|
3348
3322
|
changeMoldings.push(destMolding);
|
|
3349
|
-
} else if (
|
|
3323
|
+
} else if (isEmpty(destMolding) && selItem.molding.some(function (md) {
|
|
3350
3324
|
return md.location_type === mg.location_type;
|
|
3351
3325
|
})) {
|
|
3352
3326
|
// if current item has more molding than adjoined then remove theses moldings
|
|
@@ -3364,7 +3338,7 @@ function updateMoldingGroupArray(MGArray, selItem, planData, layer) {
|
|
|
3364
3338
|
var filteredNewMGList = new_MGArray.filter(function (mg) {
|
|
3365
3339
|
return mg.location_type === oldMG.location_type;
|
|
3366
3340
|
});
|
|
3367
|
-
if (
|
|
3341
|
+
if (isEmpty(filteredNewMGList)) {
|
|
3368
3342
|
return true;
|
|
3369
3343
|
}
|
|
3370
3344
|
var _loop3 = function _loop3() {
|
|
@@ -3438,7 +3412,7 @@ function updateMoldingGroupArray(MGArray, selItem, planData, layer) {
|
|
|
3438
3412
|
if (mg.molding !== null && mg.molding.itemID !== molding.itemID) {
|
|
3439
3413
|
deleteMGMesh(mg, planData, mode);
|
|
3440
3414
|
}
|
|
3441
|
-
mg =
|
|
3415
|
+
mg = MoldingUtils.createMonldingGroup(mg, layer, molding, planData.catalog);
|
|
3442
3416
|
}
|
|
3443
3417
|
if (!mg.meshes.length) {
|
|
3444
3418
|
addMGMesh(mg, planData, layer);
|
|
@@ -3467,7 +3441,7 @@ function updateMoldingGroupArray(MGArray, selItem, planData, layer) {
|
|
|
3467
3441
|
return MGArray;
|
|
3468
3442
|
}
|
|
3469
3443
|
}
|
|
3470
|
-
function removeSelItemMesh(MGArray, selItem, planData, mode) {
|
|
3444
|
+
export function removeSelItemMesh(MGArray, selItem, planData, mode) {
|
|
3471
3445
|
if (selItem) {
|
|
3472
3446
|
if (!selItem.selected) {
|
|
3473
3447
|
return;
|
|
@@ -3497,7 +3471,7 @@ function removeSelItemMesh(MGArray, selItem, planData, mode) {
|
|
|
3497
3471
|
*
|
|
3498
3472
|
* And one-door-cabinet is the same case with the left door of two-door-cabinet
|
|
3499
3473
|
*/
|
|
3500
|
-
function updateDoorHandleMesh(_, item3D, flip) {
|
|
3474
|
+
export function updateDoorHandleMesh(_, item3D, flip) {
|
|
3501
3475
|
if (!item3D) {
|
|
3502
3476
|
console.error('Item mesh is undefined.');
|
|
3503
3477
|
return;
|
|
@@ -3578,11 +3552,11 @@ function updateDoorHandleMesh(_, item3D, flip) {
|
|
|
3578
3552
|
}
|
|
3579
3553
|
});
|
|
3580
3554
|
}
|
|
3581
|
-
function addWarningBox(itemId, altitude, planData) {
|
|
3555
|
+
export function addWarningBox(itemId, altitude, planData) {
|
|
3582
3556
|
deleteSpecifiedMeshObjects('WarningBox' + itemId);
|
|
3583
3557
|
var item3D = planData.sceneGraph.layers[planData.sceneData.selectedLayer].items[itemId];
|
|
3584
3558
|
if (item3D == undefined) return;
|
|
3585
|
-
var altitudeLength =
|
|
3559
|
+
var altitudeLength = convert(altitude).from('in').to('cm');
|
|
3586
3560
|
var sBounding = item3D.children[0].userData;
|
|
3587
3561
|
var width = sBounding.max.x - sBounding.min.x;
|
|
3588
3562
|
var height = sBounding.max.y - sBounding.min.y;
|
|
@@ -3604,7 +3578,7 @@ function addWarningBox(itemId, altitude, planData) {
|
|
|
3604
3578
|
warnBoxObj.name = 'WarningBox' + itemId;
|
|
3605
3579
|
// planData.plan.add(warnBoxObj);
|
|
3606
3580
|
}
|
|
3607
|
-
function checkCabinetOverlap(itemPos, itemRect, holeItems, planData) {
|
|
3581
|
+
export function checkCabinetOverlap(itemPos, itemRect, holeItems, planData) {
|
|
3608
3582
|
if (holeItems.length) {
|
|
3609
3583
|
var depth = itemRect.size.depth;
|
|
3610
3584
|
var i;
|
|
@@ -3621,7 +3595,7 @@ function checkCabinetOverlap(itemPos, itemRect, holeItems, planData) {
|
|
|
3621
3595
|
if (i != holeItems.length) {
|
|
3622
3596
|
var altitude = itemRect.itemInfo.properties.get('altitude').get('_length');
|
|
3623
3597
|
var altitudeUnit = itemRect.itemInfo.properties.get('altitude').get('_unit') || 'cm';
|
|
3624
|
-
altitude =
|
|
3598
|
+
altitude = convert(altitude).from(altitudeUnit).to('cm');
|
|
3625
3599
|
addWarningBox(itemRect.itemInfo.id, altitude, planData);
|
|
3626
3600
|
}
|
|
3627
3601
|
}
|