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

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