kitchen-simulator 5.0.0-test.4 → 5.0.0-test.6

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 (751) hide show
  1. package/package.json +23 -41
  2. package/es/@history.js +0 -3
  3. package/es/@history.js.map +0 -1
  4. package/es/AppContext.js +0 -4
  5. package/es/AppContext.js.map +0 -1
  6. package/es/KitchenConfigurator.js +0 -1345
  7. package/es/KitchenConfigurator.js.map +0 -1
  8. package/es/KitchenConfiguratorApp.js +0 -532
  9. package/es/KitchenConfiguratorApp.js.map +0 -1
  10. package/es/actions/area-actions.js +0 -15
  11. package/es/actions/area-actions.js.map +0 -1
  12. package/es/actions/export.js +0 -26
  13. package/es/actions/export.js.map +0 -1
  14. package/es/actions/groups-actions.js +0 -90
  15. package/es/actions/groups-actions.js.map +0 -1
  16. package/es/actions/holes-actions.js +0 -120
  17. package/es/actions/holes-actions.js.map +0 -1
  18. package/es/actions/items-actions.js +0 -314
  19. package/es/actions/items-actions.js.map +0 -1
  20. package/es/actions/lines-actions.js +0 -83
  21. package/es/actions/lines-actions.js.map +0 -1
  22. package/es/actions/project-actions.js +0 -282
  23. package/es/actions/project-actions.js.map +0 -1
  24. package/es/actions/scene-actions.js +0 -34
  25. package/es/actions/scene-actions.js.map +0 -1
  26. package/es/actions/user-actions.js +0 -59
  27. package/es/actions/user-actions.js.map +0 -1
  28. package/es/actions/vertices-actions.js +0 -28
  29. package/es/actions/vertices-actions.js.map +0 -1
  30. package/es/actions/viewer2d-actions.js +0 -59
  31. package/es/actions/viewer2d-actions.js.map +0 -1
  32. package/es/actions/viewer3d-actions.js +0 -24
  33. package/es/actions/viewer3d-actions.js.map +0 -1
  34. package/es/catalog/areas/area/planner-element.js +0 -41
  35. package/es/catalog/areas/area/planner-element.js.map +0 -1
  36. package/es/catalog/areas/area/textures/ceramic-tile.jpg +0 -0
  37. package/es/catalog/areas/area/textures/grass.jpg +0 -0
  38. package/es/catalog/areas/area/textures/parquet.jpg +0 -0
  39. package/es/catalog/areas/area/textures/strand-porcelain.jpg +0 -0
  40. package/es/catalog/areas/area/textures/tile1.jpg +0 -0
  41. package/es/catalog/back.png +0 -0
  42. package/es/catalog/catalog.js +0 -278
  43. package/es/catalog/catalog.js.map +0 -1
  44. package/es/catalog/doors.png +0 -0
  45. package/es/catalog/doorways.png +0 -0
  46. package/es/catalog/envMap/nx.hdr +0 -0
  47. package/es/catalog/envMap/ny.hdr +0 -0
  48. package/es/catalog/envMap/nz.hdr +0 -0
  49. package/es/catalog/envMap/px.hdr +0 -0
  50. package/es/catalog/envMap/py.hdr +0 -0
  51. package/es/catalog/envMap/pz.hdr +0 -0
  52. package/es/catalog/factories/area-factory-3d.js +0 -183
  53. package/es/catalog/factories/area-factory-3d.js.map +0 -1
  54. package/es/catalog/factories/area-factory.js +0 -82
  55. package/es/catalog/factories/area-factory.js.map +0 -1
  56. package/es/catalog/factories/export.js +0 -8
  57. package/es/catalog/factories/export.js.map +0 -1
  58. package/es/catalog/factories/wall-factory-3d.js +0 -203
  59. package/es/catalog/factories/wall-factory-3d.js.map +0 -1
  60. package/es/catalog/factories/wall-factory.js +0 -269
  61. package/es/catalog/factories/wall-factory.js.map +0 -1
  62. package/es/catalog/holes/door-closet/planner-element.js +0 -223
  63. package/es/catalog/holes/door-closet/planner-element.js.map +0 -1
  64. package/es/catalog/holes/door-double/door_double.png +0 -0
  65. package/es/catalog/holes/door-double/planner-element.js +0 -316
  66. package/es/catalog/holes/door-double/planner-element.js.map +0 -1
  67. package/es/catalog/holes/door-exterior/planner-element.js +0 -216
  68. package/es/catalog/holes/door-exterior/planner-element.js.map +0 -1
  69. package/es/catalog/holes/door-interior/planner-element.js +0 -228
  70. package/es/catalog/holes/door-interior/planner-element.js.map +0 -1
  71. package/es/catalog/holes/door-panic/panicDoor.png +0 -0
  72. package/es/catalog/holes/door-panic/planner-element.js +0 -504
  73. package/es/catalog/holes/door-panic/planner-element.js.map +0 -1
  74. package/es/catalog/holes/door-panic-double/panicDoorDouble.png +0 -0
  75. package/es/catalog/holes/door-panic-double/planner-element.js +0 -464
  76. package/es/catalog/holes/door-panic-double/planner-element.js.map +0 -1
  77. package/es/catalog/holes/door-sliding/planner-element.js +0 -226
  78. package/es/catalog/holes/door-sliding/planner-element.js.map +0 -1
  79. package/es/catalog/holes/doorway-framed/planner-element.js +0 -146
  80. package/es/catalog/holes/doorway-framed/planner-element.js.map +0 -1
  81. package/es/catalog/holes/doorway-frameless/planner-element.js +0 -105
  82. package/es/catalog/holes/doorway-frameless/planner-element.js.map +0 -1
  83. package/es/catalog/holes/gate/gate.jpg +0 -0
  84. package/es/catalog/holes/window-clear/planner-element.js +0 -167
  85. package/es/catalog/holes/window-clear/planner-element.js.map +0 -1
  86. package/es/catalog/holes/window-clear/texture.png +0 -0
  87. package/es/catalog/holes/window-cross/planner-element.js +0 -166
  88. package/es/catalog/holes/window-cross/planner-element.js.map +0 -1
  89. package/es/catalog/holes/window-cross/texture.png +0 -0
  90. package/es/catalog/holes/window-double-hung/planner-element.js +0 -304
  91. package/es/catalog/holes/window-double-hung/planner-element.js.map +0 -1
  92. package/es/catalog/holes/window-double-hung/texture.png +0 -0
  93. package/es/catalog/holes/window-vertical/planner-element.js +0 -277
  94. package/es/catalog/holes/window-vertical/planner-element.js.map +0 -1
  95. package/es/catalog/holes/window-vertical/texture.png +0 -0
  96. package/es/catalog/lines/wall/planner-element.js +0 -71
  97. package/es/catalog/lines/wall/planner-element.js.map +0 -1
  98. package/es/catalog/lines/wall/textures/bricks-normal.jpg +0 -0
  99. package/es/catalog/lines/wall/textures/bricks-normal2.jpg +0 -0
  100. package/es/catalog/lines/wall/textures/bricks.jpg +0 -0
  101. package/es/catalog/lines/wall/textures/bricks2.jpg +0 -0
  102. package/es/catalog/lines/wall/textures/bricks3.jpg +0 -0
  103. package/es/catalog/lines/wall/textures/morden-normal.jpg +0 -0
  104. package/es/catalog/lines/wall/textures/morden.jpg +0 -0
  105. package/es/catalog/lines/wall/textures/painted-normal.jpg +0 -0
  106. package/es/catalog/lines/wall/textures/painted.jpg +0 -0
  107. package/es/catalog/lines/wall/textures/plaster-normal.jpg +0 -0
  108. package/es/catalog/lines/wall/textures/plaster.jpg +0 -0
  109. package/es/catalog/lines/wall/wall.png +0 -0
  110. package/es/catalog/molding/molding-dcm/planner-element.js +0 -30
  111. package/es/catalog/molding/molding-dcm/planner-element.js.map +0 -1
  112. package/es/catalog/molding/molding-dcm/texture.png +0 -0
  113. package/es/catalog/molding/molding-fbm/planner-element.js +0 -30
  114. package/es/catalog/molding/molding-fbm/planner-element.js.map +0 -1
  115. package/es/catalog/molding/molding-fbm/texture.png +0 -0
  116. package/es/catalog/molding/molding-lrm/planner-element.js +0 -30
  117. package/es/catalog/molding/molding-lrm/planner-element.js.map +0 -1
  118. package/es/catalog/molding/molding-lrm/texture.png +0 -0
  119. package/es/catalog/properties/export.js +0 -22
  120. package/es/catalog/properties/export.js.map +0 -1
  121. package/es/catalog/properties/property-checkbox.js +0 -72
  122. package/es/catalog/properties/property-checkbox.js.map +0 -1
  123. package/es/catalog/properties/property-color.js +0 -40
  124. package/es/catalog/properties/property-color.js.map +0 -1
  125. package/es/catalog/properties/property-enum.js +0 -56
  126. package/es/catalog/properties/property-enum.js.map +0 -1
  127. package/es/catalog/properties/property-hidden.js +0 -20
  128. package/es/catalog/properties/property-hidden.js.map +0 -1
  129. package/es/catalog/properties/property-lenght-measure.js +0 -102
  130. package/es/catalog/properties/property-lenght-measure.js.map +0 -1
  131. package/es/catalog/properties/property-length-measure.js +0 -86
  132. package/es/catalog/properties/property-length-measure.js.map +0 -1
  133. package/es/catalog/properties/property-length-measure_hole.js +0 -102
  134. package/es/catalog/properties/property-length-measure_hole.js.map +0 -1
  135. package/es/catalog/properties/property-number.js +0 -49
  136. package/es/catalog/properties/property-number.js.map +0 -1
  137. package/es/catalog/properties/property-read-only.js +0 -27
  138. package/es/catalog/properties/property-read-only.js.map +0 -1
  139. package/es/catalog/properties/property-string.js +0 -49
  140. package/es/catalog/properties/property-string.js.map +0 -1
  141. package/es/catalog/properties/property-toggle.js +0 -40
  142. package/es/catalog/properties/property-toggle.js.map +0 -1
  143. package/es/catalog/properties/shared-property-style.js +0 -15
  144. package/es/catalog/properties/shared-property-style.js.map +0 -1
  145. package/es/catalog/utils/FuseUtils.js +0 -83
  146. package/es/catalog/utils/FuseUtils.js.map +0 -1
  147. package/es/catalog/utils/exporter.js +0 -149
  148. package/es/catalog/utils/exporter.js.map +0 -1
  149. package/es/catalog/utils/geom-utils.js +0 -190
  150. package/es/catalog/utils/geom-utils.js.map +0 -1
  151. package/es/catalog/utils/item-loader.js +0 -1522
  152. package/es/catalog/utils/item-loader.js.map +0 -1
  153. package/es/catalog/utils/load-obj.js +0 -92
  154. package/es/catalog/utils/load-obj.js.map +0 -1
  155. package/es/catalog/utils/mtl-loader.js +0 -358
  156. package/es/catalog/utils/mtl-loader.js.map +0 -1
  157. package/es/catalog/utils/obj-loader.js +0 -477
  158. package/es/catalog/utils/obj-loader.js.map +0 -1
  159. package/es/catalog/windows.png +0 -0
  160. package/es/class/FuseUtils.js +0 -83
  161. package/es/class/FuseUtils.js.map +0 -1
  162. package/es/class/area.js +0 -146
  163. package/es/class/area.js.map +0 -1
  164. package/es/class/export.js +0 -25
  165. package/es/class/export.js.map +0 -1
  166. package/es/class/group.js +0 -441
  167. package/es/class/group.js.map +0 -1
  168. package/es/class/guide.js +0 -63
  169. package/es/class/guide.js.map +0 -1
  170. package/es/class/hole.js +0 -931
  171. package/es/class/hole.js.map +0 -1
  172. package/es/class/item.js +0 -1888
  173. package/es/class/item.js.map +0 -1
  174. package/es/class/layer.js +0 -668
  175. package/es/class/layer.js.map +0 -1
  176. package/es/class/line.js +0 -1290
  177. package/es/class/line.js.map +0 -1
  178. package/es/class/project.js +0 -823
  179. package/es/class/project.js.map +0 -1
  180. package/es/class/vertex.js +0 -267
  181. package/es/class/vertex.js.map +0 -1
  182. package/es/components/atoms/Snackbar/index.js +0 -50
  183. package/es/components/atoms/Snackbar/index.js.map +0 -1
  184. package/es/components/atoms/radio-button/index.js +0 -26
  185. package/es/components/atoms/radio-button/index.js.map +0 -1
  186. package/es/components/atoms/radio-button/styles.js +0 -5
  187. package/es/components/atoms/radio-button/styles.js.map +0 -1
  188. package/es/components/button/MainButton.js +0 -92
  189. package/es/components/button/MainButton.js.map +0 -1
  190. package/es/components/button/ToggleMeasureButton.js +0 -56
  191. package/es/components/button/ToggleMeasureButton.js.map +0 -1
  192. package/es/components/catalog-view/catalog-breadcrumb.js +0 -53
  193. package/es/components/catalog-view/catalog-breadcrumb.js.map +0 -1
  194. package/es/components/catalog-view/catalog-item.js +0 -226
  195. package/es/components/catalog-view/catalog-item.js.map +0 -1
  196. package/es/components/catalog-view/catalog-list.js +0 -182
  197. package/es/components/catalog-view/catalog-list.js.map +0 -1
  198. package/es/components/catalog-view/catalog-page-item.js +0 -130
  199. package/es/components/catalog-view/catalog-page-item.js.map +0 -1
  200. package/es/components/catalog-view/catalog-turn-back-page-item.js +0 -106
  201. package/es/components/catalog-view/catalog-turn-back-page-item.js.map +0 -1
  202. package/es/components/configurator/custom-configurator.js +0 -94
  203. package/es/components/configurator/custom-configurator.js.map +0 -1
  204. package/es/components/configurator/project-configurator.js +0 -131
  205. package/es/components/configurator/project-configurator.js.map +0 -1
  206. package/es/components/content.js +0 -123
  207. package/es/components/content.js.map +0 -1
  208. package/es/components/export.js +0 -24
  209. package/es/components/export.js.map +0 -1
  210. package/es/components/firstsetting/button/styles.js +0 -27
  211. package/es/components/firstsetting/button/styles.js.map +0 -1
  212. package/es/components/firstsetting/export.js +0 -9
  213. package/es/components/firstsetting/export.js.map +0 -1
  214. package/es/components/firstsetting/firstsetting-content-button.js +0 -217
  215. package/es/components/firstsetting/firstsetting-content-button.js.map +0 -1
  216. package/es/components/firstsetting/firstsetting-toggle-button.js +0 -126
  217. package/es/components/firstsetting/firstsetting-toggle-button.js.map +0 -1
  218. package/es/components/firstsetting/firstsetting.js +0 -626
  219. package/es/components/firstsetting/firstsetting.js.map +0 -1
  220. package/es/components/footerbar/button/ControlButton.js +0 -72
  221. package/es/components/footerbar/button/ControlButton.js.map +0 -1
  222. package/es/components/footerbar/button/DirectionButton.js +0 -69
  223. package/es/components/footerbar/button/DirectionButton.js.map +0 -1
  224. package/es/components/footerbar/button/DirectionPanSpinButton.js +0 -50
  225. package/es/components/footerbar/button/DirectionPanSpinButton.js.map +0 -1
  226. package/es/components/footerbar/button/ToggleButton.js +0 -76
  227. package/es/components/footerbar/button/ToggleButton.js.map +0 -1
  228. package/es/components/footerbar/button/ToggleConvertButton.js +0 -73
  229. package/es/components/footerbar/button/ToggleConvertButton.js.map +0 -1
  230. package/es/components/footerbar/button/ToggleMeasureButton.js +0 -52
  231. package/es/components/footerbar/button/ToggleMeasureButton.js.map +0 -1
  232. package/es/components/footerbar/button/styles.js +0 -22
  233. package/es/components/footerbar/button/styles.js.map +0 -1
  234. package/es/components/footerbar/export.js +0 -9
  235. package/es/components/footerbar/export.js.map +0 -1
  236. package/es/components/footerbar/footer-content-button.js +0 -217
  237. package/es/components/footerbar/footer-content-button.js.map +0 -1
  238. package/es/components/footerbar/footer-toggle-button.js +0 -126
  239. package/es/components/footerbar/footer-toggle-button.js.map +0 -1
  240. package/es/components/footerbar/footerbar.js +0 -801
  241. package/es/components/footerbar/footerbar.js.map +0 -1
  242. package/es/components/footerbar/styles.js +0 -34
  243. package/es/components/footerbar/styles.js.map +0 -1
  244. package/es/components/header/button/MenuButton.js +0 -70
  245. package/es/components/header/button/MenuButton.js.map +0 -1
  246. package/es/components/header/button/SaveButton.js +0 -48
  247. package/es/components/header/button/SaveButton.js.map +0 -1
  248. package/es/components/header/button/styles.js +0 -59
  249. package/es/components/header/button/styles.js.map +0 -1
  250. package/es/components/header/export.js +0 -5
  251. package/es/components/header/export.js.map +0 -1
  252. package/es/components/header/header.js +0 -550
  253. package/es/components/header/header.js.map +0 -1
  254. package/es/components/header/header.style.css +0 -47
  255. package/es/components/header/styles.js +0 -41
  256. package/es/components/header/styles.js.map +0 -1
  257. package/es/components/login/Login.js +0 -86
  258. package/es/components/login/Login.js.map +0 -1
  259. package/es/components/login/LoginForm/index.js +0 -132
  260. package/es/components/login/LoginForm/index.js.map +0 -1
  261. package/es/components/login/Register.js +0 -96
  262. package/es/components/login/Register.js.map +0 -1
  263. package/es/components/login/RegisterForm/index.js +0 -230
  264. package/es/components/login/RegisterForm/index.js.map +0 -1
  265. package/es/components/login/jwtService.js +0 -232
  266. package/es/components/login/jwtService.js.map +0 -1
  267. package/es/components/login/style.css +0 -158
  268. package/es/components/login/style.scss +0 -260
  269. package/es/components/molecules/slider/index.js +0 -13
  270. package/es/components/molecules/slider/index.js.map +0 -1
  271. package/es/components/molecules/slider/styles.js +0 -2
  272. package/es/components/molecules/slider/styles.js.map +0 -1
  273. package/es/components/molecules/slider/styles.scss +0 -3
  274. package/es/components/myprojects/export.js +0 -5
  275. package/es/components/myprojects/export.js.map +0 -1
  276. package/es/components/myprojects/index.js +0 -446
  277. package/es/components/myprojects/index.js.map +0 -1
  278. package/es/components/myprojects/styles.js +0 -24
  279. package/es/components/myprojects/styles.js.map +0 -1
  280. package/es/components/sidebar/custom-accordion.js +0 -38
  281. package/es/components/sidebar/custom-accordion.js.map +0 -1
  282. package/es/components/sidebar/export.js +0 -14
  283. package/es/components/sidebar/export.js.map +0 -1
  284. package/es/components/sidebar/panel-element-editor/attributes-editor/attributes-editor.js +0 -65
  285. package/es/components/sidebar/panel-element-editor/attributes-editor/attributes-editor.js.map +0 -1
  286. package/es/components/sidebar/panel-element-editor/attributes-editor/confirm-popup.js +0 -116
  287. package/es/components/sidebar/panel-element-editor/attributes-editor/confirm-popup.js.map +0 -1
  288. package/es/components/sidebar/panel-element-editor/attributes-editor/hole-attributes-editor.js +0 -126
  289. package/es/components/sidebar/panel-element-editor/attributes-editor/hole-attributes-editor.js.map +0 -1
  290. package/es/components/sidebar/panel-element-editor/attributes-editor/item-attributes-editor.js +0 -251
  291. package/es/components/sidebar/panel-element-editor/attributes-editor/item-attributes-editor.js.map +0 -1
  292. package/es/components/sidebar/panel-element-editor/attributes-editor/line-attributes-editor.js +0 -75
  293. package/es/components/sidebar/panel-element-editor/attributes-editor/line-attributes-editor.js.map +0 -1
  294. package/es/components/sidebar/panel-element-editor/element-editor.js +0 -878
  295. package/es/components/sidebar/panel-element-editor/element-editor.js.map +0 -1
  296. package/es/components/sidebar/panel-element-editor/multi-elements-editor.js +0 -2
  297. package/es/components/sidebar/panel-element-editor/multi-elements-editor.js.map +0 -1
  298. package/es/components/sidebar/panel-element-editor/panel-element-editor.js +0 -49
  299. package/es/components/sidebar/panel-element-editor/panel-element-editor.js.map +0 -1
  300. package/es/components/sidebar/panel-element-editor/panel-multi-elements-editor.js +0 -118
  301. package/es/components/sidebar/panel-element-editor/panel-multi-elements-editor.js.map +0 -1
  302. package/es/components/sidebar/panel-group-editor.js +0 -211
  303. package/es/components/sidebar/panel-group-editor.js.map +0 -1
  304. package/es/components/sidebar/panel-groups.js +0 -267
  305. package/es/components/sidebar/panel-groups.js.map +0 -1
  306. package/es/components/sidebar/panel-guides.js +0 -185
  307. package/es/components/sidebar/panel-guides.js.map +0 -1
  308. package/es/components/sidebar/panel-layer-elements.js +0 -251
  309. package/es/components/sidebar/panel-layer-elements.js.map +0 -1
  310. package/es/components/sidebar/panel-layers.js +0 -340
  311. package/es/components/sidebar/panel-layers.js.map +0 -1
  312. package/es/components/sidebar/panel.js +0 -103
  313. package/es/components/sidebar/panel.js.map +0 -1
  314. package/es/components/sidebar/sidebar.js +0 -109
  315. package/es/components/sidebar/sidebar.js.map +0 -1
  316. package/es/components/sidebar/toolbar-panel.js +0 -164
  317. package/es/components/sidebar/toolbar-panel.js.map +0 -1
  318. package/es/components/sign/export.js +0 -6
  319. package/es/components/sign/export.js.map +0 -1
  320. package/es/components/sign/main/index.js +0 -560
  321. package/es/components/sign/main/index.js.map +0 -1
  322. package/es/components/sign/main/styles.js +0 -20
  323. package/es/components/sign/main/styles.js.map +0 -1
  324. package/es/components/style/button.js +0 -114
  325. package/es/components/style/button.js.map +0 -1
  326. package/es/components/style/cancel-button.js +0 -23
  327. package/es/components/style/cancel-button.js.map +0 -1
  328. package/es/components/style/content-container.js +0 -34
  329. package/es/components/style/content-container.js.map +0 -1
  330. package/es/components/style/content-title.js +0 -30
  331. package/es/components/style/content-title.js.map +0 -1
  332. package/es/components/style/delete-button.js +0 -26
  333. package/es/components/style/delete-button.js.map +0 -1
  334. package/es/components/style/export.js +0 -32
  335. package/es/components/style/export.js.map +0 -1
  336. package/es/components/style/form-block.js +0 -25
  337. package/es/components/style/form-block.js.map +0 -1
  338. package/es/components/style/form-color-input.js +0 -28
  339. package/es/components/style/form-color-input.js.map +0 -1
  340. package/es/components/style/form-label.js +0 -27
  341. package/es/components/style/form-label.js.map +0 -1
  342. package/es/components/style/form-number-input.js +0 -190
  343. package/es/components/style/form-number-input.js.map +0 -1
  344. package/es/components/style/form-number-input_2.js +0 -207
  345. package/es/components/style/form-number-input_2.js.map +0 -1
  346. package/es/components/style/form-select.js +0 -21
  347. package/es/components/style/form-select.js.map +0 -1
  348. package/es/components/style/form-slider.js +0 -46
  349. package/es/components/style/form-slider.js.map +0 -1
  350. package/es/components/style/form-submit-button.js +0 -27
  351. package/es/components/style/form-submit-button.js.map +0 -1
  352. package/es/components/style/form-text-input.js +0 -77
  353. package/es/components/style/form-text-input.js.map +0 -1
  354. package/es/components/toolbar/button/ControlButton.js +0 -69
  355. package/es/components/toolbar/button/ControlButton.js.map +0 -1
  356. package/es/components/toolbar/button/DirectionButton.js +0 -50
  357. package/es/components/toolbar/button/DirectionButton.js.map +0 -1
  358. package/es/components/toolbar/button/RightButton.js +0 -133
  359. package/es/components/toolbar/button/RightButton.js.map +0 -1
  360. package/es/components/toolbar/button/ToggleButton.js +0 -59
  361. package/es/components/toolbar/button/ToggleButton.js.map +0 -1
  362. package/es/components/toolbar/button/index.js +0 -88
  363. package/es/components/toolbar/button/index.js.map +0 -1
  364. package/es/components/toolbar/button/styles.js +0 -14
  365. package/es/components/toolbar/button/styles.js.map +0 -1
  366. package/es/components/toolbar/components/DoorStyleMenu.js +0 -105
  367. package/es/components/toolbar/components/DoorStyleMenu.js.map +0 -1
  368. package/es/components/toolbar/components/Pricing.js +0 -101
  369. package/es/components/toolbar/components/Pricing.js.map +0 -1
  370. package/es/components/toolbar/components/ReviewForQuote.js +0 -476
  371. package/es/components/toolbar/components/ReviewForQuote.js.map +0 -1
  372. package/es/components/toolbar/export.js +0 -14
  373. package/es/components/toolbar/export.js.map +0 -1
  374. package/es/components/toolbar/main/Alert.js +0 -125
  375. package/es/components/toolbar/main/Alert.js.map +0 -1
  376. package/es/components/toolbar/main/TakePictureModal.js +0 -100
  377. package/es/components/toolbar/main/TakePictureModal.js.map +0 -1
  378. package/es/components/toolbar/main/confirm-popup.js +0 -88
  379. package/es/components/toolbar/main/confirm-popup.js.map +0 -1
  380. package/es/components/toolbar/main/index.js +0 -4612
  381. package/es/components/toolbar/main/index.js.map +0 -1
  382. package/es/components/toolbar/main/lShaped.json +0 -311
  383. package/es/components/toolbar/main/longNarrow.json +0 -238
  384. package/es/components/toolbar/main/myComponents.js +0 -118
  385. package/es/components/toolbar/main/myComponents.js.map +0 -1
  386. package/es/components/toolbar/main/oRectangle.json +0 -220
  387. package/es/components/toolbar/main/rectangle.json +0 -238
  388. package/es/components/toolbar/main/style.css +0 -107
  389. package/es/components/toolbar/main/styles.js +0 -64
  390. package/es/components/toolbar/main/styles.js.map +0 -1
  391. package/es/components/toolbar/plugin-item.js +0 -150
  392. package/es/components/toolbar/plugin-item.js.map +0 -1
  393. package/es/components/toolbar/popup/appliance/appliance-category/index.js +0 -77
  394. package/es/components/toolbar/popup/appliance/appliance-category/index.js.map +0 -1
  395. package/es/components/toolbar/popup/appliance/choose-appliance/index.js +0 -76
  396. package/es/components/toolbar/popup/appliance/choose-appliance/index.js.map +0 -1
  397. package/es/components/toolbar/popup/appliance/index.js +0 -81
  398. package/es/components/toolbar/popup/appliance/index.js.map +0 -1
  399. package/es/components/toolbar/popup/autosaveprompt/index.js +0 -91
  400. package/es/components/toolbar/popup/autosaveprompt/index.js.map +0 -1
  401. package/es/components/toolbar/popup/autosaveprompt/styles.css +0 -64
  402. package/es/components/toolbar/popup/autosaveprompt/styles.js +0 -9
  403. package/es/components/toolbar/popup/autosaveprompt/styles.js.map +0 -1
  404. package/es/components/toolbar/popup/cabinet/cabinet-category/index.js +0 -77
  405. package/es/components/toolbar/popup/cabinet/cabinet-category/index.js.map +0 -1
  406. package/es/components/toolbar/popup/cabinet/choose-product/index.js +0 -98
  407. package/es/components/toolbar/popup/cabinet/choose-product/index.js.map +0 -1
  408. package/es/components/toolbar/popup/cabinet/index.js +0 -83
  409. package/es/components/toolbar/popup/cabinet/index.js.map +0 -1
  410. package/es/components/toolbar/popup/doorStyle/choose-style/index.js +0 -50
  411. package/es/components/toolbar/popup/doorStyle/choose-style/index.js.map +0 -1
  412. package/es/components/toolbar/popup/doorStyle/index.js +0 -61
  413. package/es/components/toolbar/popup/doorStyle/index.js.map +0 -1
  414. package/es/components/toolbar/popup/doorStyle/style-category/index.js +0 -143
  415. package/es/components/toolbar/popup/doorStyle/style-category/index.js.map +0 -1
  416. package/es/components/toolbar/popup/downloadsummary/downloadSummaryContext.js +0 -3
  417. package/es/components/toolbar/popup/downloadsummary/downloadSummaryContext.js.map +0 -1
  418. package/es/components/toolbar/popup/downloadsummary/downloadSummaryTemp.js +0 -119
  419. package/es/components/toolbar/popup/downloadsummary/downloadSummaryTemp.js.map +0 -1
  420. package/es/components/toolbar/popup/downloadsummary/index.js +0 -564
  421. package/es/components/toolbar/popup/downloadsummary/index.js.map +0 -1
  422. package/es/components/toolbar/popup/downloadsummary/show2D/show2DView.js +0 -51
  423. package/es/components/toolbar/popup/downloadsummary/show2D/show2DView.js.map +0 -1
  424. package/es/components/toolbar/popup/downloadsummary/show2D/viewer2DDownLoad.js +0 -191
  425. package/es/components/toolbar/popup/downloadsummary/show2D/viewer2DDownLoad.js.map +0 -1
  426. package/es/components/toolbar/popup/downloadsummary/show3D/show3DView.js +0 -245
  427. package/es/components/toolbar/popup/downloadsummary/show3D/show3DView.js.map +0 -1
  428. package/es/components/toolbar/popup/downloadsummary/show3D/viewer3DDownLoad.js +0 -1758
  429. package/es/components/toolbar/popup/downloadsummary/show3D/viewer3DDownLoad.js.map +0 -1
  430. package/es/components/toolbar/popup/downloadsummary/showCabinetInfo.js +0 -87
  431. package/es/components/toolbar/popup/downloadsummary/showCabinetInfo.js.map +0 -1
  432. package/es/components/toolbar/popup/downloadsummary/showElevation/showElevationView.js +0 -116
  433. package/es/components/toolbar/popup/downloadsummary/showElevation/showElevationView.js.map +0 -1
  434. package/es/components/toolbar/popup/downloadsummary/showElevation/viewer3DElevationDownload.js +0 -1710
  435. package/es/components/toolbar/popup/downloadsummary/showElevation/viewer3DElevationDownload.js.map +0 -1
  436. package/es/components/toolbar/popup/downloadsummary/showElevation/viewerElevationDownload.js +0 -175
  437. package/es/components/toolbar/popup/downloadsummary/showElevation/viewerElevationDownload.js.map +0 -1
  438. package/es/components/toolbar/popup/downloadsummary/showWarranty.js +0 -106
  439. package/es/components/toolbar/popup/downloadsummary/showWarranty.js.map +0 -1
  440. package/es/components/toolbar/popup/downloadsummary/styles.css +0 -177
  441. package/es/components/toolbar/popup/downloadsummary/styles.js +0 -40
  442. package/es/components/toolbar/popup/downloadsummary/styles.js.map +0 -1
  443. package/es/components/toolbar/popup/finishingtouch/category/index.js +0 -35
  444. package/es/components/toolbar/popup/finishingtouch/category/index.js.map +0 -1
  445. package/es/components/toolbar/popup/finishingtouch/index.js +0 -47
  446. package/es/components/toolbar/popup/finishingtouch/index.js.map +0 -1
  447. package/es/components/toolbar/popup/finishingtouch/material-edit.js +0 -156
  448. package/es/components/toolbar/popup/finishingtouch/material-edit.js.map +0 -1
  449. package/es/components/toolbar/popup/finishingtouch/product/index.js +0 -56
  450. package/es/components/toolbar/popup/finishingtouch/product/index.js.map +0 -1
  451. package/es/components/toolbar/popup/floorplan/choose-floor/confirm-popup.js +0 -116
  452. package/es/components/toolbar/popup/floorplan/choose-floor/confirm-popup.js.map +0 -1
  453. package/es/components/toolbar/popup/floorplan/choose-floor/index.js +0 -246
  454. package/es/components/toolbar/popup/floorplan/choose-floor/index.js.map +0 -1
  455. package/es/components/toolbar/popup/floorplan/choose-floor/lShaped.json +0 -311
  456. package/es/components/toolbar/popup/floorplan/choose-floor/longNarrow.json +0 -238
  457. package/es/components/toolbar/popup/floorplan/choose-floor/oRectangle.json +0 -220
  458. package/es/components/toolbar/popup/floorplan/choose-floor/rectangle.json +0 -238
  459. package/es/components/toolbar/popup/floorplan/choose-floor/styles.js +0 -11
  460. package/es/components/toolbar/popup/floorplan/choose-floor/styles.js.map +0 -1
  461. package/es/components/toolbar/popup/floorplan/floor-category/index.js +0 -90
  462. package/es/components/toolbar/popup/floorplan/floor-category/index.js.map +0 -1
  463. package/es/components/toolbar/popup/floorplan/index.js +0 -49
  464. package/es/components/toolbar/popup/floorplan/index.js.map +0 -1
  465. package/es/components/toolbar/popup/index.js +0 -188
  466. package/es/components/toolbar/popup/index.js.map +0 -1
  467. package/es/components/toolbar/popup/newproject/index.js +0 -67
  468. package/es/components/toolbar/popup/newproject/index.js.map +0 -1
  469. package/es/components/toolbar/popup/newproject/styles.css +0 -64
  470. package/es/components/toolbar/popup/newproject/styles.js +0 -9
  471. package/es/components/toolbar/popup/newproject/styles.js.map +0 -1
  472. package/es/components/toolbar/popup/product/appliance.js +0 -65
  473. package/es/components/toolbar/popup/product/appliance.js.map +0 -1
  474. package/es/components/toolbar/popup/product/cabinetproduct.js +0 -25
  475. package/es/components/toolbar/popup/product/cabinetproduct.js.map +0 -1
  476. package/es/components/toolbar/popup/product/doorstyle.js +0 -50
  477. package/es/components/toolbar/popup/product/doorstyle.js.map +0 -1
  478. package/es/components/toolbar/popup/product/doorstyleproduct.js +0 -51
  479. package/es/components/toolbar/popup/product/doorstyleproduct.js.map +0 -1
  480. package/es/components/toolbar/popup/product/floor.js +0 -52
  481. package/es/components/toolbar/popup/product/floor.js.map +0 -1
  482. package/es/components/toolbar/popup/product/floorproduct.js +0 -61
  483. package/es/components/toolbar/popup/product/floorproduct.js.map +0 -1
  484. package/es/components/toolbar/popup/product/index.js +0 -52
  485. package/es/components/toolbar/popup/product/index.js.map +0 -1
  486. package/es/components/toolbar/popup/product/primary.js +0 -63
  487. package/es/components/toolbar/popup/product/primary.js.map +0 -1
  488. package/es/components/toolbar/popup/product/productline.js +0 -120
  489. package/es/components/toolbar/popup/product/productline.js.map +0 -1
  490. package/es/components/toolbar/popup/product/reviewItem.js +0 -338
  491. package/es/components/toolbar/popup/product/reviewItem.js.map +0 -1
  492. package/es/components/toolbar/popup/product/reviewMolding.js +0 -282
  493. package/es/components/toolbar/popup/product/reviewMolding.js.map +0 -1
  494. package/es/components/toolbar/popup/product/style.css +0 -54
  495. package/es/components/toolbar/popup/product/styles.js +0 -71
  496. package/es/components/toolbar/popup/product/styles.js.map +0 -1
  497. package/es/components/toolbar/popup/savedesign/FullPictureForm.js +0 -161
  498. package/es/components/toolbar/popup/savedesign/FullPictureForm.js.map +0 -1
  499. package/es/components/toolbar/popup/savedesign/index.js +0 -508
  500. package/es/components/toolbar/popup/savedesign/index.js.map +0 -1
  501. package/es/components/toolbar/popup/savedesign/savedesign.style.css +0 -16
  502. package/es/components/toolbar/popup/savedesign/styles.js +0 -19
  503. package/es/components/toolbar/popup/savedesign/styles.js.map +0 -1
  504. package/es/components/toolbar/popup/setDoorStyleOption/index.js +0 -57
  505. package/es/components/toolbar/popup/setDoorStyleOption/index.js.map +0 -1
  506. package/es/components/toolbar/popup/styles.js +0 -98
  507. package/es/components/toolbar/popup/styles.js.map +0 -1
  508. package/es/components/toolbar/popup/submitforquote/AddToCartOptions.js +0 -157
  509. package/es/components/toolbar/popup/submitforquote/AddToCartOptions.js.map +0 -1
  510. package/es/components/toolbar/popup/submitforquote/CustomerRequestsForm.js +0 -85
  511. package/es/components/toolbar/popup/submitforquote/CustomerRequestsForm.js.map +0 -1
  512. package/es/components/toolbar/popup/submitforquote/SkipDesignerReview.js +0 -36
  513. package/es/components/toolbar/popup/submitforquote/SkipDesignerReview.js.map +0 -1
  514. package/es/components/toolbar/popup/submitforquote/StepDots.js +0 -33
  515. package/es/components/toolbar/popup/submitforquote/StepDots.js.map +0 -1
  516. package/es/components/toolbar/popup/submitforquote/cart-choice.js +0 -132
  517. package/es/components/toolbar/popup/submitforquote/cart-choice.js.map +0 -1
  518. package/es/components/toolbar/popup/submitforquote/doorstyle-menus.js +0 -43
  519. package/es/components/toolbar/popup/submitforquote/doorstyle-menus.js.map +0 -1
  520. package/es/components/toolbar/popup/submitforquote/index.js +0 -690
  521. package/es/components/toolbar/popup/submitforquote/index.js.map +0 -1
  522. package/es/components/toolbar/popup/submitforquote/styles.css +0 -105
  523. package/es/components/toolbar/popup/submitforquote/styles.js +0 -31
  524. package/es/components/toolbar/popup/submitforquote/styles.js.map +0 -1
  525. package/es/components/toolbar/popup/submitprompt/index.js +0 -71
  526. package/es/components/toolbar/popup/submitprompt/index.js.map +0 -1
  527. package/es/components/toolbar/popup/submitprompt/styles.css +0 -64
  528. package/es/components/toolbar/popup/submitprompt/styles.js +0 -9
  529. package/es/components/toolbar/popup/submitprompt/styles.js.map +0 -1
  530. package/es/components/toolbar/toolbar-button.js +0 -105
  531. package/es/components/toolbar/toolbar-button.js.map +0 -1
  532. package/es/components/toolbar/toolbar-load-button.js +0 -29
  533. package/es/components/toolbar/toolbar-load-button.js.map +0 -1
  534. package/es/components/toolbar/toolbar-save-button.js +0 -27
  535. package/es/components/toolbar/toolbar-save-button.js.map +0 -1
  536. package/es/components/tutorial-view/Modal.js +0 -498
  537. package/es/components/tutorial-view/Modal.js.map +0 -1
  538. package/es/components/tutorial-view/style.css +0 -111
  539. package/es/components/tutorial-view/styles.js +0 -6
  540. package/es/components/tutorial-view/styles.js.map +0 -1
  541. package/es/components/viewer2d/area.js +0 -83
  542. package/es/components/viewer2d/area.js.map +0 -1
  543. package/es/components/viewer2d/export.js +0 -32
  544. package/es/components/viewer2d/export.js.map +0 -1
  545. package/es/components/viewer2d/grids/grid-horizontal-streak.js +0 -38
  546. package/es/components/viewer2d/grids/grid-horizontal-streak.js.map +0 -1
  547. package/es/components/viewer2d/grids/grid-streak.js +0 -38
  548. package/es/components/viewer2d/grids/grid-streak.js.map +0 -1
  549. package/es/components/viewer2d/grids/grid-vertical-streak.js +0 -38
  550. package/es/components/viewer2d/grids/grid-vertical-streak.js.map +0 -1
  551. package/es/components/viewer2d/grids/grids.js +0 -36
  552. package/es/components/viewer2d/grids/grids.js.map +0 -1
  553. package/es/components/viewer2d/group.js +0 -54
  554. package/es/components/viewer2d/group.js.map +0 -1
  555. package/es/components/viewer2d/item.js +0 -514
  556. package/es/components/viewer2d/item.js.map +0 -1
  557. package/es/components/viewer2d/layer.js +0 -165
  558. package/es/components/viewer2d/layer.js.map +0 -1
  559. package/es/components/viewer2d/line.js +0 -889
  560. package/es/components/viewer2d/line.js.map +0 -1
  561. package/es/components/viewer2d/ruler.js +0 -101
  562. package/es/components/viewer2d/ruler.js.map +0 -1
  563. package/es/components/viewer2d/rulerDist.js +0 -147
  564. package/es/components/viewer2d/rulerDist.js.map +0 -1
  565. package/es/components/viewer2d/rulerX.js +0 -152
  566. package/es/components/viewer2d/rulerX.js.map +0 -1
  567. package/es/components/viewer2d/rulerY.js +0 -154
  568. package/es/components/viewer2d/rulerY.js.map +0 -1
  569. package/es/components/viewer2d/scene.js +0 -141
  570. package/es/components/viewer2d/scene.js.map +0 -1
  571. package/es/components/viewer2d/snap.js +0 -75
  572. package/es/components/viewer2d/snap.js.map +0 -1
  573. package/es/components/viewer2d/state.js +0 -79
  574. package/es/components/viewer2d/state.js.map +0 -1
  575. package/es/components/viewer2d/utils.js +0 -163
  576. package/es/components/viewer2d/utils.js.map +0 -1
  577. package/es/components/viewer2d/vertex.js +0 -67
  578. package/es/components/viewer2d/vertex.js.map +0 -1
  579. package/es/components/viewer2d/viewer2d.js +0 -1402
  580. package/es/components/viewer2d/viewer2d.js.map +0 -1
  581. package/es/components/viewer3d/camera-controls-module/camera-controls.module.js +0 -2593
  582. package/es/components/viewer3d/camera-controls-module/camera-controls.module.js.map +0 -1
  583. package/es/components/viewer3d/dcm.js +0 -402
  584. package/es/components/viewer3d/dcm.js.map +0 -1
  585. package/es/components/viewer3d/fbm.js +0 -415
  586. package/es/components/viewer3d/fbm.js.map +0 -1
  587. package/es/components/viewer3d/front3D.js +0 -67
  588. package/es/components/viewer3d/front3D.js.map +0 -1
  589. package/es/components/viewer3d/grid-creator.js +0 -26
  590. package/es/components/viewer3d/grid-creator.js.map +0 -1
  591. package/es/components/viewer3d/grids/grid-horizontal-streak.js +0 -37
  592. package/es/components/viewer3d/grids/grid-horizontal-streak.js.map +0 -1
  593. package/es/components/viewer3d/grids/grid-streak.js +0 -28
  594. package/es/components/viewer3d/grids/grid-streak.js.map +0 -1
  595. package/es/components/viewer3d/grids/grid-vertical-streak.js +0 -37
  596. package/es/components/viewer3d/grids/grid-vertical-streak.js.map +0 -1
  597. package/es/components/viewer3d/libs/first-person-controls.js +0 -68
  598. package/es/components/viewer3d/libs/first-person-controls.js.map +0 -1
  599. package/es/components/viewer3d/libs/helvetiker_regular.typeface.js +0 -1282
  600. package/es/components/viewer3d/libs/helvetiker_regular.typeface.js.map +0 -1
  601. package/es/components/viewer3d/libs/mtl-loader.js +0 -358
  602. package/es/components/viewer3d/libs/mtl-loader.js.map +0 -1
  603. package/es/components/viewer3d/libs/obj-loader.js +0 -463
  604. package/es/components/viewer3d/libs/obj-loader.js.map +0 -1
  605. package/es/components/viewer3d/libs/orbit-controls.js +0 -699
  606. package/es/components/viewer3d/libs/orbit-controls.js.map +0 -1
  607. package/es/components/viewer3d/libs/pointer-lock-controls.js +0 -46
  608. package/es/components/viewer3d/libs/pointer-lock-controls.js.map +0 -1
  609. package/es/components/viewer3d/lrm.js +0 -306
  610. package/es/components/viewer3d/lrm.js.map +0 -1
  611. package/es/components/viewer3d/model.js +0 -709
  612. package/es/components/viewer3d/model.js.map +0 -1
  613. package/es/components/viewer3d/pointer-lock-navigation.js +0 -116
  614. package/es/components/viewer3d/pointer-lock-navigation.js.map +0 -1
  615. package/es/components/viewer3d/ruler-utils/itemRect.js +0 -62
  616. package/es/components/viewer3d/ruler-utils/itemRect.js.map +0 -1
  617. package/es/components/viewer3d/ruler-utils/layer3D.js +0 -496
  618. package/es/components/viewer3d/ruler-utils/layer3D.js.map +0 -1
  619. package/es/components/viewer3d/ruler-utils/ruler3D.js +0 -228
  620. package/es/components/viewer3d/ruler-utils/ruler3D.js.map +0 -1
  621. package/es/components/viewer3d/ruler-utils/scene3D.js +0 -62
  622. package/es/components/viewer3d/ruler-utils/scene3D.js.map +0 -1
  623. package/es/components/viewer3d/ruler-utils/state3D.js +0 -19
  624. package/es/components/viewer3d/ruler-utils/state3D.js.map +0 -1
  625. package/es/components/viewer3d/scene-creator.js +0 -3607
  626. package/es/components/viewer3d/scene-creator.js.map +0 -1
  627. package/es/components/viewer3d/three-memory-cleaner.js +0 -52
  628. package/es/components/viewer3d/three-memory-cleaner.js.map +0 -1
  629. package/es/components/viewer3d/viewer3d-first-person.js +0 -316
  630. package/es/components/viewer3d/viewer3d-first-person.js.map +0 -1
  631. package/es/components/viewer3d/viewer3d.js +0 -2504
  632. package/es/components/viewer3d/viewer3d.js.map +0 -1
  633. package/es/components/wizardstep/button/styles.js +0 -60
  634. package/es/components/wizardstep/button/styles.js.map +0 -1
  635. package/es/components/wizardstep/export.js +0 -5
  636. package/es/components/wizardstep/export.js.map +0 -1
  637. package/es/components/wizardstep/index.js +0 -971
  638. package/es/components/wizardstep/index.js.map +0 -1
  639. package/es/components/wizardstep/styles.js +0 -61
  640. package/es/components/wizardstep/styles.js.map +0 -1
  641. package/es/components/wizardstep/wizardstep-content-button.js +0 -217
  642. package/es/components/wizardstep/wizardstep-content-button.js.map +0 -1
  643. package/es/components/wizardstep/wizardstep-toggle-button.js +0 -126
  644. package/es/components/wizardstep/wizardstep-toggle-button.js.map +0 -1
  645. package/es/constants.js +0 -637
  646. package/es/constants.js.map +0 -1
  647. package/es/hooks/useCheckCart.js +0 -53
  648. package/es/hooks/useCheckCart.js.map +0 -1
  649. package/es/hooks/useGetPricesBySku.js +0 -74
  650. package/es/hooks/useGetPricesBySku.js.map +0 -1
  651. package/es/hooks/useValidateToken.js +0 -201
  652. package/es/hooks/useValidateToken.js.map +0 -1
  653. package/es/index.js +0 -17
  654. package/es/index.js.map +0 -1
  655. package/es/models.js +0 -511
  656. package/es/models.js.map +0 -1
  657. package/es/plugins/SVGLoader.js +0 -1413
  658. package/es/plugins/SVGLoader.js.map +0 -1
  659. package/es/plugins/autosave.js +0 -34
  660. package/es/plugins/autosave.js.map +0 -1
  661. package/es/plugins/console-debugger.js +0 -38
  662. package/es/plugins/console-debugger.js.map +0 -1
  663. package/es/plugins/export.js +0 -10
  664. package/es/plugins/export.js.map +0 -1
  665. package/es/plugins/keyboard.js +0 -102
  666. package/es/plugins/keyboard.js.map +0 -1
  667. package/es/reducers/areas-reducer.js +0 -13
  668. package/es/reducers/areas-reducer.js.map +0 -1
  669. package/es/reducers/export.js +0 -26
  670. package/es/reducers/export.js.map +0 -1
  671. package/es/reducers/groups-reducer.js +0 -39
  672. package/es/reducers/groups-reducer.js.map +0 -1
  673. package/es/reducers/holes-reducer.js +0 -63
  674. package/es/reducers/holes-reducer.js.map +0 -1
  675. package/es/reducers/items-reducer.js +0 -144
  676. package/es/reducers/items-reducer.js.map +0 -1
  677. package/es/reducers/lines-reducer.js +0 -46
  678. package/es/reducers/lines-reducer.js.map +0 -1
  679. package/es/reducers/project-reducer.js +0 -130
  680. package/es/reducers/project-reducer.js.map +0 -1
  681. package/es/reducers/reducer.js +0 -20
  682. package/es/reducers/reducer.js.map +0 -1
  683. package/es/reducers/scene-reducer.js +0 -29
  684. package/es/reducers/scene-reducer.js.map +0 -1
  685. package/es/reducers/user-reducer.js +0 -42
  686. package/es/reducers/user-reducer.js.map +0 -1
  687. package/es/reducers/vertices-reducer.js +0 -20
  688. package/es/reducers/vertices-reducer.js.map +0 -1
  689. package/es/reducers/viewer2d-reducer.js +0 -76
  690. package/es/reducers/viewer2d-reducer.js.map +0 -1
  691. package/es/reducers/viewer3d-reducer.js +0 -57
  692. package/es/reducers/viewer3d-reducer.js.map +0 -1
  693. package/es/shared-style.js +0 -67
  694. package/es/shared-style.js.map +0 -1
  695. package/es/styles/export.js +0 -6
  696. package/es/styles/export.js.map +0 -1
  697. package/es/styles/tabs.css +0 -40
  698. package/es/translator/en.js +0 -105
  699. package/es/translator/en.js.map +0 -1
  700. package/es/translator/it.js +0 -80
  701. package/es/translator/it.js.map +0 -1
  702. package/es/translator/ru.js +0 -80
  703. package/es/translator/ru.js.map +0 -1
  704. package/es/translator/translator.js +0 -85
  705. package/es/translator/translator.js.map +0 -1
  706. package/es/utils/browser.js +0 -34
  707. package/es/utils/browser.js.map +0 -1
  708. package/es/utils/email-validator.js +0 -5
  709. package/es/utils/email-validator.js.map +0 -1
  710. package/es/utils/export.js +0 -26
  711. package/es/utils/export.js.map +0 -1
  712. package/es/utils/geometry.js +0 -2237
  713. package/es/utils/geometry.js.map +0 -1
  714. package/es/utils/get-edges-of-subgraphs.js +0 -27
  715. package/es/utils/get-edges-of-subgraphs.js.map +0 -1
  716. package/es/utils/graph-cycles.js +0 -239
  717. package/es/utils/graph-cycles.js.map +0 -1
  718. package/es/utils/graph-inner-cycles.js +0 -47
  719. package/es/utils/graph-inner-cycles.js.map +0 -1
  720. package/es/utils/graph.js +0 -150
  721. package/es/utils/graph.js.map +0 -1
  722. package/es/utils/helper.js +0 -337
  723. package/es/utils/helper.js.map +0 -1
  724. package/es/utils/history.js +0 -30
  725. package/es/utils/history.js.map +0 -1
  726. package/es/utils/id-broker.js +0 -20
  727. package/es/utils/id-broker.js.map +0 -1
  728. package/es/utils/logger.js +0 -9
  729. package/es/utils/logger.js.map +0 -1
  730. package/es/utils/math.js +0 -51
  731. package/es/utils/math.js.map +0 -1
  732. package/es/utils/molding.js +0 -840
  733. package/es/utils/molding.js.map +0 -1
  734. package/es/utils/name-generator.js +0 -19
  735. package/es/utils/name-generator.js.map +0 -1
  736. package/es/utils/objects-utils.js +0 -51
  737. package/es/utils/objects-utils.js.map +0 -1
  738. package/es/utils/phone-validator.js +0 -5
  739. package/es/utils/phone-validator.js.map +0 -1
  740. package/es/utils/process-black-list.js +0 -19
  741. package/es/utils/process-black-list.js.map +0 -1
  742. package/es/utils/react-if.js +0 -19
  743. package/es/utils/react-if.js.map +0 -1
  744. package/es/utils/snap-scene.js +0 -100
  745. package/es/utils/snap-scene.js.map +0 -1
  746. package/es/utils/snap.js +0 -238
  747. package/es/utils/snap.js.map +0 -1
  748. package/es/utils/threeCSG.es6.js +0 -499
  749. package/es/utils/threeCSG.es6.js.map +0 -1
  750. package/es/version.js +0 -2
  751. package/es/version.js.map +0 -1
