kitchen-simulator 1.1.1-test.62 → 1.1.1-test.63

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