kitchen-simulator 1.1.1-test.72 → 1.1.1-test.74

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (188) hide show
  1. package/es/@history.js +2 -5
  2. package/es/AppContext.js +3 -6
  3. package/es/KitchenConfigurator.js +86 -86
  4. package/es/KitchenConfiguratorApp.js +134 -128
  5. package/es/actions/area-actions.js +5 -8
  6. package/es/actions/export.js +12 -24
  7. package/es/actions/groups-actions.js +27 -41
  8. package/es/actions/holes-actions.js +34 -51
  9. package/es/actions/items-actions.js +94 -141
  10. package/es/actions/lines-actions.js +21 -32
  11. package/es/actions/project-actions.js +94 -141
  12. package/es/actions/scene-actions.js +11 -17
  13. package/es/actions/vertices-actions.js +7 -11
  14. package/es/actions/viewer2d-actions.js +21 -32
  15. package/es/actions/viewer3d-actions.js +9 -14
  16. package/es/catalog/areas/area/planner-element.js +2 -5
  17. package/es/catalog/catalog.js +15 -17
  18. package/es/catalog/factories/area-factory-3d.js +22 -26
  19. package/es/catalog/factories/area-factory.js +13 -15
  20. package/es/catalog/factories/export.js +6 -10
  21. package/es/catalog/factories/wall-factory-3d.js +31 -36
  22. package/es/catalog/factories/wall-factory.js +21 -26
  23. package/es/catalog/holes/door-closet/planner-element.js +15 -19
  24. package/es/catalog/holes/door-double/planner-element.js +15 -19
  25. package/es/catalog/holes/door-exterior/planner-element.js +16 -20
  26. package/es/catalog/holes/door-interior/planner-element.js +16 -20
  27. package/es/catalog/holes/door-panic/planner-element.js +7 -11
  28. package/es/catalog/holes/door-panic-double/planner-element.js +15 -19
  29. package/es/catalog/holes/door-sliding/planner-element.js +17 -21
  30. package/es/catalog/holes/doorway-framed/planner-element.js +11 -15
  31. package/es/catalog/holes/doorway-frameless/planner-element.js +7 -11
  32. package/es/catalog/holes/export.js +13 -29
  33. package/es/catalog/holes/window-clear/planner-element.js +10 -14
  34. package/es/catalog/holes/window-cross/planner-element.js +10 -14
  35. package/es/catalog/holes/window-double-hung/planner-element.js +10 -14
  36. package/es/catalog/holes/window-vertical/planner-element.js +10 -14
  37. package/es/catalog/lines/wall/planner-element.js +2 -5
  38. package/es/catalog/molding/molding-dcm/planner-element.js +5 -9
  39. package/es/catalog/molding/molding-fbm/planner-element.js +5 -9
  40. package/es/catalog/molding/molding-lrm/planner-element.js +5 -9
  41. package/es/catalog/properties/export.js +20 -31
  42. package/es/catalog/properties/property-checkbox.js +28 -29
  43. package/es/catalog/properties/property-color.js +16 -19
  44. package/es/catalog/properties/property-enum.js +24 -27
  45. package/es/catalog/properties/property-hidden.js +9 -12
  46. package/es/catalog/properties/property-lenght-measure.js +38 -41
  47. package/es/catalog/properties/property-length-measure.js +36 -39
  48. package/es/catalog/properties/property-length-measure_hole.js +38 -41
  49. package/es/catalog/properties/property-number.js +17 -20
  50. package/es/catalog/properties/property-read-only.js +16 -19
  51. package/es/catalog/properties/property-string.js +16 -19
  52. package/es/catalog/properties/property-toggle.js +16 -19
  53. package/es/catalog/properties/shared-property-style.js +1 -3
  54. package/es/catalog/utils/FuseUtils.js +12 -13
  55. package/es/catalog/utils/exporter.js +10 -11
  56. package/es/catalog/utils/geom-utils.js +13 -24
  57. package/es/catalog/utils/item-loader.js +86 -92
  58. package/es/catalog/utils/load-obj.js +20 -24
  59. package/es/catalog/utils/mtl-loader.js +3 -4
  60. package/es/catalog/utils/obj-loader.js +3 -4
  61. package/es/class/FuseUtils.js +12 -13
  62. package/es/class/area.js +24 -24
  63. package/es/class/export.js +23 -36
  64. package/es/class/group.js +53 -55
  65. package/es/class/guide.js +15 -17
  66. package/es/class/hole.js +83 -85
  67. package/es/class/item.js +155 -155
  68. package/es/class/layer.js +59 -61
  69. package/es/class/line.js +135 -138
  70. package/es/class/project.js +93 -94
  71. package/es/class/vertex.js +29 -31
  72. package/es/components/content.js +19 -23
  73. package/es/components/disclaimer/disclaimer.js +10 -13
  74. package/es/components/export.js +8 -13
  75. package/es/components/style/button.js +25 -25
  76. package/es/components/style/cancel-button.js +7 -10
  77. package/es/components/style/content-container.js +11 -12
  78. package/es/components/style/content-title.js +13 -15
  79. package/es/components/style/delete-button.js +8 -12
  80. package/es/components/style/export.js +30 -46
  81. package/es/components/style/form-block.js +10 -11
  82. package/es/components/style/form-color-input.js +7 -10
  83. package/es/components/style/form-label.js +10 -11
  84. package/es/components/style/form-number-input.js +45 -43
  85. package/es/components/style/form-number-input_2.js +41 -39
  86. package/es/components/style/form-select.js +19 -20
  87. package/es/components/style/form-slider.js +10 -13
  88. package/es/components/style/form-submit-button.js +8 -12
  89. package/es/components/style/form-text-input.js +30 -28
  90. package/es/components/viewer2d/area.js +17 -20
  91. package/es/components/viewer2d/export.js +30 -46
  92. package/es/components/viewer2d/grids/grid-horizontal-streak.js +10 -13
  93. package/es/components/viewer2d/grids/grid-streak.js +10 -13
  94. package/es/components/viewer2d/grids/grid-vertical-streak.js +10 -13
  95. package/es/components/viewer2d/grids/grids.js +10 -14
  96. package/es/components/viewer2d/group.js +15 -19
  97. package/es/components/viewer2d/item.js +61 -65
  98. package/es/components/viewer2d/layer.js +23 -26
  99. package/es/components/viewer2d/line.js +101 -106
  100. package/es/components/viewer2d/ruler.js +22 -25
  101. package/es/components/viewer2d/rulerDist.js +21 -24
  102. package/es/components/viewer2d/rulerX.js +46 -44
  103. package/es/components/viewer2d/rulerY.js +44 -42
  104. package/es/components/viewer2d/scene.js +34 -34
  105. package/es/components/viewer2d/snap.js +13 -17
  106. package/es/components/viewer2d/state.js +18 -22
  107. package/es/components/viewer2d/utils.js +24 -33
  108. package/es/components/viewer2d/vertex.js +8 -12
  109. package/es/components/viewer2d/viewer2d.js +156 -159
  110. package/es/components/viewer3d/camera-controls-module/camera-controls.module.js +21 -19
  111. package/es/components/viewer3d/dcm.js +1 -3
  112. package/es/components/viewer3d/fbm.js +1 -3
  113. package/es/components/viewer3d/front3D.js +12 -16
  114. package/es/components/viewer3d/grid-creator.js +8 -12
  115. package/es/components/viewer3d/grids/grid-horizontal-streak.js +6 -9
  116. package/es/components/viewer3d/grids/grid-streak.js +5 -8
  117. package/es/components/viewer3d/grids/grid-vertical-streak.js +6 -9
  118. package/es/components/viewer3d/libs/first-person-controls.js +2 -5
  119. package/es/components/viewer3d/libs/helvetiker_regular.typeface.js +1 -3
  120. package/es/components/viewer3d/libs/mtl-loader.js +1 -3
  121. package/es/components/viewer3d/libs/obj-loader.js +1 -3
  122. package/es/components/viewer3d/libs/orbit-controls.js +2 -4
  123. package/es/components/viewer3d/libs/pointer-lock-controls.js +2 -4
  124. package/es/components/viewer3d/lrm.js +1 -3
  125. package/es/components/viewer3d/model.js +1 -3
  126. package/es/components/viewer3d/pointer-lock-navigation.js +3 -6
  127. package/es/components/viewer3d/ruler-utils/itemRect.js +18 -21
  128. package/es/components/viewer3d/ruler-utils/layer3D.js +59 -62
  129. package/es/components/viewer3d/ruler-utils/ruler3D.js +42 -43
  130. package/es/components/viewer3d/ruler-utils/scene3D.js +9 -13
  131. package/es/components/viewer3d/ruler-utils/state3D.js +4 -7
  132. package/es/components/viewer3d/scene-creator.js +197 -223
  133. package/es/components/viewer3d/three-memory-cleaner.js +3 -7
  134. package/es/components/viewer3d/viewer3d-first-person.js +42 -42
  135. package/es/components/viewer3d/viewer3d.js +200 -198
  136. package/es/constants.js +349 -354
  137. package/es/index.js +7 -11
  138. package/es/models.js +193 -191
  139. package/es/plugins/SVGLoader.js +48 -49
  140. package/es/plugins/autosave.js +3 -5
  141. package/es/plugins/console-debugger.js +6 -7
  142. package/es/plugins/export.js +8 -13
  143. package/es/plugins/keyboard.js +29 -31
  144. package/es/reducers/areas-reducer.js +7 -9
  145. package/es/reducers/export.js +24 -37
  146. package/es/reducers/groups-reducer.js +31 -33
  147. package/es/reducers/holes-reducer.js +43 -45
  148. package/es/reducers/items-reducer.js +106 -108
  149. package/es/reducers/lines-reducer.js +28 -30
  150. package/es/reducers/project-reducer.js +105 -107
  151. package/es/reducers/reducer.js +16 -19
  152. package/es/reducers/scene-reducer.js +15 -17
  153. package/es/reducers/user-reducer.js +5 -7
  154. package/es/reducers/vertices-reducer.js +11 -13
  155. package/es/reducers/viewer2d-reducer.js +18 -20
  156. package/es/reducers/viewer3d-reducer.js +16 -18
  157. package/es/shared-style.js +10 -12
  158. package/es/styles/export.js +3 -6
  159. package/es/translator/en.js +1 -3
  160. package/es/translator/it.js +1 -3
  161. package/es/translator/ru.js +1 -3
  162. package/es/translator/translator.js +13 -15
  163. package/es/utils/browser.js +2 -5
  164. package/es/utils/convert-units-lite.js +1 -3
  165. package/es/utils/email-validator.js +1 -3
  166. package/es/utils/export.js +15 -29
  167. package/es/utils/geometry.js +190 -280
  168. package/es/utils/get-edges-of-subgraphs.js +2 -5
  169. package/es/utils/graph-cycles.js +8 -7
  170. package/es/utils/graph-inner-cycles.js +10 -14
  171. package/es/utils/graph.js +9 -13
  172. package/es/utils/helper.js +41 -58
  173. package/es/utils/history.js +8 -11
  174. package/es/utils/id-broker.js +8 -11
  175. package/es/utils/logger.js +1 -3
  176. package/es/utils/math.js +5 -8
  177. package/es/utils/molding.js +130 -146
  178. package/es/utils/name-generator.js +7 -9
  179. package/es/utils/objects-utils.js +7 -14
  180. package/es/utils/phone-validator.js +1 -3
  181. package/es/utils/process-black-list.js +5 -6
  182. package/es/utils/react-if.js +7 -9
  183. package/es/utils/snap-scene.js +27 -30
  184. package/es/utils/snap.js +53 -57
  185. package/es/utils/summarizeCart.js +1 -3
  186. package/es/utils/threeCSG.es6.js +13 -17
  187. package/es/version.js +1 -3
  188. package/package.json +1 -1