@@ -1,2237 +0,0 @@
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); }
6
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
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); }
11
- 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
- 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
19
- * @param {number} x0 Vertex 0 x
20
- * @param {number} y0 Vertex 0 y
21
- * @param {number} x1 Vertex 1 x
22
- * @param {number} y1 Vertex 1 y
23
- * @return {number}
24
- */
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) {
33
- return v0.x === v1.x ? v0.y - v1.y : v0.x - v1.x;
34
- }
35
- export function minVertex(v0, v1) {
36
- return compareVertices(v0, v1) > 0 ? v1 : v0;
37
- }
38
- export function maxVertex(v0, v1) {
39
- return compareVertices(v0, v1) > 0 ? v0 : v1;
40
- }
41
- export function orderVertices(vertices) {
42
- return vertices.sort(compareVertices);
43
- }
44
- export function pointsDistance(x0, y0, x1, y1) {
45
- var diff_x = x0 - x1;
46
- var diff_y = y0 - y1;
47
- return Math.sqrt(diff_x * diff_x + diff_y * diff_y);
48
- }
49
- export function verticesDistance(v1, v2) {
50
- var x0 = v1.x,
51
- y0 = v1.y;
52
- var x1 = v2.x,
53
- y1 = v2.y;
54
- return pointsDistance(x0, y0, x1, y1);
55
- }
56
- export function horizontalLine(y) {
57
- return {
58
- a: 0,
59
- b: 1,
60
- c: -y
61
- };
62
- }
63
- export var almostEqual = function almostEqual(x, y) {
64
- return Math.abs(x - y) < EPSILON;
65
- };
66
- export function verticalLine(x) {
67
- return {
68
- a: 1,
69
- b: 0,
70
- c: -x
71
- };
72
- }
73
- export function upcrossLine(x, y) {
74
- return {
75
- a: 1,
76
- b: 1,
77
- c: -x - y
78
- };
79
- }
80
- export function downcrossLine(x, y) {
81
- return {
82
- a: 1,
83
- b: -1,
84
- c: -x + y
85
- };
86
- }
87
- export function linePassingThroughTwoPoints(x1, y1, x2, y2) {
88
- if (x1 === x2 && y1 == y2) throw new Error('Geometry error');
89
- //if (x1 === x2) return verticalLine(x1);
90
- //if (y1 === y2) return horizontalLine(y1);
91
-
92
- return {
93
- a: y1 - y2,
94
- b: x2 - x1,
95
- c: y2 * x1 - x2 * y1
96
- };
97
- }
98
- export function getNormaline(x1, y1, x2, y2) {
99
- var lineFunction = linePassingThroughTwoPoints(x1, y1, x2, y2);
100
- return {
101
- x: lineFunction.a / Math.sqrt(lineFunction.a * lineFunction.a + lineFunction.b * lineFunction.b),
102
- y: lineFunction.b / Math.sqrt(lineFunction.a * lineFunction.a + lineFunction.b * lineFunction.b)
103
- };
104
- }
105
- export function distancePointFromLine(a, b, c, x, y) {
106
- //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);
108
- }
109
- export function closestPointFromLine(a, b, c, x, y) {
110
- //https://en.wikipedia.org/wiki/Distance_from_a_point_to_a_line
111
- var denom = a * a + b * b;
112
- return {
113
- x: (b * (b * x - a * y) - a * c) / denom,
114
- y: (a * -b * x + a * y - b * c) / denom
115
- };
116
- }
117
-
118
- /** @description Get point of intersection between two lines using ax+by+c line's equation
119
- * @param {number} a x coefficent of first line
120
- * @param {number} b y coefficent of first line
121
- * @param {number} c costant of first line
122
- * @param {number} j x coefficent of second line
123
- * @param {number} k y coefficent of second line
124
- * @param {number} l costant of second line
125
- * @return {object} {x,y} point's coordinates
126
- */
127
- export function twoLinesIntersection(a, b, c, j, k, l) {
128
- var angularCoefficientsDiff = b * j - a * k;
129
- if (angularCoefficientsDiff === 0) return undefined; //no intersection
130
-
131
- var y = (a * l - c * j) / angularCoefficientsDiff;
132
- var x = (c * k - b * l) / angularCoefficientsDiff;
133
- return {
134
- x: x,
135
- y: y
136
- };
137
- }
138
- export function twoLineSegmentsIntersection(p1, p2, p3, p4) {
139
- //https://github.com/psalaets/line-intersect/blob/master/lib/check-intersection.js
140
-
141
- var x1 = p1.x,
142
- y1 = p1.y;
143
- var x2 = p2.x,
144
- y2 = p2.y;
145
- var x3 = p3.x,
146
- y3 = p3.y;
147
- var x4 = p4.x,
148
- y4 = p4.y;
149
- var denom = (y4 - y3) * (x2 - x1) - (x4 - x3) * (y2 - y1);
150
- var numA = (x4 - x3) * (y1 - y3) - (y4 - y3) * (x1 - x3);
151
- var numB = (x2 - x1) * (y1 - y3) - (y2 - y1) * (x1 - x3);
152
- if (fAbs(denom) <= EPSILON) {
153
- if (fAbs(numA) <= EPSILON && fAbs(numB) <= EPSILON) {
154
- var comparator = function comparator(pa, pb) {
155
- return pa.x === pb.x ? pa.y - pb.y : pa.x - pb.x;
156
- };
157
- var line0 = [p1, p2].sort(comparator);
158
- var line1 = [p3.toJS(), p4.toJS()].sort(comparator);
159
- var _sort = [line0, line1].sort(function (lineA, lineB) {
160
- return comparator(lineA[0], lineB[0]);
161
- }),
162
- _sort2 = _slicedToArray(_sort, 2),
163
- lineSX = _sort2[0],
164
- lineDX = _sort2[1];
165
- if (lineSX[1].x === lineDX[0].x) {
166
- return {
167
- type: lineDX[0].y <= lineSX[1].y ? 'colinear' : 'none'
168
- };
169
- } else {
170
- return {
171
- type: lineDX[0].x <= lineSX[1].x ? 'colinear' : 'none'
172
- };
173
- }
174
- }
175
- return {
176
- type: 'parallel'
177
- };
178
- }
179
- var uA = numA / denom;
180
- var uB = numB / denom;
181
- if (uA >= 0 - EPSILON && uA <= 1 + EPSILON && uB >= 0 - EPSILON && uB <= 1 + EPSILON) {
182
- var _point = {
183
- x: x1 + uA * (x2 - x1),
184
- y: y1 + uA * (y2 - y1)
185
- };
186
- return {
187
- type: 'intersecting',
188
- point: _point
189
- };
190
- }
191
- return {
192
- type: 'none'
193
- };
194
- }
195
- export function distancePointFromLineSegment(v1, v2, xp, yp) {
196
- //http://stackoverflow.com/a/6853926/1398836
197
- var x1 = v1.x,
198
- y1 = v1.y;
199
- var x2 = v2.x,
200
- y2 = v2.y;
201
- var A = xp - x1;
202
- var B = yp - y1;
203
- var C = x2 - x1;
204
- var D = y2 - y1;
205
- var dot = A * C + B * D;
206
- var len_sq = C * C + D * D;
207
- var param = -1;
208
- if (len_sq != 0)
209
- //in case of 0 length line
210
- param = dot / len_sq;
211
- var xx, yy;
212
- if (param < 0) {
213
- xx = x1;
214
- yy = y1;
215
- } else if (param > 1) {
216
- xx = x2;
217
- yy = y2;
218
- } else {
219
- xx = x1 + param * C;
220
- yy = y1 + param * D;
221
- }
222
- var dx = xp - xx;
223
- var dy = yp - yy;
224
- return Math.sqrt(dx * dx + dy * dy);
225
- }
226
-
227
- /**
228
- *
229
- * @param x1 {number} x for first vertex of the segment
230
- * @param y1 {number} y for first vertex of the segment
231
- * @param x2 {number} x for second vertex of the segment
232
- * @param y2 {number} y for second vertex of the segment
233
- * @param xp {number} x for point we want to verify
234
- * @param yp {number} y for point we want to verify
235
- * @param maxDistance {number} the epsilon value used for comparisons
236
- * @returns {boolean} true if the point lies on the line segment false otherwise
237
- */
238
- export function isPointOnLineSegment(x1, y1, x2, y2, xp, yp) {
239
- var maxDistance = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : EPSILON;
240
- return distancePointFromLineSegment({
241
- x: x1,
242
- y: y1
243
- }, {
244
- x: x2,
245
- y: y2
246
- }, xp, yp) <= maxDistance;
247
- }
248
- export function closestPointFromLineSegment(x1, y1, x2, y2, xp, yp) {
249
- if (x1 === x2) return {
250
- x: x1,
251
- y: yp
252
- };
253
- if (y1 === y2) return {
254
- x: xp,
255
- y: y1
256
- };
257
- var m = (y2 - y1) / (x2 - x1);
258
- var q = y1 - m * x1;
259
- var mi = -1 / m;
260
- var qi = yp - mi * xp;
261
- var x = (qi - q) / (m - mi);
262
- var y = m * x + q;
263
- return {
264
- x: x,
265
- y: y
266
- };
267
- }
268
- export function pointPositionOnLineSegment(x1, y1, x2, y2, xp, yp) {
269
- var length = pointsDistance(x1, y1, x2, y2);
270
- var distance = pointsDistance(x1, y1, xp, yp);
271
- var offset = distance / length;
272
- /*
273
- if (x1 > x2) offset = 1 - offset;
274
- if (y1 > y2) offset = 1 - offset;
275
- */
276
- return offset;
277
- }
278
- export function mapRange(value, low1, high1, low2, high2) {
279
- return low2 + (high2 - low2) * (value - low1) / (high1 - low1);
280
- }
281
- export function angleBetweenTwoPointsAndOrigin(x1, y1, x2, y2) {
282
- return -Math.atan2(y1 - y2, x2 - x1) * 180 / Math.PI;
283
- }
284
- export function angleBetweenTwoPoints(x1, y1, x2, y2) {
285
- return Math.atan2(y2 - y1, x2 - x1);
286
- }
287
- export function angleBetweenTwoLines(line, drawingLine, vertices) {
288
- var points = [];
289
-
290
- // safety guards
291
- var lv = Array.isArray(line === null || line === void 0 ? void 0 : line.vertices) ? line.vertices : [];
292
- var dv = Array.isArray(drawingLine === null || drawingLine === void 0 ? void 0 : drawingLine.vertices) ? drawingLine.vertices : [];
293
-
294
- // 1) push common vertices (in order of line.vertices)
295
- var _iterator = _createForOfIteratorHelper(lv),
296
- _step;
297
- try {
298
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
299
- var vt = _step.value;
300
- if (dv.includes(vt) && !points.includes(vt)) points.push(vt);
301
- }
302
-
303
- // 2) push remaining vertices from line.vertices
304
- } catch (err) {
305
- _iterator.e(err);
306
- } finally {
307
- _iterator.f();
308
- }
309
- var _iterator2 = _createForOfIteratorHelper(lv),
310
- _step2;
311
- try {
312
- for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
313
- var _vt = _step2.value;
314
- if (!points.includes(_vt)) points.push(_vt);
315
- }
316
-
317
- // 3) push remaining vertices from drawingLine.vertices
318
- } catch (err) {
319
- _iterator2.e(err);
320
- } finally {
321
- _iterator2.f();
322
- }
323
- var _iterator3 = _createForOfIteratorHelper(dv),
324
- _step3;
325
- try {
326
- for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
327
- var _vt2 = _step3.value;
328
- if (!points.includes(_vt2)) points.push(_vt2);
329
- }
330
-
331
- // If no points at all, nothing to compute — return 0 (safe fallback)
332
- } catch (err) {
333
- _iterator3.e(err);
334
- } finally {
335
- _iterator3.f();
336
- }
337
- if (points.length === 0) return 0;
338
-
339
- // Ensure we have at least 3 entries (same behaviour as original)
340
- while (points.length < 3) points.push(points[points.length - 1]);
341
- var _points$slice$map = points.slice(0, 3).map(function (idx) {
342
- var v = vertices === null || vertices === void 0 ? void 0 : vertices[idx];
343
- return v ? new Three.Vector2(v.x, v.y) : new Three.Vector2(0, 0);
344
- }),
345
- _points$slice$map2 = _slicedToArray(_points$slice$map, 3),
346
- c = _points$slice$map2[0],
347
- p1 = _points$slice$map2[1],
348
- p2 = _points$slice$map2[2];
349
- var vec1 = p1.clone().sub(c).normalize();
350
- var vec2 = p2.clone().sub(c).normalize();
351
- return Math.floor(vec1.angle() * 180 / Math.PI - vec2.angle() * 180 / Math.PI + 0.5);
352
- }
353
- export var getRelatedLines = function getRelatedLines(tlines, drawingLine, vertices, lines) {
354
- var exceptLineId = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
355
- if (!(drawingLine !== null && drawingLine !== void 0 && drawingLine.vertices) || !Array.isArray(drawingLine.vertices)) return;
356
- var seen = new Set();
357
- var _iterator4 = _createForOfIteratorHelper(drawingLine.vertices),
358
- _step4;
359
- try {
360
- for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
361
- var vIdx = _step4.value;
362
- var vertex = vertices === null || vertices === void 0 ? void 0 : vertices[vIdx];
363
- if (!(vertex !== null && vertex !== void 0 && vertex.lines)) continue;
364
- var _iterator5 = _createForOfIteratorHelper(vertex.lines),
365
- _step5;
366
- try {
367
- for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
368
- var lineId = _step5.value;
369
- if (lineId !== drawingLine.id && lineId !== exceptLineId && !isEmpty(lines === null || lines === void 0 ? void 0 : lines[lineId]) && !seen.has(lineId)) {
370
- seen.add(lineId);
371
- tlines.push(lines[lineId]);
372
- }
373
- }
374
- } catch (err) {
375
- _iterator5.e(err);
376
- } finally {
377
- _iterator5.f();
378
- }
379
- }
380
- } catch (err) {
381
- _iterator4.e(err);
382
- } finally {
383
- _iterator4.f();
384
- }
385
- };
386
- export function snapAngleByUnit(lineAngle, vertices, drawingLine, x, y, dragVertexId) {
387
- var tx, ty;
388
- var absAngle = Math.abs(lineAngle);
389
- // angle snapping as a value of UNIT_ANGLE
390
- var rest = absAngle % UNIT_ANGLE;
391
- var missAngle = UNIT_ANGLE - rest;
392
- // the origin point of rotation(snapping)
393
- var originVerId = drawingLine.vertices.findIndex(function (vertice) {
394
- return vertice !== dragVertexId;
395
- });
396
- originVerId = originVerId < 0 ? drawingLine.vertices[0] : drawingLine.vertices[originVerId];
397
- var ox = vertices[originVerId].x;
398
- var oy = vertices[originVerId].y;
399
- // check whether the line is snapped to before point.
400
- if (rest <= UNIT_ANGLE / 2) {
401
- // determine the direction of rotation.
402
- rest = lineAngle > 0 ? rest : -rest;
403
- // rotate the current point to last point around the first point of drawing line.
404
- tx = rotatePointAroundPoint(x, y, ox, oy, rest).x;
405
- ty = rotatePointAroundPoint(x, y, ox, oy, rest).y;
406
- }
407
- // check whether the line is snapped to next new point.
408
- else if (rest > UNIT_ANGLE / 2) {
409
- // determine the direction of rotation.
410
- missAngle = lineAngle > 0 ? -missAngle : missAngle;
411
- // rotate the current point to last point around the first point of drawing line.
412
- tx = rotatePointAroundPoint(x, y, ox, oy, missAngle).x;
413
- ty = rotatePointAroundPoint(x, y, ox, oy, missAngle).y;
414
- }
415
- var resPoint = {
416
- x: tx,
417
- y: ty
418
- };
419
- return resPoint;
420
- }
421
- export function absAngleBetweenTwoPoints(x1, y1, x2, y2) {
422
- return Math.atan2(y2 - y1, Math.abs(x2 - x1));
423
- }
424
- export function samePoints(_ref, _ref2) {
425
- var x1 = _ref.x,
426
- y1 = _ref.y;
427
- var x2 = _ref2.x,
428
- y2 = _ref2.y;
429
- return fAbs(x1 - x2) <= EPSILON && fAbs(y1 - y2) <= EPSILON;
430
- }
431
- export function sameDistances(dis1, dis2) {
432
- return fAbs(dis1 - dis2) <= EPSILON;
433
- }
434
- export function sameMPoints(_ref3, _ref4) {
435
- var x1 = _ref3.x,
436
- y1 = _ref3.y;
437
- var x2 = _ref4.x,
438
- y2 = _ref4.y;
439
- return fAbs(x1 - x2) <= MEPSILON && fAbs(y1 - y2) <= MEPSILON;
440
- }
441
- export function sameMDistances(dis1, dis2) {
442
- return fAbs(dis1 - dis2) <= MEPSILON;
443
- }
444
- export function isPointInRect(rect, point) {
445
- var result = true;
446
- for (var i = 0; i < rect.length; i++) {
447
- var pos1 = rect[i];
448
- var pos2 = rect[(i + 1) % rect.length];
449
- if (isPointOnLineSegment(pos1.x, pos1.y, pos2.x, pos2.y, point.x, point.y)) {
450
- result = false;
451
- }
452
- }
453
- return result;
454
- }
455
-
456
- /** @description Extend line based on coordinates and new line length
457
- * @param {number} x1 Vertex 1 x
458
- * @param {number} y1 Vertex 1 y
459
- * @param {number} x2 Vertex 2 x
460
- * @param {number} y2 Vertex 2 y
461
- * @param {number} newDistance New line length
462
- * @return {object}
463
- */
464
- export function extendLine(x1, y1, x2, y2, newDistance) {
465
- var precision = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 6;
466
- var rad = angleBetweenTwoPoints(x1, y1, x2, y2);
467
- return {
468
- x: toFixedFloat(x1 + Math.cos(rad) * newDistance, precision),
469
- y: toFixedFloat(y1 + Math.sin(rad) * newDistance, precision)
470
- };
471
- }
472
- export function roundVertex(vertex) {
473
- var precision = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 6;
474
- vertex.set('x', toFixedFloat(vertex.get('x'), precision));
475
- vertex.set('y', toFixedFloat(vertex.get('y'), precision));
476
- return vertex;
477
- }
478
-
479
- //https://github.com/MartyWallace/PolyK
480
- export function ContainsPoint(polygon, pointX, pointY) {
481
- var n = polygon.length >> 1;
482
- var ax, lup;
483
- var ay = polygon[2 * n - 3] - pointY;
484
- var bx = polygon[2 * n - 2] - pointX;
485
- var by = polygon[2 * n - 1] - pointY;
486
- if (bx === 0 && by === 0) return false; // point on edge
487
-
488
- // let lup = by > ay;
489
- for (var ii = 0; ii < n; ii++) {
490
- ax = bx;
491
- ay = by;
492
- bx = polygon[2 * ii] - pointX;
493
- by = polygon[2 * ii + 1] - pointY;
494
- if (bx === 0 && by === 0) return false; // point on edge
495
- if (ay === by) continue;
496
- lup = by > ay;
497
- }
498
- var depth = 0;
499
- for (var i = 0; i < n; i++) {
500
- ax = bx;
501
- ay = by;
502
- bx = polygon[2 * i] - pointX;
503
- by = polygon[2 * i + 1] - pointY;
504
- if (ay < 0 && by < 0) continue; // both 'up' or both 'down'
505
- if (ay > 0 && by > 0) continue; // both 'up' or both 'down'
506
- if (ax < 0 && bx < 0) continue; // both points on the left
507
-
508
- if (ay === by && Math.min(ax, bx) < 0) return true;
509
- if (ay === by) continue;
510
- var lx = ax + (bx - ax) * -ay / (by - ay);
511
- if (lx === 0) return false; // point on edge
512
- if (lx > 0) depth++;
513
- if (ay === 0 && lup && by > ay) depth--; // hit vertex, both up
514
- if (ay === 0 && !lup && by < ay) depth--; // hit vertex, both down
515
- lup = by > ay;
516
- }
517
- return (depth & 1) === 1;
518
- }
519
- export function cosWithThreshold(alpha, threshold) {
520
- var cos = Math.cos(alpha);
521
- return cos < threshold ? 0 : cos;
522
- }
523
- export function sinWithThreshold(alpha, threshold) {
524
- var sin = Math.sin(alpha);
525
- return sin < threshold ? 0 : sin;
526
- }
527
- export function midPoint(x1, y1, x2, y2) {
528
- return {
529
- x: (x1 + x2) / 2,
530
- y: (y1 + y2) / 2
531
- };
532
- }
533
- export function verticesMidPoint(verticesArray) {
534
- var res = verticesArray.reduce(function (incr, vertex) {
535
- return {
536
- x: incr.x + vertex.x,
537
- y: incr.y + vertex.y
538
- };
539
- }, {
540
- x: 0,
541
- y: 0
542
- });
543
- return {
544
- x: res.x / verticesArray.length,
545
- y: res.y / verticesArray.length
546
- };
547
- }
548
- export function rotatePointAroundPoint(px, py, ox, oy, theta) {
549
- var thetaRad = theta * Math.PI / 180;
550
- var cos = Math.cos(thetaRad);
551
- var sin = Math.sin(thetaRad);
552
- var deltaX = px - ox;
553
- var deltaY = py - oy;
554
- return {
555
- x: cos * deltaX - sin * deltaY + ox,
556
- y: sin * deltaX + cos * deltaY + oy
557
- };
558
- }
559
-
560
- // point: x,y
561
- // itemrectInfo: pos(x,y),rotRad,size,layoutpos,is_corner
562
- // calcRect: rect(point[4]),pos(x,y),rotRad,size,layoutpos,is_corner
563
-
564
- function point(x, y) {
565
- return {
566
- x: x,
567
- y: y
568
- };
569
- }
570
- function itemrectInfo(x, y, rotRad, size, layoutpos, is_corner) {
571
- return {
572
- pos: {
573
- x: x,
574
- y: y
575
- },
576
- rotRad: rotRad,
577
- size: size,
578
- layoutpos: layoutpos,
579
- is_corner: is_corner
580
- };
581
- }
582
- export function getCalcRectFromItem(item) {
583
- var itemInfo;
584
- if (item === undefined) itemInfo = [];else itemInfo = item.item;
585
- var x = item.pos.x;
586
- var y = item.pos.y;
587
- var rotRad = item.rotRad;
588
- var w = item.size && item.size.width / 2;
589
- var h = item.size && item.size.height / 2;
590
- var mx = x - w * Math.cos(rotRad);
591
- var my = y - w * Math.sin(rotRad);
592
- var x0 = mx + h * Math.sin(rotRad);
593
- var y0 = my - h * Math.cos(rotRad);
594
- var x3 = mx * 2 - x0;
595
- var y3 = my * 2 - y0;
596
- var x1 = x * 2 - x3;
597
- var y1 = y * 2 - y3;
598
- var x2 = x * 2 - x0;
599
- var y2 = y * 2 - y0;
600
- return {
601
- rect: [point(x0, y0), point(x1, y1), point(x2, y2), point(x3, y3)],
602
- pos: point(x, y),
603
- rotRad: rotRad,
604
- size: item.size,
605
- layoutpos: item.layoutpos,
606
- is_corner: item.is_corner,
607
- itemInfo: itemInfo
608
- };
609
- }
610
- export function getCalcRectFromItem3D(item) {
611
- var itemInfo;
612
- if (item === undefined) itemInfo = [];else itemInfo = item.item;
613
- var x = item.pos.x;
614
- var y = item.pos.y;
615
- var rotRad = item.rotRad;
616
- var w = item.size.width / 2;
617
- var h = item.size.depth / 2;
618
- var mx = x - w * Math.cos(rotRad);
619
- var my = y - w * Math.sin(rotRad);
620
- var x0 = mx + h * Math.sin(rotRad);
621
- var y0 = my - h * Math.cos(rotRad);
622
- var x3 = mx * 2 - x0;
623
- var y3 = my * 2 - y0;
624
- var x1 = x * 2 - x3;
625
- var y1 = y * 2 - y3;
626
- var x2 = x * 2 - x0;
627
- var y2 = y * 2 - y0;
628
- return {
629
- rect: [point(x0, y0), point(x1, y1), point(x2, y2), point(x3, y3)],
630
- pos: point(x, y),
631
- rotRad: rotRad,
632
- size: item.size,
633
- layoutpos: item.layoutpos,
634
- is_corner: item.is_corner,
635
- itemInfo: itemInfo
636
- };
637
- }
638
- export function getAllItems(scene, catalog, allLineRects) {
639
- var layerID = scene.selectedLayer;
640
- var layer = scene.layers.get(layerID);
641
- var curiteminfo;
642
- var iteminfo = [];
643
- var otherItems = [];
644
- var selectedItem;
645
- var currentItem;
646
- if (layer.selected.items.size > 0) {
647
- selectedItem = layer.getIn(['items', layer.selected.items.get(0)]);
648
- var catid = selectedItem.type;
649
- var cat = catalog.elements[catid];
650
- if (!cat) cat = catalog.elements[returnReplaceableDeepSearchType(catid)];
651
- currentItem = {
652
- selectedItem: selectedItem,
653
- cat: cat
654
- };
655
- }
656
- layer.items.forEach(function (item) {
657
- var val = {
658
- pos: {
659
- x: item.x,
660
- y: item.y
661
- },
662
- rotRad: item.rotation / 180 * Math.PI
663
- };
664
- var catid = item.type;
665
- var cat = catalog.elements[catid];
666
- if (!cat) {
667
- cat = catalog.elements[returnReplaceableDeepSearchType(catid)];
668
- }
669
- var sizeinfo = [];
670
- var width, height, depth;
671
- sizeinfo = {
672
- width: item.properties.get('width').get('_length'),
673
- height: item.properties.get('height').get('_length'),
674
- depth: item.properties.get('depth').get('_length'),
675
- widthUnit: item.properties.get('width').get('_unit'),
676
- heightUnit: item.properties.get('height').get('_unit'),
677
- depthUnit: item.properties.get('depth').get('_unit')
678
- };
679
- sizeinfo = _objectSpread(_objectSpread({}, sizeinfo), {}, {
680
- layoutpos: cat && cat.info.layoutpos,
681
- is_corner: cat && cat.info.is_corner
682
- });
683
- width = convert(sizeinfo.width).from(sizeinfo.widthUnit).to(scene.unit);
684
- height = convert(sizeinfo.depth).from(sizeinfo.depthUnit).to(scene.unit);
685
- depth = convert(sizeinfo.height).from(sizeinfo.heightUnit).to(scene.unit);
686
- val.size = {
687
- width: width,
688
- height: height,
689
- depth: depth
690
- };
691
- val.layoutpos = sizeinfo.layoutpos;
692
- val.is_corner = sizeinfo.is_corner;
693
- val.doorStyle = item.doorStyle;
694
- val.item = item;
695
- var otherItem = {
696
- item: item,
697
- cat: cat
698
- };
699
- if (!needSnap(currentItem, otherItem)) {
700
- return;
701
- }
702
- if (item.selected) {
703
- curiteminfo = getCalcRectFromItem(val);
704
- } else {
705
- var calcrect = getCalcRectFromItem(val);
706
- calcrect.isSnappedLine = isSnappedLine(calcrect, allLineRects);
707
- iteminfo.push(calcrect);
708
- otherItems.push(otherItem);
709
- }
710
- });
711
- return {
712
- cur: curiteminfo,
713
- others: iteminfo,
714
- currentItem: currentItem,
715
- otherItems: otherItems
716
- };
717
- }
718
- export function getAllItemSpecified(scene, catalog, filter) {
719
- var _scene$layers, _scene$layers$get;
720
- var layerID = scene === null || scene === void 0 ? void 0 : scene.selectedLayer;
721
- 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);
722
- if (!layer || !layer.items) return {
723
- cur: null,
724
- others: []
725
- };
726
- var curiteminfo;
727
- var iteminfo = [];
728
- layer.items.forEach(function (item) {
729
- var _cat$obj;
730
- if (!item) return;
731
- var val = {
732
- pos: {
733
- x: item.x,
734
- y: item.y
735
- },
736
- rotRad: item.rotation / 180 * Math.PI
737
- };
738
- var cat = item.type ? findCatalogElement(catalog, item.type) : null;
739
- var info = cat === null || cat === void 0 ? void 0 : cat.info;
740
- var props = item.properties;
741
- var getSize = function getSize(key) {
742
- var _props$getIn;
743
- var length = props === null || props === void 0 || (_props$getIn = props.getIn) === null || _props$getIn === void 0 ? void 0 : _props$getIn.call(props, [key, '_length']);
744
- return length != null ? convert(length).from('in').to(scene.unit) : 0;
745
- };
746
- val.size = {
747
- width: getSize('width'),
748
- height: getSize('height'),
749
- depth: getSize('depth')
750
- };
751
- val.item = item;
752
- if (info) {
753
- val.layoutpos = info.layoutpos;
754
- val.is_corner = info.is_corner;
755
- }
756
-
757
- // Filter check
758
- if (Array.isArray(filter)) {
759
- if (info && !filter.includes(info.layoutpos)) return;
760
- } else if (info && (info.layoutpos !== filter || (cat === null || cat === void 0 ? void 0 : cat.type) === 'appliance' && ['Cook Top', 'Microwave'].includes(cat === null || cat === void 0 || (_cat$obj = cat.obj) === null || _cat$obj === void 0 ? void 0 : _cat$obj.category))) {
761
- return;
762
- }
763
-
764
- // Current vs others
765
- var rect = getCalcRectFromItem3D(val);
766
- if (item.selected) {
767
- curiteminfo = rect;
768
- } else {
769
- iteminfo.push(rect);
770
- }
771
- });
772
- return {
773
- cur: curiteminfo,
774
- others: iteminfo
775
- };
776
- }
777
- export function findCatalogElement(catalog, elementName) {
778
- if (!elementName || !catalog) return null;
779
- var variants = [elementName, elementName.toLowerCase()];
780
- var deepVariants = variants.map(function (v) {
781
- return returnReplaceableDeepSearchType(v);
782
- }).filter(Boolean);
783
- var allCandidates = [].concat(variants, _toConsumableArray(deepVariants));
784
- var getElement = function getElement(catid) {
785
- if (!catid) return null;
786
-
787
- // Immutable.js Map
788
- if (typeof catalog.getIn === 'function') {
789
- return catalog.getIn(['elements', catid]);
790
- }
791
-
792
- // Plain JS object
793
- if (catalog.elements && catalog.elements[catid]) {
794
- return catalog.elements[catid];
795
- }
796
- return null;
797
- };
798
- var _iterator6 = _createForOfIteratorHelper(allCandidates),
799
- _step6;
800
- try {
801
- for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
802
- var name = _step6.value;
803
- var cat = getElement(name);
804
- if (cat) return cat;
805
- }
806
- } catch (err) {
807
- _iterator6.e(err);
808
- } finally {
809
- _iterator6.f();
810
- }
811
- return null;
812
- }
813
- export function isSnappedLine(calcrect, allLineRects) {
814
- if (allLineRects === undefined) return false;
815
- var r2 = calcrect.rect[2];
816
- var r3 = calcrect.rect[3];
817
- var result = allLineRects.some(function (linerect) {
818
- var l2 = linerect.rect[2];
819
- var l3 = linerect.rect[3];
820
- var delta = verticesDistance(l2, r3) + verticesDistance(r3, r2) + verticesDistance(r2, l3) - verticesDistance(l3, l2);
821
- if (delta < EPSILON) {
822
- return true;
823
- } else {
824
- l2 = linerect.rect[3];
825
- l3 = linerect.rect[2];
826
- delta = verticesDistance(l2, r3) + verticesDistance(r3, r2) + verticesDistance(r2, l3) - verticesDistance(l3, l2);
827
- return delta < EPSILON;
828
- }
829
- });
830
- return result;
831
- }
832
- export function isSnappedSideLine(calcrect, allLineRects) {
833
- if (allLineRects === undefined) return 0;
834
- var r2 = calcrect.rect[1];
835
- var r3 = calcrect.rect[2];
836
- var result = allLineRects.some(function (linerect) {
837
- var l2 = linerect.rect[2];
838
- var l3 = linerect.rect[3];
839
- var delta = verticesDistance(l2, r3) + verticesDistance(r3, r2) + verticesDistance(r2, l3) - verticesDistance(l3, l2);
840
- return delta < EPSILON;
841
- });
842
- return result;
843
- }
844
-
845
- /** Calculate candidate positions */
846
- export function getAllItemSnap(allItemRects) {
847
- var allItemSnap = [];
848
- var cur = allItemRects.cur;
849
-
850
- // For development
851
- var otherItems = allItemRects.otherItems,
852
- currentItem = allItemRects.currentItem;
853
- allItemRects.others.forEach(function (rect, index) {
854
- var cw = cur && cur.size.width / 2;
855
- var ch = cur && cur.size.height / 2;
856
- var cos = Math.cos(rect.rotRad);
857
- var sin = Math.sin(rect.rotRad);
858
- var ox0 = cw * cos - ch * sin; // (cw, ch) rot
859
- var oy0 = cw * sin + ch * cos;
860
- var ox1 = -cw * cos - ch * sin; // (-cw, ch) rot
861
- var oy1 = -cw * sin + ch * cos;
862
- var ox2 = ch * sin - cw * cos;
863
- var oy2 = -ch * cos - cw * sin;
864
- var ox3 = ch * sin + cw * cos;
865
- var oy3 = -ch * cos + cw * sin;
866
- var nrot = rect.rotRad + Math.PI;
867
- if (nrot >= Math.PI) nrot -= Math.PI * 2;
868
- var snap1 = itemrectInfo(rect.rect[2].x + ox3, rect.rect[2].y + oy3, rect.rotRad, cur && cur.size, rect.layoutpos, rect.is_corner);
869
- var snap2 = itemrectInfo(rect.rect[3].x + ox2, rect.rect[3].y + oy2, rect.rotRad, cur && cur.size, rect.layoutpos, rect.is_corner);
870
- var snap3 = itemrectInfo(rect.rect[2].x + ox1, rect.rect[2].y + oy1, nrot, cur && cur.size, rect.layoutpos, rect.is_corner);
871
- var snap4 = itemrectInfo(rect.rect[3].x + ox0, rect.rect[3].y + oy0, nrot, cur && cur.size, rect.layoutpos, rect.is_corner);
872
- var sizeinfo = otherItems[index].cat && otherItems[index].cat.info.sizeinfo;
873
- if (sizeinfo) {
874
- var leftBlindLength = sizeinfo.leftBlindLength,
875
- rightBlindLength = sizeinfo.rightBlindLength;
876
- if (leftBlindLength > 0) {
877
- var vx = leftBlindLength - ch;
878
- var vy = cw;
879
- var dx = vx * cos + vy * sin;
880
- var dy = vx * sin - vy * cos;
881
- var snap6 = itemrectInfo(rect.rect[0].x + dx, rect.rect[0].y + dy, rect.rotRad + Math.PI / 2, cur && cur.size, rect.layoutpos, rect.is_corner);
882
- allItemSnap.push(snap6);
883
- }
884
- if (rightBlindLength > 0) {
885
- var _vx = ch - rightBlindLength;
886
- var _vy = cw;
887
- var _dx = _vx * cos + _vy * sin;
888
- var _dy = _vx * sin - _vy * cos;
889
- var snap7 = itemrectInfo(rect.rect[1].x + _dx, rect.rect[1].y + _dy, rect.rotRad - Math.PI / 2, cur && cur.size, rect.layoutpos, rect.is_corner);
890
- allItemSnap.push(snap7);
891
- }
892
- }
893
- if (rect.isSnappedLine) {
894
- snap1.isSnappedLine = true;
895
- snap2.isSnappedLine = true;
896
- }
897
- if (rect.is_corner) {
898
- var _nrot = rect.rotRad + Math.PI * 3 / 2;
899
- if (_nrot >= Math.PI) _nrot -= Math.PI * 2;
900
- var snap5 = itemrectInfo(rect.rect[1].x - oy1, rect.rect[1].y + ox1, _nrot, cur && cur.size, rect.layoutpos, rect.is_corner);
901
- allItemSnap.push(snap2);
902
- allItemSnap.push(snap5);
903
- } else {
904
- allItemSnap.push(snap1);
905
- allItemSnap.push(snap2);
906
- allItemSnap.push(snap3);
907
- allItemSnap.push(snap4);
908
- }
909
- });
910
- return allItemSnap;
911
- }
912
- export function getAllArea(layer) {
913
- var allAreaLines = [];
914
- var allLines = [];
915
- var verticesArray = [];
916
- var vertexID_to_verticesArrayIndex = {};
917
- layer.vertices.forEach(function (vertex) {
918
- var verticesCount = verticesArray.push([vertex.x, vertex.y]);
919
- var latestVertexIndex = verticesCount - 1;
920
- vertexID_to_verticesArrayIndex[vertex.id] = latestVertexIndex;
921
- });
922
- layer.areas.forEach(function (area) {
923
- allAreaLines.push(area.vertices);
924
- });
925
- allAreaLines.forEach(function (area) {
926
- var pt = [];
927
- area.forEach(function (element) {
928
- pt.push({
929
- x: verticesArray[vertexID_to_verticesArrayIndex[element]][0],
930
- y: verticesArray[vertexID_to_verticesArrayIndex[element]][1]
931
- });
932
- });
933
- allLines.push(pt);
934
- });
935
- return allLines;
936
- }
937
-
938
- /** Get all lines of the scene */
939
- export function getAllLines(layer) {
940
- var allAreaLines = getAllAreaLines(layer);
941
- var allLines = [];
942
- //let allNonAreaLines = [];
943
- var thick = LINE_THICKNESS / 2;
944
- layer.lines.forEach(function (line) {
945
- var i = containLine(allAreaLines, line);
946
- // let thick = line.properties.getIn(['thickness', 'length']);
947
- if (i < 0) {
948
- var vertices = line.vertices.toJS();
949
- var tmp_vertices = {
950
- x1: layer.vertices.get(vertices[0]).x,
951
- y1: layer.vertices.get(vertices[0]).y,
952
- x2: layer.vertices.get(vertices[1]).x,
953
- y2: layer.vertices.get(vertices[1]).y
954
- };
955
- if (tmp_vertices.x1 == tmp_vertices.x2 && tmp_vertices.y1 == tmp_vertices.y2) return;
956
- var addIdx = allLines.length;
957
- var flag = 0;
958
- allLines.forEach(function (element, idx) {
959
- if (flag == 0) {
960
- var el = element[0];
961
- var tmp_el = {
962
- x1: layer.vertices.get(el[0]).x,
963
- y1: layer.vertices.get(el[0]).y,
964
- x2: layer.vertices.get(el[1]).x,
965
- y2: layer.vertices.get(el[1]).y
966
- };
967
- if (tmp_el.x1 == tmp_vertices.x1 && tmp_el.y1 == tmp_vertices.y1) {
968
- var tmp = vertices[0];
969
- vertices[0] = vertices[1];
970
- vertices[1] = tmp;
971
- addIdx = idx == 0 ? 0 : idx - 1;
972
- flag = 1;
973
- } else if (tmp_el.x2 == tmp_vertices.x1 && tmp_el.y2 == tmp_vertices.y1) {
974
- addIdx = idx;
975
- flag = 1;
976
- } else if (tmp_el.x1 == tmp_vertices.x2 && tmp_el.y1 == tmp_vertices.y2) {
977
- addIdx = idx == 0 ? 0 : idx - 1;
978
- flag = 1;
979
- } else if (tmp_el.x2 == tmp_vertices.x2 && tmp_el.y2 == tmp_vertices.y2) {
980
- var _tmp = vertices[0];
981
- vertices[0] = vertices[1];
982
- vertices[1] = _tmp;
983
- addIdx = idx;
984
- flag = 1;
985
- }
986
- }
987
- });
988
- allLines.splice(addIdx, 0, [vertices, thick]);
989
- } else {
990
- allLines.push([allAreaLines[i], thick]);
991
- }
992
- });
993
- return allLines;
994
- }
995
-
996
- /** Get lines that wraps the area */
997
- export function getAllAreaLines(layer) {
998
- var areainfo = [];
999
- layer.areas.forEach(function (area) {
1000
- var sz = area.vertices.size;
1001
- for (var i = 0; i < sz; i++) {
1002
- areainfo.push([area.vertices.get(i), area.vertices.get((i + 1) % sz)]);
1003
- }
1004
- });
1005
- return areainfo;
1006
- }
1007
- export function containLine(lines, line) {
1008
- // lines: [array]
1009
- var sz = lines.length;
1010
- for (var i = 0; i < sz; i++) {
1011
- var l = lines[i];
1012
- if (line.vertices.get(0) == l[0] && line.vertices.get(1) == l[1] || line.vertices.get(1) == l[0] && line.vertices.get(0) == l[1]) {
1013
- return i;
1014
- }
1015
- }
1016
- return -1;
1017
- }
1018
- export function buildRectFromLines(layer, lines) {
1019
- var rect = [];
1020
- lines.forEach(function (line) {
1021
- var vxys = []; // 0: x0, 1: y0, 2: x1, 3: y1
1022
- line[0].forEach(function (vertex) {
1023
- var vert = layer.vertices.get(vertex);
1024
- vxys.push(vert.x);
1025
- vxys.push(vert.y);
1026
- });
1027
- var thick = line[1];
1028
- var x0 = vxys[0];
1029
- var y0 = vxys[1];
1030
- var x1 = vxys[2];
1031
- var y1 = vxys[3];
1032
- rect.push(getCalcRectFromLine(x0, y0, x1, y1, thick, layer));
1033
- });
1034
- return rect;
1035
- }
1036
- export function getRelatedVertices(x0, y0, x1, y1, layer) {
1037
- var verticesArray = [];
1038
- var mapVertIDtoIndex = {};
1039
- layer.vertices.forEach(function (vertex) {
1040
- var verticesCount = verticesArray.push([vertex.x, vertex.y]);
1041
- var latestVertexIndex = verticesCount - 1;
1042
- mapVertIDtoIndex[vertex.id] = latestVertexIndex;
1043
- });
1044
- var relVerts = [];
1045
- layer.lines.some(function (line) {
1046
- var vertID0 = line.vertices.get(0);
1047
- var vertID1 = line.vertices.get(1);
1048
- var pt0 = {
1049
- x: verticesArray[mapVertIDtoIndex[vertID0]][0],
1050
- y: verticesArray[mapVertIDtoIndex[vertID0]][1]
1051
- };
1052
- var pt1 = {
1053
- x: verticesArray[mapVertIDtoIndex[vertID1]][0],
1054
- y: verticesArray[mapVertIDtoIndex[vertID1]][1]
1055
- };
1056
- 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) {
1057
- if (line.relatedVertices.size == 2) {
1058
- var relPt0 = point(x0, y0);
1059
- var relPt1 = point(x1, y1);
1060
- line.relatedVertices.forEach(function (relatedVertice, index) {
1061
- if (relatedVertice.index == undefined) relatedVertice = relatedVertice.toJSON();
1062
- if (relatedVertice.index == 0) relPt0 = point(relatedVertice.point.x, relatedVertice.point.y);else relPt1 = point(relatedVertice.point.x, relatedVertice.point.y);
1063
- });
1064
- relVerts.push(relPt0);
1065
- relVerts.push(relPt1);
1066
- }
1067
- return true;
1068
- }
1069
- });
1070
- return relVerts;
1071
- }
1072
- export function getCalcRectFromLine(x0, y0, x1, y1, thick, layer) {
1073
- // get line from vertex coordinate
1074
- var relVerts = getRelatedVertices(x0, y0, x1, y1, layer);
1075
- var dx = x1 - x0;
1076
- var dy = y1 - y0;
1077
- var dl = Math.sqrt(dx * dx + dy * dy);
1078
- var ox = -dy / dl * thick;
1079
- var oy = dx / dl * thick;
1080
- var rot = Math.atan2(dy, dx);
1081
- if (relVerts.length == 2) {
1082
- var vN = point(ox, oy);
1083
- var vR = point(relVerts[0].x - x0, relVerts[0].y - y0);
1084
- if (dotprod(vN, vR) < 0) {
1085
- ox = -ox;
1086
- oy = -oy;
1087
- } else {
1088
- rot += Math.PI;
1089
- }
1090
- } else {
1091
- var pt0 = point(x0 + ox, y0 + oy);
1092
- var pt1 = point(x1 + ox, y1 + oy);
1093
- var ptC = point((pt0.x + pt1.x) / 2, (pt0.y + pt1.y) / 2);
1094
- var allArea = getAllArea(layer);
1095
- if (isPointInArea(allArea, ptC)) {
1096
- // try make rect under line
1097
- var _pt0 = point(x0 - ox, y0 - oy);
1098
- var _pt1 = point(x1 - ox, y1 - oy);
1099
- var _ptC = point((_pt0.x + _pt1.x) / 2, (_pt0.y + _pt1.y) / 2);
1100
- if (!isPointInArea(allArea, _ptC)) {
1101
- // only under rect is not included in area, make rect under line
1102
- ox = -ox;
1103
- oy = -oy;
1104
- }
1105
- }
1106
- }
1107
- return {
1108
- rectEnd: [point(x0 + ox / 2, y0 + oy / 2), point(x1 + ox / 2, y1 + oy / 2)],
1109
- rect: [point(x0 + ox, y0 + oy), point(x1 + ox, y1 + oy), point(x1, y1), point(x0, y0)],
1110
- pos: point((x0 + x1 + ox) / 2, (y0 + y1 + ox) / 2),
1111
- rotRad: rot,
1112
- size: {
1113
- width: dl,
1114
- height: thick / 2
1115
- }
1116
- };
1117
- }
1118
- export function getAllLineSnap(allLineRects, curItemRect) {
1119
- var allLineSnap = [];
1120
- var cur = curItemRect;
1121
- if (cur === undefined || cur === null) return;else allLineRects.forEach(function (rect) {
1122
- var cw = cur.size.width / 2;
1123
- var ch = cur.size.height / 2;
1124
- var cos = Math.cos(rect.rotRad);
1125
- var sin = Math.sin(rect.rotRad);
1126
- var ox0 = cw * cos - ch * sin; // (cw, ch) rot
1127
- var oy0 = cw * sin + ch * cos;
1128
- var ox1 = -cw * cos - ch * sin; // (-cw, ch) rot
1129
- var oy1 = -cw * sin + ch * cos;
1130
- var nrot = rect.rotRad + Math.PI;
1131
- if (nrot >= Math.PI) nrot -= Math.PI * 2;
1132
- var thick = rect.size.height;
1133
- var snap3 = itemInfo(rect.rect[2].x + ox1, rect.rect[2].y + oy1, nrot, cur.size);
1134
- var snap4 = itemInfo(rect.rect[3].x + ox0, rect.rect[3].y + oy0, nrot, cur.size);
1135
- if (!cur.is_corner) {
1136
- allLineSnap.push(snap3);
1137
- }
1138
- allLineSnap.push(snap4);
1139
- });
1140
- return allLineSnap;
1141
- }
1142
- export function validateSnaps(allSnaps, allRects) {
1143
- var validSnaps = [];
1144
- if (allSnaps !== undefined && allSnaps !== null && allSnaps.length > 0) allSnaps.forEach(function (snap) {
1145
- if (validSnap(snap, allRects)) {
1146
- validSnaps.push(snap);
1147
- }
1148
- });
1149
- return validSnaps;
1150
- }
1151
- export function validateLineSnaps(allSnaps, allItemSnap, allLineSnap, allItemRects, allLineRects, allRects) {
1152
- var validSnaps = [];
1153
- allSnaps.forEach(function (snap) {
1154
- if (validSnap(snap, allRects)) {
1155
- validSnaps.push(snap);
1156
- } else {
1157
- allItemSnap.forEach(function (snap) {
1158
- validSnaps.push(snap);
1159
- });
1160
- allLineSnap.forEach(function (snap) {
1161
- validSnaps.push(snap);
1162
- });
1163
- }
1164
- });
1165
- return validSnaps;
1166
- }
1167
- export function validSnap(snap, rects) {
1168
- var snaprect = getCalcRectFromItem(snap);
1169
- return rects.every(function (rect) {
1170
- return !intersectRect(rect.rect, snaprect.rect);
1171
- });
1172
- }
1173
- export function itemInfo(x, y, rotRad, size) {
1174
- return {
1175
- pos: {
1176
- x: x,
1177
- y: y
1178
- },
1179
- rotRad: rotRad,
1180
- size: size
1181
- };
1182
- }
1183
- export function intersectRect(rect1, rect2) {
1184
- var ret = false;
1185
- rect1 = shrinkRect(rect1);
1186
- rect2 = shrinkRect(rect2);
1187
- ret = ret || getInterSect(rect1, rect2);
1188
- ret = ret || rect1.some(function (pt) {
1189
- return containPointInRect(pt, rect2);
1190
- });
1191
- ret = ret || rect2.some(function (pt) {
1192
- return containPointInRect(pt, rect1);
1193
- });
1194
- return ret;
1195
- }
1196
- export function containPointInRect(point, rect) {
1197
- // true: contain, false: not contain
1198
- for (var i = 0; i < rect.length; i++) {
1199
- var ni = (i + 1) % rect.length;
1200
- if (crossprod(diff(point, rect[i]), diff(rect[i], rect[ni])) < 0) {
1201
- return false;
1202
- }
1203
- }
1204
- return true;
1205
- }
1206
- export function diff(v0, v1) {
1207
- return {
1208
- x: v0.x - v1.x,
1209
- y: v0.y - v1.y
1210
- };
1211
- }
1212
- export function crossprod(v0, v1) {
1213
- return v0.x * v1.y - v0.y * v1.x;
1214
- }
1215
- export function shrinkRect(rect) {
1216
- var v02x = rect[2].x - rect[0].x;
1217
- var v02y = rect[2].y - rect[0].y;
1218
- var d02 = Math.sqrt(v02x * v02x + v02y * v02y);
1219
- var o02x = v02x / d02 * 0.1;
1220
- var o02y = v02y / d02 * 0.1;
1221
- var v13x = rect[3].x - rect[1].x;
1222
- var v13y = rect[3].y - rect[1].y;
1223
- var d13 = Math.sqrt(v02x * v02x + v02y * v02y);
1224
- var o13x = v13x / d13 * 0.1;
1225
- var o13y = v13y / d13 * 0.1;
1226
- 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)];
1227
- }
1228
- export function getInterSect(shape1, shape2) {
1229
- // return result of intersect of two shape
1230
- var count = 0;
1231
- for (var i = 0; i < shape1.length; i++) {
1232
- var sl1 = {
1233
- x: shape1[i].x,
1234
- y: shape1[i].y
1235
- };
1236
- var sl2 = {
1237
- x: shape1[(i + 1) % shape1.length].x,
1238
- y: shape1[(i + 1) % shape1.length].y
1239
- };
1240
- for (var j = 0; j < shape2.length; j++) {
1241
- var el1 = {
1242
- x: shape2[j].x,
1243
- y: shape2[j].y
1244
- };
1245
- var el2 = {
1246
- x: shape2[(j + 1) % shape2.length].x,
1247
- y: shape2[(j + 1) % shape2.length].y
1248
- };
1249
- var flag = getLineInterSect(sl1.x, sl1.y, sl2.x, sl2.y, el1.x, el1.y, el2.x, el2.y);
1250
- if (flag) {
1251
- count++;
1252
- if (count > 1) return true;
1253
- }
1254
- }
1255
- }
1256
- return false;
1257
- }
1258
- export function getLineInterSect(s1x, s1y, e1x, e1y, s2x, s2y, e2x, e2y) {
1259
- var ax = s1x;
1260
- var ay = s1y;
1261
- var bx = e1x - s1x;
1262
- var by = e1y - s1y;
1263
- var cx = s2x;
1264
- var cy = s2y;
1265
- var dx = e2x - s2x;
1266
- var dy = e2y - s2y;
1267
- if (Math.abs(bx * dy - by * dx) < 0.00000001) {
1268
- if (Math.abs((cx - ax) * by - (cy - ay) * bx) < 0.00000001) {
1269
- var maxX = ax;
1270
- var minX = ax;
1271
- var maxY = ay;
1272
- var minY = ay;
1273
- if (maxX < e1x) maxX = e1x;
1274
- if (maxX < cx) maxX = cx;
1275
- if (maxX < e2x) maxX = e2x;
1276
- if (minX > e1x) minX = e1x;
1277
- if (minX > cx) minX = cx;
1278
- if (minX > e2x) minX = e2x;
1279
- if (maxY < e1y) maxY = e1y;
1280
- if (maxY < cy) maxY = cy;
1281
- if (maxY < e2y) maxY = e2y;
1282
- if (minY > e1y) minY = e1y;
1283
- if (minY > cy) minY = cy;
1284
- if (minY > e2y) minX = e2y;
1285
- var len = Math.sqrt((maxX - minX) * (maxX - minX) + (maxY - minY) * (maxY - minY));
1286
- var len1 = Math.sqrt(bx * bx + by * by);
1287
- var len2 = Math.sqrt(dx * dx + dy * dy);
1288
- if (len < len1 + len2) {
1289
- return true;
1290
- } else {
1291
- return false;
1292
- }
1293
- } else {
1294
- return false;
1295
- }
1296
- } else {
1297
- var t = (dx * (ay - cy) + dy * (cx - ax)) / (bx * dy - by * dx);
1298
- var u = (bx * (cy - ay) + by * (ax - cx)) / (dx * by - dy * bx);
1299
- var ret = u < 1 && u > 0 && t > 0 && t < 1;
1300
- return ret;
1301
- }
1302
- }
1303
- export function isPointInArea(allArea, pt) {
1304
- var x = pt.x;
1305
- var y = pt.y;
1306
- var result = false;
1307
- result = allArea.some(function (area) {
1308
- var sum = 0,
1309
- alpha = 0;
1310
- for (var i = 0; i < area.length; i++) {
1311
- var x0 = area[i].x;
1312
- var y0 = area[i].y;
1313
- var x1 = area[(i + 1) % area.length].x;
1314
- var y1 = area[(i + 1) % area.length].y;
1315
- var v0 = {
1316
- x: x0 - x,
1317
- y: y0 - y
1318
- };
1319
- var v1 = {
1320
- x: x1 - x,
1321
- y: y1 - y
1322
- };
1323
- if (Math.abs(v0.x) < EPSILON && Math.abs(v0.y) < EPSILON)
1324
- // check if pt is area point
1325
- return true;
1326
-
1327
- // check if pt is in area line
1328
- var lineLen = Math.sqrt((x1 - x0) * (x1 - x0) + (y1 - y0) * (y1 - y0));
1329
- var v0Len = Math.sqrt(v0.x * v0.x + v0.y * v0.y);
1330
- var vPt = {
1331
- x: -v0.x / v0Len,
1332
- y: -v0.y / v0Len
1333
- };
1334
- var xE = x0 + vPt.x * lineLen;
1335
- var yE = y0 + vPt.y * lineLen;
1336
- if (v0Len <= lineLen && Math.abs(xE - x1) < EPSILON && Math.abs(yE - y1) < EPSILON) return true;
1337
- alpha = Math.atan2(v0.x * v1.y - v1.x * v0.y, v0.x * v1.x + v0.y * v1.y);
1338
- sum += alpha;
1339
- }
1340
- if (Math.abs(Math.abs(sum) - Math.PI * 2) < EPSILON) return true;
1341
- });
1342
- return result;
1343
- }
1344
- export function calcSnap(allItemRect, allItemSnap, allLineRects, allLineSnap, allRect, x, y, allAreaLines) {
1345
- return calcSnap2(allItemRect, allItemSnap, allLineRects, allLineSnap, allRect, x, y, allAreaLines);
1346
- }
1347
- export function calcCreateSnap(allItemRect, allItemSnap, allLineRects, allLineSnap, allRect, x, y, polygonPoint) {
1348
- // Validate required input and guard against missing `.cur`
1349
- if (!allItemRect || !allItemRect.cur) return;
1350
- var cur = allItemRect.cur; // safe alias
1351
- var cx = x;
1352
- var cy = y;
1353
- var ndist = 5000;
1354
- var rotRad = cur.rotRad;
1355
-
1356
- // Get candidate snaps and validate them as before
1357
- var allCurSnap = getAllCurSnap(allLineRects, x, y, cur);
1358
- allCurSnap = validateLineSnaps(allCurSnap, allItemSnap, allLineSnap, allItemRect, allLineRects, allRect);
1359
- var getSnap = false;
1360
- var snapdist = [];
1361
-
1362
- // Build distances for snaps that lie inside polygonPoint (if any)
1363
- if (Array.isArray(allCurSnap)) {
1364
- allCurSnap.forEach(function (snap) {
1365
- if (!snap || !snap.pos) return;
1366
- var inside = ContainsPoint(polygonPoint, snap.pos.x, snap.pos.y);
1367
- if (inside) {
1368
- var dx = snap.pos.x - x;
1369
- var dy = snap.pos.y - y;
1370
- snapdist.push(dx * dx + dy * dy);
1371
- }
1372
- });
1373
- }
1374
-
1375
- // Find minimum distance (Infinity if none)
1376
- var edist = snapdist.length ? Math.min.apply(Math, snapdist) : Infinity;
1377
-
1378
- // Choose the snap with distance === edist
1379
- if (Array.isArray(allCurSnap)) {
1380
- allCurSnap.forEach(function (snap) {
1381
- if (!snap || !snap.pos) return;
1382
- var dx = snap.pos.x - x;
1383
- var dy = snap.pos.y - y;
1384
- var dist = dx * dx + dy * dy;
1385
- if (dist === edist) {
1386
- var _snap$rotRad;
1387
- ndist = dist;
1388
- cx = snap.pos.x;
1389
- cy = snap.pos.y;
1390
- rotRad = (_snap$rotRad = snap.rotRad) !== null && _snap$rotRad !== void 0 ? _snap$rotRad : rotRad; // nullish coalescing
1391
- getSnap = true;
1392
- }
1393
- });
1394
- }
1395
- var crot = rotRad / Math.PI * 180;
1396
- return {
1397
- cx: cx,
1398
- cy: cy,
1399
- crot: crot,
1400
- rotRad: rotRad
1401
- };
1402
- }
1403
-
1404
- ////////////
1405
- export function calcSnap1(allItemRect, allItemSnap, allLineRects, allLineSnap, allRect, x, y) {
1406
- var cx = allItemRect.cur.pos.x;
1407
- var cy = allItemRect.cur.pos.y;
1408
- var nx = x;
1409
- var ny = y;
1410
- var cursize = allItemRect.cur.size;
1411
- var ndist = cursize.width * cursize.width + cursize.height * cursize.height;
1412
- ndist = ndist / 4;
1413
- var rotRad = allItemRect.cur.rotRad;
1414
- var allCurSnap = getAllCurSnap(allLineRects, x, y, allItemRect.cur);
1415
- allCurSnap = validateSnaps(allCurSnap, allRect);
1416
- var getSnap = false;
1417
- allCurSnap.forEach(function (snap) {
1418
- var dist = (snap.pos.x - x) * (snap.pos.x - x) + (snap.pos.y - y) * (snap.pos.y - y);
1419
- if (dist < ndist) {
1420
- ndist = dist;
1421
- nx = snap.pos.x;
1422
- ny = snap.pos.y;
1423
- rotRad = snap.rotRad;
1424
- getSnap = true;
1425
- }
1426
- });
1427
- if (!getSnap) {
1428
- allLineSnap.concat(allItemSnap).forEach(function (snap) {
1429
- var dist = (snap.pos.x - x) * (snap.pos.x - x) + (snap.pos.y - y) * (snap.pos.y - y);
1430
- if (dist < ndist) {
1431
- ndist = dist;
1432
- nx = snap.pos.x;
1433
- ny = snap.pos.y;
1434
- rotRad = snap.rotRad;
1435
- }
1436
- });
1437
- }
1438
- var rot = rotRad / Math.PI * 180;
1439
- var ret = {
1440
- nx: nx,
1441
- ny: ny,
1442
- rot: rot,
1443
- rotRad: rotRad
1444
- };
1445
- return ret;
1446
- }
1447
-
1448
- ////////////
1449
- export function calcSnap2(allItemRect, allItemSnap, allLineRects, allLineSnap, allRect, x, y, allArea) {
1450
- var nx = x;
1451
- var ny = y;
1452
- var ndist = 20;
1453
- var rotRad = allItemRect.cur && allItemRect.cur.rotRad;
1454
- var val = {
1455
- pos: {
1456
- x: x,
1457
- y: y
1458
- },
1459
- rotRad: rotRad
1460
- };
1461
- val.size = allItemRect.cur && allItemRect.cur.size;
1462
- val.layoutpos = allItemRect.cur && allItemRect.cur.layoutpos;
1463
- val.is_corner = allItemRect.cur && allItemRect.cur.is_corner;
1464
- var curitem = getCalcRectFromItem(val);
1465
- var allCurSnap = [];
1466
- //if (!val.is_corner) {
1467
- allCurSnap = getAllCurSnap(allLineRects, x, y, allItemRect.cur);
1468
- allCurSnap = validateSnaps(allCurSnap, allRect);
1469
- //}
1470
- var getSnap = false;
1471
- var snapdist = [];
1472
- //console.log("allItemSnap", allItemSnap.filter(e => e.isSnappedLine))
1473
- //console.log("~~~~start~~~~");
1474
- allItemSnap.filter(function (e) {
1475
- return e.isSnappedLine;
1476
- }).forEach(function (snap) {
1477
- var dist = (snap.pos.x - x) * (snap.pos.x - x) + (snap.pos.y - y) * (snap.pos.y - y);
1478
- snapdist.push(dist);
1479
- //console.log("dist", snap)
1480
- if (isPointInArea(allArea, snap.pos) || !allArea.length) if (dist < 100) {
1481
- ndist = dist;
1482
- nx = snap.pos.x;
1483
- ny = snap.pos.y;
1484
- rotRad = snap.rotRad;
1485
- getSnap = true;
1486
-
1487
- //console.log("SUCCESS!!!!");
1488
- }
1489
- });
1490
- //console.log("====end====");
1491
- if (getSnap == false) {
1492
- allCurSnap.forEach(function (snap) {
1493
- var dist = (snap.pos.x - x) * (snap.pos.x - x) + (snap.pos.y - y) * (snap.pos.y - y);
1494
- snapdist.push(dist);
1495
- if (isPointInArea(allArea, snap.pos) || !allArea.length) if (dist < ndist) {
1496
- ndist = dist;
1497
- nx = snap.pos.x;
1498
- ny = snap.pos.y;
1499
- rotRad = snap.rotRad;
1500
- getSnap = true;
1501
- //console.log("SUCCE!!!!");
1502
- }
1503
- });
1504
- if (!getSnap && allLineRects.some(function (others) {
1505
- return intersectRect(others.rect, curitem.rect);
1506
- })) {
1507
- var edist = Math.min.apply(null, snapdist);
1508
- allCurSnap.forEach(function (snap) {
1509
- var dist = (snap.pos.x - x) * (snap.pos.x - x) + (snap.pos.y - y) * (snap.pos.y - y);
1510
- if (isPointInArea(allArea, snap.pos) || !allArea.length) if (dist === edist) {
1511
- ndist = dist;
1512
- nx = snap.pos.x;
1513
- ny = snap.pos.y;
1514
- rotRad = snap.rotRad;
1515
- getSnap = true;
1516
- }
1517
- });
1518
- }
1519
- if (getSnap === false) {
1520
- var nearRect = null;
1521
- var minDist = Infinity;
1522
- allLineRects.forEach(function (rect) {
1523
- var e = rect.rectEnd[0];
1524
- e = clone_point(e);
1525
- e.x -= curitem.pos.x;
1526
- e.y -= curitem.pos.y;
1527
- var nRot = rect.rotRad + Math.PI / 2;
1528
- var dist = Math.abs(e.x * Math.cos(nRot) + e.y * Math.sin(nRot));
1529
- if (minDist > dist) {
1530
- minDist = dist;
1531
- nearRect = rect;
1532
- }
1533
- });
1534
- var containrect = nearRect && intersectRect(nearRect.rect, curitem.rect);
1535
- if (containrect) {
1536
- var filter_func = function filter_func(snap) {
1537
- var diff = Math.abs(snap.rotRad - nearRect.rotRad - Math.PI);
1538
- return diff == 0 || diff == 2 * Math.PI;
1539
- };
1540
- var tempSnap = allLineSnap.filter(filter_func);
1541
- tempSnap = tempSnap.concat(allLineSnap.filter(function (snap) {
1542
- return !filter_func(snap);
1543
- }));
1544
- tempSnap.some(function (snap) {
1545
- var dist = (snap.pos.x - x) * (snap.pos.x - x) + (snap.pos.y - y) * (snap.pos.y - y);
1546
- if (isPointInArea(allArea, snap.pos) || !allArea.length) if (dist < 5000) {
1547
- nx = snap.pos.x;
1548
- ny = snap.pos.y;
1549
- rotRad = snap.rotRad;
1550
- getSnap = true;
1551
- return true;
1552
- }
1553
- return false;
1554
- });
1555
- }
1556
- }
1557
- if (allItemRect.others.some(function (others) {
1558
- return intersectRect(others.rect, curitem.rect);
1559
- })) {
1560
- getSnap = false;
1561
- }
1562
- if (!getSnap) {
1563
- var _snapdist = [];
1564
- allItemSnap.forEach(function (snap) {
1565
- var dist = (snap.pos.x - x) * (snap.pos.x - x) + (snap.pos.y - y) * (snap.pos.y - y);
1566
- _snapdist.push(dist);
1567
- if (isPointInArea(allArea, snap.pos) || !allArea.length) if (dist < ndist) {
1568
- ndist = dist;
1569
- nx = snap.pos.x;
1570
- ny = snap.pos.y;
1571
- rotRad = snap.rotRad;
1572
- getSnap = true;
1573
- }
1574
- });
1575
- if (!getSnap && allItemRect.others.some(function (others) {
1576
- return intersectRect(others.rect, curitem.rect);
1577
- })) {
1578
- var _edist = Math.min.apply(null, _snapdist);
1579
- allItemSnap.forEach(function (snap) {
1580
- var dist = (snap.pos.x - x) * (snap.pos.x - x) + (snap.pos.y - y) * (snap.pos.y - y);
1581
- if (isPointInArea(allArea, snap.pos) || !allArea.length) if (dist === _edist) {
1582
- ndist = dist;
1583
- nx = snap.pos.x;
1584
- ny = snap.pos.y;
1585
- rotRad = snap.rotRad;
1586
- }
1587
- });
1588
- if (allItemRect.cur.itemInfo.name.includes('Cook Top')) {
1589
- var intersects = allItemRect.others.filter(function (others) {
1590
- return intersectRect(others.rect, curitem.rect);
1591
- });
1592
- intersects.forEach(function (rect) {
1593
- if (isPointInArea(allArea, rect.itemInfo) || !allArea.length) if (rect.itemInfo.layoutpos.includes(BASE_CABINET_LAYOUTPOS)) {
1594
- nx = rect.itemInfo.x;
1595
- ny = rect.itemInfo.y;
1596
- rotRad = rect.itemInfo.rotation * Math.PI / 180;
1597
- }
1598
- });
1599
- }
1600
- if (allItemRect.cur.itemInfo.name.includes('Hood') || allItemRect.cur.itemInfo.name.includes('Range') || allItemRect.cur.itemInfo.name.includes('Cook Top')) {
1601
- var _intersects = allItemRect.others.filter(function (others) {
1602
- return intersectRect(others.rect, curitem.rect);
1603
- });
1604
- _intersects.forEach(function (rect) {
1605
- if (isPointInArea(allArea, rect.itemInfo) || !allArea.length) if (rect.itemInfo.name.includes('Hood') || rect.itemInfo.name.includes('Range') || rect.itemInfo.name.includes('Cook Top')) {
1606
- nx = rect.itemInfo.x;
1607
- ny = rect.itemInfo.y;
1608
- rotRad = rect.itemInfo.rotation * Math.PI / 180;
1609
- }
1610
- });
1611
- }
1612
- }
1613
- }
1614
- }
1615
- var rot = rotRad / Math.PI * 180;
1616
-
1617
- //Check case.
1618
- //If item is 'blind base cabinet', it must be pulled from other 3".
1619
- if (allItemRect.cur && allItemRect.cur.itemInfo.sku_number.startsWith('BBC')) {
1620
- var offset3inch = convert(3).from('in').to('cm');
1621
- var tx = nx,
1622
- ty = ny;
1623
- if (allItemRect.cur && allItemRect.cur.itemInfo.sku_number.endsWith('-L')) {
1624
- if (rot == 0 || rot == -180) {
1625
- tx -= offset3inch * Math.cos(rotRad);
1626
- }
1627
- if (rot == 90 || rot == -90) {
1628
- ty -= offset3inch * Math.sin(rotRad);
1629
- }
1630
- }
1631
- if (allItemRect.cur && allItemRect.cur.itemInfo.sku_number.endsWith('-R')) {
1632
- if (rot == 0 || rot == -180) {
1633
- tx += offset3inch * Math.cos(rotRad);
1634
- }
1635
- if (rot == 90 || rot == -90) {
1636
- ty += offset3inch * Math.sin(rotRad);
1637
- }
1638
- }
1639
- var t_val = {
1640
- pos: {
1641
- x: tx,
1642
- y: ty
1643
- },
1644
- rotRad: rotRad,
1645
- size: allItemRect.cur.size,
1646
- layoutpos: allItemRect.cur.layoutpos,
1647
- is_corner: allItemRect.cur.is_corner
1648
- };
1649
- var isItemRectSect = validInterSect(allItemRect.others, t_val);
1650
- var isWallRectSect = validInterSect(allLineRects, t_val);
1651
- if (isItemRectSect && isWallRectSect) {
1652
- nx = tx;
1653
- ny = ty;
1654
- }
1655
- }
1656
- return {
1657
- nx: nx,
1658
- ny: ny,
1659
- rot: rot,
1660
- rotRad: rotRad
1661
- };
1662
- }
1663
-
1664
- ////////////
1665
- export function calcSnap3(allItemRect, allItemSnap, allLineRects, allLineSnap, allRect, x, y) {
1666
- // let layer = scene.layers.get(layerID);
1667
- // let cx = allItemRect.cur.pos.x;
1668
- // let cy = allItemRect.cur.pos.y;
1669
- var nx = x;
1670
- var ny = y;
1671
- var ndist = 20;
1672
- var rotRad = allItemRect.cur.rotRad;
1673
- var val = {
1674
- pos: {
1675
- x: x,
1676
- y: y
1677
- },
1678
- rotRad: rotRad
1679
- };
1680
- val.size = allItemRect.cur.size;
1681
- val.layoutpos = allItemRect.cur.layoutpos;
1682
- val.is_corner = allItemRect.cur.is_corner;
1683
- var curitem = getCalcRectFromItem3D(val);
1684
- var allCurSnap = getAllCurSnap(allLineRects, x, y, allItemRect.cur);
1685
- allCurSnap = validateSnaps(allCurSnap, allRect);
1686
- var getSnap = false;
1687
- var snapdist = [];
1688
- allCurSnap.forEach(function (snap) {
1689
- var dist = (snap.pos.x - x) * (snap.pos.x - x) + (snap.pos.y - y) * (snap.pos.y - y);
1690
- snapdist.push(dist);
1691
- if (dist < ndist) {
1692
- ndist = dist;
1693
- nx = snap.pos.x;
1694
- ny = snap.pos.y;
1695
- rotRad = snap.rotRad;
1696
- getSnap = true;
1697
- } else {
1698
- var i = 0;
1699
- allLineRects.forEach(function (others) {
1700
- var containrect = intersectRect(others.rect, curitem.rect);
1701
- if (containrect) {
1702
- var edist = Math.min.apply(null, snapdist);
1703
- allCurSnap.forEach(function (snap) {
1704
- var dist = (snap.pos.x - x) * (snap.pos.x - x) + (snap.pos.y - y) * (snap.pos.y - y);
1705
- if (dist === edist) {
1706
- ndist = dist;
1707
- nx = snap.pos.x;
1708
- ny = snap.pos.y;
1709
- rotRad = snap.rotRad;
1710
- getSnap = true;
1711
- }
1712
- });
1713
- }
1714
- });
1715
- }
1716
- });
1717
- if (getSnap === false) {
1718
- allLineRects.forEach(function (others) {
1719
- var containrect = intersectRect(others.rect, curitem.rect);
1720
- if (containrect) {
1721
- allLineSnap.forEach(function (snap) {
1722
- var dist = (snap.pos.x - x) * (snap.pos.x - x) + (snap.pos.y - y) * (snap.pos.y - y);
1723
- if (dist < 5000) {
1724
- nx = snap.pos.x;
1725
- ny = snap.pos.y;
1726
- rotRad = snap.rotRad;
1727
- getSnap = true;
1728
- }
1729
- });
1730
- }
1731
- });
1732
- }
1733
- allItemRect.others.forEach(function (others) {
1734
- if (!(others.layoutpos === 'base' && allItemRect.cur.layoutpos === 'wall') || !(others.layoutpos === 'wall' && allItemRect.cur.layoutpos === 'base')) {
1735
- var containrect = intersectRect(others.rect, curitem.rect);
1736
- if (containrect) {
1737
- getSnap = false;
1738
- }
1739
- }
1740
- });
1741
- if (!getSnap) {
1742
- var _snapdist2 = [];
1743
- allItemSnap.forEach(function (snap) {
1744
- var dist = (snap.pos.x - x) * (snap.pos.x - x) + (snap.pos.y - y) * (snap.pos.y - y);
1745
- _snapdist2.push(dist);
1746
- if (dist < ndist) {
1747
- ndist = dist;
1748
- nx = snap.pos.x;
1749
- ny = snap.pos.y;
1750
- rotRad = snap.rotRad;
1751
- } else {
1752
- allItemRect.others.forEach(function (others) {
1753
- if (!(others.layoutpos === 'base' && allItemRect.cur.layoutpos === 'wall') || !(others.layoutpos === 'wall' && allItemRect.cur.layoutpos === 'base')) {
1754
- var containrect = intersectRect(others.rect, curitem.rect);
1755
- if (containrect) {
1756
- var edist = Math.min.apply(null, _snapdist2);
1757
- allItemSnap.forEach(function (snap) {
1758
- var dist = (snap.pos.x - x) * (snap.pos.x - x) + (snap.pos.y - y) * (snap.pos.y - y);
1759
- if (dist === edist) {
1760
- ndist = dist;
1761
- nx = snap.pos.x;
1762
- ny = snap.pos.y;
1763
- rotRad = snap.rotRad;
1764
- }
1765
- });
1766
- }
1767
- }
1768
- });
1769
- }
1770
- });
1771
- }
1772
- var rot = rotRad / Math.PI * 180;
1773
- return {
1774
- nx: nx,
1775
- ny: ny,
1776
- rot: rot,
1777
- rotRad: rotRad
1778
- };
1779
- }
1780
- export function getAllCurSnap(allLineRects, x, y, curItemRect) {
1781
- if (!curItemRect) return;
1782
- var allCurSnap = [];
1783
- var thick = LINE_THICKNESS / 2;
1784
- allLineRects.forEach(function (linerect) {
1785
- //allLineRects:left, right, top, bottom line
1786
- var p0 = clone_point(linerect.rect[2]); //point 2(x, y) inside of line
1787
- var p1 = clone_point(linerect.rect[3]); //point 3(x, y) inside of line
1788
- var q = point(x, y); // point of item
1789
- var cos = Math.cos(linerect.rotRad);
1790
- var sin = Math.sin(linerect.rotRad);
1791
- p0.x -= cos * curItemRect.size.width / 2;
1792
- p0.y -= sin * curItemRect.size.width / 2;
1793
- p1.x += cos * curItemRect.size.width / 2;
1794
- p1.y += sin * curItemRect.size.width / 2;
1795
- var n = point(-sin, cos);
1796
- var v3to0 = {
1797
- x: linerect.rect[0].x - p1.x,
1798
- y: linerect.rect[0].y - p1.y
1799
- };
1800
- var fDot = dotprod(n, v3to0);
1801
- if (fDot > 0) {
1802
- // normal vector is crossing the wall
1803
- n.x = -n.x;
1804
- n.y = -n.y;
1805
- }
1806
- var dist = dotprod(diff(p1, q), n);
1807
- var h = point(q.x + dist * n.x, q.y + dist * n.y);
1808
- var nrot = linerect.rotRad + Math.PI;
1809
- if (nrot >= Math.PI) nrot -= Math.PI * 2;
1810
- var o = itemrectInfo(h.x + n.x * (curItemRect && curItemRect.size.height / 2), h.y + n.y * (curItemRect && curItemRect.size.height / 2), nrot, curItemRect && curItemRect.size, curItemRect && curItemRect.layoutpos, curItemRect && curItemRect.is_corner);
1811
- allCurSnap.push(o);
1812
- nrot = nrot + Math.PI;
1813
- o = itemrectInfo(h.x - n.x * (curItemRect && curItemRect.size.height / 2 + thick), h.y - n.y * (curItemRect && curItemRect.size.height / 2 + thick), nrot, curItemRect && curItemRect.size, curItemRect && curItemRect.layoutpos, curItemRect && curItemRect.is_corner);
1814
- allCurSnap.push(o);
1815
- });
1816
- return allCurSnap;
1817
- }
1818
- export function clone_point(pt) {
1819
- return point(pt.x, pt.y);
1820
- }
1821
- export function dotprod(v0, v1) {
1822
- return v0.x * v1.x + v0.y * v1.y;
1823
- }
1824
-
1825
- //////////
1826
- export function validInterSect(rect, val) {
1827
- var curitem = getCalcRectFromItem(val);
1828
- var datas = [];
1829
- rect.forEach(function (line) {
1830
- datas.push(line);
1831
- });
1832
- for (var i = 0; i < datas.length; i++) {
1833
- var data = datas[i];
1834
- var containrect = intersectRect(data.rect, curitem.rect);
1835
- if (containrect) {
1836
- return false;
1837
- }
1838
- }
1839
- return true;
1840
- }
1841
- var lineRect = function lineRect(layer) {
1842
- var areainfo = [];
1843
- layer.areas.forEach(function (area) {
1844
- var sz = area.vertices.size;
1845
- for (var i = 0; i < sz; i++) {
1846
- areainfo.push(area.vertices.get(i));
1847
- }
1848
- });
1849
- var rect = [];
1850
- areainfo.forEach(function (area) {
1851
- var vert = layer.vertices.get(area);
1852
- rect.push(vert.x, vert.y);
1853
- });
1854
- return rect;
1855
- };
1856
- export function getAllHoleRect(scene, val) {
1857
- var layerID = scene.selectedLayer;
1858
- var layer = scene.layers.get(layerID);
1859
- var selectedItem = layer.getIn(['items', layer.selected.items.get(0)]);
1860
- if (selectedItem !== undefined) {
1861
- if (selectedItem.category != 'cabinet') {
1862
- // If selected Item type is not `cabinet` then do not snap at windows
1863
- return {
1864
- isSect: true,
1865
- snap: null
1866
- };
1867
- }
1868
- } else {
1869
- return {
1870
- isSect: false,
1871
- snap: null
1872
- };
1873
- }
1874
- var holes = [];
1875
- var itemRect = getCalcRectFromItem(val);
1876
- layer.lines.forEach(function (line) {
1877
- line.holes.forEach(function (holeID) {
1878
- var hole = layer.holes.get(holeID);
1879
- holes.push(hole);
1880
- });
1881
- });
1882
- var i = 0;
1883
- for (; i < holes.length; i++) {
1884
- var twidth = holes[i].properties.getIn(['width', 'length']);
1885
- var theight = holes[i].properties.getIn(['thickness', 'length']) + 1;
1886
- var tdepth = holes[i].properties.getIn(['altitude', 'length']);
1887
- //let trot = holes[i].rotation;
1888
- var verticeIDs = scene.getIn(['layers', layerID, 'lines', holes[i].line, 'vertices'])._tail.array;
1889
- var vertice0 = scene.getIn(['layers', layerID, 'vertices', verticeIDs[0]]);
1890
- var vertice1 = scene.getIn(['layers', layerID, 'vertices', verticeIDs[1]]);
1891
- var point0 = {
1892
- x: vertice0.x,
1893
- y: vertice0.y
1894
- };
1895
- var point1 = {
1896
- x: vertice1.x,
1897
- y: vertice1.y
1898
- };
1899
- var rotation = Math.atan2(point1.y - point0.y, point1.x - point0.x);
1900
- var rectInfo = getCalcRectFromLine(point0.x, point0.y, point1.x, point1.y, LINE_THICKNESS, layer);
1901
- var vN = point(rectInfo.rect[0].x - rectInfo.rect[3].x, rectInfo.rect[0].y - rectInfo.rect[3].y);
1902
- var lenN = Math.sqrt(vN.x * vN.x + vN.y * vN.y);
1903
- vN.x /= lenN;
1904
- vN.y /= lenN;
1905
- var hx = holes[i].x;
1906
- var hy = holes[i].y;
1907
- hx += theight / 2 * vN.x;
1908
- hy += theight / 2 * vN.y;
1909
- var tval = {
1910
- pos: {
1911
- x: hx,
1912
- y: hy
1913
- },
1914
- rotRad: rotation
1915
- };
1916
- tval.size = {
1917
- width: twidth,
1918
- height: theight
1919
- };
1920
- var hole_rect = getCalcRectFromItem(tval);
1921
- if (intersectRect(itemRect.rect, hole_rect.rect)) {
1922
- if (tdepth > itemRect.size.depth && itemRect.layoutpos !== WALL_CABINET_LAYOUTPOS) {
1923
- var dist = itemRect.size.height / 2 + theight / 2;
1924
- var snap = [];
1925
- var p0 = {
1926
- x: hx + dist * Math.cos(rotation + Math.PI / 2),
1927
- y: hy + dist * Math.sin(rotation + Math.PI / 2)
1928
- };
1929
- var p1 = {
1930
- x: hx - dist * Math.cos(rotation + Math.PI / 2),
1931
- y: hy - dist * Math.sin(rotation + Math.PI / 2)
1932
- };
1933
- var allArea = getAllArea(layer);
1934
- if (isPointInArea(allArea, p0)) {
1935
- snap.push(p0);
1936
- }
1937
- if (isPointInArea(allArea, p1)) {
1938
- snap.push(p1);
1939
- }
1940
- return {
1941
- isSect: true,
1942
- snap: snap
1943
- };
1944
- } else return {
1945
- isSect: false,
1946
- snap: null
1947
- };
1948
- }
1949
- }
1950
- return {
1951
- isSect: true,
1952
- snap: null
1953
- };
1954
- }
1955
- export function getHoleItems(layer) {
1956
- var holeItems = [];
1957
- layer.holes.map(function (hole) {
1958
- var width = hole.properties.getIn(['width', 'length']);
1959
- var altitude = hole.properties.getIn(['altitude', 'length']);
1960
- holeItems.push({
1961
- x: hole.x,
1962
- y: hole.y,
1963
- width: width,
1964
- altitude: altitude
1965
- });
1966
- });
1967
- return holeItems;
1968
- }
1969
- export function needSnap(curItem, othItem) {
1970
- var blSnap = false;
1971
- if (curItem == undefined || curItem == null) return false;
1972
- var altitude = curItem.selectedItem.properties.get('altitude');
1973
- var heightFromFloor = convert(altitude.get('_length')).from(altitude.get('_unit')).to('in');
1974
- var height = curItem.cat.info.sizeinfo.height;
1975
- var currentItem = {
1976
- heightFromFloor: heightFromFloor,
1977
- height: height
1978
- };
1979
- altitude = othItem.item.properties.get('altitude');
1980
- heightFromFloor = convert(altitude.get('_length')).from(altitude.get('_unit')).to('in');
1981
- height = othItem.cat && othItem.cat.info.sizeinfo.height;
1982
- var otherItem = {
1983
- heightFromFloor: heightFromFloor,
1984
- height: height
1985
- };
1986
- var curFloor = currentItem.heightFromFloor;
1987
- var otherFloor = otherItem.heightFromFloor;
1988
- var delta;
1989
- curFloor > otherFloor ? delta = otherItem.height : delta = currentItem.height;
1990
- if (Math.abs(curFloor - otherFloor) < delta) blSnap = true;
1991
- if (curItem.cat.hasOwnProperty('long_name') || othItem.cat && othItem.cat.hasOwnProperty('long_name')) {
1992
- if (curItem.cat.long_name.includes('Hood') || othItem.cat && othItem.cat.long_name.includes('Hood')) blSnap = true;
1993
- if (curItem.cat.long_name.includes('Hood') && othItem.cat && othItem.cat.long_name.includes('Base Cabinet') || curItem.cat.long_name.includes('Base Cabinet') && othItem.cat && othItem.cat.long_name.includes('Hood')) blSnap = false;
1994
- if (curItem.cat.long_name.includes('Cook Top') && othItem.cat && othItem.cat.long_name.includes('Cabinet') || curItem.cat.long_name.includes('Cabinet') && othItem.cat && othItem.cat.long_name.includes('Cook Top')) blSnap = true;
1995
- }
1996
- return blSnap;
1997
- }
1998
- export function isFrontWall(v0, v1) {
1999
- var x1 = v0.x,
2000
- y1 = v0.y;
2001
- var x2 = v1.x,
2002
- y2 = v1.y;
2003
- var alpha = angleBetweenTwoPoints(x1, y1, x2, y2);
2004
- return almostEqual(y1, y2) && x1 < x2 || -Math.PI / 2 < alpha && alpha < Math.PI / 2;
2005
- }
2006
- export function isBackWall(v0, v1) {
2007
- var x1 = v0.x,
2008
- y1 = v0.y;
2009
- var x2 = v1.x,
2010
- y2 = v1.y;
2011
- var alpha = angleBetweenTwoPoints(x1, y1, x2, y2);
2012
- return almostEqual(y1, y2) && x1 > x2 || -Math.PI / 2 > alpha || alpha > Math.PI / 2;
2013
- }
2014
- export function isLeftWall(v0, v1) {
2015
- var x1 = v0.x,
2016
- y1 = v0.y;
2017
- var x2 = v1.x,
2018
- y2 = v1.y;
2019
- var alpha = angleBetweenTwoPoints(x1, y1, x2, y2);
2020
- return almostEqual(x1, x2) && y1 < y2 || Math.PI > alpha && alpha > 0;
2021
- }
2022
- export function isRightWall(v0, v1) {
2023
- var x1 = v0.x,
2024
- y1 = v0.y;
2025
- var x2 = v1.x,
2026
- y2 = v1.y;
2027
- var alpha = angleBetweenTwoPoints(x1, y1, x2, y2);
2028
- return almostEqual(x1, x2) && y1 > y2 || -Math.PI < alpha && alpha < 0;
2029
- }
2030
-
2031
- /**
2032
- * Calculate the overlapping relationship of two lines
2033
- * @param {*} srcLine // source line
2034
- * @param {*} destLine // destination line
2035
- * @returns overlapping status (OVERLAP_NONE | OVERLAP_SAME | OVERLAP_LINK | OVERLAP_INCLUDED | OVERLAP_SOME) and line segments of srcLine which broken with destLine
2036
- * OVERLAP_NONE: two lines are not overlapped
2037
- * OVERLAP_SAME: the start point and endpoint of two lines are same
2038
- * OVERLAP_LINK: two lines are linked at the common point, so they can be merged to one line
2039
- * OVERLAP_INCLUDED: destLine includes srcLine
2040
- * OVERLAP_SOME: two lines are overlapped with some common range, then returns the trimmed segments of srcLine
2041
- *
2042
- * //////// test - start /////////////
2043
- const p1 = { x1: 1413.1313131313132, y1: 1044.949494949495 };
2044
- const p2 = { x1: 1476.2626262626263, y1: 1108.0808080808079 };
2045
- const p3 = { x1: 1596.969696969697, y1: 1228.7878787878785 };
2046
- const p4 = { x1: 1664.1414141414139, y1: 1295.9595959595958 };
2047
- const tempRet = GeometryUtils.relationshipOfTwoOverlappedLines(
2048
- { x1: p3.x1, y1: p3.y1, x2: p1.x1, y2: p1.y1 },
2049
- { x1: p1.x1, y1: p1.y1, x2: p3.x1, y2: p3.y1 }
2050
- );
2051
- console.log(tempRet);
2052
- //////// test - end /////////////
2053
-
2054
- */
2055
- export function relationshipOfTwoOverlappedLines(srcLine, destLine) {
2056
- var INFINITY = 1000000;
2057
- // geometric equation of srcLine
2058
- var dx1 = MathUtils.toFixedFloat(srcLine.x2 - srcLine.x1, 2);
2059
- var dy1 = MathUtils.toFixedFloat(srcLine.y2 - srcLine.y1, 2);
2060
- var a1 = dx1 === 0 ? INFINITY : MathUtils.toFixedFloat(dy1 / dx1, 2);
2061
- var b1 = a1 === INFINITY ? MathUtils.toFixedFloat(srcLine.x1, 2) : MathUtils.toFixedFloat(srcLine.y1 - a1 * srcLine.x1, 2);
2062
- // geometric equation of destLine
2063
- var dx2 = MathUtils.toFixedFloat(destLine.x2 - destLine.x1, 2);
2064
- var dy2 = MathUtils.toFixedFloat(destLine.y2 - destLine.y1, 2);
2065
- var a2 = dx2 === 0 ? INFINITY : MathUtils.toFixedFloat(dy2 / dx2, 2);
2066
- var b2 = a2 === INFINITY ? MathUtils.toFixedFloat(destLine.x1, 2) : MathUtils.toFixedFloat(destLine.y1 - a2 * destLine.x1, 2);
2067
- if (MathUtils.fAbs(a1) - MathUtils.fAbs(a2) !== 0)
2068
- // two lines are not parallel
2069
- return {
2070
- result: OVERLAP_NONE
2071
- };
2072
- if (b1 !== b2)
2073
- // two lines are parallel but not overlap
2074
- return {
2075
- result: OVERLAP_NONE
2076
- };
2077
-
2078
- // parametric equation of destLine
2079
- var sk1 = dx1 === 0 ? INFINITY : MathUtils.toFixedFloat(MathUtils.toFixedFloat(destLine.x1 - srcLine.x1, 2) / dx1, 2);
2080
- var sk2 = dy1 === 0 ? INFINITY : MathUtils.toFixedFloat(MathUtils.toFixedFloat(destLine.y1 - srcLine.y1, 2) / dy1, 2);
2081
- var ek1 = dx1 === 0 ? INFINITY : MathUtils.toFixedFloat(MathUtils.toFixedFloat(destLine.x2 - srcLine.x1, 2) / dx1, 2);
2082
- var ek2 = dy1 === 0 ? INFINITY : MathUtils.toFixedFloat(MathUtils.toFixedFloat(destLine.y2 - srcLine.y1, 2) / dy1, 2);
2083
- if (sk1 !== INFINITY && sk2 !== INFINITY && ek1 !== INFINITY && ek2 !== INFINITY && (sk1 !== sk2 || ek1 !== ek2))
2084
- // destLine does not overlap with srcLine
2085
- return {
2086
- result: OVERLAP_NONE
2087
- };
2088
-
2089
- // parameter of destLine on the start and end points
2090
- var sk = Math.min(sk1, sk2);
2091
- var ek = Math.min(ek1, ek2);
2092
-
2093
- // check the relationship between srcLine and destLine
2094
- if (sk < 0 && ek < 0 || sk > 1 && ek > 1)
2095
- // not overlap
2096
- return {
2097
- result: OVERLAP_NONE
2098
- };
2099
- if (sk === 0 && ek === 1 || sk === 1 && ek === 0)
2100
- // same lines
2101
- return {
2102
- result: OVERLAP_SAME
2103
- };
2104
- if (sk <= 0 && ek >= 1 || sk >= 1 && ek <= 0)
2105
- // destLine includes srcLine
2106
- return {
2107
- result: OVERLAP_INCLUDED
2108
- };
2109
- if (sk === 0 && ek < 0 || sk === 1 && ek > 1 || ek === 0 && sk < 0 || ek === 1 && sk > 1) {
2110
- // linked with one common point
2111
- var linkedLine;
2112
- if (sk === 0 && ek < 0) {
2113
- // destE destS srcS srcE
2114
- // |----------|------------|
2115
- linkedLine = {
2116
- x1: destLine.x2,
2117
- y1: destLine.y2,
2118
- x2: srcLine.x2,
2119
- y2: srcLine.y2
2120
- };
2121
- } else if (sk === 1 && ek > 1) {
2122
- // srcS srcE destS destE
2123
- // |----------|------------|
2124
- linkedLine = {
2125
- x1: srcLine.x1,
2126
- y1: srcLine.y1,
2127
- x2: destLine.x2,
2128
- y2: destLine.y2
2129
- };
2130
- } else if (ek === 0 && sk < 0) {
2131
- // destS destE srcS srcE
2132
- // |----------|------------|
2133
- linkedLine = {
2134
- x1: destLine.x1,
2135
- y1: destLine.y1,
2136
- x2: srcLine.x2,
2137
- y2: srcLine.y2
2138
- };
2139
- } else if (ek === 1 && sk > 1) {
2140
- // srcS srcE destE destS
2141
- // |----------|------------|
2142
- linkedLine = {
2143
- x1: srcLine.x1,
2144
- y1: srcLine.y1,
2145
- x2: destLine.x1,
2146
- y2: destLine.y1
2147
- };
2148
- }
2149
- return {
2150
- result: OVERLAP_LINK,
2151
- linkedLine: linkedLine
2152
- };
2153
- }
2154
- var trimmedSegment1 = null;
2155
- var trimmedSegment2 = null;
2156
- var ret = {
2157
- result: OVERLAP_SOME,
2158
- trimmedSegs: []
2159
- };
2160
- if (0 <= sk && sk <= 1 && 0 <= ek && ek <= 1) {
2161
- // srcLine includes destLine
2162
- if (sk < ek) {
2163
- // srcS destS destE srcE
2164
- // |------|---------|-------|
2165
- trimmedSegment1 = {
2166
- x1: srcLine.x1,
2167
- y1: srcLine.y1,
2168
- x2: destLine.x1,
2169
- y2: destLine.y1
2170
- };
2171
- if (ek < 1) trimmedSegment2 = {
2172
- x1: destLine.x2,
2173
- y1: destLine.y2,
2174
- x2: srcLine.x2,
2175
- y2: srcLine.y2
2176
- };
2177
- } else {
2178
- // srcS destE destS srcE
2179
- // |------|---------|-------|
2180
- trimmedSegment1 = {
2181
- x1: srcLine.x1,
2182
- y1: srcLine.y1,
2183
- x2: destLine.x2,
2184
- y2: destLine.y2
2185
- };
2186
- if (sk < 1) trimmedSegment2 = {
2187
- x1: destLine.x1,
2188
- y1: destLine.y1,
2189
- x2: srcLine.x2,
2190
- y2: srcLine.y2
2191
- };
2192
- }
2193
- } else {
2194
- // srcLine and destLine are overlapped with some range
2195
- if (sk < 0) {
2196
- // destS srcS destE srcE
2197
- // |------|---------|-------|
2198
- trimmedSegment1 = {
2199
- x1: destLine.x2,
2200
- y1: destLine.y2,
2201
- x2: srcLine.x2,
2202
- y2: srcLine.y2
2203
- };
2204
- } else if (ek < 0) {
2205
- // destE srcS destS srcE
2206
- // |------|---------|-------|
2207
- trimmedSegment1 = {
2208
- x1: destLine.x1,
2209
- y1: destLine.y1,
2210
- x2: srcLine.x2,
2211
- y2: srcLine.y2
2212
- };
2213
- } else if (sk > 1) {
2214
- // srcS destE srcE destS
2215
- // |------|---------|-------|
2216
- trimmedSegment1 = {
2217
- x1: srcLine.x1,
2218
- y1: srcLine.y1,
2219
- x2: destLine.x2,
2220
- y2: destLine.y2
2221
- };
2222
- } else if (ek > 1) {
2223
- // srcS destS srcE destE
2224
- // |------|---------|-------|
2225
- trimmedSegment1 = {
2226
- x1: srcLine.x1,
2227
- y1: srcLine.y1,
2228
- x2: destLine.x1,
2229
- y2: destLine.y1
2230
- };
2231
- }
2232
- }
2233
- if (trimmedSegment1 !== null) ret.trimmedSegs.push(trimmedSegment1);
2234
- if (trimmedSegment2 !== null) ret.trimmedSegs.push(trimmedSegment2);
2235
- return ret;
2236
- }
2237
- //# sourceMappingURL=geometry.js.map