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