kitchen-simulator 1.1.1-test.70 → 1.1.1-test.71

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