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

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 (354) hide show
  1. package/es/@history.js +8 -2
  2. package/es/AppContext.js +8 -3
  3. package/es/KitchenConfigurator.js +93 -106
  4. package/es/KitchenConfiguratorApp.js +143 -154
  5. package/es/actions/area-actions.js +10 -5
  6. package/es/actions/export.js +27 -12
  7. package/es/actions/groups-actions.js +43 -27
  8. package/es/actions/holes-actions.js +53 -34
  9. package/es/actions/items-actions.js +143 -94
  10. package/es/actions/lines-actions.js +34 -21
  11. package/es/actions/project-actions.js +143 -94
  12. package/es/actions/scene-actions.js +19 -11
  13. package/es/actions/vertices-actions.js +13 -7
  14. package/es/actions/viewer2d-actions.js +34 -21
  15. package/es/actions/viewer3d-actions.js +16 -9
  16. package/es/catalog/areas/area/planner-element.js +16 -8
  17. package/es/catalog/catalog.js +19 -24
  18. package/es/catalog/factories/area-factory-3d.js +29 -22
  19. package/es/catalog/factories/area-factory.js +18 -14
  20. package/es/catalog/factories/export.js +12 -6
  21. package/es/catalog/factories/wall-factory-3d.js +39 -31
  22. package/es/catalog/factories/wall-factory.js +29 -21
  23. package/es/catalog/holes/door-closet/planner-element.js +22 -15
  24. package/es/catalog/holes/door-double/planner-element.js +22 -15
  25. package/es/catalog/holes/door-exterior/planner-element.js +23 -16
  26. package/es/catalog/holes/door-interior/planner-element.js +23 -16
  27. package/es/catalog/holes/door-panic/planner-element.js +14 -7
  28. package/es/catalog/holes/door-panic-double/planner-element.js +22 -15
  29. package/es/catalog/holes/door-sliding/planner-element.js +23 -16
  30. package/es/catalog/holes/doorway-framed/planner-element.js +18 -11
  31. package/es/catalog/holes/doorway-frameless/planner-element.js +14 -7
  32. package/es/catalog/holes/export.js +31 -13
  33. package/es/catalog/holes/window-clear/planner-element.js +17 -10
  34. package/es/catalog/holes/window-cross/planner-element.js +17 -10
  35. package/es/catalog/holes/window-double-hung/planner-element.js +17 -10
  36. package/es/catalog/holes/window-vertical/planner-element.js +17 -10
  37. package/es/catalog/lines/wall/planner-element.js +19 -11
  38. package/es/catalog/molding/molding-dcm/planner-element.js +12 -5
  39. package/es/catalog/molding/molding-fbm/planner-element.js +12 -5
  40. package/es/catalog/molding/molding-lrm/planner-element.js +12 -5
  41. package/es/catalog/properties/export.js +33 -20
  42. package/es/catalog/properties/property-checkbox.js +82 -35
  43. package/es/catalog/properties/property-color.js +21 -16
  44. package/es/catalog/properties/property-enum.js +70 -28
  45. package/es/catalog/properties/property-hidden.js +14 -9
  46. package/es/catalog/properties/property-lenght-measure.js +43 -39
  47. package/es/catalog/properties/property-length-measure.js +82 -34
  48. package/es/catalog/properties/property-length-measure_hole.js +43 -39
  49. package/es/catalog/properties/property-number.js +22 -17
  50. package/es/catalog/properties/property-read-only.js +21 -16
  51. package/es/catalog/properties/property-string.js +21 -16
  52. package/es/catalog/properties/property-toggle.js +21 -16
  53. package/es/catalog/properties/shared-property-style.js +5 -1
  54. package/es/catalog/utils/FuseUtils.js +13 -11
  55. package/es/catalog/utils/exporter.js +13 -11
  56. package/es/catalog/utils/geom-utils.js +27 -13
  57. package/es/catalog/utils/item-loader.js +95 -91
  58. package/es/catalog/utils/load-obj.js +26 -20
  59. package/es/catalog/utils/mtl-loader.js +7 -3
  60. package/es/catalog/utils/obj-loader.js +7 -3
  61. package/es/class/FuseUtils.js +13 -11
  62. package/es/class/area.js +26 -26
  63. package/es/class/export.js +38 -23
  64. package/es/class/group.js +57 -62
  65. package/es/class/guide.js +19 -19
  66. package/es/class/hole.js +87 -88
  67. package/es/class/item.js +148 -155
  68. package/es/class/layer.js +63 -63
  69. package/es/class/line.js +141 -144
  70. package/es/class/project.js +96 -94
  71. package/es/class/vertex.js +33 -33
  72. package/es/components/content.js +27 -19
  73. package/es/components/disclaimer/disclaimer.js +79 -93
  74. package/es/components/export.js +15 -8
  75. package/es/components/style/button.js +29 -30
  76. package/es/components/style/cancel-button.js +12 -8
  77. package/es/components/style/content-container.js +14 -12
  78. package/es/components/style/content-title.js +18 -15
  79. package/es/components/style/delete-button.js +15 -9
  80. package/es/components/style/export.js +48 -30
  81. package/es/components/style/form-block.js +13 -12
  82. package/es/components/style/form-color-input.js +12 -8
  83. package/es/components/style/form-label.js +13 -12
  84. package/es/components/style/form-number-input.js +71 -47
  85. package/es/components/style/form-number-input_2.js +42 -42
  86. package/es/components/style/form-select.js +58 -14
  87. package/es/components/style/form-slider.js +36 -16
  88. package/es/components/style/form-submit-button.js +15 -9
  89. package/es/components/style/form-text-input.js +55 -37
  90. package/es/components/viewer2d/area.js +22 -17
  91. package/es/components/viewer2d/export.js +48 -30
  92. package/es/components/viewer2d/grids/grid-horizontal-streak.js +15 -11
  93. package/es/components/viewer2d/grids/grid-streak.js +15 -11
  94. package/es/components/viewer2d/grids/grid-vertical-streak.js +15 -11
  95. package/es/components/viewer2d/grids/grids.js +17 -15
  96. package/es/components/viewer2d/group.js +22 -15
  97. package/es/components/viewer2d/item.js +68 -68
  98. package/es/components/viewer2d/layer.js +28 -23
  99. package/es/components/viewer2d/line.js +109 -104
  100. package/es/components/viewer2d/ruler.js +27 -23
  101. package/es/components/viewer2d/rulerDist.js +26 -21
  102. package/es/components/viewer2d/rulerX.js +45 -45
  103. package/es/components/viewer2d/rulerY.js +43 -43
  104. package/es/components/viewer2d/scene.js +40 -46
  105. package/es/components/viewer2d/snap.js +20 -13
  106. package/es/components/viewer2d/state.js +25 -23
  107. package/es/components/viewer2d/utils.js +63 -21
  108. package/es/components/viewer2d/vertex.js +15 -8
  109. package/es/components/viewer2d/viewer2d.js +169 -166
  110. package/es/components/viewer3d/camera-controls-module/camera-controls.module.js +21 -24
  111. package/es/components/viewer3d/dcm.js +5 -1
  112. package/es/components/viewer3d/fbm.js +5 -1
  113. package/es/components/viewer3d/front3D.js +19 -17
  114. package/es/components/viewer3d/grid-creator.js +15 -8
  115. package/es/components/viewer3d/grids/grid-horizontal-streak.js +12 -6
  116. package/es/components/viewer3d/grids/grid-streak.js +11 -5
  117. package/es/components/viewer3d/grids/grid-vertical-streak.js +12 -6
  118. package/es/components/viewer3d/libs/first-person-controls.js +7 -2
  119. package/es/components/viewer3d/libs/helvetiker_regular.typeface.js +5 -1
  120. package/es/components/viewer3d/libs/mtl-loader.js +6 -2
  121. package/es/components/viewer3d/libs/obj-loader.js +6 -2
  122. package/es/components/viewer3d/libs/orbit-controls.js +10 -5
  123. package/es/components/viewer3d/libs/pointer-lock-controls.js +9 -4
  124. package/es/components/viewer3d/lrm.js +5 -1
  125. package/es/components/viewer3d/model.js +5 -1
  126. package/es/components/viewer3d/pointer-lock-navigation.js +8 -3
  127. package/es/components/viewer3d/ruler-utils/itemRect.js +23 -18
  128. package/es/components/viewer3d/ruler-utils/layer3D.js +64 -59
  129. package/es/components/viewer3d/ruler-utils/ruler3D.js +44 -42
  130. package/es/components/viewer3d/ruler-utils/scene3D.js +16 -11
  131. package/es/components/viewer3d/ruler-utils/state3D.js +9 -4
  132. package/es/components/viewer3d/scene-creator.js +225 -198
  133. package/es/components/viewer3d/three-memory-cleaner.js +10 -3
  134. package/es/components/viewer3d/viewer3d-first-person.js +44 -46
  135. package/es/components/viewer3d/viewer3d.js +206 -209
  136. package/es/constants.js +356 -349
  137. package/es/index.js +20 -15
  138. package/es/models.js +183 -183
  139. package/es/plugins/SVGLoader.js +51 -48
  140. package/es/plugins/autosave.js +7 -3
  141. package/es/plugins/console-debugger.js +10 -8
  142. package/es/plugins/export.js +15 -8
  143. package/es/plugins/keyboard.js +33 -29
  144. package/es/reducers/areas-reducer.js +11 -7
  145. package/es/reducers/export.js +39 -24
  146. package/es/reducers/groups-reducer.js +35 -31
  147. package/es/reducers/holes-reducer.js +47 -43
  148. package/es/reducers/items-reducer.js +110 -109
  149. package/es/reducers/lines-reducer.js +32 -28
  150. package/es/reducers/project-reducer.js +109 -105
  151. package/es/reducers/reducer.js +21 -16
  152. package/es/reducers/scene-reducer.js +19 -15
  153. package/es/reducers/user-reducer.js +9 -6
  154. package/es/reducers/vertices-reducer.js +15 -11
  155. package/es/reducers/viewer2d-reducer.js +22 -18
  156. package/es/reducers/viewer3d-reducer.js +20 -16
  157. package/es/shared-style.js +14 -10
  158. package/es/styles/export.js +9 -3
  159. package/es/translator/en.js +5 -1
  160. package/es/translator/it.js +5 -1
  161. package/es/translator/ru.js +5 -1
  162. package/es/translator/translator.js +17 -17
  163. package/es/utils/browser.js +7 -2
  164. package/es/utils/convert-units-lite.js +33 -0
  165. package/es/utils/email-validator.js +5 -1
  166. package/es/utils/export.js +32 -15
  167. package/es/utils/geometry.js +277 -191
  168. package/es/utils/get-edges-of-subgraphs.js +7 -1
  169. package/es/utils/graph-cycles.js +9 -9
  170. package/es/utils/graph-inner-cycles.js +16 -10
  171. package/es/utils/graph.js +15 -12
  172. package/es/utils/helper.js +61 -109
  173. package/es/utils/history.js +13 -8
  174. package/es/utils/id-broker.js +13 -12
  175. package/es/utils/logger.js +5 -1
  176. package/es/utils/math.js +10 -5
  177. package/es/utils/molding.js +175 -158
  178. package/es/utils/name-generator.js +11 -11
  179. package/es/utils/objects-utils.js +17 -7
  180. package/es/utils/phone-validator.js +5 -1
  181. package/es/utils/process-black-list.js +8 -6
  182. package/es/utils/react-if.js +10 -6
  183. package/es/utils/snap-scene.js +32 -32
  184. package/es/utils/snap.js +57 -51
  185. package/es/utils/summarizeCart.js +5 -1
  186. package/es/utils/threeCSG.es6.js +20 -17
  187. package/es/version.js +5 -1
  188. package/lib/@history.js +3 -2
  189. package/lib/AppContext.js +3 -2
  190. package/lib/KitchenConfigurator.js +70 -88
  191. package/lib/KitchenConfiguratorApp.js +98 -113
  192. package/lib/actions/export.js +1 -1
  193. package/lib/catalog/areas/area/planner-element.js +13 -8
  194. package/lib/catalog/catalog.js +9 -16
  195. package/lib/catalog/factories/area-factory-3d.js +1 -1
  196. package/lib/catalog/factories/area-factory.js +6 -7
  197. package/lib/catalog/factories/export.js +1 -1
  198. package/lib/catalog/factories/wall-factory-3d.js +4 -4
  199. package/lib/catalog/factories/wall-factory.js +4 -3
  200. package/lib/catalog/holes/door-closet/planner-element.js +4 -3
  201. package/lib/catalog/holes/door-double/planner-element.js +4 -3
  202. package/lib/catalog/holes/door-exterior/planner-element.js +4 -3
  203. package/lib/catalog/holes/door-interior/planner-element.js +4 -3
  204. package/lib/catalog/holes/door-panic/planner-element.js +4 -3
  205. package/lib/catalog/holes/door-panic-double/planner-element.js +4 -3
  206. package/lib/catalog/holes/door-sliding/planner-element.js +4 -3
  207. package/lib/catalog/holes/doorway-framed/planner-element.js +4 -3
  208. package/lib/catalog/holes/doorway-frameless/planner-element.js +4 -3
  209. package/lib/catalog/holes/export.js +14 -14
  210. package/lib/catalog/holes/window-clear/planner-element.js +4 -3
  211. package/lib/catalog/holes/window-cross/planner-element.js +4 -3
  212. package/lib/catalog/holes/window-double-hung/planner-element.js +4 -3
  213. package/lib/catalog/holes/window-vertical/planner-element.js +4 -3
  214. package/lib/catalog/lines/wall/planner-element.js +16 -11
  215. package/lib/catalog/molding/molding-dcm/planner-element.js +4 -3
  216. package/lib/catalog/molding/molding-fbm/planner-element.js +4 -3
  217. package/lib/catalog/molding/molding-lrm/planner-element.js +4 -3
  218. package/lib/catalog/properties/export.js +1 -1
  219. package/lib/catalog/properties/property-checkbox.js +68 -25
  220. package/lib/catalog/properties/property-color.js +3 -2
  221. package/lib/catalog/properties/property-enum.js +54 -16
  222. package/lib/catalog/properties/property-hidden.js +3 -2
  223. package/lib/catalog/properties/property-lenght-measure.js +10 -10
  224. package/lib/catalog/properties/property-length-measure.js +61 -17
  225. package/lib/catalog/properties/property-length-measure_hole.js +10 -10
  226. package/lib/catalog/properties/property-number.js +3 -2
  227. package/lib/catalog/properties/property-read-only.js +3 -2
  228. package/lib/catalog/properties/property-string.js +3 -2
  229. package/lib/catalog/properties/property-toggle.js +3 -2
  230. package/lib/catalog/properties/shared-property-style.js +2 -1
  231. package/lib/catalog/utils/FuseUtils.js +10 -11
  232. package/lib/catalog/utils/exporter.js +10 -12
  233. package/lib/catalog/utils/geom-utils.js +1 -1
  234. package/lib/catalog/utils/item-loader.js +29 -35
  235. package/lib/catalog/utils/mtl-loader.js +7 -3
  236. package/lib/catalog/utils/obj-loader.js +7 -3
  237. package/lib/class/FuseUtils.js +10 -11
  238. package/lib/class/area.js +9 -11
  239. package/lib/class/export.js +1 -1
  240. package/lib/class/group.js +13 -20
  241. package/lib/class/guide.js +9 -12
  242. package/lib/class/hole.js +7 -9
  243. package/lib/class/item.js +25 -35
  244. package/lib/class/layer.js +7 -9
  245. package/lib/class/line.js +14 -20
  246. package/lib/class/project.js +10 -11
  247. package/lib/class/vertex.js +9 -11
  248. package/lib/components/content.js +5 -3
  249. package/lib/components/disclaimer/disclaimer.js +69 -88
  250. package/lib/components/export.js +1 -1
  251. package/lib/components/style/button.js +17 -22
  252. package/lib/components/style/cancel-button.js +7 -7
  253. package/lib/components/style/content-container.js +5 -7
  254. package/lib/components/style/content-title.js +10 -12
  255. package/lib/components/style/delete-button.js +8 -8
  256. package/lib/components/style/export.js +1 -1
  257. package/lib/components/style/form-block.js +9 -12
  258. package/lib/components/style/form-color-input.js +7 -7
  259. package/lib/components/style/form-label.js +9 -12
  260. package/lib/components/style/form-number-input.js +43 -23
  261. package/lib/components/style/form-number-input_2.js +15 -19
  262. package/lib/components/style/form-select.js +53 -15
  263. package/lib/components/style/form-slider.js +28 -12
  264. package/lib/components/style/form-submit-button.js +8 -8
  265. package/lib/components/style/form-text-input.js +46 -32
  266. package/lib/components/viewer2d/area.js +8 -7
  267. package/lib/components/viewer2d/export.js +1 -1
  268. package/lib/components/viewer2d/grids/grid-horizontal-streak.js +3 -3
  269. package/lib/components/viewer2d/grids/grid-streak.js +3 -3
  270. package/lib/components/viewer2d/grids/grid-vertical-streak.js +3 -3
  271. package/lib/components/viewer2d/grids/grids.js +6 -10
  272. package/lib/components/viewer2d/group.js +4 -3
  273. package/lib/components/viewer2d/item.js +14 -19
  274. package/lib/components/viewer2d/layer.js +3 -2
  275. package/lib/components/viewer2d/line.js +4 -7
  276. package/lib/components/viewer2d/ruler.js +9 -9
  277. package/lib/components/viewer2d/rulerDist.js +7 -6
  278. package/lib/components/viewer2d/rulerX.js +15 -19
  279. package/lib/components/viewer2d/rulerY.js +15 -19
  280. package/lib/components/viewer2d/scene.js +24 -34
  281. package/lib/components/viewer2d/snap.js +4 -3
  282. package/lib/components/viewer2d/state.js +7 -11
  283. package/lib/components/viewer2d/utils.js +35 -2
  284. package/lib/components/viewer2d/vertex.js +4 -3
  285. package/lib/components/viewer2d/viewer2d.js +40 -41
  286. package/lib/components/viewer3d/camera-controls-module/camera-controls.module.js +14 -20
  287. package/lib/components/viewer3d/dcm.js +2 -1
  288. package/lib/components/viewer3d/fbm.js +2 -1
  289. package/lib/components/viewer3d/front3D.js +6 -10
  290. package/lib/components/viewer3d/grid-creator.js +4 -3
  291. package/lib/components/viewer3d/grids/grid-horizontal-streak.js +3 -2
  292. package/lib/components/viewer3d/grids/grid-streak.js +3 -2
  293. package/lib/components/viewer3d/grids/grid-vertical-streak.js +3 -2
  294. package/lib/components/viewer3d/libs/mtl-loader.js +7 -2
  295. package/lib/components/viewer3d/libs/obj-loader.js +7 -2
  296. package/lib/components/viewer3d/libs/orbit-controls.js +10 -5
  297. package/lib/components/viewer3d/libs/pointer-lock-controls.js +9 -4
  298. package/lib/components/viewer3d/lrm.js +2 -1
  299. package/lib/components/viewer3d/pointer-lock-navigation.js +1 -1
  300. package/lib/components/viewer3d/ruler-utils/itemRect.js +10 -9
  301. package/lib/components/viewer3d/ruler-utils/layer3D.js +35 -34
  302. package/lib/components/viewer3d/ruler-utils/ruler3D.js +5 -7
  303. package/lib/components/viewer3d/ruler-utils/scene3D.js +4 -5
  304. package/lib/components/viewer3d/ruler-utils/state3D.js +3 -2
  305. package/lib/components/viewer3d/scene-creator.js +40 -45
  306. package/lib/components/viewer3d/three-memory-cleaner.js +1 -1
  307. package/lib/components/viewer3d/viewer3d-first-person.js +13 -17
  308. package/lib/components/viewer3d/viewer3d.js +34 -38
  309. package/lib/index.js +16 -88
  310. package/lib/models.js +58 -63
  311. package/lib/plugins/autosave.js +2 -1
  312. package/lib/plugins/console-debugger.js +5 -7
  313. package/lib/plugins/export.js +1 -1
  314. package/lib/plugins/keyboard.js +2 -1
  315. package/lib/reducers/areas-reducer.js +2 -1
  316. package/lib/reducers/export.js +1 -1
  317. package/lib/reducers/groups-reducer.js +2 -1
  318. package/lib/reducers/holes-reducer.js +2 -1
  319. package/lib/reducers/items-reducer.js +2 -1
  320. package/lib/reducers/lines-reducer.js +2 -1
  321. package/lib/reducers/project-reducer.js +2 -1
  322. package/lib/reducers/scene-reducer.js +2 -1
  323. package/lib/reducers/user-reducer.js +2 -2
  324. package/lib/reducers/vertices-reducer.js +2 -1
  325. package/lib/reducers/viewer2d-reducer.js +5 -5
  326. package/lib/reducers/viewer3d-reducer.js +5 -5
  327. package/lib/styles/export.js +1 -1
  328. package/lib/translator/en.js +2 -1
  329. package/lib/translator/it.js +2 -1
  330. package/lib/translator/ru.js +2 -1
  331. package/lib/translator/translator.js +7 -10
  332. package/lib/utils/convert-units-lite.js +35 -0
  333. package/lib/utils/export.js +2 -2
  334. package/lib/utils/geometry.js +20 -28
  335. package/lib/utils/get-edges-of-subgraphs.js +7 -1
  336. package/lib/utils/graph-cycles.js +9 -9
  337. package/lib/utils/graph-inner-cycles.js +1 -1
  338. package/lib/utils/graph.js +15 -12
  339. package/lib/utils/helper.js +14 -83
  340. package/lib/utils/history.js +1 -1
  341. package/lib/utils/id-broker.js +7 -10
  342. package/lib/utils/molding.js +66 -71
  343. package/lib/utils/name-generator.js +7 -9
  344. package/lib/utils/objects-utils.js +5 -3
  345. package/lib/utils/process-black-list.js +3 -5
  346. package/lib/utils/react-if.js +3 -2
  347. package/lib/utils/snap-scene.js +3 -7
  348. package/lib/utils/snap.js +22 -26
  349. package/lib/utils/threeCSG.es6.js +16 -15
  350. package/package.json +26 -54
  351. package/es/analytics/ga4.js +0 -191
  352. package/es/analytics/posthog.js +0 -60
  353. package/lib/analytics/ga4.js +0 -197
  354. package/lib/analytics/posthog.js +0 -68