@@ -1,43 +1,27 @@
1
- var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard")["default"];
2
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
3
- exports.__esModule = true;
4
- exports.createMonldingGroup = createMonldingGroup;
5
- exports.getAllMoldingGroups = getAllMoldingGroups;
6
- exports.getItemGroupFromMolding = getItemGroupFromMolding;
7
- exports.getItemRect = getItemRect;
8
- exports.getLinesFromItems = getLinesFromItems;
9
- exports.getLinesFromItems2 = getLinesFromItems2;
10
- exports.getLinesOfItem = getLinesOfItem;
11
- exports.hasMoldingLayout = hasMoldingLayout;
12
- exports.isEnableItemForMolding = isEnableItemForMolding;
13
- exports.isItemSameItemByLocation = isItemSameItemByLocation;
14
- exports.isItemSnappedGroup = isItemSnappedGroup;
15
- exports.isItemSnappedItem = isItemSnappedItem;
16
- exports.isLinesOverlapped = isLinesOverlapped;
17
- exports.isSameMoldingLayoutpos = isSameMoldingLayoutpos;
18
- exports.mergeOverlappedLines = mergeOverlappedLines;
19
- exports.sortItemsByDistance = sortItemsByDistance;
20
- exports.tryMergeMDItem = tryMergeMDItem;
21
- var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
22
- var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/toConsumableArray"));
23
- var _createForOfIteratorHelper2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createForOfIteratorHelper"));
24
- var _constants = require("../constants");
25
- var Three = _interopRequireWildcard(require("three"));
26
- var _convertUnitsLite = require("./convert-units-lite");
27
- var _idBroker = _interopRequireDefault(require("./id-broker"));
28
- var _utils = require("../components/viewer2d/utils");
29
- var _export = require("./export");
30
- var _helper = require("./helper");
31
- function getItemRect(item) {
1
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
+ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
3
+ 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; }
4
+ 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; }
5
+ 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; } } }; }
6
+ 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; } }
7
+ 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; }
8
+ import { BASE_CABINET_LAYOUTPOS, BOTTOM_MOLDING_LOCATION, EPSILON, MIDDLE_MOLDING_LOCATION, MOLDING_LOCATIONS, OVERLAP_INCLUDED, OVERLAP_LINK, OVERLAP_SAME, OVERLAP_SOME, TALL_CABINET_LAYOUTPOS, TOP_MOLDING_LOCATION, WALL_CABINET_LAYOUTPOS } from "../constants";
9
+ import * as Three from 'three';
10
+ import { convert } from "./convert-units-lite";
11
+ import IDBroker from "./id-broker";
12
+ import { returnReplaceableDeepSearchType } from "../components/viewer2d/utils";
13
+ import { GeometryUtils } from "./export";
14
+ import { isEmpty } from "./helper";
15
+ export function getItemRect(item) {
32
16
  var x = item.x;
33
17
  var y = item.y;
34
18
  var rotRad = item.rotation / 180 * Math.PI;
35
19
  var itemWidth = item.properties.get('width').get('_length');
36
20
  var itemWidthUnit = item.properties.get('width').get('_unit') || 'cm';
37
- itemWidth = (0, _convertUnitsLite.convert)(itemWidth / 2).from(itemWidthUnit).to('cm');
21
+ itemWidth = convert(itemWidth / 2).from(itemWidthUnit).to('cm');
38
22
  var itemDepth = item.properties.get('depth').get('_length');
39
23
  var itemDepthUnit = item.properties.get('depth').get('_unit') || 'cm';
40
- itemDepth = (0, _convertUnitsLite.convert)(itemDepth / 2).from(itemDepthUnit).to('cm');
24
+ itemDepth = convert(itemDepth / 2).from(itemDepthUnit).to('cm');
41
25
  var mx = x - itemWidth * Math.cos(rotRad);
42
26
  var my = y - itemWidth * Math.sin(rotRad);
43
27
  var x0 = mx + itemDepth * Math.sin(rotRad);
@@ -64,17 +48,17 @@ function getItemRect(item) {
64
48
  }]