@@ -1,90 +1,176 @@
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); }
2
- function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
3
- 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."); }
4
- function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
5
- function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ var _typeof = require("@babel/runtime/helpers/typeof");
5
+ exports.__esModule = true;
6
+ exports.ContainsPoint = ContainsPoint;
7
+ exports._twoLineSegmentsIntersection = _twoLineSegmentsIntersection;
8
+ exports.absAngleBetweenTwoPoints = absAngleBetweenTwoPoints;
9
+ exports.almostEqual = void 0;
10
+ exports.angleBetweenTwoLines = angleBetweenTwoLines;
11
+ exports.angleBetweenTwoPoints = angleBetweenTwoPoints;
12
+ exports.angleBetweenTwoPointsAndOrigin = angleBetweenTwoPointsAndOrigin;
13
+ exports.buildRectFromLines = buildRectFromLines;
14
+ exports.calcCreateSnap = calcCreateSnap;
15
+ exports.calcSnap = calcSnap;
16
+ exports.calcSnap1 = calcSnap1;
17
+ exports.calcSnap2 = calcSnap2;
18
+ exports.calcSnap3 = calcSnap3;
19
+ exports.clone_point = clone_point;
20
+ exports.closestPointFromLine = closestPointFromLine;
21
+ exports.closestPointFromLineSegment = closestPointFromLineSegment;
22
+ exports.compareVertices = compareVertices;
23
+ exports.containLine = containLine;
24
+ exports.containPointInRect = containPointInRect;
25
+ exports.cosWithThreshold = cosWithThreshold;
26
+ exports.crossprod = crossprod;
27
+ exports.diff = diff;
28
+ exports.distancePointFromLine = distancePointFromLine;
29
+ exports.distancePointFromLineSegment = distancePointFromLineSegment;
30
+ exports.dotprod = dotprod;
31
+ exports.downcrossLine = downcrossLine;
32
+ exports.extendLine = extendLine;
33
+ exports.findCatalogElement = findCatalogElement;
34
+ exports.getAllArea = getAllArea;
35
+ exports.getAllAreaLines = getAllAreaLines;
36
+ exports.getAllCurSnap = getAllCurSnap;
37
+ exports.getAllHoleRect = getAllHoleRect;
38
+ exports.getAllItemSnap = getAllItemSnap;
39
+ exports.getAllItemSpecified = getAllItemSpecified;
40
+ exports.getAllItems = getAllItems;
41
+ exports.getAllLineSnap = getAllLineSnap;
42
+ exports.getAllLines = getAllLines;
43
+ exports.getCalcRectFromItem = getCalcRectFromItem;
44
+ exports.getCalcRectFromItem3D = getCalcRectFromItem3D;
45
+ exports.getCalcRectFromLine = getCalcRectFromLine;
46
+ exports.getCentroidOfPolygon = getCentroidOfPolygon;
47
+ exports.getHoleItems = getHoleItems;
48
+ exports.getInterSect = getInterSect;
49
+ exports.getLineInterSect = getLineInterSect;
50
+ exports.getNormaline = getNormaline;
51
+ exports.getRelatedLines = void 0;
52
+ exports.getRelatedVertices = getRelatedVertices;
53
+ exports.horizontalLine = horizontalLine;
54
+ exports.intersectRect = intersectRect;
55
+ exports.isBackWall = isBackWall;
56
+ exports.isFrontWall = isFrontWall;
57
+ exports.isLeftWall = isLeftWall;
58
+ exports.isPointInArea = isPointInArea;
59
+ exports.isPointInRect = isPointInRect;
60
+ exports.isPointOnLineSegment = isPointOnLineSegment;
61
+ exports.isRightWall = isRightWall;
62
+ exports.isSnappedLine = isSnappedLine;
63
+ exports.isSnappedSideLine = isSnappedSideLine;
64
+ exports.itemInfo = itemInfo;
65
+ exports.linePassingThroughTwoPoints = linePassingThroughTwoPoints;
66
+ exports.mapRange = mapRange;
67
+ exports.maxVertex = maxVertex;
68
+ exports.midPoint = midPoint;
69
+ exports.minVertex = minVertex;
70
+ exports.needSnap = needSnap;
71
+ exports.orderVertices = orderVertices;
72
+ exports.pointPositionOnLineSegment = pointPositionOnLineSegment;
73
+ exports.pointsDistance = pointsDistance;
74
+ exports.relationshipOfTwoOverlappedLines = relationshipOfTwoOverlappedLines;
75
+ exports.relationshipOfTwoOverlappedLines1 = relationshipOfTwoOverlappedLines1;
76
+ exports.relationshipOfTwoOverlappedLines2 = relationshipOfTwoOverlappedLines2;
77
+ exports.rotatePointAroundPoint = rotatePointAroundPoint;
78
+ exports.roundVertex = roundVertex;
79
+ exports.sameDistances = sameDistances;
80
+ exports.sameMDistances = sameMDistances;
81
+ exports.sameMPoints = sameMPoints;
82
+ exports.samePoints = samePoints;
83
+ exports.shrinkRect = shrinkRect;
84
+ exports.sinWithThreshold = sinWithThreshold;
85
+ exports.snapAngleByUnit = snapAngleByUnit;
86
+ exports.twoLineSegmentsIntersection = twoLineSegmentsIntersection;
87
+ exports.twoLinesIntersection = twoLinesIntersection;
88
+ exports.upcrossLine = upcrossLine;
89
+ exports.validInterSect = validInterSect;
90
+ exports.validSnap = validSnap;
91
+ exports.validateLineSnaps = validateLineSnaps;
92
+ exports.validateSnaps = validateSnaps;
93
+ exports.verticalLine = verticalLine;
94
+ exports.verticesDistance = verticesDistance;
95
+ exports.verticesMidPoint = verticesMidPoint;
96
+ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/toConsumableArray"));
97
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/defineProperty"));
98
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
99
+ var _math = require("./math.js");
100
+ var _constants = require("../constants");
101
+ var _convertUnitsLite = require("./convert-units-lite");
102
+ var Three = _interopRequireWildcard(require("three"));
103
+ var _utils = require("../components/viewer2d/utils.js");
104
+ var _helper = require("./helper.js");
105
+ var _export = require("./export.js");
106
+ 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); }
6
107
  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; }
7
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
8
- 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; }
9
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
10
- 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); }
108
+ 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
109
  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
- function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
13
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
14
110
  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; } }
15
- 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; }
16
- function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
17
- function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
18
- /** @description Determines the distance between two points
111
+ 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; } /** @description Determines the distance between two points
19
112
  * @param {number} x0 Vertex 0 x
20
113
  * @param {number} y0 Vertex 0 y
21
114
  * @param {number} x1 Vertex 1 x
22
115
  * @param {number} y1 Vertex 1 y
23
116
  * @return {number}
24
117
  */
25
- import { toFixedFloat, fAbs } from "./math.js";
26
- import { BASE_CABINET_LAYOUTPOS, EPSILON, LINE_THICKNESS, MEPSILON, OVERLAP_INCLUDED, OVERLAP_LINK, OVERLAP_NONE, OVERLAP_SAME, OVERLAP_SOME, WALL_CABINET_LAYOUTPOS, UNIT_ANGLE, MIN_ANGLE_DISALLOW_DRAW_WALL } from "../constants";
27
- import convert from 'convert-units';
28
- import * as Three from 'three';
29
- import { returnReplaceableDeepSearchType } from "../components/viewer2d/utils.js";
30
- import { isEmpty } from "./helper.js";
31
- import { MathUtils } from "./export.js";
32
- export function compareVertices(v0, v1) {
118
+ function compareVertices(v0, v1) {
33
119
  return v0.x === v1.x ? v0.y - v1.y : v0.x - v1.x;
34
120
  }
35
- export function minVertex(v0, v1) {
121
+ function minVertex(v0, v1) {
36
122
  return compareVertices(v0, v1) > 0 ? v1 : v0;
37
123
  }
38
- export function maxVertex(v0, v1) {
124
+ function maxVertex(v0, v1) {
39
125
  return compareVertices(v0, v1) > 0 ? v0 : v1;
40
126
  }
41
- export function orderVertices(vertices) {
127
+ function orderVertices(vertices) {
42
128
  return vertices.sort(compareVertices);
43
129
  }
44
- export function pointsDistance(x0, y0, x1, y1) {
130
+ function pointsDistance(x0, y0, x1, y1) {
45
131
  var diff_x = x0 - x1;
46
132
  var diff_y = y0 - y1;
47
133
  return Math.sqrt(diff_x * diff_x + diff_y * diff_y);
48
134
  }
49
- export function verticesDistance(v1, v2) {
135
+ function verticesDistance(v1, v2) {
50
136
  var x0 = v1.x,
51
137
  y0 = v1.y;
52
138
  var x1 = v2.x,
53
139
  y1 = v2.y;
54
140
  return pointsDistance(x0, y0, x1, y1);
55
141
  }
56
- export function horizontalLine(y) {
142
+ function horizontalLine(y) {
57
143
  return {
58
144
  a: 0,
59
145
  b: 1,
60
146
  c: -y
61
147
  };
62
148
  }
63
- export var almostEqual = function almostEqual(x, y) {
64
- return Math.abs(x - y) < EPSILON;
149
+ var almostEqual = exports.almostEqual = function almostEqual(x, y) {
150
+ return Math.abs(x - y) < _constants.EPSILON;
65
151
  };
66
- export function verticalLine(x) {
152
+ function verticalLine(x) {
67
153
  return {
68
154
  a: 1,
69
155
  b: 0,
70
156
  c: -x
71
157
  };
72
158
  }
73
- export function upcrossLine(x, y) {
159
+ function upcrossLine(x, y) {
74
160
  return {
75
161
  a: 1,
76
162
  b: 1,
77
163
  c: -x - y
78
164
  };
79
165
  }
80
- export function downcrossLine(x, y) {
166
+ function downcrossLine(x, y) {
81
167
  return {
82
168
  a: 1,
83
169
  b: -1,
84
170
  c: -x + y
85
171
  };
86
172
  }
87
- export function linePassingThroughTwoPoints(x1, y1, x2, y2) {
173
+ function linePassingThroughTwoPoints(x1, y1, x2, y2) {
88
174
  if (x1 === x2 && y1 == y2) throw new Error('Geometry error');
89
175
  //if (x1 === x2) return verticalLine(x1);
90
176
  //if (y1 === y2) return horizontalLine(y1);
@@ -95,18 +181,18 @@ export function linePassingThroughTwoPoints(x1, y1, x2, y2) {
95
181
  c: y2 * x1 - x2 * y1
96
182
  };
97
183
  }
98
- export function getNormaline(x1, y1, x2, y2) {
184
+ function getNormaline(x1, y1, x2, y2) {
99
185
  var lineFunction = linePassingThroughTwoPoints(x1, y1, x2, y2);
100
186
  return {
101
187
  x: lineFunction.a / Math.sqrt(lineFunction.a * lineFunction.a + lineFunction.b * lineFunction.b),
102
188
  y: lineFunction.b / Math.sqrt(lineFunction.a * lineFunction.a + lineFunction.b * lineFunction.b)
103
189
  };
104
190
  }
105
- export function distancePointFromLine(a, b, c, x, y) {
191
+ function distancePointFromLine(a, b, c, x, y) {
106
192
  //https://en.wikipedia.org/wiki/Distance_from_a_point_to_a_line
107
- return fAbs(a * x + b * y + c) / Math.sqrt(a * a + b * b);
193
+ return (0, _math.fAbs)(a * x + b * y + c) / Math.sqrt(a * a + b * b);
108
194
  }
109
- export function closestPointFromLine(a, b, c, x, y) {
195
+ function closestPointFromLine(a, b, c, x, y) {
110
196
  //https://en.wikipedia.org/wiki/Distance_from_a_point_to_a_line
111
197
  var denom = a * a + b * b;
112
198
  return {
@@ -124,7 +210,7 @@ export function closestPointFromLine(a, b, c, x, y) {
124
210
  * @param {number} l costant of second line
125
211
  * @return {object} {x,y} point's coordinates
126
212
  */
127
- export function twoLinesIntersection(a, b, c, j, k, l) {
213
+ function twoLinesIntersection(a, b, c, j, k, l) {
128
214
  var angularCoefficientsDiff = b * j - a * k;
129
215
  if (angularCoefficientsDiff === 0) return undefined; //no intersection
130
216
 
@@ -135,10 +221,10 @@ export function twoLinesIntersection(a, b, c, j, k, l) {
135
221
  y: y
136
222
  };
137
223
  }
138
- export function twoLineSegmentsIntersection(p1, p2, p3, p4) {
224
+ function twoLineSegmentsIntersection(p1, p2, p3, p4) {
139
225
  return _twoLineSegmentsIntersection(p1, p2, p3.toJS(), p4.toJS());
140
226
  }
141
- export function _twoLineSegmentsIntersection(p1, p2, p3, p4) {
227
+ function _twoLineSegmentsIntersection(p1, p2, p3, p4) {
142
228
  //https://github.com/psalaets/line-intersect/blob/master/lib/check-intersection.js
143
229
 
144
230
  var x1 = p1.x,
@@ -152,8 +238,8 @@ export function _twoLineSegmentsIntersection(p1, p2, p3, p4) {
152
238
  var denom = (y4 - y3) * (x2 - x1) - (x4 - x3) * (y2 - y1);
153
239
  var numA = (x4 - x3) * (y1 - y3) - (y4 - y3) * (x1 - x3);
154
240
  var numB = (x2 - x1) * (y1 - y3) - (y2 - y1) * (x1 - x3);
155
- if (fAbs(denom) <= EPSILON) {
156
- if (fAbs(numA) <= EPSILON && fAbs(numB) <= EPSILON) {
241
+ if ((0, _math.fAbs)(denom) <= _constants.EPSILON) {
242
+ if ((0, _math.fAbs)(numA) <= _constants.EPSILON && (0, _math.fAbs)(numB) <= _constants.EPSILON) {
157
243
  var comparator = function comparator(pa, pb) {
158
244
  return pa.x === pb.x ? pa.y - pb.y : pa.x - pb.x;
159
245
  };
@@ -162,7 +248,7 @@ export function _twoLineSegmentsIntersection(p1, p2, p3, p4) {
162
248
  var _sort = [line0, line1].sort(function (lineA, lineB) {
163
249
  return comparator(lineA[0], lineB[0]);
164
250
  }),
165
- _sort2 = _slicedToArray(_sort, 2),
251
+ _sort2 = (0, _slicedToArray2["default"])(_sort, 2),
166
252
  lineSX = _sort2[0],
167
253
  lineDX = _sort2[1];
168
254
  comparator(lineSX[1], lineDX[0]) < 0 ? 'colinear' : 'none';
@@ -182,7 +268,7 @@ export function _twoLineSegmentsIntersection(p1, p2, p3, p4) {
182
268
  }
183
269
  var uA = numA / denom;
184
270
  var uB = numB / denom;
185
- if (uA >= 0 - EPSILON && uA <= 1 + EPSILON && uB >= 0 - EPSILON && uB <= 1 + EPSILON) {
271
+ if (uA >= 0 - _constants.EPSILON && uA <= 1 + _constants.EPSILON && uB >= 0 - _constants.EPSILON && uB <= 1 + _constants.EPSILON) {
186
272
  var _point = {
187
273
  x: x1 + uA * (x2 - x1),
188
274
  y: y1 + uA * (y2 - y1)
@@ -196,7 +282,7 @@ export function _twoLineSegmentsIntersection(p1, p2, p3, p4) {
196
282
  type: 'none'
197
283
  };
198
284
  }
199
- export function distancePointFromLineSegment(v1, v2, xp, yp) {
285
+ function distancePointFromLineSegment(v1, v2, xp, yp) {
200
286
  //http://stackoverflow.com/a/6853926/1398836
201
287
  var x1 = v1.x,
202
288
  y1 = v1.y;
@@ -239,8 +325,8 @@ export function distancePointFromLineSegment(v1, v2, xp, yp) {
239
325
  * @param maxDistance {number} the epsilon value used for comparisons
240
326
  * @returns {boolean} true if the point lies on the line segment false otherwise
241
327
  */
242
- export function isPointOnLineSegment(x1, y1, x2, y2, xp, yp) {
243
- var maxDistance = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : EPSILON;
328
+ function isPointOnLineSegment(x1, y1, x2, y2, xp, yp) {
329
+ var maxDistance = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : _constants.EPSILON;
244
330
  return distancePointFromLineSegment({
245
331
  x: x1,
246
332
  y: y1
@@ -249,7 +335,7 @@ export function isPointOnLineSegment(x1, y1, x2, y2, xp, yp) {
249
335
  y: y2
250
336
  }, xp, yp) <= maxDistance;
251
337
  }
252
- export function closestPointFromLineSegment(x1, y1, x2, y2, xp, yp) {
338
+ function closestPointFromLineSegment(x1, y1, x2, y2, xp, yp) {
253
339
  if (x1 === x2) return {
254
340
  x: x1,
255
341
  y: yp
@@ -269,7 +355,7 @@ export function closestPointFromLineSegment(x1, y1, x2, y2, xp, yp) {
269
355
  y: y
270
356
  };
271
357
  }
272
- export function pointPositionOnLineSegment(x1, y1, x2, y2, xp, yp) {
358
+ function pointPositionOnLineSegment(x1, y1, x2, y2, xp, yp) {
273
359
  var length = pointsDistance(x1, y1, x2, y2);
274
360
  var distance = pointsDistance(x1, y1, xp, yp);
275
361
  var offset = distance / length;
@@ -279,16 +365,16 @@ export function pointPositionOnLineSegment(x1, y1, x2, y2, xp, yp) {
279
365
  */
280
366
  return offset;
281
367
  }
282
- export function mapRange(value, low1, high1, low2, high2) {
368
+ function mapRange(value, low1, high1, low2, high2) {
283
369
  return low2 + (high2 - low2) * (value - low1) / (high1 - low1);
284
370
  }
285
- export function angleBetweenTwoPointsAndOrigin(x1, y1, x2, y2) {
371
+ function angleBetweenTwoPointsAndOrigin(x1, y1, x2, y2) {
286
372
  return -Math.atan2(y1 - y2, x2 - x1) * 180 / Math.PI;
287
373
  }
288
- export function angleBetweenTwoPoints(x1, y1, x2, y2) {
374
+ function angleBetweenTwoPoints(x1, y1, x2, y2) {
289
375
  return Math.atan2(y2 - y1, x2 - x1);
290
376
  }
291
- export function angleBetweenTwoLines(line, drawingLine, vertices) {
377
+ function angleBetweenTwoLines(line, drawingLine, vertices) {
292
378
  var points = [];
293
379
 
294
380
  // safety guards
@@ -346,7 +432,7 @@ export function angleBetweenTwoLines(line, drawingLine, vertices) {
346
432
  var v = vertices === null || vertices === void 0 ? void 0 : vertices[idx];
347
433
  return v ? new Three.Vector2(v.x, v.y) : new Three.Vector2(0, 0);
348
434
  }),
349
- _points$slice$map2 = _slicedToArray(_points$slice$map, 3),
435
+ _points$slice$map2 = (0, _slicedToArray2["default"])(_points$slice$map, 3),
350
436
  c = _points$slice$map2[0],
351
437
  p1 = _points$slice$map2[1],
352
438
  p2 = _points$slice$map2[2];
@@ -354,7 +440,7 @@ export function angleBetweenTwoLines(line, drawingLine, vertices) {
354
440
  var vec2 = p2.clone().sub(c).normalize();
355
441
  return Math.floor(vec1.angle() * 180 / Math.PI - vec2.angle() * 180 / Math.PI + 0.5);
356
442
  }
357
- export var getRelatedLines = function getRelatedLines(tlines, drawingLine, vertices, lines) {
443
+ var getRelatedLines = exports.getRelatedLines = function getRelatedLines(tlines, drawingLine, vertices, lines) {
358
444
  var exceptLineId = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
359
445
  if (!(drawingLine !== null && drawingLine !== void 0 && drawingLine.vertices) || !Array.isArray(drawingLine.vertices)) return;
360
446
  var seen = new Set();
@@ -370,7 +456,7 @@ export var getRelatedLines = function getRelatedLines(tlines, drawingLine, verti
370
456
  try {
371
457
  for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
372
458
  var lineId = _step5.value;
373
- if (lineId !== drawingLine.id && lineId !== exceptLineId && !isEmpty(lines === null || lines === void 0 ? void 0 : lines[lineId]) && !seen.has(lineId)) {
459
+ if (lineId !== drawingLine.id && lineId !== exceptLineId && !(0, _helper.isEmpty)(lines === null || lines === void 0 ? void 0 : lines[lineId]) && !seen.has(lineId)) {
374
460
  seen.add(lineId);
375
461
  tlines.push(lines[lineId]);
376
462
  }
@@ -387,12 +473,12 @@ export var getRelatedLines = function getRelatedLines(tlines, drawingLine, verti
387
473
  _iterator4.f();
388
474
  }
389
475
  };
390
- export function snapAngleByUnit(lineAngle, vertices, drawingLine, x, y, dragVertexId) {
476
+ function snapAngleByUnit(lineAngle, vertices, drawingLine, x, y, dragVertexId) {
391
477
  var tx, ty;
392
478
  var absAngle = Math.abs(lineAngle);
393
479
  // angle snapping as a value of UNIT_ANGLE
394
- var rest = absAngle % UNIT_ANGLE;
395
- var missAngle = UNIT_ANGLE - rest;
480
+ var rest = absAngle % _constants.UNIT_ANGLE;
481
+ var missAngle = _constants.UNIT_ANGLE - rest;
396
482
  // the origin point of rotation(snapping)
397
483
  var originVerId = drawingLine.vertices.findIndex(function (vertice) {
398
484
  return vertice !== dragVertexId;
@@ -401,7 +487,7 @@ export function snapAngleByUnit(lineAngle, vertices, drawingLine, x, y, dragVert
401
487
  var ox = vertices[originVerId].x;
402
488
  var oy = vertices[originVerId].y;
403
489
  // check whether the line is snapped to before point.
404
- if (rest <= UNIT_ANGLE / 2) {
490
+ if (rest <= _constants.UNIT_ANGLE / 2) {
405
491
  // determine the direction of rotation.
406
492
  rest = lineAngle > 0 ? rest : -rest;
407
493
  // rotate the current point to last point around the first point of drawing line.
@@ -409,7 +495,7 @@ export function snapAngleByUnit(lineAngle, vertices, drawingLine, x, y, dragVert
409
495
  ty = rotatePointAroundPoint(x, y, ox, oy, rest).y;
410
496
  }
411
497
  // check whether the line is snapped to next new point.
412
- else if (rest > UNIT_ANGLE / 2) {
498
+ else if (rest > _constants.UNIT_ANGLE / 2) {
413
499
  // determine the direction of rotation.
414
500
  missAngle = lineAngle > 0 ? -missAngle : missAngle;
415
501
  // rotate the current point to last point around the first point of drawing line.
@@ -422,30 +508,30 @@ export function snapAngleByUnit(lineAngle, vertices, drawingLine, x, y, dragVert
422
508
  };
423
509
  return resPoint;
424
510
  }
425
- export function absAngleBetweenTwoPoints(x1, y1, x2, y2) {
511
+ function absAngleBetweenTwoPoints(x1, y1, x2, y2) {
426
512
  return Math.atan2(y2 - y1, Math.abs(x2 - x1));
427
513
  }
428
- export function samePoints(_ref, _ref2) {
514
+ function samePoints(_ref, _ref2) {
429
515
  var x1 = _ref.x,
430
516
  y1 = _ref.y;
431
517
  var x2 = _ref2.x,
432
518
  y2 = _ref2.y;
433
- return fAbs(x1 - x2) <= EPSILON && fAbs(y1 - y2) <= EPSILON;
519
+ return (0, _math.fAbs)(x1 - x2) <= _constants.EPSILON && (0, _math.fAbs)(y1 - y2) <= _constants.EPSILON;
434
520
  }
435
- export function sameDistances(dis1, dis2) {
436
- return fAbs(dis1 - dis2) <= EPSILON;
521
+ function sameDistances(dis1, dis2) {
522
+ return (0, _math.fAbs)(dis1 - dis2) <= _constants.EPSILON;
437
523
  }
438
- export function sameMPoints(_ref3, _ref4) {
524
+ function sameMPoints(_ref3, _ref4) {
439
525
  var x1 = _ref3.x,
440
526
  y1 = _ref3.y;
441
527
  var x2 = _ref4.x,
442
528
  y2 = _ref4.y;
443
- return fAbs(x1 - x2) <= MEPSILON && fAbs(y1 - y2) <= MEPSILON;
529
+ return (0, _math.fAbs)(x1 - x2) <= _constants.MEPSILON && (0, _math.fAbs)(y1 - y2) <= _constants.MEPSILON;
444
530
  }
445
- export function sameMDistances(dis1, dis2) {
446
- return fAbs(dis1 - dis2) <= MEPSILON;
531
+ function sameMDistances(dis1, dis2) {
532
+ return (0, _math.fAbs)(dis1 - dis2) <= _constants.MEPSILON;
447
533
  }
448
- export function isPointInRect(rect, point) {
534
+ function isPointInRect(rect, point) {
449
535
  var result = true;
450
536
  for (var i = 0; i < rect.length; i++) {
451
537
  var pos1 = rect[i];
@@ -465,23 +551,23 @@ export function isPointInRect(rect, point) {
465
551
  * @param {number} newDistance New line length
466
552
  * @return {object}
467
553
  */
468
- export function extendLine(x1, y1, x2, y2, newDistance) {
554
+ function extendLine(x1, y1, x2, y2, newDistance) {
469
555
  var precision = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 6;
470
556
  var rad = angleBetweenTwoPoints(x1, y1, x2, y2);
471
557
  return {
472
- x: toFixedFloat(x1 + Math.cos(rad) * newDistance, precision),
473
- y: toFixedFloat(y1 + Math.sin(rad) * newDistance, precision)
558
+ x: (0, _math.toFixedFloat)(x1 + Math.cos(rad) * newDistance, precision),
559
+ y: (0, _math.toFixedFloat)(y1 + Math.sin(rad) * newDistance, precision)
474
560
  };
475
561
  }
476
- export function roundVertex(vertex) {
562
+ function roundVertex(vertex) {
477
563
  var precision = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 6;
478
- vertex.set('x', toFixedFloat(vertex.get('x'), precision));
479
- vertex.set('y', toFixedFloat(vertex.get('y'), precision));
564
+ vertex.set('x', (0, _math.toFixedFloat)(vertex.get('x'), precision));
565
+ vertex.set('y', (0, _math.toFixedFloat)(vertex.get('y'), precision));
480
566
  return vertex;
481
567
  }
482
568
 
483
569
  //https://github.com/MartyWallace/PolyK
484
- export function ContainsPoint(polygon, pointX, pointY) {
570
+ function ContainsPoint(polygon, pointX, pointY) {
485
571
  var n = polygon.length >> 1;
486
572
  var ax, lup;
487
573
  var ay = polygon[2 * n - 3] - pointY;
@@ -520,21 +606,21 @@ export function ContainsPoint(polygon, pointX, pointY) {
520
606
  }
521
607
  return (depth & 1) === 1;
522
608
  }
523
- export function cosWithThreshold(alpha, threshold) {
609
+ function cosWithThreshold(alpha, threshold) {
524
610
  var cos = Math.cos(alpha);
525
611
  return cos < threshold ? 0 : cos;
526
612
  }
527
- export function sinWithThreshold(alpha, threshold) {
613
+ function sinWithThreshold(alpha, threshold) {
528
614
  var sin = Math.sin(alpha);
529
615
  return sin < threshold ? 0 : sin;
530
616
  }
531
- export function midPoint(x1, y1, x2, y2) {
617
+ function midPoint(x1, y1, x2, y2) {
532
618
  return {
533
619
  x: (x1 + x2) / 2,
534
620
  y: (y1 + y2) / 2
535
621
  };
536
622
  }
537
- export function verticesMidPoint(verticesArray) {
623
+ function verticesMidPoint(verticesArray) {
538
624
  var res = verticesArray.reduce(function (incr, vertex) {
539
625
  return {
540
626
  x: incr.x + vertex.x,
@@ -549,7 +635,7 @@ export function verticesMidPoint(verticesArray) {
549
635
  y: res.y / verticesArray.length
550
636
  };
551
637
  }
552
- export function rotatePointAroundPoint(px, py, ox, oy, theta) {
638
+ function rotatePointAroundPoint(px, py, ox, oy, theta) {
553
639
  var thetaRad = theta * Math.PI / 180;
554
640
  var cos = Math.cos(thetaRad);
555
641
  var sin = Math.sin(thetaRad);
@@ -583,7 +669,7 @@ function itemrectInfo(x, y, rotRad, size, layoutpos, is_corner) {
583
669
  is_corner: is_corner
584
670
  };
585
671
  }
586
- export function getCalcRectFromItem(item) {
672
+ function getCalcRectFromItem(item) {
587
673
  var itemInfo;
588
674
  if (item === undefined) itemInfo = [];else itemInfo = item.item;
589
675
  var x = item.pos.x;
@@ -611,7 +697,7 @@ export function getCalcRectFromItem(item) {
611
697
  itemInfo: itemInfo
612
698
  };
613
699
  }
614
- export function getCalcRectFromItem3D(item) {
700
+ function getCalcRectFromItem3D(item) {
615
701
  var itemInfo;
616
702
  if (item === undefined) itemInfo = [];else itemInfo = item.item;
617
703
  var x = item.pos.x;
@@ -639,7 +725,7 @@ export function getCalcRectFromItem3D(item) {
639
725
  itemInfo: itemInfo
640
726
  };
641
727
  }
642
- export function getAllItems(scene, catalog, allLineRects) {
728
+ function getAllItems(scene, catalog, allLineRects) {
643
729
  var layerID = scene.selectedLayer;
644
730
  var layer = scene.layers.get(layerID);
645
731
  var curiteminfo;
@@ -651,7 +737,7 @@ export function getAllItems(scene, catalog, allLineRects) {
651
737
  selectedItem = layer.getIn(['items', layer.selected.items.get(0)]);
652
738
  var catid = selectedItem.type;
653
739
  var cat = catalog.elements[catid];
654
- if (!cat) cat = catalog.elements[returnReplaceableDeepSearchType(catid)];
740
+ if (!cat) cat = catalog.elements[(0, _utils.returnReplaceableDeepSearchType)(catid)];
655
741
  currentItem = {
656
742
  selectedItem: selectedItem,
657
743
  cat: cat
@@ -668,7 +754,7 @@ export function getAllItems(scene, catalog, allLineRects) {
668
754
  var catid = item.type;
669
755
  var cat = catalog.elements[catid];
670
756
  if (!cat) {
671
- cat = catalog.elements[returnReplaceableDeepSearchType(catid)];
757
+ cat = catalog.elements[(0, _utils.returnReplaceableDeepSearchType)(catid)];
672
758
  }
673
759
  var sizeinfo = [];
674
760
  var width, height, depth;
@@ -684,9 +770,9 @@ export function getAllItems(scene, catalog, allLineRects) {
684
770
  layoutpos: cat && cat.info.layoutpos,
685
771
  is_corner: cat && cat.info.is_corner
686
772
  });
687
- width = convert(sizeinfo.width).from(sizeinfo.widthUnit).to(scene.unit);
688
- height = convert(sizeinfo.depth).from(sizeinfo.depthUnit).to(scene.unit);
689
- depth = convert(sizeinfo.height).from(sizeinfo.heightUnit).to(scene.unit);
773
+ width = (0, _convertUnitsLite.convert)(sizeinfo.width).from(sizeinfo.widthUnit).to(scene.unit);
774
+ height = (0, _convertUnitsLite.convert)(sizeinfo.depth).from(sizeinfo.depthUnit).to(scene.unit);
775
+ depth = (0, _convertUnitsLite.convert)(sizeinfo.height).from(sizeinfo.heightUnit).to(scene.unit);
690
776
  val.size = {
691
777
  width: width,
692
778
  height: height,
@@ -719,7 +805,7 @@ export function getAllItems(scene, catalog, allLineRects) {
719
805
  otherItems: otherItems
720
806
  };
721
807
  }
722
- export function getAllItemSpecified(scene, catalog, filter) {
808
+ function getAllItemSpecified(scene, catalog, filter) {
723
809
  var _scene$layers, _scene$layers$get;
724
810
  var layerID = scene === null || scene === void 0 ? void 0 : scene.selectedLayer;
725
811
  var layer = scene === null || scene === void 0 || (_scene$layers = scene.layers) === null || _scene$layers === void 0 || (_scene$layers$get = _scene$layers.get) === null || _scene$layers$get === void 0 ? void 0 : _scene$layers$get.call(_scene$layers, layerID);
@@ -745,7 +831,7 @@ export function getAllItemSpecified(scene, catalog, filter) {
745
831
  var getSize = function getSize(key) {
746
832
  var _props$getIn;
747
833
  var length = props === null || props === void 0 || (_props$getIn = props.getIn) === null || _props$getIn === void 0 ? void 0 : _props$getIn.call(props, [key, '_length']);
748
- return length != null ? convert(length).from('in').to(scene.unit) : 0;
834
+ return length != null ? (0, _convertUnitsLite.convert)(length).from('in').to(scene.unit) : 0;
749
835
  };
750
836
  val.size = {
751
837
  width: getSize('width'),
@@ -778,13 +864,13 @@ export function getAllItemSpecified(scene, catalog, filter) {
778
864
  others: iteminfo
779
865
  };
780
866
  }
781
- export function findCatalogElement(catalog, elementName) {
867
+ function findCatalogElement(catalog, elementName) {
782
868
  if (!elementName || !catalog) return null;
783
869
  var variants = [elementName, elementName.toLowerCase()];
784
870
  var deepVariants = variants.map(function (v) {
785
- return returnReplaceableDeepSearchType(v);
871
+ return (0, _utils.returnReplaceableDeepSearchType)(v);
786
872
  }).filter(Boolean);
787
- var allCandidates = [].concat(variants, _toConsumableArray(deepVariants));
873
+ var allCandidates = [].concat(variants, (0, _toConsumableArray2["default"])(deepVariants));
788
874
  var getElement = function getElement(catid) {
789
875
  if (!catid) return null;
790
876
 
@@ -814,7 +900,7 @@ export function findCatalogElement(catalog, elementName) {
814
900
  }
815
901
  return null;
816
902
  }
817
- export function isSnappedLine(calcrect, allLineRects) {
903
+ function isSnappedLine(calcrect, allLineRects) {
818
904
  if (allLineRects === undefined) return false;
819
905
  var r2 = calcrect.rect[2];
820
906
  var r3 = calcrect.rect[3];
@@ -822,18 +908,18 @@ export function isSnappedLine(calcrect, allLineRects) {
822
908
  var l2 = linerect.rect[2];
823
909
  var l3 = linerect.rect[3];
824
910
  var delta = verticesDistance(l2, r3) + verticesDistance(r3, r2) + verticesDistance(r2, l3) - verticesDistance(l3, l2);
825
- if (delta < EPSILON) {
911
+ if (delta < _constants.EPSILON) {
826
912
  return true;
827
913
  } else {
828
914
  l2 = linerect.rect[3];
829
915
  l3 = linerect.rect[2];
830
916
  delta = verticesDistance(l2, r3) + verticesDistance(r3, r2) + verticesDistance(r2, l3) - verticesDistance(l3, l2);
831
- return delta < EPSILON;
917
+ return delta < _constants.EPSILON;
832
918
  }
833
919
  });
834
920
  return result;
835
921
  }
836
- export function isSnappedSideLine(calcrect, allLineRects) {
922
+ function isSnappedSideLine(calcrect, allLineRects) {
837
923
  if (allLineRects === undefined) return 0;
838
924
  var r2 = calcrect.rect[1];
839
925
  var r3 = calcrect.rect[2];
@@ -841,13 +927,13 @@ export function isSnappedSideLine(calcrect, allLineRects) {
841
927
  var l2 = linerect.rect[2];
842
928
  var l3 = linerect.rect[3];
843
929
  var delta = verticesDistance(l2, r3) + verticesDistance(r3, r2) + verticesDistance(r2, l3) - verticesDistance(l3, l2);
844
- return delta < EPSILON;
930
+ return delta < _constants.EPSILON;
845
931
  });
846
932
  return result;
847
933
  }
848
934
 
849
935
  /** Calculate candidate positions */
850
- export function getAllItemSnap(allItemRects) {
936
+ function getAllItemSnap(allItemRects) {
851
937
  var allItemSnap = [];
852
938
  var cur = allItemRects.cur;
853
939
 
@@ -913,7 +999,7 @@ export function getAllItemSnap(allItemRects) {
913
999
  });
914
1000
  return allItemSnap;
915
1001
  }
916
- export function getAllArea(layer) {
1002
+ function getAllArea(layer) {
917
1003
  var allAreaLines = [];
918
1004
  var allLines = [];
919
1005
  var verticesArray = [];
@@ -940,11 +1026,11 @@ export function getAllArea(layer) {
940
1026
  }
941
1027
 
942
1028
  /** Get all lines of the scene */
943
- export function getAllLines(layer) {
1029
+ function getAllLines(layer) {
944
1030
  var allAreaLines = getAllAreaLines(layer);
945
1031
  var allLines = [];
946
1032
  //let allNonAreaLines = [];
947
- var thick = LINE_THICKNESS / 2;
1033
+ var thick = _constants.LINE_THICKNESS / 2;
948
1034
  layer.lines.forEach(function (line) {
949
1035
  var i = containLine(allAreaLines, line);
950
1036
  // let thick = line.properties.getIn(['thickness', 'length']);
@@ -998,7 +1084,7 @@ export function getAllLines(layer) {
998
1084
  }
999
1085
 
1000
1086
  /** Get lines that wraps the area */
1001
- export function getAllAreaLines(layer) {
1087
+ function getAllAreaLines(layer) {
1002
1088
  var areainfo = [];
1003
1089
  layer.areas.forEach(function (area) {
1004
1090
  var sz = area.vertices.size;
@@ -1008,7 +1094,7 @@ export function getAllAreaLines(layer) {
1008
1094
  });
1009
1095
  return areainfo;
1010
1096
  }
1011
- export function containLine(lines, line) {
1097
+ function containLine(lines, line) {
1012
1098
  // lines: [array]
1013
1099
  var sz = lines.length;
1014
1100
  for (var i = 0; i < sz; i++) {
@@ -1019,7 +1105,7 @@ export function containLine(lines, line) {
1019
1105
  }
1020
1106
  return -1;
1021
1107
  }
1022
- export function buildRectFromLines(layer, lines) {
1108
+ function buildRectFromLines(layer, lines) {
1023
1109
  var rect = [];
1024
1110
  lines.forEach(function (line) {
1025
1111
  var vxys = []; // 0: x0, 1: y0, 2: x1, 3: y1
@@ -1037,7 +1123,7 @@ export function buildRectFromLines(layer, lines) {
1037
1123
  });
1038
1124
  return rect;
1039
1125
  }
1040
- export function getRelatedVertices(x0, y0, x1, y1, layer) {
1126
+ function getRelatedVertices(x0, y0, x1, y1, layer) {
1041
1127
  var verticesArray = [];
1042
1128
  var mapVertIDtoIndex = {};
1043
1129
  layer.vertices.forEach(function (vertex) {
@@ -1057,7 +1143,7 @@ export function getRelatedVertices(x0, y0, x1, y1, layer) {
1057
1143
  x: verticesArray[mapVertIDtoIndex[vertID1]][0],
1058
1144
  y: verticesArray[mapVertIDtoIndex[vertID1]][1]
1059
1145
  };
1060
- if (Math.abs(pt0.x - x0) < EPSILON && Math.abs(pt0.y - y0) < EPSILON && Math.abs(pt1.x - x1) < EPSILON && Math.abs(pt1.y - y1) < EPSILON || Math.abs(pt0.x - x1) < EPSILON && Math.abs(pt0.y - y1) < EPSILON && Math.abs(pt1.x - x0) < EPSILON && Math.abs(pt1.y - y0) < EPSILON) {
1146
+ if (Math.abs(pt0.x - x0) < _constants.EPSILON && Math.abs(pt0.y - y0) < _constants.EPSILON && Math.abs(pt1.x - x1) < _constants.EPSILON && Math.abs(pt1.y - y1) < _constants.EPSILON || Math.abs(pt0.x - x1) < _constants.EPSILON && Math.abs(pt0.y - y1) < _constants.EPSILON && Math.abs(pt1.x - x0) < _constants.EPSILON && Math.abs(pt1.y - y0) < _constants.EPSILON) {
1061
1147
  if (line.relatedVertices.size == 2) {
1062
1148
  var relPt0 = point(x0, y0);
1063
1149
  var relPt1 = point(x1, y1);
@@ -1073,7 +1159,7 @@ export function getRelatedVertices(x0, y0, x1, y1, layer) {
1073
1159
  });
1074
1160
  return relVerts;
1075
1161
  }
1076
- export function getCalcRectFromLine(x0, y0, x1, y1, thick, layer) {
1162
+ function getCalcRectFromLine(x0, y0, x1, y1, thick, layer) {
1077
1163
  // get line from vertex coordinate
1078
1164
  var relVerts = getRelatedVertices(x0, y0, x1, y1, layer);
1079
1165
  var dx = x1 - x0;
@@ -1119,7 +1205,7 @@ export function getCalcRectFromLine(x0, y0, x1, y1, thick, layer) {
1119
1205
  }
1120
1206
  };
1121
1207
  }
1122
- export function getAllLineSnap(allLineRects, curItemRect) {
1208
+ function getAllLineSnap(allLineRects, curItemRect) {
1123
1209
  var allLineSnap = [];
1124
1210
  var cur = curItemRect;
1125
1211
  if (cur === undefined || cur === null) return;else allLineRects.forEach(function (rect) {
@@ -1143,7 +1229,7 @@ export function getAllLineSnap(allLineRects, curItemRect) {
1143
1229
  });
1144
1230
  return allLineSnap;
1145
1231
  }
1146
- export function validateSnaps(allSnaps, allRects) {
1232
+ function validateSnaps(allSnaps, allRects) {
1147
1233
  var validSnaps = [];
1148
1234
  if (allSnaps !== undefined && allSnaps !== null && allSnaps.length > 0) allSnaps.forEach(function (snap) {
1149
1235
  if (validSnap(snap, allRects)) {
@@ -1152,7 +1238,7 @@ export function validateSnaps(allSnaps, allRects) {
1152
1238
  });
1153
1239
  return validSnaps;
1154
1240
  }
1155
- export function validateLineSnaps(allSnaps, allItemSnap, allLineSnap, allItemRects, allLineRects, allRects) {
1241
+ function validateLineSnaps(allSnaps, allItemSnap, allLineSnap, allItemRects, allLineRects, allRects) {
1156
1242
  var validSnaps = [];
1157
1243
  allSnaps.forEach(function (snap) {
1158
1244
  if (validSnap(snap, allRects)) {
@@ -1168,13 +1254,13 @@ export function validateLineSnaps(allSnaps, allItemSnap, allLineSnap, allItemRec
1168
1254
  });
1169
1255
  return validSnaps;
1170
1256
  }
1171
- export function validSnap(snap, rects) {
1257
+ function validSnap(snap, rects) {
1172
1258
  var snaprect = getCalcRectFromItem(snap);
1173
1259
  return rects.every(function (rect) {
1174
1260
  return !intersectRect(rect.rect, snaprect.rect);
1175
1261
  });
1176
1262
  }
1177
- export function itemInfo(x, y, rotRad, size) {
1263
+ function itemInfo(x, y, rotRad, size) {
1178
1264
  return {
1179
1265
  pos: {
1180
1266
  x: x,
@@ -1184,7 +1270,7 @@ export function itemInfo(x, y, rotRad, size) {
1184
1270
  size: size
1185
1271
  };
1186
1272
  }
1187
- export function intersectRect(rect1, rect2) {
1273
+ function intersectRect(rect1, rect2) {
1188
1274
  var ret = false;
1189
1275
  rect1 = shrinkRect(rect1);
1190
1276
  rect2 = shrinkRect(rect2);
@@ -1197,7 +1283,7 @@ export function intersectRect(rect1, rect2) {
1197
1283
  });
1198
1284
  return ret;
1199
1285
  }
1200
- export function containPointInRect(point, rect) {
1286
+ function containPointInRect(point, rect) {
1201
1287
  // true: contain, false: not contain
1202
1288
  for (var i = 0; i < rect.length; i++) {
1203
1289
  var ni = (i + 1) % rect.length;
@@ -1207,16 +1293,16 @@ export function containPointInRect(point, rect) {
1207
1293
  }
1208
1294
  return true;
1209
1295
  }
1210
- export function diff(v0, v1) {
1296
+ function diff(v0, v1) {
1211
1297
  return {
1212
1298
  x: v0.x - v1.x,
1213
1299
  y: v0.y - v1.y
1214
1300
  };
1215
1301
  }
1216
- export function crossprod(v0, v1) {
1302
+ function crossprod(v0, v1) {
1217
1303
  return v0.x * v1.y - v0.y * v1.x;
1218
1304
  }
1219
- export function shrinkRect(rect) {
1305
+ function shrinkRect(rect) {
1220
1306
  var v02x = rect[2].x - rect[0].x;
1221
1307
  var v02y = rect[2].y - rect[0].y;
1222
1308
  var d02 = Math.sqrt(v02x * v02x + v02y * v02y);
@@ -1229,7 +1315,7 @@ export function shrinkRect(rect) {
1229
1315
  var o13y = v13y / d13 * 0.1;
1230
1316
  return [point(rect[0].x + o02x, rect[0].y + o02y), point(rect[1].x + o13x, rect[1].y + o13y), point(rect[2].x - o02x, rect[2].y - o02y), point(rect[3].x - o13x, rect[3].y - o13y)];
1231
1317
  }
1232
- export function getInterSect(shape1, shape2) {
1318
+ function getInterSect(shape1, shape2) {
1233
1319
  // return result of intersect of two shape
1234
1320
  var count = 0;
1235
1321
  for (var i = 0; i < shape1.length; i++) {
@@ -1259,7 +1345,7 @@ export function getInterSect(shape1, shape2) {
1259
1345
  }
1260
1346
  return false;
1261
1347
  }
1262
- export function getLineInterSect(s1x, s1y, e1x, e1y, s2x, s2y, e2x, e2y) {
1348
+ function getLineInterSect(s1x, s1y, e1x, e1y, s2x, s2y, e2x, e2y) {
1263
1349
  var ax = s1x;
1264
1350
  var ay = s1y;
1265
1351
  var bx = e1x - s1x;
@@ -1304,7 +1390,7 @@ export function getLineInterSect(s1x, s1y, e1x, e1y, s2x, s2y, e2x, e2y) {
1304
1390
  return ret;
1305
1391
  }
1306
1392
  }
1307
- export function isPointInArea(allArea, pt) {
1393
+ function isPointInArea(allArea, pt) {
1308
1394
  var x = pt.x;
1309
1395
  var y = pt.y;
1310
1396
  var result = false;
@@ -1324,7 +1410,7 @@ export function isPointInArea(allArea, pt) {
1324
1410
  x: x1 - x,
1325
1411
  y: y1 - y
1326
1412
  };
1327
- if (Math.abs(v0.x) < EPSILON && Math.abs(v0.y) < EPSILON)
1413
+ if (Math.abs(v0.x) < _constants.EPSILON && Math.abs(v0.y) < _constants.EPSILON)
1328
1414
  // check if pt is area point
1329
1415
  return true;
1330
1416
 
@@ -1337,18 +1423,18 @@ export function isPointInArea(allArea, pt) {
1337
1423
  };
1338
1424
  var xE = x0 + vPt.x * lineLen;
1339
1425
  var yE = y0 + vPt.y * lineLen;
1340
- if (v0Len <= lineLen && Math.abs(xE - x1) < EPSILON && Math.abs(yE - y1) < EPSILON) return true;
1426
+ if (v0Len <= lineLen && Math.abs(xE - x1) < _constants.EPSILON && Math.abs(yE - y1) < _constants.EPSILON) return true;
1341
1427
  alpha = Math.atan2(v0.x * v1.y - v1.x * v0.y, v0.x * v1.x + v0.y * v1.y);
1342
1428
  sum += alpha;
1343
1429
  }
1344
- if (Math.abs(Math.abs(sum) - Math.PI * 2) < EPSILON) return true;
1430
+ if (Math.abs(Math.abs(sum) - Math.PI * 2) < _constants.EPSILON) return true;
1345
1431
  });
1346
1432
  return result;
1347
1433
  }
1348
- export function calcSnap(allItemRect, allItemSnap, allLineRects, allLineSnap, allRect, x, y, allAreaLines) {
1434
+ function calcSnap(allItemRect, allItemSnap, allLineRects, allLineSnap, allRect, x, y, allAreaLines) {
1349
1435
  return calcSnap2(allItemRect, allItemSnap, allLineRects, allLineSnap, allRect, x, y, allAreaLines);
1350
1436
  }
1351
- export function calcCreateSnap(allItemRect, allItemSnap, allLineRects, allLineSnap, allRect, x, y, polygonPoint) {
1437
+ function calcCreateSnap(allItemRect, allItemSnap, allLineRects, allLineSnap, allRect, x, y, polygonPoint) {
1352
1438
  // Validate required input and guard against missing `.cur`
1353
1439
  if (!allItemRect || !allItemRect.cur) return;
1354
1440
  var cur = allItemRect.cur; // safe alias
@@ -1406,7 +1492,7 @@ export function calcCreateSnap(allItemRect, allItemSnap, allLineRects, allLineSn
1406
1492
  }
1407
1493
 
1408
1494
  ////////////
1409
- export function calcSnap1(allItemRect, allItemSnap, allLineRects, allLineSnap, allRect, x, y) {
1495
+ function calcSnap1(allItemRect, allItemSnap, allLineRects, allLineSnap, allRect, x, y) {
1410
1496
  var cx = allItemRect.cur.pos.x;
1411
1497
  var cy = allItemRect.cur.pos.y;
1412
1498
  var nx = x;
@@ -1450,7 +1536,7 @@ export function calcSnap1(allItemRect, allItemSnap, allLineRects, allLineSnap, a
1450
1536
  }
1451
1537
 
1452
1538
  ////////////
1453
- export function calcSnap2(allItemRect, allItemSnap, allLineRects, allLineSnap, allRect, x, y, allArea) {
1539
+ function calcSnap2(allItemRect, allItemSnap, allLineRects, allLineSnap, allRect, x, y, allArea) {
1454
1540
  var nx = x;
1455
1541
  var ny = y;
1456
1542
  var ndist = 20;
@@ -1594,7 +1680,7 @@ export function calcSnap2(allItemRect, allItemSnap, allLineRects, allLineSnap, a
1594
1680
  return intersectRect(others.rect, curitem.rect);
1595
1681
  });
1596
1682
  intersects.forEach(function (rect) {
1597
- if (isPointInArea(allArea, rect.itemInfo) || !allArea.length) if (rect.itemInfo.layoutpos.includes(BASE_CABINET_LAYOUTPOS)) {
1683
+ if (isPointInArea(allArea, rect.itemInfo) || !allArea.length) if (rect.itemInfo.layoutpos.includes(_constants.BASE_CABINET_LAYOUTPOS)) {
1598
1684
  nx = rect.itemInfo.x;
1599
1685
  ny = rect.itemInfo.y;
1600
1686
  rotRad = rect.itemInfo.rotation * Math.PI / 180;
@@ -1621,7 +1707,7 @@ export function calcSnap2(allItemRect, allItemSnap, allLineRects, allLineSnap, a
1621
1707
  //Check case.
1622
1708
  //If item is 'blind base cabinet', it must be pulled from other 3".
1623
1709
  if (allItemRect.cur && allItemRect.cur.itemInfo.sku_number.startsWith('BBC')) {
1624
- var offset3inch = convert(3).from('in').to('cm');
1710
+ var offset3inch = (0, _convertUnitsLite.convert)(3).from('in').to('cm');
1625
1711
  var tx = nx,
1626
1712
  ty = ny;
1627
1713
  if (allItemRect.cur && allItemRect.cur.itemInfo.sku_number.endsWith('-L')) {
@@ -1666,7 +1752,7 @@ export function calcSnap2(allItemRect, allItemSnap, allLineRects, allLineSnap, a
1666
1752
  }
1667
1753
 
1668
1754
  ////////////
1669
- export function calcSnap3(allItemRect, allItemSnap, allLineRects, allLineSnap, allRect, x, y) {
1755
+ function calcSnap3(allItemRect, allItemSnap, allLineRects, allLineSnap, allRect, x, y) {
1670
1756
  // let layer = scene.layers.get(layerID);
1671
1757
  // let cx = allItemRect.cur.pos.x;
1672
1758
  // let cy = allItemRect.cur.pos.y;
@@ -1781,10 +1867,10 @@ export function calcSnap3(allItemRect, allItemSnap, allLineRects, allLineSnap, a
1781
1867
  rotRad: rotRad
1782
1868
  };
1783
1869
  }
1784
- export function getAllCurSnap(allLineRects, x, y, curItemRect) {
1870
+ function getAllCurSnap(allLineRects, x, y, curItemRect) {
1785
1871
  if (!curItemRect) return;
1786
1872
  var allCurSnap = [];
1787
- var thick = LINE_THICKNESS / 2;
1873
+ var thick = _constants.LINE_THICKNESS / 2;
1788
1874
  allLineRects.forEach(function (linerect) {
1789
1875
  //allLineRects:left, right, top, bottom line
1790
1876
  var p0 = clone_point(linerect.rect[2]); //point 2(x, y) inside of line
@@ -1819,15 +1905,15 @@ export function getAllCurSnap(allLineRects, x, y, curItemRect) {
1819
1905
  });
1820
1906
  return allCurSnap;
1821
1907
  }
1822
- export function clone_point(pt) {
1908
+ function clone_point(pt) {
1823
1909
  return point(pt.x, pt.y);
1824
1910
  }
1825
- export function dotprod(v0, v1) {
1911
+ function dotprod(v0, v1) {
1826
1912
  return v0.x * v1.x + v0.y * v1.y;
1827
1913
  }
1828
1914
 
1829
1915
  //////////
1830
- export function validInterSect(rect, val) {
1916
+ function validInterSect(rect, val) {
1831
1917
  var curitem = getCalcRectFromItem(val);
1832
1918
  var datas = [];
1833
1919
  rect.forEach(function (line) {
@@ -1857,7 +1943,7 @@ var lineRect = function lineRect(layer) {
1857
1943
  });
1858
1944
  return rect;
1859
1945
  };
1860
- export function getAllHoleRect(scene, val) {
1946
+ function getAllHoleRect(scene, val) {
1861
1947
  var layerID = scene.selectedLayer;
1862
1948
  var layer = scene.layers.get(layerID);
1863
1949
  var selectedItem = layer.getIn(['items', layer.selected.items.get(0)]);
@@ -1901,7 +1987,7 @@ export function getAllHoleRect(scene, val) {
1901
1987
  y: vertice1.y
1902
1988
  };
1903
1989
  var rotation = Math.atan2(point1.y - point0.y, point1.x - point0.x);
1904
- var rectInfo = getCalcRectFromLine(point0.x, point0.y, point1.x, point1.y, LINE_THICKNESS, layer);
1990
+ var rectInfo = getCalcRectFromLine(point0.x, point0.y, point1.x, point1.y, _constants.LINE_THICKNESS, layer);
1905
1991
  var vN = point(rectInfo.rect[0].x - rectInfo.rect[3].x, rectInfo.rect[0].y - rectInfo.rect[3].y);
1906
1992
  var lenN = Math.sqrt(vN.x * vN.x + vN.y * vN.y);
1907
1993
  vN.x /= lenN;
@@ -1923,7 +2009,7 @@ export function getAllHoleRect(scene, val) {
1923
2009
  };
1924
2010
  var hole_rect = getCalcRectFromItem(tval);
1925
2011
  if (intersectRect(itemRect.rect, hole_rect.rect)) {
1926
- if (tdepth > itemRect.size.depth && itemRect.layoutpos !== WALL_CABINET_LAYOUTPOS) {
2012
+ if (tdepth > itemRect.size.depth && itemRect.layoutpos !== _constants.WALL_CABINET_LAYOUTPOS) {
1927
2013
  var dist = itemRect.size.height / 2 + theight / 2;
1928
2014
  var snap = [];
1929
2015
  var p0 = {
@@ -1956,7 +2042,7 @@ export function getAllHoleRect(scene, val) {
1956
2042
  snap: null
1957
2043
  };
1958
2044
  }
1959
- export function getHoleItems(layer) {
2045
+ function getHoleItems(layer) {
1960
2046
  var holeItems = [];
1961
2047
  layer.holes.map(function (hole) {
1962
2048
  var width = hole.properties.getIn(['width', 'length']);
@@ -1970,18 +2056,18 @@ export function getHoleItems(layer) {
1970
2056
  });
1971
2057
  return holeItems;
1972
2058
  }
1973
- export function needSnap(curItem, othItem) {
2059
+ function needSnap(curItem, othItem) {
1974
2060
  var blSnap = false;
1975
2061
  if (curItem == undefined || curItem == null) return false;
1976
2062
  var altitude = curItem.selectedItem.properties.get('altitude');
1977
- var heightFromFloor = convert(altitude.get('_length')).from(altitude.get('_unit')).to('in');
2063
+ var heightFromFloor = (0, _convertUnitsLite.convert)(altitude.get('_length')).from(altitude.get('_unit')).to('in');
1978
2064
  var height = curItem.cat.info.sizeinfo.height;
1979
2065
  var currentItem = {
1980
2066
  heightFromFloor: heightFromFloor,
1981
2067
  height: height
1982
2068
  };
1983
2069
  altitude = othItem.item.properties.get('altitude');
1984
- heightFromFloor = convert(altitude.get('_length')).from(altitude.get('_unit')).to('in');
2070
+ heightFromFloor = (0, _convertUnitsLite.convert)(altitude.get('_length')).from(altitude.get('_unit')).to('in');
1985
2071
  height = othItem.cat && othItem.cat.info.sizeinfo.height;
1986
2072
  var otherItem = {
1987
2073
  heightFromFloor: heightFromFloor,
@@ -1999,7 +2085,7 @@ export function needSnap(curItem, othItem) {
1999
2085
  }
2000
2086
  return blSnap;
2001
2087
  }
2002
- export function isFrontWall(v0, v1) {
2088
+ function isFrontWall(v0, v1) {
2003
2089
  var x1 = v0.x,
2004
2090
  y1 = v0.y;
2005
2091
  var x2 = v1.x,
@@ -2007,7 +2093,7 @@ export function isFrontWall(v0, v1) {
2007
2093
  var alpha = angleBetweenTwoPoints(x1, y1, x2, y2);
2008
2094
  return almostEqual(y1, y2) && x1 < x2 || -Math.PI / 2 < alpha && alpha < Math.PI / 2;
2009
2095
  }
2010
- export function isBackWall(v0, v1) {
2096
+ function isBackWall(v0, v1) {
2011
2097
  var x1 = v0.x,
2012
2098
  y1 = v0.y;
2013
2099
  var x2 = v1.x,
@@ -2015,7 +2101,7 @@ export function isBackWall(v0, v1) {
2015
2101
  var alpha = angleBetweenTwoPoints(x1, y1, x2, y2);
2016
2102
  return almostEqual(y1, y2) && x1 > x2 || -Math.PI / 2 > alpha || alpha > Math.PI / 2;
2017
2103
  }
2018
- export function isLeftWall(v0, v1) {
2104
+ function isLeftWall(v0, v1) {
2019
2105
  var x1 = v0.x,
2020
2106
  y1 = v0.y;
2021
2107
  var x2 = v1.x,
@@ -2023,7 +2109,7 @@ export function isLeftWall(v0, v1) {
2023
2109
  var alpha = angleBetweenTwoPoints(x1, y1, x2, y2);
2024
2110
  return almostEqual(x1, x2) && y1 < y2 || Math.PI > alpha && alpha > 0;
2025
2111
  }
2026
- export function isRightWall(v0, v1) {
2112
+ function isRightWall(v0, v1) {
2027
2113
  var x1 = v0.x,
2028
2114
  y1 = v0.y;
2029
2115
  var x2 = v1.x,
@@ -2042,7 +2128,7 @@ export function isRightWall(v0, v1) {
2042
2128
  * OVERLAP_LINK: two lines are linked at the common point, so they can be merged to one line
2043
2129
  * OVERLAP_INCLUDED: destLine includes srcLine
2044
2130
  * OVERLAP_SOME: two lines are overlapped with some common range, then returns the trimmed segments of srcLine
2045
- *
2131
+ *
2046
2132
  * //////// test - start /////////////
2047
2133
  const p1 = { x1: 1413.1313131313132, y1: 1044.949494949495 };
2048
2134
  const p2 = { x1: 1476.2626262626263, y1: 1108.0808080808079 };
@@ -2056,7 +2142,7 @@ export function isRightWall(v0, v1) {
2056
2142
  //////// test - end /////////////
2057
2143
 
2058
2144
  */
2059
- export function relationshipOfTwoOverlappedLines(srcLine, destLine) {
2145
+ function relationshipOfTwoOverlappedLines(srcLine, destLine) {
2060
2146
  // let res1 = relationshipOfTwoOverlappedLines1(srcLine, destLine);
2061
2147
  var res2 = relationshipOfTwoOverlappedLines2(srcLine, destLine);
2062
2148
  // if (res1.result !== 0 || res2.result !== 0) {
@@ -2068,7 +2154,7 @@ export function relationshipOfTwoOverlappedLines(srcLine, destLine) {
2068
2154
  // }
2069
2155
  return res2;
2070
2156
  }
2071
- export function relationshipOfTwoOverlappedLines2(srcLine, destLine) {
2157
+ function relationshipOfTwoOverlappedLines2(srcLine, destLine) {
2072
2158
  var p1 = {
2073
2159
  x: srcLine.x1,
2074
2160
  y: srcLine.y1
@@ -2096,10 +2182,10 @@ export function relationshipOfTwoOverlappedLines2(srcLine, destLine) {
2096
2182
  var denom = (y4 - y3) * (x2 - x1) - (x4 - x3) * (y2 - y1);
2097
2183
  var numA = (x4 - x3) * (y1 - y3) - (y4 - y3) * (x1 - x3);
2098
2184
  var numB = (x2 - x1) * (y1 - y3) - (y2 - y1) * (x1 - x3);
2099
- if (fAbs(denom) <= EPSILON) {
2100
- if (fAbs(numA) <= EPSILON && fAbs(numB) <= EPSILON) {
2185
+ if ((0, _math.fAbs)(denom) <= _constants.EPSILON) {
2186
+ if ((0, _math.fAbs)(numA) <= _constants.EPSILON && (0, _math.fAbs)(numB) <= _constants.EPSILON) {
2101
2187
  var comparator = function comparator(pa, pb) {
2102
- return fAbs(pa.x - pb.x) <= EPSILON ? pa.y - pb.y : pa.x - pb.x;
2188
+ return (0, _math.fAbs)(pa.x - pb.x) <= _constants.EPSILON ? pa.y - pb.y : pa.x - pb.x;
2103
2189
  };
2104
2190
  var line0 = [p1, p2].sort(comparator);
2105
2191
  var line1 = [p3, p4].sort(comparator);
@@ -2108,7 +2194,7 @@ export function relationshipOfTwoOverlappedLines2(srcLine, destLine) {
2108
2194
  var _sort3 = [line0, line1].sort(function (lineA, lineB) {
2109
2195
  return comparator(lineA[0], lineB[0]);
2110
2196
  }),
2111
- _sort4 = _slicedToArray(_sort3, 2),
2197
+ _sort4 = (0, _slicedToArray2["default"])(_sort3, 2),
2112
2198
  lineSX = _sort4[0],
2113
2199
  lineDX = _sort4[1];
2114
2200
  var isReversedSrcLineIdx = false;
@@ -2116,17 +2202,17 @@ export function relationshipOfTwoOverlappedLines2(srcLine, destLine) {
2116
2202
  var compare0 = comparator(lineSX[0], lineDX[0]);
2117
2203
  var compare1 = comparator(lineSX[1], lineDX[0]);
2118
2204
  var compare2 = comparator(lineSX[1], lineDX[1]);
2119
- if (MathUtils.fAbs(compare0) < EPSILON && MathUtils.fAbs(compare2) < EPSILON) {
2205
+ if (_export.MathUtils.fAbs(compare0) < _constants.EPSILON && _export.MathUtils.fAbs(compare2) < _constants.EPSILON) {
2120
2206
  return {
2121
- result: OVERLAP_SAME
2207
+ result: _constants.OVERLAP_SAME
2122
2208
  };
2123
- } else if (MathUtils.fAbs(compare0) < EPSILON && compare2 < 0) {
2209
+ } else if (_export.MathUtils.fAbs(compare0) < _constants.EPSILON && compare2 < 0) {
2124
2210
  // lineDX includes lineSX
2125
2211
  if (!isReversedSrcLineIdx) {
2126
2212
  // dest === lineDX : dest includes src
2127
2213
  // return OVERLAP_INCLUDED; // lineSX[1] - lineDX[1]
2128
2214
  return {
2129
- result: OVERLAP_INCLUDED
2215
+ result: _constants.OVERLAP_INCLUDED
2130
2216
  };
2131
2217
  }
2132
2218
  // else {
@@ -2143,10 +2229,10 @@ export function relationshipOfTwoOverlappedLines2(srcLine, destLine) {
2143
2229
  // };
2144
2230
  // }
2145
2231
  }
2146
- if (MathUtils.fAbs(compare1) < EPSILON) {
2232
+ if (_export.MathUtils.fAbs(compare1) < _constants.EPSILON) {
2147
2233
  // return OVERLAP_LINK; // lineSX[1]
2148
2234
  return {
2149
- result: OVERLAP_LINK,
2235
+ result: _constants.OVERLAP_LINK,
2150
2236
  linkedLine: {
2151
2237
  x1: isReversedSrcLineDirection ? lineDX[1].x : lineSX[0].x,
2152
2238
  y1: isReversedSrcLineDirection ? lineDX[1].y : lineSX[0].y,
@@ -2156,16 +2242,16 @@ export function relationshipOfTwoOverlappedLines2(srcLine, destLine) {
2156
2242
  };
2157
2243
  } else if (compare1 < 0) {
2158
2244
  return {
2159
- result: OVERLAP_NONE
2245
+ result: _constants.OVERLAP_NONE
2160
2246
  };
2161
2247
  } else {
2162
- if (MathUtils.fAbs(compare2) < EPSILON || compare2 > 0) {
2248
+ if (_export.MathUtils.fAbs(compare2) < _constants.EPSILON || compare2 > 0) {
2163
2249
  // lineSX includes lineDX
2164
2250
  if (isReversedSrcLineIdx) {
2165
2251
  // dest === lineSX : dest includes src
2166
2252
  // return OVERLAP_INCLUDED; // lineDX[0] - lineDX[1]
2167
2253
  return {
2168
- result: OVERLAP_INCLUDED
2254
+ result: _constants.OVERLAP_INCLUDED
2169
2255
  };
2170
2256
  } else {
2171
2257
  // dest === lineDX : src includes dest
@@ -2184,7 +2270,7 @@ export function relationshipOfTwoOverlappedLines2(srcLine, destLine) {
2184
2270
  y2: isReversedSrcLineDirection ? lineDX[1].y : lineSX[1].y
2185
2271
  });
2186
2272
  return {
2187
- result: OVERLAP_SOME,
2273
+ result: _constants.OVERLAP_SOME,
2188
2274
  trimmedSegs: trimmedSegs
2189
2275
  };
2190
2276
  }
@@ -2205,7 +2291,7 @@ export function relationshipOfTwoOverlappedLines2(srcLine, destLine) {
2205
2291
  y2: isReversedSrcLineDirection ? lineSX[1].y : lineDX[1].y
2206
2292
  });
2207
2293
  return {
2208
- result: OVERLAP_SOME,
2294
+ result: _constants.OVERLAP_SOME,
2209
2295
  trimmedSegs: _trimmedSegs
2210
2296
  };
2211
2297
  }
@@ -2213,46 +2299,46 @@ export function relationshipOfTwoOverlappedLines2(srcLine, destLine) {
2213
2299
  }
2214
2300
  }
2215
2301
  return {
2216
- result: OVERLAP_NONE
2302
+ result: _constants.OVERLAP_NONE
2217
2303
  };
2218
2304
  }
2219
- export function relationshipOfTwoOverlappedLines1(srcLine, destLine) {
2305
+ function relationshipOfTwoOverlappedLines1(srcLine, destLine) {
2220
2306
  var INFINITY = 1000000;
2221
2307
  var ZERO_DELTA = 0.01;
2222
2308
  // geometric equation of srcLine
2223
2309
  var dx1 = srcLine.x2 - srcLine.x1;
2224
- dx1 = MathUtils.fAbs(dx1) < ZERO_DELTA ? 0 : dx1;
2310
+ dx1 = _export.MathUtils.fAbs(dx1) < ZERO_DELTA ? 0 : dx1;
2225
2311
  var dy1 = srcLine.y2 - srcLine.y1;
2226
- dy1 = MathUtils.fAbs(dy1) < ZERO_DELTA ? 0 : dy1;
2312
+ dy1 = _export.MathUtils.fAbs(dy1) < ZERO_DELTA ? 0 : dy1;
2227
2313
  var a1 = dx1 === 0 ? INFINITY : dy1 / dx1;
2228
2314
  var b1 = a1 === INFINITY ? srcLine.x1 : srcLine.y1 - a1 * srcLine.x1;
2229
2315
  // geometric equation of destLine
2230
2316
  var dx2 = destLine.x2 - destLine.x1;
2231
- dx2 = MathUtils.fAbs(dx2) < ZERO_DELTA ? 0 : dx2;
2317
+ dx2 = _export.MathUtils.fAbs(dx2) < ZERO_DELTA ? 0 : dx2;
2232
2318
  var dy2 = destLine.y2 - destLine.y1;
2233
- dy2 = MathUtils.fAbs(dy2) < ZERO_DELTA ? 0 : dy2;
2319
+ dy2 = _export.MathUtils.fAbs(dy2) < ZERO_DELTA ? 0 : dy2;
2234
2320
  var a2 = dx2 === 0 ? INFINITY : dy2 / dx2;
2235
2321
  var b2 = a2 === INFINITY ? destLine.x1 : destLine.y1 - a2 * destLine.x1;
2236
- if (MathUtils.fAbs(MathUtils.fAbs(a1) - MathUtils.fAbs(a2)) > ZERO_DELTA)
2322
+ if (_export.MathUtils.fAbs(_export.MathUtils.fAbs(a1) - _export.MathUtils.fAbs(a2)) > ZERO_DELTA)
2237
2323
  // two lines are not parallel
2238
2324
  return {
2239
- result: OVERLAP_NONE
2325
+ result: _constants.OVERLAP_NONE
2240
2326
  };
2241
- if (MathUtils.fAbs(MathUtils.fAbs(b1) - MathUtils.fAbs(b2)) > ZERO_DELTA)
2327
+ if (_export.MathUtils.fAbs(_export.MathUtils.fAbs(b1) - _export.MathUtils.fAbs(b2)) > ZERO_DELTA)
2242
2328
  // two lines are parallel but not overlap
2243
2329
  return {
2244
- result: OVERLAP_NONE
2330
+ result: _constants.OVERLAP_NONE
2245
2331
  };
2246
2332
 
2247
2333
  // parametric equation of destLine
2248
- var sk1 = dx1 === 0 ? INFINITY : MathUtils.toFixedFloat((destLine.x1 - srcLine.x1) / dx1, 3);
2249
- var sk2 = dy1 === 0 ? INFINITY : MathUtils.toFixedFloat((destLine.y1 - srcLine.y1) / dy1, 3);
2250
- var ek1 = dx1 === 0 ? INFINITY : MathUtils.toFixedFloat((destLine.x2 - srcLine.x1) / dx1, 3);
2251
- var ek2 = dy1 === 0 ? INFINITY : MathUtils.toFixedFloat((destLine.y2 - srcLine.y1) / dy1, 3);
2334
+ var sk1 = dx1 === 0 ? INFINITY : _export.MathUtils.toFixedFloat((destLine.x1 - srcLine.x1) / dx1, 3);
2335
+ var sk2 = dy1 === 0 ? INFINITY : _export.MathUtils.toFixedFloat((destLine.y1 - srcLine.y1) / dy1, 3);
2336
+ var ek1 = dx1 === 0 ? INFINITY : _export.MathUtils.toFixedFloat((destLine.x2 - srcLine.x1) / dx1, 3);
2337
+ var ek2 = dy1 === 0 ? INFINITY : _export.MathUtils.toFixedFloat((destLine.y2 - srcLine.y1) / dy1, 3);
2252
2338
  if (sk1 !== INFINITY && sk2 !== INFINITY && ek1 !== INFINITY && ek2 !== INFINITY && (sk1 !== sk2 || ek1 !== ek2))
2253
2339
  // destLine does not overlap with srcLine
2254
2340
  return {
2255
- result: OVERLAP_NONE
2341
+ result: _constants.OVERLAP_NONE
2256
2342
  };
2257
2343
 
2258
2344
  // parameter of destLine on the start and end points
@@ -2266,17 +2352,17 @@ export function relationshipOfTwoOverlappedLines1(srcLine, destLine) {
2266
2352
  if (sk < 0 && ek < 0 || sk > 1 && ek > 1)
2267
2353
  // not overlap
2268
2354
  return {
2269
- result: OVERLAP_NONE
2355
+ result: _constants.OVERLAP_NONE
2270
2356
  };
2271
2357
  if (sk === 0 && ek === 1 || sk === 1 && ek === 0)
2272
2358
  // same lines
2273
2359
  return {
2274
- result: OVERLAP_SAME
2360
+ result: _constants.OVERLAP_SAME
2275
2361
  };
2276
2362
  if (sk <= 0 && ek >= 1 || sk >= 1 && ek <= 0)
2277
2363
  // destLine includes srcLine
2278
2364
  return {
2279
- result: OVERLAP_INCLUDED
2365
+ result: _constants.OVERLAP_INCLUDED
2280
2366
  };
2281
2367
  if (sk === 0 && ek < 0 || sk === 1 && ek > 1 || ek === 0 && sk < 0 || ek === 1 && sk > 1) {
2282
2368
  // linked with one common point
@@ -2319,14 +2405,14 @@ export function relationshipOfTwoOverlappedLines1(srcLine, destLine) {
2319
2405
  };
2320
2406
  }
2321
2407
  return {
2322
- result: OVERLAP_LINK,
2408
+ result: _constants.OVERLAP_LINK,
2323
2409
  linkedLine: linkedLine
2324
2410
  };
2325
2411
  }
2326
2412
  var trimmedSegment1 = null;
2327
2413
  var trimmedSegment2 = null;
2328
2414
  var ret = {
2329
- result: OVERLAP_SOME,
2415
+ result: _constants.OVERLAP_SOME,
2330
2416
  trimmedSegs: []
2331
2417
  };
2332
2418
  if (0 <= sk && sk <= 1 && 0 <= ek && ek <= 1) {
@@ -2412,7 +2498,7 @@ export function relationshipOfTwoOverlappedLines1(srcLine, destLine) {
2412
2498
  * @param {Array} points //points of polygon
2413
2499
  * @returns {Array} [centroid.x, centroid.y]
2414
2500
  */
2415
- export function getCentroidOfPolygon(points) {
2501
+ function getCentroidOfPolygon(points) {
2416
2502
  var center = points.reduce(function (x, y) {
2417
2503
  return [x[0] + y[0] / points.length, x[1] + y[1] / points.length];
2418
2504
  }, [0, 0]);