65
49
  };
66
50
  }
67
- function hasMoldingLayout(molding, layoutpos) {
51
+ export function hasMoldingLayout(molding, layoutpos) {
68
52
  var types = molding === null || molding === void 0 ? void 0 : molding.molding_type;
69
53
  return (Array.isArray(types) || typeof types === 'string') && types.includes(layoutpos);
70
54
  }
71
- function isEnableItemForMolding(layer, selItem) {
55
+ export function isEnableItemForMolding(layer, selItem) {
72
56
  var molding = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
73
- var allLineRects = _export.GeometryUtils.buildRectFromLines(layer, _export.GeometryUtils.getAllLines(layer));
74
- var result = !(0, _helper.isEmpty)(selItem) && selItem.category === 'cabinet' && (selItem.layoutpos === _constants.BASE_CABINET_LAYOUTPOS && !_export.GeometryUtils.isSnappedLine(getItemRect(selItem), allLineRects) || (selItem.layoutpos === _constants.WALL_CABINET_LAYOUTPOS || selItem.layoutpos === _constants.TALL_CABINET_LAYOUTPOS) && _export.GeometryUtils.isSnappedLine(getItemRect(selItem), allLineRects));
57
+ var allLineRects = GeometryUtils.buildRectFromLines(layer, GeometryUtils.getAllLines(layer));
58
+ var result = !isEmpty(selItem) && selItem.category === 'cabinet' && (selItem.layoutpos === BASE_CABINET_LAYOUTPOS && !GeometryUtils.isSnappedLine(getItemRect(selItem), allLineRects) || (selItem.layoutpos === WALL_CABINET_LAYOUTPOS || selItem.layoutpos === TALL_CABINET_LAYOUTPOS) && GeometryUtils.isSnappedLine(getItemRect(selItem), allLineRects));
75
59
 
76
60
  // check this item is enable for any molding
77
- if ((0, _helper.isEmpty)(molding)) return result;
61
+ if (isEmpty(molding)) return result;
78
62
  // check this item is enable for specified molding
79
63
  else return result && hasMoldingLayout(molding, selItem.layoutpos);
80
64
  }
@@ -98,66 +82,66 @@ function getDelta(selRectPos1, selRectPos2, curRectPos1, curRectPos2) {
98
82
  // GeometryUtils.verticesDistance(curRectPos2, curRectPos1) -
99
83
  // GeometryUtils.verticesDistance(selRectPos1, selRectPos2)
100
84
  // )
101
- Math.abs(_export.GeometryUtils.verticesDistance(curRectPos1, selRectPos1) + _export.GeometryUtils.verticesDistance(selRectPos2, curRectPos2) - _export.GeometryUtils.verticesDistance(curRectPos2, curRectPos1) - _export.GeometryUtils.verticesDistance(selRectPos1, selRectPos2))
85
+ Math.abs(GeometryUtils.verticesDistance(curRectPos1, selRectPos1) + GeometryUtils.verticesDistance(selRectPos2, curRectPos2) - GeometryUtils.verticesDistance(curRectPos2, curRectPos1) - GeometryUtils.verticesDistance(selRectPos1, selRectPos2))
102
86
  );
103
87
  }
104
- function isItemSnappedItem(selItem, curItem) {
88
+ export function isItemSnappedItem(selItem, curItem) {
105
89
  var selRect = getItemRect(selItem).rect;
106
90
  var curRect = getItemRect(curItem).rect;
107
- var flag30 = getDelta(selRect[3], selRect[0], curRect[1], curRect[2]) < _constants.EPSILON;
108
- var flag21 = getDelta(selRect[2], selRect[1], curRect[0], curRect[3]) < _constants.EPSILON;
109
- var flag23 = getDelta(selRect[2], selRect[3], curRect[2], curRect[3]) < _constants.EPSILON;
110
- var flag01 = getDelta(selRect[1], selRect[0], curRect[0], curRect[3]) < _constants.EPSILON;
111
- var flag03 = getDelta(selRect[0], selRect[3], curRect[1], curRect[0]) < _constants.EPSILON;
91
+ var flag30 = getDelta(selRect[3], selRect[0], curRect[1], curRect[2]) < EPSILON;
92
+ var flag21 = getDelta(selRect[2], selRect[1], curRect[0], curRect[3]) < EPSILON;
93
+ var flag23 = getDelta(selRect[2], selRect[3], curRect[2], curRect[3]) < EPSILON;
94
+ var flag01 = getDelta(selRect[1], selRect[0], curRect[0], curRect[3]) < EPSILON;
95
+ var flag03 = getDelta(selRect[0], selRect[3], curRect[1], curRect[0]) < EPSILON;
112
96
  return flag30 || flag21 || flag23 || flag01 || flag03;
113
97
  }
114
- function isItemSnappedGroup(selItem, itemGroup) {
98
+ export function isItemSnappedGroup(selItem, itemGroup) {
115
99
  return itemGroup.some(function (curItem) {
116
100
  return isItemSnappedItem(selItem, curItem);
117
101
  });
118
102
  }
119
- function sortItemsByDistance(items, selItem) {
103
+ export function sortItemsByDistance(items, selItem) {
120
104
  items.sort(function (a, b) {
121
- return _export.GeometryUtils.pointsDistance(a.x, a.y, selItem.x, selItem.y) - _export.GeometryUtils.pointsDistance(b.x, b.y, selItem.x, selItem.y);
105
+ return GeometryUtils.pointsDistance(a.x, a.y, selItem.x, selItem.y) - GeometryUtils.pointsDistance(b.x, b.y, selItem.x, selItem.y);
122
106
  });
123
107
  return items;
124
108
  }
125
- function isSameMoldingLayoutpos(curItem, item) {
126
- return curItem.layoutpos === _constants.BASE_CABINET_LAYOUTPOS && curItem.layoutpos === item.layoutpos || [_constants.WALL_CABINET_LAYOUTPOS, _constants.TALL_CABINET_LAYOUTPOS].includes(curItem.layoutpos) && [_constants.WALL_CABINET_LAYOUTPOS, _constants.TALL_CABINET_LAYOUTPOS].includes(item.layoutpos);
109
+ export function isSameMoldingLayoutpos(curItem, item) {
110
+ return curItem.layoutpos === BASE_CABINET_LAYOUTPOS && curItem.layoutpos === item.layoutpos || [WALL_CABINET_LAYOUTPOS, TALL_CABINET_LAYOUTPOS].includes(curItem.layoutpos) && [WALL_CABINET_LAYOUTPOS, TALL_CABINET_LAYOUTPOS].includes(item.layoutpos);
127
111
  }
128
- function isItemSameItemByLocation(item1, item2, location) {
112
+ export function isItemSameItemByLocation(item1, item2, location) {
129
113
  var item1Altitude = item1.properties.get('altitude').get('_length');
130
114
  var item1AltitudeUnit = item1.properties.get('altitude').get('_unit');
131
- item1Altitude = (0, _convertUnitsLite.convert)(item1Altitude).from(item1AltitudeUnit).to('cm');
115
+ item1Altitude = convert(item1Altitude).from(item1AltitudeUnit).to('cm');
132
116
  var item1Height = item1.properties.get('height').get('_length');
133
117
  var item1HeightUnit = item1.properties.get('height').get('_unit');
134
- item1Height = (0, _convertUnitsLite.convert)(item1Height).from(item1HeightUnit).to('cm');
118
+ item1Height = convert(item1Height).from(item1HeightUnit).to('cm');
135
119
  var item2Altitude = item2.properties.get('altitude').get('_length');
136
120
  var item2AltitudeUnit = item2.properties.get('altitude').get('_unit');
137
- item2Altitude = (0, _convertUnitsLite.convert)(item2Altitude).from(item2AltitudeUnit).to('cm');
121
+ item2Altitude = convert(item2Altitude).from(item2AltitudeUnit).to('cm');
138
122
  var item2Height = item2.properties.get('height').get('_length');
139
123
  var item2HeightUnit = item2.properties.get('height').get('_unit');
140
- item2Height = (0, _convertUnitsLite.convert)(item2Height).from(item2HeightUnit).to('cm');
124
+ item2Height = convert(item2Height).from(item2HeightUnit).to('cm');
141
125
  var flag = false;
142
126
  switch (location) {
143
- case _constants.TOP_MOLDING_LOCATION:
144
- if (_export.GeometryUtils.sameDistances(item1Altitude + item1Height, item2Altitude + item2Height)) flag = true;
127
+ case TOP_MOLDING_LOCATION:
128
+ if (GeometryUtils.sameDistances(item1Altitude + item1Height, item2Altitude + item2Height)) flag = true;
145
129
  break;
146
- case _constants.MIDDLE_MOLDING_LOCATION:
147
- if (_export.GeometryUtils.sameDistances(item1Altitude + item1Height / 2, item2Altitude + item2Height / 2)) flag = true;
130
+ case MIDDLE_MOLDING_LOCATION:
131
+ if (GeometryUtils.sameDistances(item1Altitude + item1Height / 2, item2Altitude + item2Height / 2)) flag = true;
148
132
  break;
149
- case _constants.BOTTOM_MOLDING_LOCATION:
150
- if (_export.GeometryUtils.sameDistances(item1Altitude, item2Altitude)) flag = true;
133
+ case BOTTOM_MOLDING_LOCATION:
134
+ if (GeometryUtils.sameDistances(item1Altitude, item2Altitude)) flag = true;
151
135
  break;
152
136
  }
153
137
  return flag;
154
138
  }
155
- function tryMergeMDItem(layer, selItem, curItem, itemGroup, molding) {
139
+ export function tryMergeMDItem(layer, selItem, curItem, itemGroup, molding) {
156
140
  return isSameMoldingLayoutpos(selItem, curItem) && isEnableItemForMolding(layer, curItem, molding) && isItemSnappedGroup(curItem, itemGroup) && !itemGroup.some(function (item) {
157
141
  return item.id === curItem.id;
158
142
  }) && isItemSameItemByLocation(selItem, curItem, molding.location_type);
159
143
  }
160
- function getItemGroupFromMolding(layer, curItem, molding) {
144
+ export function getItemGroupFromMolding(layer, curItem, molding) {
161
145
  var selectedItem = layer.getIn(['items', layer.selected.toJS().items[0]]);
162
146
  var itemGroup = [curItem];
163
147
  var temp_layer_items = layer.items.toArray().filter(function (item) {
@@ -184,7 +168,7 @@ function tryMergeItemWithLocation(curItem, itemGroup, location) {
184
168
  * @param {*} items - Mergable snapped item group, if [items] is null then get all MG array of layer
185
169
  * @returns MG array
186
170
  */
187
- function getAllMoldingGroups(layer) {
171
+ export function getAllMoldingGroups(layer) {
188
172
  var items = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
189
173
  if (items === null) items = layer.items.toArray();
190
174
  var MGArray = [];
@@ -206,7 +190,7 @@ function getAllMoldingGroups(layer) {
206
190
  return it.category === 'cabinet' && isSameMoldingLayoutpos(curItem, it) && it.id !== curItem.id;
207
191
  });
208
192
  temp_items = sortItemsByDistance(temp_items, curItem);
209
- _constants.MOLDING_LOCATIONS.forEach(function (location) {
193
+ MOLDING_LOCATIONS.forEach(function (location) {
210
194
  if (!MGArray.some(function (mg) {
211
195
  return mg.items.some(function (it) {
212
196
  return it.id === curItem.id;
@@ -229,7 +213,7 @@ function getAllMoldingGroups(layer) {
229
213
  }
230
214
  } while (isChangedItemGroup);
231
215
  MGArray.push({
232
- id: _idBroker["default"].acquireID(),
216
+ id: IDBroker.acquireID(),
233
217
  items: itemGroup,
234
218
  location_type: location,
235
219
  molding: null,
@@ -246,18 +230,18 @@ function getAllMoldingGroups(layer) {
246
230
  });
247
231
  return MGArray;
248
232
  }
249
- function getLinesOfItem(item, allLineRects, catalog) {
233
+ export function getLinesOfItem(item, allLineRects, catalog) {
250
234
  var lines = [];
251
235
  var outline = null;
252
236
  var element = catalog.elements[item.get('type')];
253
- if (!element) element = catalog.elements[(0, _utils.returnReplaceableDeepSearchType)(item.get('type'))];
237
+ if (!element) element = catalog.elements[returnReplaceableDeepSearchType(item.get('type'))];
254
238
  // get edge lines
255
239
  var newWidth = item.properties.get('width').get('_length');
256
240
  var wUnit = item.properties.get('width').get('_unit') || 'cm';
257
- newWidth = (0, _convertUnitsLite.convert)(newWidth).from(wUnit).to('cm');
241
+ newWidth = convert(newWidth).from(wUnit).to('cm');
258
242
  var newDepth = item.properties.get('depth').get('_length');
259
243
  var hUnit = item.properties.get('depth').get('_unit') || 'cm';
260
- newDepth = (0, _convertUnitsLite.convert)(newDepth).from(hUnit).to('cm');
244
+ newDepth = convert(newDepth).from(hUnit).to('cm');
261
245
  if (item) {
262
246
  // Get Outline Data of Selected Item
263
247
  outline = element.info.outline;
@@ -267,12 +251,12 @@ function getLinesOfItem(item, allLineRects, catalog) {
267
251
  var outlineWidth = outline.svgWidth;
268
252
  var outlineHeight = outline.svgHeight;
269
253
  var outlinePoints = []; // Hold Points Of SVG
270
- var _iterator = (0, _createForOfIteratorHelper2["default"])(outlinePaths),
254
+ var _iterator = _createForOfIteratorHelper(outlinePaths),
271
255
  _step;
272
256
  try {
273
257
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
274
258
  var path = _step.value;
275
- var _iterator2 = (0, _createForOfIteratorHelper2["default"])(path.subPaths),
259
+ var _iterator2 = _createForOfIteratorHelper(path.subPaths),
276
260
  _step2;
277
261
  try {
278
262
  for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
@@ -292,18 +276,18 @@ function getLinesOfItem(item, allLineRects, catalog) {
292
276
  }
293
277
  outline.reverse && outlinePoints.reverse();
294
278
  for (var i = 0; i < outlinePoints.length - 1; i++) {
295
- lines.push([_export.GeometryUtils.rotatePointAroundPoint((outlinePoints[i].x / outlineWidth - 0.5) * newWidth + item.x, (outlinePoints[i].y / outlineHeight - 0.5) * newDepth + item.y, item.x, item.y, item.rotation + 90), _export.GeometryUtils.rotatePointAroundPoint((outlinePoints[i + 1].x / outlineWidth - 0.5) * newWidth + item.x, (outlinePoints[i + 1].y / outlineHeight - 0.5) * newDepth + item.y, item.x, item.y, item.rotation + 90), _idBroker["default"].acquireID()]);
279
+ lines.push([GeometryUtils.rotatePointAroundPoint((outlinePoints[i].x / outlineWidth - 0.5) * newWidth + item.x, (outlinePoints[i].y / outlineHeight - 0.5) * newDepth + item.y, item.x, item.y, item.rotation + 90), GeometryUtils.rotatePointAroundPoint((outlinePoints[i + 1].x / outlineWidth - 0.5) * newWidth + item.x, (outlinePoints[i + 1].y / outlineHeight - 0.5) * newDepth + item.y, item.x, item.y, item.rotation + 90), IDBroker.acquireID()]);
296
280
  }
297
281
  } else {
298
282
  var pos = [[-1, -1], [1, -1], [1, 1], [-1, 1]];
299
283
  for (var _i = 0; _i < 4; _i++) {
300
- lines.push([_export.GeometryUtils.rotatePointAroundPoint(pos[_i][0] * newWidth / 2 + item.x, pos[_i][1] * newDepth / 2 + item.y, item.x, item.y, item.rotation), _export.GeometryUtils.rotatePointAroundPoint(pos[(_i + 1) % 4][0] * newWidth / 2 + item.x, pos[(_i + 1) % 4][1] * newDepth / 2 + item.y, item.x, item.y, item.rotation), _idBroker["default"].acquireID()]);
284
+ lines.push([GeometryUtils.rotatePointAroundPoint(pos[_i][0] * newWidth / 2 + item.x, pos[_i][1] * newDepth / 2 + item.y, item.x, item.y, item.rotation), GeometryUtils.rotatePointAroundPoint(pos[(_i + 1) % 4][0] * newWidth / 2 + item.x, pos[(_i + 1) % 4][1] * newDepth / 2 + item.y, item.x, item.y, item.rotation), IDBroker.acquireID()]);
301
285
  }
302
286
  }
303
287
  }
304
- if (item.layoutpos !== _constants.BASE_CABINET_LAYOUTPOS) {
288
+ if (item.layoutpos !== BASE_CABINET_LAYOUTPOS) {
305
289
  lines = lines.filter(function (line) {
306
- return !_export.GeometryUtils.isSnappedLine({
290
+ return !GeometryUtils.isSnappedLine({
307
291
  rect: [{
308
292
  x: 0,
309
293
  y: 0
@@ -318,29 +302,29 @@ function getLinesOfItem(item, allLineRects, catalog) {
318
302
  }
319
303
  function isParallelLines(line1, line2) {
320
304
  var isParallel = false;
321
- if (Math.abs(line1[0].y - line1[1].y) <= _constants.EPSILON && Math.abs(line2[0].y - line2[1].y) <= _constants.EPSILON) isParallel = true;
322
- if (Math.abs(line1[0].x - line1[1].x) <= _constants.EPSILON && Math.abs(line2[0].x - line2[1].x) <= _constants.EPSILON) isParallel = true;
323
- 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;
305
+ if (Math.abs(line1[0].y - line1[1].y) <= EPSILON && Math.abs(line2[0].y - line2[1].y) <= EPSILON) isParallel = true;
306
+ if (Math.abs(line1[0].x - line1[1].x) <= EPSILON && Math.abs(line2[0].x - line2[1].x) <= EPSILON) isParallel = true;
307
+ 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;
324
308
  if (isParallel) {
325
309
  return true;
326
310
  }
327
311
  return false;
328
312
  }
329
- function isLinesOverlapped(line1, line2) {
313
+ export function isLinesOverlapped(line1, line2) {
330
314
  return isParallelLines(line1, line2) && line1.some(function (l1) {
331
315
  return line2.some(function (l2) {
332
- return _export.GeometryUtils.samePoints(l1, l2);
316
+ return GeometryUtils.samePoints(l1, l2);
333
317
  });
334
318
  });
335
319
  }
336
- function mergeOverlappedLines(line1, line2) {
320
+ export function mergeOverlappedLines(line1, line2) {
337
321
  var line1_idx = 0,
338
322
  line2_idx = 0;
339
323
  line1.forEach(function (l1, idx1) {
340
324
  if (idx1 !== line1.length - 1) {
341
325
  line2.forEach(function (l2, idx2) {
342
326
  if (idx2 !== line2.length - 1) {
343
- if (_export.GeometryUtils.samePoints(l1, l2)) {
327
+ if (GeometryUtils.samePoints(l1, l2)) {
344
328
  line1_idx = idx1;
345
329
  line2_idx = idx2;
346
330
  }
@@ -351,9 +335,9 @@ function mergeOverlappedLines(line1, line2) {
351
335
  //If line1 's end point and line2 's start point is same, two lines merge into a line with
352
336
  //the line1's start point as the start point and line2's end point as the end point.
353
337
  if (line1_idx === 1) {
354
- return [line1[1 - line1_idx], line2[1 - line2_idx], _idBroker["default"].acquireID()];
338
+ return [line1[1 - line1_idx], line2[1 - line2_idx], IDBroker.acquireID()];
355
339
  } else {
356
- return [line2[1 - line2_idx], line1[1 - line1_idx], _idBroker["default"].acquireID()];
340
+ return [line2[1 - line2_idx], line1[1 - line1_idx], IDBroker.acquireID()];
357
341
  }
358
342
  }
359
343
 
@@ -364,12 +348,12 @@ function mergeOverlappedLines(line1, line2) {
364
348
  * @param {*} catalog
365
349
  * @returns contour line array of moldingGroup items
366
350
  */
367
- function getLinesFromItems2(moldingGroup, layer, catalog) {
351
+ export function getLinesFromItems2(moldingGroup, layer, catalog) {
368
352
  // wall lines
369
- var allLineRects = _export.GeometryUtils.buildRectFromLines(layer, _export.GeometryUtils.getAllLines(layer));
353
+ var allLineRects = GeometryUtils.buildRectFromLines(layer, GeometryUtils.getAllLines(layer));
370
354
  var MGlines = [];
371
355
  var MGlinesOtherSnapped = [];
372
- var items = (0, _toConsumableArray2["default"])(moldingGroup.items);
356
+ var items = _toConsumableArray(moldingGroup.items);
373
357
  // The other item's lines (these items are snapped to the moldingGroup items)
374
358
  var itemsOtherSnapped = layer.items.toArray().filter(function (item) {
375
359
  if (items.some(function (it) {
@@ -379,17 +363,17 @@ function getLinesFromItems2(moldingGroup, layer, catalog) {
379
363
  var itemLines = getLinesOfItem(item, allLineRects, catalog);
380
364
  var itemAltitude = item.properties.get('altitude').get('_length');
381
365
  var itemAltitudeUnit = item.properties.get('altitude').get('_unit');
382
- itemAltitude = (0, _convertUnitsLite.convert)(itemAltitude).from(itemAltitudeUnit).to('cm');
366
+ itemAltitude = convert(itemAltitude).from(itemAltitudeUnit).to('cm');
383
367
  var itemHeight = item.properties.get('height').get('_length');
384
368
  var itemHeightUnit = item.properties.get('height').get('_unit');
385
- itemHeight = (0, _convertUnitsLite.convert)(itemHeight).from(itemHeightUnit).to('cm');
369
+ itemHeight = convert(itemHeight).from(itemHeightUnit).to('cm');
386
370
  itemLines.forEach(function (line) {
387
371
  line.push({
388
372
  altitude: itemAltitude,
389
373
  height: itemHeight
390
374
  });
391
375
  });
392
- MGlinesOtherSnapped = [].concat((0, _toConsumableArray2["default"])(MGlinesOtherSnapped), (0, _toConsumableArray2["default"])(itemLines));
376
+ MGlinesOtherSnapped = [].concat(_toConsumableArray(MGlinesOtherSnapped), _toConsumableArray(itemLines));
393
377
  return true;
394
378
  } else return false;
395
379
  });
@@ -398,10 +382,10 @@ function getLinesFromItems2(moldingGroup, layer, catalog) {
398
382
  items.forEach(function (item) {
399
383
  var itemAltitude = item.properties.get('altitude').get('_length');
400
384
  var itemAltitudeUnit = item.properties.get('altitude').get('_unit');
401
- itemAltitude = (0, _convertUnitsLite.convert)(itemAltitude).from(itemAltitudeUnit).to('cm');
385
+ itemAltitude = convert(itemAltitude).from(itemAltitudeUnit).to('cm');
402
386
  var itemHeight = item.properties.get('height').get('_length');
403
387
  var itemHeightUnit = item.properties.get('height').get('_unit');
404
- itemHeight = (0, _convertUnitsLite.convert)(itemHeight).from(itemHeightUnit).to('cm');
388
+ itemHeight = convert(itemHeight).from(itemHeightUnit).to('cm');
405
389
  var itemLines = getLinesOfItem(item, allLineRects, catalog);
406
390
 
407
391
  // remove the edge that overlapped with other snapped items
@@ -416,17 +400,17 @@ function getLinesFromItems2(moldingGroup, layer, catalog) {
416
400
  for (var j = 0; j < MGlinesOtherSnapped.length; j++) {
417
401
  var bCheck = false;
418
402
  switch (moldingGroup.location_type) {
419
- case _constants.TOP_MOLDING_LOCATION:
403
+ case TOP_MOLDING_LOCATION:
420
404
  bCheck = MGlinesOtherSnapped[j][3].altitude + MGlinesOtherSnapped[j][3].height > itemAltitude + itemHeight;
421
405
  break;
422
- case _constants.MIDDLE_MOLDING_LOCATION:
406
+ case MIDDLE_MOLDING_LOCATION:
423
407
  bCheck = true;
424
408
  break;
425
- case _constants.BOTTOM_MOLDING_LOCATION:
409
+ case BOTTOM_MOLDING_LOCATION:
426
410
  bCheck = MGlinesOtherSnapped[j][3].altitude < itemAltitude;
427
411
  break;
428
412
  }
429
- if (item.category !== 'cabinet' || ![_constants.BASE_CABINET_LAYOUTPOS, _constants.WALL_CABINET_LAYOUTPOS, _constants.TALL_CABINET_LAYOUTPOS].includes(item.layoutpos)) bCheck = true;
413
+ if (item.category !== 'cabinet' || ![BASE_CABINET_LAYOUTPOS, WALL_CABINET_LAYOUTPOS, TALL_CABINET_LAYOUTPOS].includes(item.layoutpos)) bCheck = true;
430
414
  if (bCheck) {
431
415
  var destLine = {
432
416
  x1: MGlinesOtherSnapped[j][0].x,
@@ -434,8 +418,8 @@ function getLinesFromItems2(moldingGroup, layer, catalog) {
434
418
  x2: MGlinesOtherSnapped[j][1].x,
435
419
  y2: MGlinesOtherSnapped[j][1].y
436
420
  };
437
- var rst = _export.GeometryUtils.relationshipOfTwoOverlappedLines(srcLine, destLine);
438
- if (rst.result === _constants.OVERLAP_SAME || rst.result === _constants.OVERLAP_INCLUDED) {
421
+ var rst = GeometryUtils.relationshipOfTwoOverlappedLines(srcLine, destLine);
422
+ if (rst.result === OVERLAP_SAME || rst.result === OVERLAP_INCLUDED) {
439
423
  ret = false;
440
424
  break;
441
425
  }
@@ -443,7 +427,7 @@ function getLinesFromItems2(moldingGroup, layer, catalog) {
443
427
  }
444
428
  return ret;
445
429
  });
446
- MGlines = [].concat((0, _toConsumableArray2["default"])(MGlines), (0, _toConsumableArray2["default"])(itemLines));
430
+ MGlines = [].concat(_toConsumableArray(MGlines), _toConsumableArray(itemLines));
447
431
  });
448
432
 
449
433
  // Filtering overlapped edges and get contour edges
@@ -464,16 +448,16 @@ function getLinesFromItems2(moldingGroup, layer, catalog) {
464
448
  x2: MGlines[j][1].x,
465
449
  y2: MGlines[j][1].y
466
450
  };
467
- var rst = _export.GeometryUtils.relationshipOfTwoOverlappedLines(srcLine, destLine);
468
- if (rst.result === _constants.OVERLAP_SAME || rst.result === _constants.OVERLAP_INCLUDED) {
451
+ var rst = GeometryUtils.relationshipOfTwoOverlappedLines(srcLine, destLine);
452
+ if (rst.result === OVERLAP_SAME || rst.result === OVERLAP_INCLUDED) {
469
453
  removeLineIds.push(i);
470
454
  return 1; // break
471
- } else if (rst.result === _constants.OVERLAP_SOME) {
455
+ } else if (rst.result === OVERLAP_SOME) {
472
456
  removeLineIds.push(i);
473
457
  var lineSegs = getTrimmedContourLineSegs(rst.trimmedSegs, MGlines.filter(function (v, idx) {
474
458
  return idx !== i && idx !== j;
475
459
  }), 0);
476
- if (lineSegs.length > 0) newLines = [].concat((0, _toConsumableArray2["default"])(newLines), (0, _toConsumableArray2["default"])(lineSegs));
460
+ if (lineSegs.length > 0) newLines = [].concat(_toConsumableArray(newLines), _toConsumableArray(lineSegs));
477
461
  return 1; // break
478
462
  }
479
463
  },
@@ -492,7 +476,7 @@ function getLinesFromItems2(moldingGroup, layer, catalog) {
492
476
  return idx === id;
493
477
  });
494
478
  });
495
- if (newLines.length > 0) MGlines = [].concat((0, _toConsumableArray2["default"])(MGlines), (0, _toConsumableArray2["default"])(newLines));
479
+ if (newLines.length > 0) MGlines = [].concat(_toConsumableArray(MGlines), _toConsumableArray(newLines));
496
480
 
497
481
  // merge the collinear linked lines to one line
498
482
  var newMGlines = [];
@@ -552,15 +536,15 @@ function getMergedLine(line, MGlines, cnt) {
552
536
  x2: newMGlines[i][1].x,
553
537
  y2: newMGlines[i][1].y
554
538
  };
555
- var rst = _export.GeometryUtils.relationshipOfTwoOverlappedLines(srcLine, destLine);
556
- if (rst.result === _constants.OVERLAP_LINK) {
539
+ var rst = GeometryUtils.relationshipOfTwoOverlappedLines(srcLine, destLine);
540
+ if (rst.result === OVERLAP_LINK) {
557
541
  var mergedLine = [{
558
542
  x: rst.linkedLine.x1,
559
543
  y: rst.linkedLine.y1
560
544
  }, {
561
545
  x: rst.linkedLine.x2,
562
546
  y: rst.linkedLine.y2
563
- }, _idBroker["default"].acquireID()];
547
+ }, IDBroker.acquireID()];
564
548
  mergeResult = getMergedLine(mergedLine, newMGlines.filter(function (v, idx) {
565
549
  return idx !== i;
566
550
  }), cnt);
@@ -605,15 +589,15 @@ function getTrimmedContourLineSegs(lineSegs, otherLines, cnt) {
605
589
  x2: otherLines[j][1].x,
606
590
  y2: otherLines[j][1].y
607
591
  };
608
- var rst = _export.GeometryUtils.relationshipOfTwoOverlappedLines(srcLine, destLine);
609
- if (rst.result == _constants.OVERLAP_SAME || rst.result == _constants.OVERLAP_INCLUDED) {
592
+ var rst = GeometryUtils.relationshipOfTwoOverlappedLines(srcLine, destLine);
593
+ if (rst.result == OVERLAP_SAME || rst.result == OVERLAP_INCLUDED) {
610
594
  bContourSeg = false;
611
595
  return 0; // break
612
- } else if (rst.result == _constants.OVERLAP_SOME) {
596
+ } else if (rst.result == OVERLAP_SOME) {
613
597
  var tLineSegs = getTrimmedContourLineSegs(rst.trimmedSegs, otherLines.filter(function (v, idx) {
614
598
  return idx !== j;
615
599
  }), cnt);
616
- if (tLineSegs.length > 0) returnSegs = [].concat((0, _toConsumableArray2["default"])(returnSegs), (0, _toConsumableArray2["default"])(tLineSegs));
600
+ if (tLineSegs.length > 0) returnSegs = [].concat(_toConsumableArray(returnSegs), _toConsumableArray(tLineSegs));
617
601
  bContourSeg = false;
618
602
  return 0; // break
619
603
  }
@@ -629,7 +613,7 @@ function getTrimmedContourLineSegs(lineSegs, otherLines, cnt) {
629
613
  }, {
630
614
  x: lineSegs[i].x2,
631
615
  y: lineSegs[i].y2
632
- }, _idBroker["default"].acquireID()]);
616
+ }, IDBroker.acquireID()]);
633
617
  }
634
618
  return returnSegs;
635
619
  } catch (e) {
@@ -637,9 +621,9 @@ function getTrimmedContourLineSegs(lineSegs, otherLines, cnt) {
637
621
  return [];
638
622
  }
639
623
  }
640
- function getLinesFromItems(moldingGroup, layer, catalog) {
641
- var allLineRects = _export.GeometryUtils.buildRectFromLines(layer, _export.GeometryUtils.getAllLines(layer));
642
- var items = (0, _toConsumableArray2["default"])(moldingGroup.items);
624
+ export function getLinesFromItems(moldingGroup, layer, catalog) {
625
+ var allLineRects = GeometryUtils.buildRectFromLines(layer, GeometryUtils.getAllLines(layer));
626
+ var items = _toConsumableArray(moldingGroup.items);
643
627
  var MGlines = getLinesOfItem(items[0], allLineRects, catalog);
644
628
  items = sortItemsByDistance(items, items[0]);
645
629
  var _loop7 = function _loop7() {
@@ -651,7 +635,7 @@ function getLinesFromItems(moldingGroup, layer, catalog) {
651
635
  });
652
636
  var curItemLine = itemLines[idx];
653
637
  if (idx > -1) {
654
- if (!(_export.GeometryUtils.samePoints(line[0], curItemLine[0]) && _export.GeometryUtils.samePoints(line[1], curItemLine[1]) || _export.GeometryUtils.samePoints(line[0], curItemLine[1]) && _export.GeometryUtils.samePoints(line[1], curItemLine[0]))) {
638
+ if (!(GeometryUtils.samePoints(line[0], curItemLine[0]) && GeometryUtils.samePoints(line[1], curItemLine[1]) || GeometryUtils.samePoints(line[0], curItemLine[1]) && GeometryUtils.samePoints(line[1], curItemLine[0]))) {
655
639
  var MGLine = mergeOverlappedLines(line, curItemLine);
656
640
  temp_MGLines.push(MGLine);
657
641
  }
@@ -678,29 +662,29 @@ function getLinesFromItems(moldingGroup, layer, catalog) {
678
662
  snapped_other_items.forEach(function (item) {
679
663
  var itemAltitude = item.properties.get('altitude').get('_length');
680
664
  var itemAltitudeUnit = item.properties.get('altitude').get('_unit');
681
- itemAltitude = (0, _convertUnitsLite.convert)(itemAltitude).from(itemAltitudeUnit).to('cm');
665
+ itemAltitude = convert(itemAltitude).from(itemAltitudeUnit).to('cm');
682
666
  var itemHeight = item.properties.get('height').get('_length');
683
667
  var itemHeightUnit = item.properties.get('height').get('_unit');
684
- itemHeight = (0, _convertUnitsLite.convert)(itemHeight).from(itemHeightUnit).to('cm');
668
+ itemHeight = convert(itemHeight).from(itemHeightUnit).to('cm');
685
669
  var mgroupAltitude = items[0].properties.get('altitude').get('_length');
686
670
  var mgroupAltitudeUnit = items[0].properties.get('altitude').get('_unit');
687
- mgroupAltitude = (0, _convertUnitsLite.convert)(mgroupAltitude).from(mgroupAltitudeUnit).to('cm');
671
+ mgroupAltitude = convert(mgroupAltitude).from(mgroupAltitudeUnit).to('cm');
688
672
  var mgroupHeight = items[0].properties.get('height').get('_length');
689
673
  var mgroupHeightUnit = items[0].properties.get('height').get('_unit');
690
- mgroupHeight = (0, _convertUnitsLite.convert)(mgroupHeight).from(mgroupHeightUnit).to('cm');
674
+ mgroupHeight = convert(mgroupHeight).from(mgroupHeightUnit).to('cm');
691
675
  var flag = false;
692
676
  switch (moldingGroup.location_type) {
693
- case _constants.TOP_MOLDING_LOCATION:
677
+ case TOP_MOLDING_LOCATION:
694
678
  flag = itemAltitude + itemHeight > mgroupAltitude + mgroupHeight;
695
679
  break;
696
- case _constants.MIDDLE_MOLDING_LOCATION:
680
+ case MIDDLE_MOLDING_LOCATION:
697
681
  flag = true;
698
682
  break;
699
- case _constants.BOTTOM_MOLDING_LOCATION:
683
+ case BOTTOM_MOLDING_LOCATION:
700
684
  flag = itemAltitude < mgroupAltitude;
701
685
  break;
702
686
  }
703
- if (item.category !== 'cabinet' || ![_constants.BASE_CABINET_LAYOUTPOS, _constants.WALL_CABINET_LAYOUTPOS, _constants.TALL_CABINET_LAYOUTPOS].includes(item.layoutpos)) flag = true;
687
+ if (item.category !== 'cabinet' || ![BASE_CABINET_LAYOUTPOS, WALL_CABINET_LAYOUTPOS, TALL_CABINET_LAYOUTPOS].includes(item.layoutpos)) flag = true;
704
688
  if (flag) {
705
689
  var itemLines = getLinesOfItem(item, allLineRects, catalog);
706
690
  var temp_MGLines = [];
@@ -710,8 +694,8 @@ function getLinesFromItems(moldingGroup, layer, catalog) {
710
694
  });
711
695
  var curITL = itemLines[idx];
712
696
  if (idx > -1) {
713
- if (getDelta(mgl[0], mgl[1], curITL[1], curITL[0]) < _constants.EPSILON || getDelta(mgl[0], mgl[1], curITL[0], curITL[1]) < _constants.EPSILON) {
714
- if (_export.GeometryUtils.verticesDistance(mgl[0], mgl[1]) > _export.GeometryUtils.verticesDistance(curITL[0], curITL[1])) {
697
+ if (getDelta(mgl[0], mgl[1], curITL[1], curITL[0]) < EPSILON || getDelta(mgl[0], mgl[1], curITL[0], curITL[1]) < EPSILON) {
698
+ if (GeometryUtils.verticesDistance(mgl[0], mgl[1]) > GeometryUtils.verticesDistance(curITL[0], curITL[1])) {
715
699
  var MGLine = mergeOverlappedLines(mgl, curITL);
716
700
  temp_MGLines.push(MGLine);
717
701
  }
@@ -729,7 +713,7 @@ function getLinesFromItems(moldingGroup, layer, catalog) {
729
713
  return MGlines;
730
714
  }
731
715
  function getMDPoints(newMD) {
732
- if (newMD.lines.length < 1) return (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, newMD), {}, {
716
+ if (newMD.lines.length < 1) return _objectSpread(_objectSpread({}, newMD), {}, {
733
717
  pointGroups: []
734
718
  });
735
719
  // let maxX = newMD.lines[0][0].x,
@@ -767,13 +751,13 @@ function getMDPoints(newMD) {
767
751
  x: (maxX + minX) / 2,
768
752
  y: (maxY + minY) / 2
769
753
  };
770
- var newSize = (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, newMD.size), {}, {
754
+ var newSize = _objectSpread(_objectSpread({}, newMD.size), {}, {
771
755
  width: maxX - minX,
772
756
  depth: maxY - minY
773
757
  });
774
758
 
775
759
  // get vertex points
776
- var MDlines = (0, _toConsumableArray2["default"])(newMD.lines);
760
+ var MDlines = _toConsumableArray(newMD.lines);
777
761
  var pointGroups = [[]];
778
762
  var flag = 1;
779
763
  var i = 0;
@@ -785,10 +769,10 @@ function getMDPoints(newMD) {
785
769
  if (flag) {
786
770
  var lastPoint = pointGroups[i][pointGroups[i].length - 1];
787
771
  var res = MDlines.findIndex(function (a) {
788
- return _export.GeometryUtils.samePoints({
772
+ return GeometryUtils.samePoints({
789
773
  x: a[0].x - cPos.x,
790
774
  y: a[0].y - cPos.y
791
- }, lastPoint) || _export.GeometryUtils.samePoints({
775
+ }, lastPoint) || GeometryUtils.samePoints({
792
776
  x: a[1].x - cPos.x,
793
777
  y: a[1].y - cPos.y
794
778
  }, lastPoint);
@@ -798,7 +782,7 @@ function getMDPoints(newMD) {
798
782
  x: MDlines[res][0].x - cPos.x,
799
783
  y: MDlines[res][0].y - cPos.y
800
784
  };
801
- if (_export.GeometryUtils.samePoints(newPos, lastPoint)) {
785
+ if (GeometryUtils.samePoints(newPos, lastPoint)) {
802
786
  newPos = {
803
787
  x: MDlines[res][1].x - cPos.x,
804
788
  y: MDlines[res][1].y - cPos.y
@@ -812,10 +796,10 @@ function getMDPoints(newMD) {
812
796
  } else {
813
797
  var firstPoint = pointGroups[i][0];
814
798
  var _res = MDlines.findIndex(function (a) {
815
- return _export.GeometryUtils.samePoints({
799
+ return GeometryUtils.samePoints({
816
800
  x: a[0].x - cPos.x,
817
801
  y: a[0].y - cPos.y
818
- }, firstPoint) || _export.GeometryUtils.samePoints({
802
+ }, firstPoint) || GeometryUtils.samePoints({
819
803
  x: a[1].x - cPos.x,
820
804
  y: a[1].y - cPos.y
821
805
  }, firstPoint);
@@ -825,13 +809,13 @@ function getMDPoints(newMD) {
825
809
  x: MDlines[_res][0].x - cPos.x,
826
810
  y: MDlines[_res][0].y - cPos.y
827
811
  };
828
- if (_export.GeometryUtils.samePoints(_newPos, firstPoint)) {
812
+ if (GeometryUtils.samePoints(_newPos, firstPoint)) {
829
813
  _newPos = {
830
814
  x: MDlines[_res][1].x - cPos.x,
831
815
  y: MDlines[_res][1].y - cPos.y
832
816
  };
833
817
  }
834
- pointGroups[i] = [new Three.Vector2(_newPos.x, _newPos.y)].concat((0, _toConsumableArray2["default"])(pointGroups[i]));
818
+ pointGroups[i] = [new Three.Vector2(_newPos.x, _newPos.y)].concat(_toConsumableArray(pointGroups[i]));
835
819
  MDlines.splice(_res, 1);
836
820
  } else {
837
821
  flag = 1;
@@ -846,33 +830,33 @@ function getMDPoints(newMD) {
846
830
  }
847
831
  var z = newMD.items[0].properties.get('altitude').get('_length');
848
832
  var zUnit = newMD.items[0].properties.get('altitude').get('_unit') || 'cm';
849
- z = (0, _convertUnitsLite.convert)(z).from(zUnit).to('cm');
833
+ z = convert(z).from(zUnit).to('cm');
850
834
  var height = newMD.items[0].properties.get('height').get('_length');
851
835
  var heightUnit = newMD.items[0].properties.get('height').get('_unit') || 'cm';
852
- height = (0, _convertUnitsLite.convert)(height).from(heightUnit).to('cm');
836
+ height = convert(height).from(heightUnit).to('cm');
853
837
  switch (newMD.location_type) {
854
- case _constants.TOP_MOLDING_LOCATION:
838
+ case TOP_MOLDING_LOCATION:
855
839
  z += height;
856
840
  break;
857
- case _constants.MIDDLE_MOLDING_LOCATION:
841
+ case MIDDLE_MOLDING_LOCATION:
858
842
  z += height / 2;
859
843
  break;
860
- case _constants.BOTTOM_MOLDING_LOCATION:
844
+ case BOTTOM_MOLDING_LOCATION:
861
845
  z += 0;
862
846
  break;
863
847
  default:
864
848
  break;
865
849
  }
866
- return (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, newMD), {}, {
850
+ return _objectSpread(_objectSpread({}, newMD), {}, {
867
851
  pointGroups: pointGroups,
868
- pos: (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, cPos), {}, {
852
+ pos: _objectSpread(_objectSpread({}, cPos), {}, {
869
853
  z: z
870
854
  }),
871
855
  size: newSize
872
856
  });
873
857
  }
874
- function createMonldingGroup(oldMG, layer, molding, catalog) {
875
- var newMG = (0, _objectSpread2["default"])({}, oldMG);
858
+ export function createMonldingGroup(oldMG, layer, molding, catalog) {
859
+ var newMG = _objectSpread({}, oldMG);
876
860
  newMG.molding = molding;
877
861
  newMG.lines = getLinesFromItems2(oldMG, layer, catalog);
878
862
  newMG.lines.reverse();