kitchen-simulator 1.0.0-DIY-1119

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 (1159) hide show
  1. package/LICENSE +0 -0
  2. package/README.md +64 -0
  3. package/es/@history.js +2 -0
  4. package/es/AppContext.js +3 -0
  5. package/es/LiteKitchenConfigurator.js +520 -0
  6. package/es/LiteRenderer.js +316 -0
  7. package/es/actions/area-actions.js +14 -0
  8. package/es/actions/export.js +36 -0
  9. package/es/actions/groups-actions.js +89 -0
  10. package/es/actions/holes-actions.js +119 -0
  11. package/es/actions/items-actions.js +352 -0
  12. package/es/actions/lines-actions.js +83 -0
  13. package/es/actions/project-actions.js +298 -0
  14. package/es/actions/scene-actions.js +33 -0
  15. package/es/actions/vertices-actions.js +27 -0
  16. package/es/actions/viewer2d-actions.js +58 -0
  17. package/es/actions/viewer3d-actions.js +23 -0
  18. package/es/analytics/ga4.js +188 -0
  19. package/es/analytics/posthog.js +60 -0
  20. package/es/assets/Window.hdr +2100 -0
  21. package/es/assets/brown_photostudio_02_1k.hdr +0 -0
  22. package/es/assets/fonts/Rene Bieder Milliard Black Italic.woff +0 -0
  23. package/es/assets/fonts/Rene Bieder Milliard Black.woff +0 -0
  24. package/es/assets/fonts/Rene Bieder Milliard Bold Italic.woff +0 -0
  25. package/es/assets/fonts/Rene Bieder Milliard Bold.woff +0 -0
  26. package/es/assets/fonts/Rene Bieder Milliard Book Italic.woff +0 -0
  27. package/es/assets/fonts/Rene Bieder Milliard Book.woff +0 -0
  28. package/es/assets/fonts/Rene Bieder Milliard ExtraBold Italic.woff +0 -0
  29. package/es/assets/fonts/Rene Bieder Milliard ExtraBold.woff +0 -0
  30. package/es/assets/fonts/Rene Bieder Milliard ExtraLight Italic.woff +0 -0
  31. package/es/assets/fonts/Rene Bieder Milliard ExtraLight.woff +0 -0
  32. package/es/assets/fonts/Rene Bieder Milliard Hairline Italic.woff +0 -0
  33. package/es/assets/fonts/Rene Bieder Milliard Hairline.woff +0 -0
  34. package/es/assets/fonts/Rene Bieder Milliard Heavy Italic.woff +0 -0
  35. package/es/assets/fonts/Rene Bieder Milliard Heavy.woff +0 -0
  36. package/es/assets/fonts/Rene Bieder Milliard Light Italic.woff +0 -0
  37. package/es/assets/fonts/Rene Bieder Milliard Light.woff +0 -0
  38. package/es/assets/fonts/Rene Bieder Milliard Medium Italic.woff +0 -0
  39. package/es/assets/fonts/Rene Bieder Milliard Medium.woff +0 -0
  40. package/es/assets/fonts/Rene Bieder Milliard SemiBold Italic.woff +0 -0
  41. package/es/assets/fonts/Rene Bieder Milliard SemiBold.woff +0 -0
  42. package/es/assets/fonts/Rene Bieder Milliard Thin Italic.woff +0 -0
  43. package/es/assets/fonts/Rene Bieder Milliard Thin.woff +0 -0
  44. package/es/assets/fonts/style.css +177 -0
  45. package/es/assets/gltf/door_closet.gltf +1 -0
  46. package/es/assets/gltf/door_exterior.gltf +1 -0
  47. package/es/assets/gltf/door_interior.gltf +1 -0
  48. package/es/assets/gltf/door_sliding.gltf +1 -0
  49. package/es/assets/gltf/doorway_framed.bin +0 -0
  50. package/es/assets/gltf/doorway_framed.fbx +0 -0
  51. package/es/assets/gltf/doorway_framed.gltf +1 -0
  52. package/es/assets/gltf/window_clear.bin +0 -0
  53. package/es/assets/gltf/window_clear.fbx +0 -0
  54. package/es/assets/gltf/window_clear.gltf +1 -0
  55. package/es/assets/gltf/window_cross.bin +0 -0
  56. package/es/assets/gltf/window_cross.fbx +0 -0
  57. package/es/assets/gltf/window_cross.gltf +1 -0
  58. package/es/assets/gltf/window_double_hung.bin +0 -0
  59. package/es/assets/gltf/window_double_hung.fbx +0 -0
  60. package/es/assets/gltf/window_double_hung.gltf +1 -0
  61. package/es/assets/gltf/window_vertical.bin +0 -0
  62. package/es/assets/gltf/window_vertical.fbx +0 -0
  63. package/es/assets/gltf/window_vertical.gltf +1 -0
  64. package/es/assets/img/TKC_thumbnail.png +0 -0
  65. package/es/assets/img/Toggle.png +0 -0
  66. package/es/assets/img/default/maple.jpg +0 -0
  67. package/es/assets/img/default/steel.jpg +0 -0
  68. package/es/assets/img/loading/loading.gif +0 -0
  69. package/es/assets/img/loading/loading_1.svg +11 -0
  70. package/es/assets/img/loading_large.gif +0 -0
  71. package/es/assets/img/png/door/closet.png +0 -0
  72. package/es/assets/img/png/door/doorwaysframed.png +0 -0
  73. package/es/assets/img/png/door/doorwaysframeles.png +0 -0
  74. package/es/assets/img/png/door/doorwaysframeless.png +0 -0
  75. package/es/assets/img/png/door/exterior.png +0 -0
  76. package/es/assets/img/png/door/interior.png +0 -0
  77. package/es/assets/img/png/door/sliding.png +0 -0
  78. package/es/assets/img/png/helper/outcome.png +0 -0
  79. package/es/assets/img/project_img.png +0 -0
  80. package/es/assets/img/rta/rta_logo_box_blue.jpg +0 -0
  81. package/es/assets/img/rta/rta_logo_box_blue_ico.jpg +0 -0
  82. package/es/assets/img/rta/rta_logo_box_blue_ico.svg +55 -0
  83. package/es/assets/img/rta/rta_logo_box_darkGray.jpg +0 -0
  84. package/es/assets/img/rta/rta_logo_box_lightblue.png +0 -0
  85. package/es/assets/img/rta/rta_logo_box_lightmaroon.png +0 -0
  86. package/es/assets/img/rta/rta_logo_box_maroon.png +0 -0
  87. package/es/assets/img/rta/rta_logo_box_white.png +0 -0
  88. package/es/assets/img/rta_menu.png +0 -0
  89. package/es/assets/img/step2.jpg +0 -0
  90. package/es/assets/img/step3.jpg +0 -0
  91. package/es/assets/img/step4.jpg +0 -0
  92. package/es/assets/img/step5.jpg +0 -0
  93. package/es/assets/img/step6.jpg +0 -0
  94. package/es/assets/img/step7.jpg +0 -0
  95. package/es/assets/img/step8.jpg +0 -0
  96. package/es/assets/img/svg/2d_delete_object.svg +33 -0
  97. package/es/assets/img/svg/2d_delete_object1.svg +33 -0
  98. package/es/assets/img/svg/2d_lock_object.svg +33 -0
  99. package/es/assets/img/svg/3d_item_move.svg +10 -0
  100. package/es/assets/img/svg/3d_item_rotation.svg +4 -0
  101. package/es/assets/img/svg/3d_item_warning_edit.svg +77 -0
  102. package/es/assets/img/svg/3d_item_warning_info.svg +81 -0
  103. package/es/assets/img/svg/accessories.svg +4 -0
  104. package/es/assets/img/svg/angle_icon.svg +39 -0
  105. package/es/assets/img/svg/blank_div.svg +14 -0
  106. package/es/assets/img/svg/bottombar/2d3d_button.svg +3 -0
  107. package/es/assets/img/svg/bottombar/2d3d_button_active.svg +3 -0
  108. package/es/assets/img/svg/bottombar/2d3d_toggle.svg +4 -0
  109. package/es/assets/img/svg/bottombar/2d3d_toggle_active.svg +4 -0
  110. package/es/assets/img/svg/bottombar/arrow-down.svg +3 -0
  111. package/es/assets/img/svg/bottombar/arrow-left.svg +3 -0
  112. package/es/assets/img/svg/bottombar/arrow-minus.svg +3 -0
  113. package/es/assets/img/svg/bottombar/arrow-plus.svg +11 -0
  114. package/es/assets/img/svg/bottombar/arrow-right.svg +3 -0
  115. package/es/assets/img/svg/bottombar/arrow-up.svg +3 -0
  116. package/es/assets/img/svg/bottombar/collapse.svg +3 -0
  117. package/es/assets/img/svg/bottombar/elevation-back.svg +6 -0
  118. package/es/assets/img/svg/bottombar/elevation-front.svg +6 -0
  119. package/es/assets/img/svg/bottombar/elevation-left.svg +6 -0
  120. package/es/assets/img/svg/bottombar/elevation-right.svg +7 -0
  121. package/es/assets/img/svg/bottombar/elevation.svg +13 -0
  122. package/es/assets/img/svg/bottombar/expand.svg +3 -0
  123. package/es/assets/img/svg/bottombar/help.svg +72 -0
  124. package/es/assets/img/svg/bottombar/incm_toggle.svg +39 -0
  125. package/es/assets/img/svg/bottombar/pan_1.svg +57 -0
  126. package/es/assets/img/svg/bottombar/pan_2.svg +27 -0
  127. package/es/assets/img/svg/bottombar/pan_3.svg +27 -0
  128. package/es/assets/img/svg/bottombar/pan_4.svg +27 -0
  129. package/es/assets/img/svg/bottombar/pan_5.svg +27 -0
  130. package/es/assets/img/svg/bottombar/settings.svg +23 -0
  131. package/es/assets/img/svg/bottombar/spin-down.svg +76 -0
  132. package/es/assets/img/svg/bottombar/spin-left.svg +75 -0
  133. package/es/assets/img/svg/bottombar/spin-right.svg +75 -0
  134. package/es/assets/img/svg/bottombar/spin-up.svg +76 -0
  135. package/es/assets/img/svg/bottombar/spin_1.svg +48 -0
  136. package/es/assets/img/svg/bottombar/spin_2.svg +31 -0
  137. package/es/assets/img/svg/bottombar/spin_3.svg +31 -0
  138. package/es/assets/img/svg/bottombar/spin_4.svg +31 -0
  139. package/es/assets/img/svg/bottombar/spin_5.svg +31 -0
  140. package/es/assets/img/svg/bottombar/zoomin.svg +29 -0
  141. package/es/assets/img/svg/bottombar/zoomout.svg +26 -0
  142. package/es/assets/img/svg/check.svg +10 -0
  143. package/es/assets/img/svg/close.svg +11 -0
  144. package/es/assets/img/svg/color/Black.svg +3 -0
  145. package/es/assets/img/svg/color/Blue.svg +3 -0
  146. package/es/assets/img/svg/color/Cream.svg +3 -0
  147. package/es/assets/img/svg/color/Gray.svg +3 -0
  148. package/es/assets/img/svg/color/Green.svg +3 -0
  149. package/es/assets/img/svg/color/White.svg +3 -0
  150. package/es/assets/img/svg/color/White.svg.bak +3 -0
  151. package/es/assets/img/svg/color/stone2.jpg +0 -0
  152. package/es/assets/img/svg/color/wood2.jpg +0 -0
  153. package/es/assets/img/svg/copy.svg +11 -0
  154. package/es/assets/img/svg/delete.svg +7 -0
  155. package/es/assets/img/svg/detail.svg +77 -0
  156. package/es/assets/img/svg/disclaimer/background.svg +758 -0
  157. package/es/assets/img/svg/disclaimer/logo-dots.svg +11 -0
  158. package/es/assets/img/svg/door/Closet.svg +11 -0
  159. package/es/assets/img/svg/door/Exterior.svg +5 -0
  160. package/es/assets/img/svg/door/Framed_dorway.svg +5 -0
  161. package/es/assets/img/svg/door/Frameless_dorway.svg +5 -0
  162. package/es/assets/img/svg/door/Interior.svg +7 -0
  163. package/es/assets/img/svg/door/Sliding.svg +5 -0
  164. package/es/assets/img/svg/doors_closet.svg +47 -0
  165. package/es/assets/img/svg/doors_exterior.svg +25 -0
  166. package/es/assets/img/svg/doors_interior.svg +29 -0
  167. package/es/assets/img/svg/doors_patio.svg +26 -0
  168. package/es/assets/img/svg/duplicate.svg +11 -0
  169. package/es/assets/img/svg/duplicate_object_left.svg +32 -0
  170. package/es/assets/img/svg/duplicate_object_right.svg +32 -0
  171. package/es/assets/img/svg/filtersActive.svg +19 -0
  172. package/es/assets/img/svg/firstsetting/L.svg +3 -0
  173. package/es/assets/img/svg/firstsetting/L2.svg +3 -0
  174. package/es/assets/img/svg/firstsetting/Open.svg +3 -0
  175. package/es/assets/img/svg/firstsetting/Square.svg +3 -0
  176. package/es/assets/img/svg/firstsetting/bar-active.svg +9 -0
  177. package/es/assets/img/svg/firstsetting/bar-normal.svg +3 -0
  178. package/es/assets/img/svg/firstsetting/bullet-current.svg +3 -0
  179. package/es/assets/img/svg/firstsetting/bullet-done.svg +3 -0
  180. package/es/assets/img/svg/firstsetting/bullet-not-done.svg +3 -0
  181. package/es/assets/img/svg/firstsetting/check-active.svg +3 -0
  182. package/es/assets/img/svg/firstsetting/check-normal.svg +3 -0
  183. package/es/assets/img/svg/firstsetting/pencil.svg +11 -0
  184. package/es/assets/img/svg/green_checkmark.svg +27 -0
  185. package/es/assets/img/svg/headerbar/assist.svg +3 -0
  186. package/es/assets/img/svg/headerbar/cart.svg +3 -0
  187. package/es/assets/img/svg/headerbar/check.svg +10 -0
  188. package/es/assets/img/svg/headerbar/consult_designer.svg +45 -0
  189. package/es/assets/img/svg/headerbar/edit_name.svg +26 -0
  190. package/es/assets/img/svg/headerbar/file-dollar.svg +13 -0
  191. package/es/assets/img/svg/headerbar/hamburger_menu.svg +32 -0
  192. package/es/assets/img/svg/headerbar/plus.svg +11 -0
  193. package/es/assets/img/svg/headerbar/review_quote.svg +44 -0
  194. package/es/assets/img/svg/headerbar/ruler-measure.svg +11 -0
  195. package/es/assets/img/svg/headerbar/save.svg +3 -0
  196. package/es/assets/img/svg/headerbar/setting.svg +75 -0
  197. package/es/assets/img/svg/help/check.svg +10 -0
  198. package/es/assets/img/svg/help/search.svg +76 -0
  199. package/es/assets/img/svg/intro/1-start-with-floorplan-whole.svg +27 -0
  200. package/es/assets/img/svg/intro/1-start-with-floorplan.svg +26 -0
  201. package/es/assets/img/svg/intro/2-start-from-scratch-whole.svg +28 -0
  202. package/es/assets/img/svg/intro/2-start-from-scratch.svg +27 -0
  203. package/es/assets/img/svg/intro/3-retrieve-project-whole.svg +19 -0
  204. package/es/assets/img/svg/intro/3-retrieve-project.svg +18 -0
  205. package/es/assets/img/svg/invert.svg +12 -0
  206. package/es/assets/img/svg/lefttoolbar/appliance-active.svg +13 -0
  207. package/es/assets/img/svg/lefttoolbar/appliance.svg +13 -0
  208. package/es/assets/img/svg/lefttoolbar/cabinet-active.svg +10 -0
  209. package/es/assets/img/svg/lefttoolbar/cabinet-category.svg +3 -0
  210. package/es/assets/img/svg/lefttoolbar/cabinet-one.svg +3 -0
  211. package/es/assets/img/svg/lefttoolbar/cabinet.svg +10 -0
  212. package/es/assets/img/svg/lefttoolbar/disigner_assistance.svg +89 -0
  213. package/es/assets/img/svg/lefttoolbar/door-style-active.svg +20 -0
  214. package/es/assets/img/svg/lefttoolbar/door-style.svg +20 -0
  215. package/es/assets/img/svg/lefttoolbar/door.svg +12 -0
  216. package/es/assets/img/svg/lefttoolbar/error_icon.svg +81 -0
  217. package/es/assets/img/svg/lefttoolbar/finishing-active.svg +13 -0
  218. package/es/assets/img/svg/lefttoolbar/finishing.svg +13 -0
  219. package/es/assets/img/svg/lefttoolbar/reviewforquote-active.svg +86 -0
  220. package/es/assets/img/svg/lefttoolbar/reviewforquote.svg +12 -0
  221. package/es/assets/img/svg/lefttoolbar/room-shape-L.svg +3 -0
  222. package/es/assets/img/svg/lefttoolbar/room-shape-active.svg +18 -0
  223. package/es/assets/img/svg/lefttoolbar/room-shape-custom.svg +12 -0
  224. package/es/assets/img/svg/lefttoolbar/room-shape-irregular.svg +3 -0
  225. package/es/assets/img/svg/lefttoolbar/room-shape-open.svg +3 -0
  226. package/es/assets/img/svg/lefttoolbar/room-shape-square.svg +3 -0
  227. package/es/assets/img/svg/lefttoolbar/room-shape.svg +18 -0
  228. package/es/assets/img/svg/lefttoolbar/search.svg +76 -0
  229. package/es/assets/img/svg/lefttoolbar/view_more.svg +86 -0
  230. package/es/assets/img/svg/lefttoolbar/warning_icon.svg +81 -0
  231. package/es/assets/img/svg/lefttoolbar/window.svg +12 -0
  232. package/es/assets/img/svg/logo.svg +11 -0
  233. package/es/assets/img/svg/logo_with_text.svg +25 -0
  234. package/es/assets/img/svg/menubar/login.svg +84 -0
  235. package/es/assets/img/svg/menubar/my_projects.svg +85 -0
  236. package/es/assets/img/svg/menubar/new_project.svg +110 -0
  237. package/es/assets/img/svg/menubar/save_project.svg +84 -0
  238. package/es/assets/img/svg/options.svg +3 -0
  239. package/es/assets/img/svg/positioning.svg +3 -0
  240. package/es/assets/img/svg/rotate.png +0 -0
  241. package/es/assets/img/svg/rotate.svg +17 -0
  242. package/es/assets/img/svg/rotate_object_clockwise.svg +26 -0
  243. package/es/assets/img/svg/rotate_object_counterclockwise.svg +26 -0
  244. package/es/assets/img/svg/toggleFilters.svg +19 -0
  245. package/es/assets/img/svg/toolbar/add_appliances_active.svg +64 -0
  246. package/es/assets/img/svg/toolbar/add_appliances_inactive.svg +52 -0
  247. package/es/assets/img/svg/toolbar/add_button.svg +36 -0
  248. package/es/assets/img/svg/toolbar/add_cabinets_active.svg +59 -0
  249. package/es/assets/img/svg/toolbar/add_cabinets_inactive.svg +49 -0
  250. package/es/assets/img/svg/toolbar/add_items_doors.svg +25 -0
  251. package/es/assets/img/svg/toolbar/add_items_doorways.svg +24 -0
  252. package/es/assets/img/svg/toolbar/add_items_refrigerator.svg +32 -0
  253. package/es/assets/img/svg/toolbar/add_items_windows.svg +28 -0
  254. package/es/assets/img/svg/toolbar/apply_button.svg +38 -0
  255. package/es/assets/img/svg/toolbar/arrow-plus.svg +11 -0
  256. package/es/assets/img/svg/toolbar/backsplash.svg +8 -0
  257. package/es/assets/img/svg/toolbar/cancel_button.svg +37 -0
  258. package/es/assets/img/svg/toolbar/consult_a_designer_button.svg +47 -0
  259. package/es/assets/img/svg/toolbar/countertop.svg +7 -0
  260. package/es/assets/img/svg/toolbar/dcm.png +0 -0
  261. package/es/assets/img/svg/toolbar/dcm_off.svg +12 -0
  262. package/es/assets/img/svg/toolbar/dcm_on.svg +474 -0
  263. package/es/assets/img/svg/toolbar/delete_button.svg +37 -0
  264. package/es/assets/img/svg/toolbar/download.svg +77 -0
  265. package/es/assets/img/svg/toolbar/draw_custom_floor.svg +31 -0
  266. package/es/assets/img/svg/toolbar/edit_button.svg +75 -0
  267. package/es/assets/img/svg/toolbar/email_quote_button.svg +44 -0
  268. package/es/assets/img/svg/toolbar/fbm.png +0 -0
  269. package/es/assets/img/svg/toolbar/finishing_touches_active.svg +54 -0
  270. package/es/assets/img/svg/toolbar/finishing_touches_inactive.svg +42 -0
  271. package/es/assets/img/svg/toolbar/floorstyle.svg +9 -0
  272. package/es/assets/img/svg/toolbar/fmb.png +0 -0
  273. package/es/assets/img/svg/toolbar/fmb_off.svg +12 -0
  274. package/es/assets/img/svg/toolbar/fmb_on.svg +489 -0
  275. package/es/assets/img/svg/toolbar/furnishings_icon.svg +6 -0
  276. package/es/assets/img/svg/toolbar/get_started_button.svg +41 -0
  277. package/es/assets/img/svg/toolbar/handles.svg +5 -0
  278. package/es/assets/img/svg/toolbar/lighting.svg +7 -0
  279. package/es/assets/img/svg/toolbar/lrm.png +0 -0
  280. package/es/assets/img/svg/toolbar/lrm_off.svg +12 -0
  281. package/es/assets/img/svg/toolbar/lrm_on.svg +470 -0
  282. package/es/assets/img/svg/toolbar/make_floorplan_active.svg +66 -0
  283. package/es/assets/img/svg/toolbar/make_floorplan_inactive.svg +52 -0
  284. package/es/assets/img/svg/toolbar/predefined_room_l_shaped.svg +20 -0
  285. package/es/assets/img/svg/toolbar/predefined_room_layout.svg +20 -0
  286. package/es/assets/img/svg/toolbar/predefined_room_long_narrow.svg +20 -0
  287. package/es/assets/img/svg/toolbar/predefined_room_open_l_shape.svg +20 -0
  288. package/es/assets/img/svg/toolbar/predefined_room_open_pentagon.svg +20 -0
  289. package/es/assets/img/svg/toolbar/predefined_room_open_rectangle.svg +20 -0
  290. package/es/assets/img/svg/toolbar/predefined_room_open_rectangle_2.svg +20 -0
  291. package/es/assets/img/svg/toolbar/predefined_room_pentagon.svg +20 -0
  292. package/es/assets/img/svg/toolbar/predefined_room_rectangle.svg +20 -0
  293. package/es/assets/img/svg/toolbar/predefined_room_rectangle_with_alcove.svg +20 -0
  294. package/es/assets/img/svg/toolbar/redo_button.svg +75 -0
  295. package/es/assets/img/svg/toolbar/redo_button1.svg +75 -0
  296. package/es/assets/img/svg/toolbar/review_quote_active.svg +14 -0
  297. package/es/assets/img/svg/toolbar/review_quote_inactive.svg +44 -0
  298. package/es/assets/img/svg/toolbar/save_project_button.svg +44 -0
  299. package/es/assets/img/svg/toolbar/select_doorstyle_active.svg +67 -0
  300. package/es/assets/img/svg/toolbar/select_doorstyle_inactive.svg +57 -0
  301. package/es/assets/img/svg/toolbar/shopping-cart.svg +13 -0
  302. package/es/assets/img/svg/toolbar/style_change_button.svg +47 -0
  303. package/es/assets/img/svg/toolbar/take_picture.svg +75 -0
  304. package/es/assets/img/svg/toolbar/undo_button.svg +76 -0
  305. package/es/assets/img/svg/toolbar/undo_button1.svg +76 -0
  306. package/es/assets/img/svg/toolbar/use_button.svg +37 -0
  307. package/es/assets/img/svg/toolbar/wall_color_icon.svg +6 -0
  308. package/es/assets/img/svg/topbar/edit_active.svg +10 -0
  309. package/es/assets/img/svg/topbar/edit_inactive.svg +10 -0
  310. package/es/assets/img/svg/topbar/redo_active.svg +42 -0
  311. package/es/assets/img/svg/topbar/redo_inactive.svg +23 -0
  312. package/es/assets/img/svg/topbar/select_all_active.svg +50 -0
  313. package/es/assets/img/svg/topbar/select_all_inactive.svg +32 -0
  314. package/es/assets/img/svg/topbar/take_picture_active.svg +51 -0
  315. package/es/assets/img/svg/topbar/take_picture_inactive.svg +26 -0
  316. package/es/assets/img/svg/topbar/undo_active.svg +42 -0
  317. package/es/assets/img/svg/topbar/undo_inactive.svg +23 -0
  318. package/es/assets/img/svg/warning_info_2d.svg +81 -0
  319. package/es/assets/img/svg/window/Clear.svg +3 -0
  320. package/es/assets/img/svg/window/Cross.svg +5 -0
  321. package/es/assets/img/svg/window/Double_hung.svg +4 -0
  322. package/es/assets/img/svg/window/Vertical.svg +4 -0
  323. package/es/assets/img/svg/windows_clear.svg +23 -0
  324. package/es/assets/img/svg/windows_cross.svg +28 -0
  325. package/es/assets/img/svg/windows_double_hung.svg +24 -0
  326. package/es/assets/img/svg/windows_vertical.svg +24 -0
  327. package/es/assets/img/svg/wizardstep/Custom.svg +3 -0
  328. package/es/assets/img/svg/wizardstep/Dashed_line.svg +3 -0
  329. package/es/assets/img/svg/wizardstep/L.svg +3 -0
  330. package/es/assets/img/svg/wizardstep/L2.svg +3 -0
  331. package/es/assets/img/svg/wizardstep/Open.svg +3 -0
  332. package/es/assets/img/svg/wizardstep/Square.svg +3 -0
  333. package/es/assets/img/svg/wizardstep/bar-active.svg +9 -0
  334. package/es/assets/img/svg/wizardstep/bar-normal.svg +3 -0
  335. package/es/assets/img/svg/wizardstep/bullet-current.svg +3 -0
  336. package/es/assets/img/svg/wizardstep/bullet-done.svg +3 -0
  337. package/es/assets/img/svg/wizardstep/bullet-not-done.svg +3 -0
  338. package/es/assets/img/svg/wizardstep/check-active.svg +3 -0
  339. package/es/assets/img/svg/wizardstep/check-normal.svg +3 -0
  340. package/es/assets/img/svg/wizardstep/detail_view.svg +87 -0
  341. package/es/assets/img/svg/wizardstep/pencil.svg +11 -0
  342. package/es/assets/img/svg/wizardstep/tile_view.svg +95 -0
  343. package/es/assets/img/texture/glass.jpg +0 -0
  344. package/es/assets/img/texture/steel.jpg +0 -0
  345. package/es/assets/img/texture/white1px.jpg +0 -0
  346. package/es/assets/img/texture/wood.jpg +0 -0
  347. package/es/assets/model/DCM.bin +0 -0
  348. package/es/assets/model/DCM.fbx +0 -0
  349. package/es/assets/model/DCM.gltf +1 -0
  350. package/es/assets/model/FBM.bin +0 -0
  351. package/es/assets/model/FBM.fbx +0 -0
  352. package/es/assets/model/FBM.gltf +1 -0
  353. package/es/assets/model/LRM.bin +0 -0
  354. package/es/assets/model/LRM.fbx +0 -0
  355. package/es/assets/model/LRM.gltf +1 -0
  356. package/es/assets/rtastore_logo.png +0 -0
  357. package/es/catalog/areas/area/planner-element.js +45 -0
  358. package/es/catalog/areas/area/textures/ceramic-tile.jpg +0 -0
  359. package/es/catalog/areas/area/textures/grass.jpg +0 -0
  360. package/es/catalog/areas/area/textures/parquet.jpg +0 -0
  361. package/es/catalog/areas/area/textures/strand-porcelain.jpg +0 -0
  362. package/es/catalog/areas/area/textures/tile1.jpg +0 -0
  363. package/es/catalog/back.png +0 -0
  364. package/es/catalog/cabinet/cabinet-assembly-order.js +36 -0
  365. package/es/catalog/cabinet/cabinet-texture-resolver.js +8 -0
  366. package/es/catalog/catalog.js +263 -0
  367. package/es/catalog/doors.png +0 -0
  368. package/es/catalog/doorways.png +0 -0
  369. package/es/catalog/envMap/nx.hdr +0 -0
  370. package/es/catalog/envMap/ny.hdr +0 -0
  371. package/es/catalog/envMap/nz.hdr +0 -0
  372. package/es/catalog/envMap/px.hdr +0 -0
  373. package/es/catalog/envMap/py.hdr +0 -0
  374. package/es/catalog/envMap/pz.hdr +0 -0
  375. package/es/catalog/export.js +0 -0
  376. package/es/catalog/factories/area-factory-3d.js +178 -0
  377. package/es/catalog/factories/area-factory.js +78 -0
  378. package/es/catalog/factories/export.js +7 -0
  379. package/es/catalog/factories/wall-factory-3d.js +202 -0
  380. package/es/catalog/factories/wall-factory.js +267 -0
  381. package/es/catalog/holes/door-closet/planner-element.js +222 -0
  382. package/es/catalog/holes/door-double/door_double.png +0 -0
  383. package/es/catalog/holes/door-double/planner-element.js +315 -0
  384. package/es/catalog/holes/door-exterior/planner-element.js +215 -0
  385. package/es/catalog/holes/door-interior/planner-element.js +227 -0
  386. package/es/catalog/holes/door-panic/panicDoor.png +0 -0
  387. package/es/catalog/holes/door-panic/planner-element.js +503 -0
  388. package/es/catalog/holes/door-panic-double/panicDoorDouble.png +0 -0
  389. package/es/catalog/holes/door-panic-double/planner-element.js +463 -0
  390. package/es/catalog/holes/door-sliding/planner-element.js +225 -0
  391. package/es/catalog/holes/doorway-framed/planner-element.js +145 -0
  392. package/es/catalog/holes/doorway-frameless/planner-element.js +104 -0
  393. package/es/catalog/holes/export.js +13 -0
  394. package/es/catalog/holes/gate/gate.jpg +0 -0
  395. package/es/catalog/holes/window-clear/planner-element.js +166 -0
  396. package/es/catalog/holes/window-clear/texture.png +0 -0
  397. package/es/catalog/holes/window-cross/planner-element.js +165 -0
  398. package/es/catalog/holes/window-cross/texture.png +0 -0
  399. package/es/catalog/holes/window-double-hung/planner-element.js +303 -0
  400. package/es/catalog/holes/window-double-hung/texture.png +0 -0
  401. package/es/catalog/holes/window-vertical/planner-element.js +276 -0
  402. package/es/catalog/holes/window-vertical/texture.png +0 -0
  403. package/es/catalog/lines/wall/planner-element.js +79 -0
  404. package/es/catalog/lines/wall/textures/bricks-normal.jpg +0 -0
  405. package/es/catalog/lines/wall/textures/bricks.jpg +0 -0
  406. package/es/catalog/lines/wall/textures/bricks2.jpg +0 -0
  407. package/es/catalog/lines/wall/textures/morden-normal.jpg +0 -0
  408. package/es/catalog/lines/wall/textures/morden.jpg +0 -0
  409. package/es/catalog/lines/wall/textures/painted-normal.jpg +0 -0
  410. package/es/catalog/lines/wall/textures/painted.jpg +0 -0
  411. package/es/catalog/lines/wall/textures/plaster-normal.jpg +0 -0
  412. package/es/catalog/lines/wall/textures/plaster.jpg +0 -0
  413. package/es/catalog/lines/wall/wall.png +0 -0
  414. package/es/catalog/molding/molding-dcm/planner-element.js +26 -0
  415. package/es/catalog/molding/molding-dcm/texture.png +0 -0
  416. package/es/catalog/molding/molding-fbm/planner-element.js +26 -0
  417. package/es/catalog/molding/molding-fbm/texture.png +0 -0
  418. package/es/catalog/molding/molding-lrm/planner-element.js +26 -0
  419. package/es/catalog/molding/molding-lrm/texture.png +0 -0
  420. package/es/catalog/utils/exporter.js +172 -0
  421. package/es/catalog/utils/geom-utils.js +189 -0
  422. package/es/catalog/utils/item-loader.js +1606 -0
  423. package/es/catalog/utils/load-obj.js +120 -0
  424. package/es/catalog/utils/mtl-loader.js +357 -0
  425. package/es/catalog/utils/obj-loader.js +476 -0
  426. package/es/catalog/windows.png +0 -0
  427. package/es/class/area.js +140 -0
  428. package/es/class/export.js +22 -0
  429. package/es/class/group.js +431 -0
  430. package/es/class/guide.js +58 -0
  431. package/es/class/hole.js +924 -0
  432. package/es/class/item.js +2131 -0
  433. package/es/class/layer.js +663 -0
  434. package/es/class/line.js +1227 -0
  435. package/es/class/project.js +940 -0
  436. package/es/class/vertex.js +204 -0
  437. package/es/components/content.js +149 -0
  438. package/es/components/export.js +7 -0
  439. package/es/components/style/export.js +5 -0
  440. package/es/components/style/form-number-input.js +183 -0
  441. package/es/components/style/form-submit-button.js +25 -0
  442. package/es/components/viewer2d/area.js +81 -0
  443. package/es/components/viewer2d/export.js +31 -0
  444. package/es/components/viewer2d/grids/grid-horizontal-streak.js +36 -0
  445. package/es/components/viewer2d/grids/grid-streak.js +36 -0
  446. package/es/components/viewer2d/grids/grid-vertical-streak.js +36 -0
  447. package/es/components/viewer2d/grids/grids.js +30 -0
  448. package/es/components/viewer2d/group.js +53 -0
  449. package/es/components/viewer2d/item.js +249 -0
  450. package/es/components/viewer2d/layer.js +164 -0
  451. package/es/components/viewer2d/line.js +964 -0
  452. package/es/components/viewer2d/ruler.js +84 -0
  453. package/es/components/viewer2d/rulerDist.js +102 -0
  454. package/es/components/viewer2d/rulerX.js +145 -0
  455. package/es/components/viewer2d/rulerY.js +147 -0
  456. package/es/components/viewer2d/scene.js +128 -0
  457. package/es/components/viewer2d/snap.js +74 -0
  458. package/es/components/viewer2d/state.js +73 -0
  459. package/es/components/viewer2d/utils.js +187 -0
  460. package/es/components/viewer2d/vertex.js +66 -0
  461. package/es/components/viewer2d/viewer2d.js +1468 -0
  462. package/es/components/viewer3d/camera-controls-module/camera-controls.module.js +2585 -0
  463. package/es/components/viewer3d/dcm.js +401 -0
  464. package/es/components/viewer3d/fbm.js +414 -0
  465. package/es/components/viewer3d/front3D.js +61 -0
  466. package/es/components/viewer3d/grid-creator.js +25 -0
  467. package/es/components/viewer3d/grids/grid-horizontal-streak.js +36 -0
  468. package/es/components/viewer3d/grids/grid-streak.js +27 -0
  469. package/es/components/viewer3d/grids/grid-vertical-streak.js +36 -0
  470. package/es/components/viewer3d/libs/first-person-controls.js +67 -0
  471. package/es/components/viewer3d/libs/helvetiker_regular.typeface.js +1281 -0
  472. package/es/components/viewer3d/libs/mtl-loader.js +357 -0
  473. package/es/components/viewer3d/libs/obj-loader.js +462 -0
  474. package/es/components/viewer3d/libs/orbit-controls.js +697 -0
  475. package/es/components/viewer3d/libs/pointer-lock-controls.js +44 -0
  476. package/es/components/viewer3d/lrm.js +305 -0
  477. package/es/components/viewer3d/model.js +708 -0
  478. package/es/components/viewer3d/pointer-lock-navigation.js +25 -0
  479. package/es/components/viewer3d/ruler-utils/itemRect.js +61 -0
  480. package/es/components/viewer3d/ruler-utils/layer3D.js +495 -0
  481. package/es/components/viewer3d/ruler-utils/ruler3D.js +224 -0
  482. package/es/components/viewer3d/ruler-utils/scene3D.js +59 -0
  483. package/es/components/viewer3d/ruler-utils/state3D.js +18 -0
  484. package/es/components/viewer3d/scene-creator.js +3853 -0
  485. package/es/components/viewer3d/three-memory-cleaner.js +37 -0
  486. package/es/components/viewer3d/viewer3d-first-person.js +309 -0
  487. package/es/components/viewer3d/viewer3d.js +2770 -0
  488. package/es/constants/applianceCategories.js +19 -0
  489. package/es/constants/catalog/skinPanel.js +9 -0
  490. package/es/constants.js +788 -0
  491. package/es/devLiteRenderer.js +913 -0
  492. package/es/engine/2d/viewer-utils.js +20 -0
  493. package/es/events/external/handleExternalEvent.js +144 -0
  494. package/es/events/external/handleExternalEvent.util.js +1099 -0
  495. package/es/events/external/handlers.addItem.js +47 -0
  496. package/es/events/external/handlers.changeDoorStyle.js +138 -0
  497. package/es/events/external/handlers.elementOps.js +16 -0
  498. package/es/events/external/handlers.finishing.js +26 -0
  499. package/es/events/external/handlers.hole.js +4 -0
  500. package/es/events/external/handlers.loadProject.js +127 -0
  501. package/es/events/external/handlers.molding.js +24 -0
  502. package/es/events/external/handlers.projectLifecycle.js +11 -0
  503. package/es/events/external/handlers.projectSettings.js +32 -0
  504. package/es/events/external/handlers.replaceCabinet.js +41 -0
  505. package/es/events/external/handlers.roomShape.js +8 -0
  506. package/es/events/external/handlers.syncScene.js +54 -0
  507. package/es/events/external/handlers.updateSelectedElements.js +11 -0
  508. package/es/events/external/handlers.viewMode.js +11 -0
  509. package/es/events/external/handlers.viewerNavigation.js +108 -0
  510. package/es/events/external/handlers.wall.js +7 -0
  511. package/es/index.js +627 -0
  512. package/es/mappings/external-events/mapExternalEventPayload.js +28 -0
  513. package/es/mappings/external-events/mappers/addItemMapper.js +97 -0
  514. package/es/mappings/external-events/mappers/ccdfMapper.js +97 -0
  515. package/es/mappings/external-events/mappers/ccdfToCDSMapper.js +50 -0
  516. package/es/mappings/external-events/mappers/changeDoorStyleMapper.js +37 -0
  517. package/es/mappings/external-events/mappers/loadProjectMapper.js +62 -0
  518. package/es/mappings/holesToCatalog.js +139 -0
  519. package/es/models.js +533 -0
  520. package/es/plugins/SVGLoader.js +1414 -0
  521. package/es/plugins/console-debugger.js +34 -0
  522. package/es/plugins/export.js +7 -0
  523. package/es/plugins/keyboard.js +110 -0
  524. package/es/reducers/areas-reducer.js +12 -0
  525. package/es/reducers/export.js +23 -0
  526. package/es/reducers/groups-reducer.js +38 -0
  527. package/es/reducers/holes-reducer.js +62 -0
  528. package/es/reducers/items-reducer.js +142 -0
  529. package/es/reducers/lines-reducer.js +45 -0
  530. package/es/reducers/project-reducer.js +136 -0
  531. package/es/reducers/reducer.js +18 -0
  532. package/es/reducers/scene-reducer.js +28 -0
  533. package/es/reducers/vertices-reducer.js +19 -0
  534. package/es/reducers/viewer2d-reducer.js +77 -0
  535. package/es/reducers/viewer3d-reducer.js +58 -0
  536. package/es/shared/concurrency/async-pool.js +71 -0
  537. package/es/shared/domain/asset/load-asset-json.js +53 -0
  538. package/es/shared/domain/asset/sanitize-asset-url.js +25 -0
  539. package/es/shared/domain/cabinet-corner.js +6 -0
  540. package/es/shared/domain/cabinet-mirror.js +7 -0
  541. package/es/shared/domain/cabinet-warning.js +13 -0
  542. package/es/shared/math/line-metrics.js +34 -0
  543. package/es/shared/network/load-json.js +45 -0
  544. package/es/shared/objects/immutable.js +3 -0
  545. package/es/shared-style.js +66 -0
  546. package/es/translator/en.js +104 -0
  547. package/es/translator/it.js +79 -0
  548. package/es/translator/ru.js +79 -0
  549. package/es/translator/translator.js +80 -0
  550. package/es/utils/browser.js +33 -0
  551. package/es/utils/convert-units-lite.js +38 -0
  552. package/es/utils/email-validator.js +4 -0
  553. package/es/utils/export.js +25 -0
  554. package/es/utils/geometry/overlap/index.js +1 -0
  555. package/es/utils/geometry/overlap/overlapHelpers.js +24 -0
  556. package/es/utils/geometry/overlap/pointHelpers.js +25 -0
  557. package/es/utils/geometry/overlap/relationshipOfTwoOverlappedLines2.js +374 -0
  558. package/es/utils/geometry.js +2800 -0
  559. package/es/utils/get-edges-of-subgraphs.js +26 -0
  560. package/es/utils/graph-cycles.js +238 -0
  561. package/es/utils/graph-inner-cycles.js +46 -0
  562. package/es/utils/graph.js +145 -0
  563. package/es/utils/helper.js +448 -0
  564. package/es/utils/history.js +41 -0
  565. package/es/utils/id-broker.js +15 -0
  566. package/es/utils/logger.js +8 -0
  567. package/es/utils/math.js +50 -0
  568. package/es/utils/molding.js +1118 -0
  569. package/es/utils/name-generator.js +14 -0
  570. package/es/utils/objects-utils.js +50 -0
  571. package/es/utils/phone-validator.js +4 -0
  572. package/es/utils/process-black-list.js +15 -0
  573. package/es/utils/react-if.js +18 -0
  574. package/es/utils/ruler.js +58 -0
  575. package/es/utils/skinPanelEngine.js +631 -0
  576. package/es/utils/snap-scene.js +94 -0
  577. package/es/utils/snap.js +231 -0
  578. package/es/utils/summarizeCart.js +24 -0
  579. package/es/utils/threeCSG.es6.js +494 -0
  580. package/es/version.js +1 -0
  581. package/lib/@history.js +11 -0
  582. package/lib/AppContext.js +11 -0
  583. package/lib/LiteKitchenConfigurator.js +529 -0
  584. package/lib/LiteRenderer.js +325 -0
  585. package/lib/actions/area-actions.js +21 -0
  586. package/lib/actions/export.js +36 -0
  587. package/lib/actions/groups-actions.js +107 -0
  588. package/lib/actions/holes-actions.js +140 -0
  589. package/lib/actions/items-actions.js +405 -0
  590. package/lib/actions/lines-actions.js +98 -0
  591. package/lib/actions/project-actions.js +351 -0
  592. package/lib/actions/scene-actions.js +43 -0
  593. package/lib/actions/vertices-actions.js +35 -0
  594. package/lib/actions/viewer2d-actions.js +73 -0
  595. package/lib/actions/viewer3d-actions.js +32 -0
  596. package/lib/analytics/ga4.js +194 -0
  597. package/lib/analytics/posthog.js +68 -0
  598. package/lib/assets/Window.hdr +2100 -0
  599. package/lib/assets/brown_photostudio_02_1k.hdr +0 -0
  600. package/lib/assets/fonts/Rene Bieder Milliard Black Italic.woff +0 -0
  601. package/lib/assets/fonts/Rene Bieder Milliard Black.woff +0 -0
  602. package/lib/assets/fonts/Rene Bieder Milliard Bold Italic.woff +0 -0
  603. package/lib/assets/fonts/Rene Bieder Milliard Bold.woff +0 -0
  604. package/lib/assets/fonts/Rene Bieder Milliard Book Italic.woff +0 -0
  605. package/lib/assets/fonts/Rene Bieder Milliard Book.woff +0 -0
  606. package/lib/assets/fonts/Rene Bieder Milliard ExtraBold Italic.woff +0 -0
  607. package/lib/assets/fonts/Rene Bieder Milliard ExtraBold.woff +0 -0
  608. package/lib/assets/fonts/Rene Bieder Milliard ExtraLight Italic.woff +0 -0
  609. package/lib/assets/fonts/Rene Bieder Milliard ExtraLight.woff +0 -0
  610. package/lib/assets/fonts/Rene Bieder Milliard Hairline Italic.woff +0 -0
  611. package/lib/assets/fonts/Rene Bieder Milliard Hairline.woff +0 -0
  612. package/lib/assets/fonts/Rene Bieder Milliard Heavy Italic.woff +0 -0
  613. package/lib/assets/fonts/Rene Bieder Milliard Heavy.woff +0 -0
  614. package/lib/assets/fonts/Rene Bieder Milliard Light Italic.woff +0 -0
  615. package/lib/assets/fonts/Rene Bieder Milliard Light.woff +0 -0
  616. package/lib/assets/fonts/Rene Bieder Milliard Medium Italic.woff +0 -0
  617. package/lib/assets/fonts/Rene Bieder Milliard Medium.woff +0 -0
  618. package/lib/assets/fonts/Rene Bieder Milliard SemiBold Italic.woff +0 -0
  619. package/lib/assets/fonts/Rene Bieder Milliard SemiBold.woff +0 -0
  620. package/lib/assets/fonts/Rene Bieder Milliard Thin Italic.woff +0 -0
  621. package/lib/assets/fonts/Rene Bieder Milliard Thin.woff +0 -0
  622. package/lib/assets/fonts/style.css +177 -0
  623. package/lib/assets/gltf/door_closet.gltf +1 -0
  624. package/lib/assets/gltf/door_exterior.gltf +1 -0
  625. package/lib/assets/gltf/door_interior.gltf +1 -0
  626. package/lib/assets/gltf/door_sliding.gltf +1 -0
  627. package/lib/assets/gltf/doorway_framed.bin +0 -0
  628. package/lib/assets/gltf/doorway_framed.fbx +0 -0
  629. package/lib/assets/gltf/doorway_framed.gltf +1 -0
  630. package/lib/assets/gltf/window_clear.bin +0 -0
  631. package/lib/assets/gltf/window_clear.fbx +0 -0
  632. package/lib/assets/gltf/window_clear.gltf +1 -0
  633. package/lib/assets/gltf/window_cross.bin +0 -0
  634. package/lib/assets/gltf/window_cross.fbx +0 -0
  635. package/lib/assets/gltf/window_cross.gltf +1 -0
  636. package/lib/assets/gltf/window_double_hung.bin +0 -0
  637. package/lib/assets/gltf/window_double_hung.fbx +0 -0
  638. package/lib/assets/gltf/window_double_hung.gltf +1 -0
  639. package/lib/assets/gltf/window_vertical.bin +0 -0
  640. package/lib/assets/gltf/window_vertical.fbx +0 -0
  641. package/lib/assets/gltf/window_vertical.gltf +1 -0
  642. package/lib/assets/img/TKC_thumbnail.png +0 -0
  643. package/lib/assets/img/Toggle.png +0 -0
  644. package/lib/assets/img/default/maple.jpg +0 -0
  645. package/lib/assets/img/default/steel.jpg +0 -0
  646. package/lib/assets/img/loading/loading.gif +0 -0
  647. package/lib/assets/img/loading/loading_1.svg +11 -0
  648. package/lib/assets/img/loading_large.gif +0 -0
  649. package/lib/assets/img/png/door/closet.png +0 -0
  650. package/lib/assets/img/png/door/doorwaysframed.png +0 -0
  651. package/lib/assets/img/png/door/doorwaysframeles.png +0 -0
  652. package/lib/assets/img/png/door/doorwaysframeless.png +0 -0
  653. package/lib/assets/img/png/door/exterior.png +0 -0
  654. package/lib/assets/img/png/door/interior.png +0 -0
  655. package/lib/assets/img/png/door/sliding.png +0 -0
  656. package/lib/assets/img/png/helper/outcome.png +0 -0
  657. package/lib/assets/img/project_img.png +0 -0
  658. package/lib/assets/img/rta/rta_logo_box_blue.jpg +0 -0
  659. package/lib/assets/img/rta/rta_logo_box_blue_ico.jpg +0 -0
  660. package/lib/assets/img/rta/rta_logo_box_blue_ico.svg +55 -0
  661. package/lib/assets/img/rta/rta_logo_box_darkGray.jpg +0 -0
  662. package/lib/assets/img/rta/rta_logo_box_lightblue.png +0 -0
  663. package/lib/assets/img/rta/rta_logo_box_lightmaroon.png +0 -0
  664. package/lib/assets/img/rta/rta_logo_box_maroon.png +0 -0
  665. package/lib/assets/img/rta/rta_logo_box_white.png +0 -0
  666. package/lib/assets/img/rta_menu.png +0 -0
  667. package/lib/assets/img/step2.jpg +0 -0
  668. package/lib/assets/img/step3.jpg +0 -0
  669. package/lib/assets/img/step4.jpg +0 -0
  670. package/lib/assets/img/step5.jpg +0 -0
  671. package/lib/assets/img/step6.jpg +0 -0
  672. package/lib/assets/img/step7.jpg +0 -0
  673. package/lib/assets/img/step8.jpg +0 -0
  674. package/lib/assets/img/svg/2d_delete_object.svg +33 -0
  675. package/lib/assets/img/svg/2d_delete_object1.svg +33 -0
  676. package/lib/assets/img/svg/2d_lock_object.svg +33 -0
  677. package/lib/assets/img/svg/3d_item_move.svg +10 -0
  678. package/lib/assets/img/svg/3d_item_rotation.svg +4 -0
  679. package/lib/assets/img/svg/3d_item_warning_edit.svg +77 -0
  680. package/lib/assets/img/svg/3d_item_warning_info.svg +81 -0
  681. package/lib/assets/img/svg/accessories.svg +4 -0
  682. package/lib/assets/img/svg/angle_icon.svg +39 -0
  683. package/lib/assets/img/svg/blank_div.svg +14 -0
  684. package/lib/assets/img/svg/bottombar/2d3d_button.svg +3 -0
  685. package/lib/assets/img/svg/bottombar/2d3d_button_active.svg +3 -0
  686. package/lib/assets/img/svg/bottombar/2d3d_toggle.svg +4 -0
  687. package/lib/assets/img/svg/bottombar/2d3d_toggle_active.svg +4 -0
  688. package/lib/assets/img/svg/bottombar/arrow-down.svg +3 -0
  689. package/lib/assets/img/svg/bottombar/arrow-left.svg +3 -0
  690. package/lib/assets/img/svg/bottombar/arrow-minus.svg +3 -0
  691. package/lib/assets/img/svg/bottombar/arrow-plus.svg +11 -0
  692. package/lib/assets/img/svg/bottombar/arrow-right.svg +3 -0
  693. package/lib/assets/img/svg/bottombar/arrow-up.svg +3 -0
  694. package/lib/assets/img/svg/bottombar/collapse.svg +3 -0
  695. package/lib/assets/img/svg/bottombar/elevation-back.svg +6 -0
  696. package/lib/assets/img/svg/bottombar/elevation-front.svg +6 -0
  697. package/lib/assets/img/svg/bottombar/elevation-left.svg +6 -0
  698. package/lib/assets/img/svg/bottombar/elevation-right.svg +7 -0
  699. package/lib/assets/img/svg/bottombar/elevation.svg +13 -0
  700. package/lib/assets/img/svg/bottombar/expand.svg +3 -0
  701. package/lib/assets/img/svg/bottombar/help.svg +72 -0
  702. package/lib/assets/img/svg/bottombar/incm_toggle.svg +39 -0
  703. package/lib/assets/img/svg/bottombar/pan_1.svg +57 -0
  704. package/lib/assets/img/svg/bottombar/pan_2.svg +27 -0
  705. package/lib/assets/img/svg/bottombar/pan_3.svg +27 -0
  706. package/lib/assets/img/svg/bottombar/pan_4.svg +27 -0
  707. package/lib/assets/img/svg/bottombar/pan_5.svg +27 -0
  708. package/lib/assets/img/svg/bottombar/settings.svg +23 -0
  709. package/lib/assets/img/svg/bottombar/spin-down.svg +76 -0
  710. package/lib/assets/img/svg/bottombar/spin-left.svg +75 -0
  711. package/lib/assets/img/svg/bottombar/spin-right.svg +75 -0
  712. package/lib/assets/img/svg/bottombar/spin-up.svg +76 -0
  713. package/lib/assets/img/svg/bottombar/spin_1.svg +48 -0
  714. package/lib/assets/img/svg/bottombar/spin_2.svg +31 -0
  715. package/lib/assets/img/svg/bottombar/spin_3.svg +31 -0
  716. package/lib/assets/img/svg/bottombar/spin_4.svg +31 -0
  717. package/lib/assets/img/svg/bottombar/spin_5.svg +31 -0
  718. package/lib/assets/img/svg/bottombar/zoomin.svg +29 -0
  719. package/lib/assets/img/svg/bottombar/zoomout.svg +26 -0
  720. package/lib/assets/img/svg/check.svg +10 -0
  721. package/lib/assets/img/svg/close.svg +11 -0
  722. package/lib/assets/img/svg/color/Black.svg +3 -0
  723. package/lib/assets/img/svg/color/Blue.svg +3 -0
  724. package/lib/assets/img/svg/color/Cream.svg +3 -0
  725. package/lib/assets/img/svg/color/Gray.svg +3 -0
  726. package/lib/assets/img/svg/color/Green.svg +3 -0
  727. package/lib/assets/img/svg/color/White.svg +3 -0
  728. package/lib/assets/img/svg/color/White.svg.bak +3 -0
  729. package/lib/assets/img/svg/color/stone2.jpg +0 -0
  730. package/lib/assets/img/svg/color/wood2.jpg +0 -0
  731. package/lib/assets/img/svg/copy.svg +11 -0
  732. package/lib/assets/img/svg/delete.svg +7 -0
  733. package/lib/assets/img/svg/detail.svg +77 -0
  734. package/lib/assets/img/svg/disclaimer/background.svg +758 -0
  735. package/lib/assets/img/svg/disclaimer/logo-dots.svg +11 -0
  736. package/lib/assets/img/svg/door/Closet.svg +11 -0
  737. package/lib/assets/img/svg/door/Exterior.svg +5 -0
  738. package/lib/assets/img/svg/door/Framed_dorway.svg +5 -0
  739. package/lib/assets/img/svg/door/Frameless_dorway.svg +5 -0
  740. package/lib/assets/img/svg/door/Interior.svg +7 -0
  741. package/lib/assets/img/svg/door/Sliding.svg +5 -0
  742. package/lib/assets/img/svg/doors_closet.svg +47 -0
  743. package/lib/assets/img/svg/doors_exterior.svg +25 -0
  744. package/lib/assets/img/svg/doors_interior.svg +29 -0
  745. package/lib/assets/img/svg/doors_patio.svg +26 -0
  746. package/lib/assets/img/svg/duplicate.svg +11 -0
  747. package/lib/assets/img/svg/duplicate_object_left.svg +32 -0
  748. package/lib/assets/img/svg/duplicate_object_right.svg +32 -0
  749. package/lib/assets/img/svg/filtersActive.svg +19 -0
  750. package/lib/assets/img/svg/firstsetting/L.svg +3 -0
  751. package/lib/assets/img/svg/firstsetting/L2.svg +3 -0
  752. package/lib/assets/img/svg/firstsetting/Open.svg +3 -0
  753. package/lib/assets/img/svg/firstsetting/Square.svg +3 -0
  754. package/lib/assets/img/svg/firstsetting/bar-active.svg +9 -0
  755. package/lib/assets/img/svg/firstsetting/bar-normal.svg +3 -0
  756. package/lib/assets/img/svg/firstsetting/bullet-current.svg +3 -0
  757. package/lib/assets/img/svg/firstsetting/bullet-done.svg +3 -0
  758. package/lib/assets/img/svg/firstsetting/bullet-not-done.svg +3 -0
  759. package/lib/assets/img/svg/firstsetting/check-active.svg +3 -0
  760. package/lib/assets/img/svg/firstsetting/check-normal.svg +3 -0
  761. package/lib/assets/img/svg/firstsetting/pencil.svg +11 -0
  762. package/lib/assets/img/svg/green_checkmark.svg +27 -0
  763. package/lib/assets/img/svg/headerbar/assist.svg +3 -0
  764. package/lib/assets/img/svg/headerbar/cart.svg +3 -0
  765. package/lib/assets/img/svg/headerbar/check.svg +10 -0
  766. package/lib/assets/img/svg/headerbar/consult_designer.svg +45 -0
  767. package/lib/assets/img/svg/headerbar/edit_name.svg +26 -0
  768. package/lib/assets/img/svg/headerbar/file-dollar.svg +13 -0
  769. package/lib/assets/img/svg/headerbar/hamburger_menu.svg +32 -0
  770. package/lib/assets/img/svg/headerbar/plus.svg +11 -0
  771. package/lib/assets/img/svg/headerbar/review_quote.svg +44 -0
  772. package/lib/assets/img/svg/headerbar/ruler-measure.svg +11 -0
  773. package/lib/assets/img/svg/headerbar/save.svg +3 -0
  774. package/lib/assets/img/svg/headerbar/setting.svg +75 -0
  775. package/lib/assets/img/svg/help/check.svg +10 -0
  776. package/lib/assets/img/svg/help/search.svg +76 -0
  777. package/lib/assets/img/svg/intro/1-start-with-floorplan-whole.svg +27 -0
  778. package/lib/assets/img/svg/intro/1-start-with-floorplan.svg +26 -0
  779. package/lib/assets/img/svg/intro/2-start-from-scratch-whole.svg +28 -0
  780. package/lib/assets/img/svg/intro/2-start-from-scratch.svg +27 -0
  781. package/lib/assets/img/svg/intro/3-retrieve-project-whole.svg +19 -0
  782. package/lib/assets/img/svg/intro/3-retrieve-project.svg +18 -0
  783. package/lib/assets/img/svg/invert.svg +12 -0
  784. package/lib/assets/img/svg/lefttoolbar/appliance-active.svg +13 -0
  785. package/lib/assets/img/svg/lefttoolbar/appliance.svg +13 -0
  786. package/lib/assets/img/svg/lefttoolbar/cabinet-active.svg +10 -0
  787. package/lib/assets/img/svg/lefttoolbar/cabinet-category.svg +3 -0
  788. package/lib/assets/img/svg/lefttoolbar/cabinet-one.svg +3 -0
  789. package/lib/assets/img/svg/lefttoolbar/cabinet.svg +10 -0
  790. package/lib/assets/img/svg/lefttoolbar/disigner_assistance.svg +89 -0
  791. package/lib/assets/img/svg/lefttoolbar/door-style-active.svg +20 -0
  792. package/lib/assets/img/svg/lefttoolbar/door-style.svg +20 -0
  793. package/lib/assets/img/svg/lefttoolbar/door.svg +12 -0
  794. package/lib/assets/img/svg/lefttoolbar/error_icon.svg +81 -0
  795. package/lib/assets/img/svg/lefttoolbar/finishing-active.svg +13 -0
  796. package/lib/assets/img/svg/lefttoolbar/finishing.svg +13 -0
  797. package/lib/assets/img/svg/lefttoolbar/reviewforquote-active.svg +86 -0
  798. package/lib/assets/img/svg/lefttoolbar/reviewforquote.svg +12 -0
  799. package/lib/assets/img/svg/lefttoolbar/room-shape-L.svg +3 -0
  800. package/lib/assets/img/svg/lefttoolbar/room-shape-active.svg +18 -0
  801. package/lib/assets/img/svg/lefttoolbar/room-shape-custom.svg +12 -0
  802. package/lib/assets/img/svg/lefttoolbar/room-shape-irregular.svg +3 -0
  803. package/lib/assets/img/svg/lefttoolbar/room-shape-open.svg +3 -0
  804. package/lib/assets/img/svg/lefttoolbar/room-shape-square.svg +3 -0
  805. package/lib/assets/img/svg/lefttoolbar/room-shape.svg +18 -0
  806. package/lib/assets/img/svg/lefttoolbar/search.svg +76 -0
  807. package/lib/assets/img/svg/lefttoolbar/view_more.svg +86 -0
  808. package/lib/assets/img/svg/lefttoolbar/warning_icon.svg +81 -0
  809. package/lib/assets/img/svg/lefttoolbar/window.svg +12 -0
  810. package/lib/assets/img/svg/logo.svg +11 -0
  811. package/lib/assets/img/svg/logo_with_text.svg +25 -0
  812. package/lib/assets/img/svg/menubar/login.svg +84 -0
  813. package/lib/assets/img/svg/menubar/my_projects.svg +85 -0
  814. package/lib/assets/img/svg/menubar/new_project.svg +110 -0
  815. package/lib/assets/img/svg/menubar/save_project.svg +84 -0
  816. package/lib/assets/img/svg/options.svg +3 -0
  817. package/lib/assets/img/svg/positioning.svg +3 -0
  818. package/lib/assets/img/svg/rotate.png +0 -0
  819. package/lib/assets/img/svg/rotate.svg +17 -0
  820. package/lib/assets/img/svg/rotate_object_clockwise.svg +26 -0
  821. package/lib/assets/img/svg/rotate_object_counterclockwise.svg +26 -0
  822. package/lib/assets/img/svg/toggleFilters.svg +19 -0
  823. package/lib/assets/img/svg/toolbar/add_appliances_active.svg +64 -0
  824. package/lib/assets/img/svg/toolbar/add_appliances_inactive.svg +52 -0
  825. package/lib/assets/img/svg/toolbar/add_button.svg +36 -0
  826. package/lib/assets/img/svg/toolbar/add_cabinets_active.svg +59 -0
  827. package/lib/assets/img/svg/toolbar/add_cabinets_inactive.svg +49 -0
  828. package/lib/assets/img/svg/toolbar/add_items_doors.svg +25 -0
  829. package/lib/assets/img/svg/toolbar/add_items_doorways.svg +24 -0
  830. package/lib/assets/img/svg/toolbar/add_items_refrigerator.svg +32 -0
  831. package/lib/assets/img/svg/toolbar/add_items_windows.svg +28 -0
  832. package/lib/assets/img/svg/toolbar/apply_button.svg +38 -0
  833. package/lib/assets/img/svg/toolbar/arrow-plus.svg +11 -0
  834. package/lib/assets/img/svg/toolbar/backsplash.svg +8 -0
  835. package/lib/assets/img/svg/toolbar/cancel_button.svg +37 -0
  836. package/lib/assets/img/svg/toolbar/consult_a_designer_button.svg +47 -0
  837. package/lib/assets/img/svg/toolbar/countertop.svg +7 -0
  838. package/lib/assets/img/svg/toolbar/dcm.png +0 -0
  839. package/lib/assets/img/svg/toolbar/dcm_off.svg +12 -0
  840. package/lib/assets/img/svg/toolbar/dcm_on.svg +474 -0
  841. package/lib/assets/img/svg/toolbar/delete_button.svg +37 -0
  842. package/lib/assets/img/svg/toolbar/download.svg +77 -0
  843. package/lib/assets/img/svg/toolbar/draw_custom_floor.svg +31 -0
  844. package/lib/assets/img/svg/toolbar/edit_button.svg +75 -0
  845. package/lib/assets/img/svg/toolbar/email_quote_button.svg +44 -0
  846. package/lib/assets/img/svg/toolbar/fbm.png +0 -0
  847. package/lib/assets/img/svg/toolbar/finishing_touches_active.svg +54 -0
  848. package/lib/assets/img/svg/toolbar/finishing_touches_inactive.svg +42 -0
  849. package/lib/assets/img/svg/toolbar/floorstyle.svg +9 -0
  850. package/lib/assets/img/svg/toolbar/fmb.png +0 -0
  851. package/lib/assets/img/svg/toolbar/fmb_off.svg +12 -0
  852. package/lib/assets/img/svg/toolbar/fmb_on.svg +489 -0
  853. package/lib/assets/img/svg/toolbar/furnishings_icon.svg +6 -0
  854. package/lib/assets/img/svg/toolbar/get_started_button.svg +41 -0
  855. package/lib/assets/img/svg/toolbar/handles.svg +5 -0
  856. package/lib/assets/img/svg/toolbar/lighting.svg +7 -0
  857. package/lib/assets/img/svg/toolbar/lrm.png +0 -0
  858. package/lib/assets/img/svg/toolbar/lrm_off.svg +12 -0
  859. package/lib/assets/img/svg/toolbar/lrm_on.svg +470 -0
  860. package/lib/assets/img/svg/toolbar/make_floorplan_active.svg +66 -0
  861. package/lib/assets/img/svg/toolbar/make_floorplan_inactive.svg +52 -0
  862. package/lib/assets/img/svg/toolbar/predefined_room_l_shaped.svg +20 -0
  863. package/lib/assets/img/svg/toolbar/predefined_room_layout.svg +20 -0
  864. package/lib/assets/img/svg/toolbar/predefined_room_long_narrow.svg +20 -0
  865. package/lib/assets/img/svg/toolbar/predefined_room_open_l_shape.svg +20 -0
  866. package/lib/assets/img/svg/toolbar/predefined_room_open_pentagon.svg +20 -0
  867. package/lib/assets/img/svg/toolbar/predefined_room_open_rectangle.svg +20 -0
  868. package/lib/assets/img/svg/toolbar/predefined_room_open_rectangle_2.svg +20 -0
  869. package/lib/assets/img/svg/toolbar/predefined_room_pentagon.svg +20 -0
  870. package/lib/assets/img/svg/toolbar/predefined_room_rectangle.svg +20 -0
  871. package/lib/assets/img/svg/toolbar/predefined_room_rectangle_with_alcove.svg +20 -0
  872. package/lib/assets/img/svg/toolbar/redo_button.svg +75 -0
  873. package/lib/assets/img/svg/toolbar/redo_button1.svg +75 -0
  874. package/lib/assets/img/svg/toolbar/review_quote_active.svg +14 -0
  875. package/lib/assets/img/svg/toolbar/review_quote_inactive.svg +44 -0
  876. package/lib/assets/img/svg/toolbar/save_project_button.svg +44 -0
  877. package/lib/assets/img/svg/toolbar/select_doorstyle_active.svg +67 -0
  878. package/lib/assets/img/svg/toolbar/select_doorstyle_inactive.svg +57 -0
  879. package/lib/assets/img/svg/toolbar/shopping-cart.svg +13 -0
  880. package/lib/assets/img/svg/toolbar/style_change_button.svg +47 -0
  881. package/lib/assets/img/svg/toolbar/take_picture.svg +75 -0
  882. package/lib/assets/img/svg/toolbar/undo_button.svg +76 -0
  883. package/lib/assets/img/svg/toolbar/undo_button1.svg +76 -0
  884. package/lib/assets/img/svg/toolbar/use_button.svg +37 -0
  885. package/lib/assets/img/svg/toolbar/wall_color_icon.svg +6 -0
  886. package/lib/assets/img/svg/topbar/edit_active.svg +10 -0
  887. package/lib/assets/img/svg/topbar/edit_inactive.svg +10 -0
  888. package/lib/assets/img/svg/topbar/redo_active.svg +42 -0
  889. package/lib/assets/img/svg/topbar/redo_inactive.svg +23 -0
  890. package/lib/assets/img/svg/topbar/select_all_active.svg +50 -0
  891. package/lib/assets/img/svg/topbar/select_all_inactive.svg +32 -0
  892. package/lib/assets/img/svg/topbar/take_picture_active.svg +51 -0
  893. package/lib/assets/img/svg/topbar/take_picture_inactive.svg +26 -0
  894. package/lib/assets/img/svg/topbar/undo_active.svg +42 -0
  895. package/lib/assets/img/svg/topbar/undo_inactive.svg +23 -0
  896. package/lib/assets/img/svg/warning_info_2d.svg +81 -0
  897. package/lib/assets/img/svg/window/Clear.svg +3 -0
  898. package/lib/assets/img/svg/window/Cross.svg +5 -0
  899. package/lib/assets/img/svg/window/Double_hung.svg +4 -0
  900. package/lib/assets/img/svg/window/Vertical.svg +4 -0
  901. package/lib/assets/img/svg/windows_clear.svg +23 -0
  902. package/lib/assets/img/svg/windows_cross.svg +28 -0
  903. package/lib/assets/img/svg/windows_double_hung.svg +24 -0
  904. package/lib/assets/img/svg/windows_vertical.svg +24 -0
  905. package/lib/assets/img/svg/wizardstep/Custom.svg +3 -0
  906. package/lib/assets/img/svg/wizardstep/Dashed_line.svg +3 -0
  907. package/lib/assets/img/svg/wizardstep/L.svg +3 -0
  908. package/lib/assets/img/svg/wizardstep/L2.svg +3 -0
  909. package/lib/assets/img/svg/wizardstep/Open.svg +3 -0
  910. package/lib/assets/img/svg/wizardstep/Square.svg +3 -0
  911. package/lib/assets/img/svg/wizardstep/bar-active.svg +9 -0
  912. package/lib/assets/img/svg/wizardstep/bar-normal.svg +3 -0
  913. package/lib/assets/img/svg/wizardstep/bullet-current.svg +3 -0
  914. package/lib/assets/img/svg/wizardstep/bullet-done.svg +3 -0
  915. package/lib/assets/img/svg/wizardstep/bullet-not-done.svg +3 -0
  916. package/lib/assets/img/svg/wizardstep/check-active.svg +3 -0
  917. package/lib/assets/img/svg/wizardstep/check-normal.svg +3 -0
  918. package/lib/assets/img/svg/wizardstep/detail_view.svg +87 -0
  919. package/lib/assets/img/svg/wizardstep/pencil.svg +11 -0
  920. package/lib/assets/img/svg/wizardstep/tile_view.svg +95 -0
  921. package/lib/assets/img/texture/glass.jpg +0 -0
  922. package/lib/assets/img/texture/steel.jpg +0 -0
  923. package/lib/assets/img/texture/white1px.jpg +0 -0
  924. package/lib/assets/img/texture/wood.jpg +0 -0
  925. package/lib/assets/model/DCM.bin +0 -0
  926. package/lib/assets/model/DCM.fbx +0 -0
  927. package/lib/assets/model/DCM.gltf +1 -0
  928. package/lib/assets/model/FBM.bin +0 -0
  929. package/lib/assets/model/FBM.fbx +0 -0
  930. package/lib/assets/model/FBM.gltf +1 -0
  931. package/lib/assets/model/LRM.bin +0 -0
  932. package/lib/assets/model/LRM.fbx +0 -0
  933. package/lib/assets/model/LRM.gltf +1 -0
  934. package/lib/assets/rtastore_logo.png +0 -0
  935. package/lib/catalog/areas/area/planner-element.js +53 -0
  936. package/lib/catalog/areas/area/textures/ceramic-tile.jpg +0 -0
  937. package/lib/catalog/areas/area/textures/grass.jpg +0 -0
  938. package/lib/catalog/areas/area/textures/parquet.jpg +0 -0
  939. package/lib/catalog/areas/area/textures/strand-porcelain.jpg +0 -0
  940. package/lib/catalog/areas/area/textures/tile1.jpg +0 -0
  941. package/lib/catalog/back.png +0 -0
  942. package/lib/catalog/cabinet/cabinet-assembly-order.js +42 -0
  943. package/lib/catalog/cabinet/cabinet-texture-resolver.js +14 -0
  944. package/lib/catalog/catalog.js +270 -0
  945. package/lib/catalog/doors.png +0 -0
  946. package/lib/catalog/doorways.png +0 -0
  947. package/lib/catalog/envMap/nx.hdr +0 -0
  948. package/lib/catalog/envMap/ny.hdr +0 -0
  949. package/lib/catalog/envMap/nz.hdr +0 -0
  950. package/lib/catalog/envMap/px.hdr +0 -0
  951. package/lib/catalog/envMap/py.hdr +0 -0
  952. package/lib/catalog/envMap/pz.hdr +0 -0
  953. package/lib/catalog/export.js +1 -0
  954. package/lib/catalog/factories/area-factory-3d.js +187 -0
  955. package/lib/catalog/factories/area-factory.js +88 -0
  956. package/lib/catalog/factories/export.js +25 -0
  957. package/lib/catalog/factories/wall-factory-3d.js +212 -0
  958. package/lib/catalog/factories/wall-factory.js +279 -0
  959. package/lib/catalog/holes/door-closet/planner-element.js +232 -0
  960. package/lib/catalog/holes/door-double/door_double.png +0 -0
  961. package/lib/catalog/holes/door-double/planner-element.js +325 -0
  962. package/lib/catalog/holes/door-exterior/planner-element.js +225 -0
  963. package/lib/catalog/holes/door-interior/planner-element.js +237 -0
  964. package/lib/catalog/holes/door-panic/panicDoor.png +0 -0
  965. package/lib/catalog/holes/door-panic/planner-element.js +513 -0
  966. package/lib/catalog/holes/door-panic-double/panicDoorDouble.png +0 -0
  967. package/lib/catalog/holes/door-panic-double/planner-element.js +473 -0
  968. package/lib/catalog/holes/door-sliding/planner-element.js +235 -0
  969. package/lib/catalog/holes/doorway-framed/planner-element.js +155 -0
  970. package/lib/catalog/holes/doorway-frameless/planner-element.js +114 -0
  971. package/lib/catalog/holes/export.js +97 -0
  972. package/lib/catalog/holes/gate/gate.jpg +0 -0
  973. package/lib/catalog/holes/window-clear/planner-element.js +176 -0
  974. package/lib/catalog/holes/window-clear/texture.png +0 -0
  975. package/lib/catalog/holes/window-cross/planner-element.js +175 -0
  976. package/lib/catalog/holes/window-cross/texture.png +0 -0
  977. package/lib/catalog/holes/window-double-hung/planner-element.js +313 -0
  978. package/lib/catalog/holes/window-double-hung/texture.png +0 -0
  979. package/lib/catalog/holes/window-vertical/planner-element.js +286 -0
  980. package/lib/catalog/holes/window-vertical/texture.png +0 -0
  981. package/lib/catalog/lines/wall/planner-element.js +87 -0
  982. package/lib/catalog/lines/wall/textures/bricks-normal.jpg +0 -0
  983. package/lib/catalog/lines/wall/textures/bricks.jpg +0 -0
  984. package/lib/catalog/lines/wall/textures/bricks2.jpg +0 -0
  985. package/lib/catalog/lines/wall/textures/morden-normal.jpg +0 -0
  986. package/lib/catalog/lines/wall/textures/morden.jpg +0 -0
  987. package/lib/catalog/lines/wall/textures/painted-normal.jpg +0 -0
  988. package/lib/catalog/lines/wall/textures/painted.jpg +0 -0
  989. package/lib/catalog/lines/wall/textures/plaster-normal.jpg +0 -0
  990. package/lib/catalog/lines/wall/textures/plaster.jpg +0 -0
  991. package/lib/catalog/lines/wall/wall.png +0 -0
  992. package/lib/catalog/molding/molding-dcm/planner-element.js +33 -0
  993. package/lib/catalog/molding/molding-dcm/texture.png +0 -0
  994. package/lib/catalog/molding/molding-fbm/planner-element.js +33 -0
  995. package/lib/catalog/molding/molding-fbm/texture.png +0 -0
  996. package/lib/catalog/molding/molding-lrm/planner-element.js +33 -0
  997. package/lib/catalog/molding/molding-lrm/texture.png +0 -0
  998. package/lib/catalog/utils/exporter.js +180 -0
  999. package/lib/catalog/utils/geom-utils.js +205 -0
  1000. package/lib/catalog/utils/item-loader.js +1620 -0
  1001. package/lib/catalog/utils/load-obj.js +129 -0
  1002. package/lib/catalog/utils/mtl-loader.js +366 -0
  1003. package/lib/catalog/utils/obj-loader.js +486 -0
  1004. package/lib/catalog/windows.png +0 -0
  1005. package/lib/class/area.js +147 -0
  1006. package/lib/class/export.js +88 -0
  1007. package/lib/class/group.js +438 -0
  1008. package/lib/class/guide.js +64 -0
  1009. package/lib/class/hole.js +930 -0
  1010. package/lib/class/item.js +2138 -0
  1011. package/lib/class/layer.js +670 -0
  1012. package/lib/class/line.js +1236 -0
  1013. package/lib/class/project.js +949 -0
  1014. package/lib/class/vertex.js +211 -0
  1015. package/lib/components/content.js +160 -0
  1016. package/lib/components/export.js +7 -0
  1017. package/lib/components/style/export.js +17 -0
  1018. package/lib/components/style/form-number-input.js +192 -0
  1019. package/lib/components/style/form-submit-button.js +35 -0
  1020. package/lib/components/viewer2d/area.js +89 -0
  1021. package/lib/components/viewer2d/export.js +121 -0
  1022. package/lib/components/viewer2d/grids/grid-horizontal-streak.js +44 -0
  1023. package/lib/components/viewer2d/grids/grid-streak.js +44 -0
  1024. package/lib/components/viewer2d/grids/grid-vertical-streak.js +44 -0
  1025. package/lib/components/viewer2d/grids/grids.js +40 -0
  1026. package/lib/components/viewer2d/group.js +63 -0
  1027. package/lib/components/viewer2d/item.js +259 -0
  1028. package/lib/components/viewer2d/layer.js +172 -0
  1029. package/lib/components/viewer2d/line.js +975 -0
  1030. package/lib/components/viewer2d/ruler.js +92 -0
  1031. package/lib/components/viewer2d/rulerDist.js +110 -0
  1032. package/lib/components/viewer2d/rulerX.js +154 -0
  1033. package/lib/components/viewer2d/rulerY.js +156 -0
  1034. package/lib/components/viewer2d/scene.js +137 -0
  1035. package/lib/components/viewer2d/snap.js +84 -0
  1036. package/lib/components/viewer2d/state.js +83 -0
  1037. package/lib/components/viewer2d/utils.js +200 -0
  1038. package/lib/components/viewer2d/vertex.js +76 -0
  1039. package/lib/components/viewer2d/viewer2d.js +1478 -0
  1040. package/lib/components/viewer3d/camera-controls-module/camera-controls.module.js +2591 -0
  1041. package/lib/components/viewer3d/dcm.js +408 -0
  1042. package/lib/components/viewer3d/fbm.js +421 -0
  1043. package/lib/components/viewer3d/front3D.js +71 -0
  1044. package/lib/components/viewer3d/grid-creator.js +35 -0
  1045. package/lib/components/viewer3d/grids/grid-horizontal-streak.js +45 -0
  1046. package/lib/components/viewer3d/grids/grid-streak.js +36 -0
  1047. package/lib/components/viewer3d/grids/grid-vertical-streak.js +45 -0
  1048. package/lib/components/viewer3d/libs/first-person-controls.js +74 -0
  1049. package/lib/components/viewer3d/libs/helvetiker_regular.typeface.js +1287 -0
  1050. package/lib/components/viewer3d/libs/mtl-loader.js +366 -0
  1051. package/lib/components/viewer3d/libs/obj-loader.js +471 -0
  1052. package/lib/components/viewer3d/libs/orbit-controls.js +706 -0
  1053. package/lib/components/viewer3d/libs/pointer-lock-controls.js +53 -0
  1054. package/lib/components/viewer3d/lrm.js +312 -0
  1055. package/lib/components/viewer3d/model.js +714 -0
  1056. package/lib/components/viewer3d/pointer-lock-navigation.js +32 -0
  1057. package/lib/components/viewer3d/ruler-utils/itemRect.js +69 -0
  1058. package/lib/components/viewer3d/ruler-utils/layer3D.js +503 -0
  1059. package/lib/components/viewer3d/ruler-utils/ruler3D.js +232 -0
  1060. package/lib/components/viewer3d/ruler-utils/scene3D.js +67 -0
  1061. package/lib/components/viewer3d/ruler-utils/state3D.js +26 -0
  1062. package/lib/components/viewer3d/scene-creator.js +3887 -0
  1063. package/lib/components/viewer3d/three-memory-cleaner.js +46 -0
  1064. package/lib/components/viewer3d/viewer3d-first-person.js +316 -0
  1065. package/lib/components/viewer3d/viewer3d.js +2777 -0
  1066. package/lib/constants/applianceCategories.js +25 -0
  1067. package/lib/constants/catalog/skinPanel.js +15 -0
  1068. package/lib/constants.js +798 -0
  1069. package/lib/devLiteRenderer.js +917 -0
  1070. package/lib/engine/2d/viewer-utils.js +25 -0
  1071. package/lib/events/external/handleExternalEvent.js +151 -0
  1072. package/lib/events/external/handleExternalEvent.util.js +1111 -0
  1073. package/lib/events/external/handlers.addItem.js +54 -0
  1074. package/lib/events/external/handlers.changeDoorStyle.js +145 -0
  1075. package/lib/events/external/handlers.elementOps.js +24 -0
  1076. package/lib/events/external/handlers.finishing.js +32 -0
  1077. package/lib/events/external/handlers.hole.js +10 -0
  1078. package/lib/events/external/handlers.loadProject.js +134 -0
  1079. package/lib/events/external/handlers.molding.js +31 -0
  1080. package/lib/events/external/handlers.projectLifecycle.js +19 -0
  1081. package/lib/events/external/handlers.projectSettings.js +38 -0
  1082. package/lib/events/external/handlers.replaceCabinet.js +48 -0
  1083. package/lib/events/external/handlers.roomShape.js +14 -0
  1084. package/lib/events/external/handlers.syncScene.js +61 -0
  1085. package/lib/events/external/handlers.updateSelectedElements.js +17 -0
  1086. package/lib/events/external/handlers.viewMode.js +19 -0
  1087. package/lib/events/external/handlers.viewerNavigation.js +117 -0
  1088. package/lib/events/external/handlers.wall.js +13 -0
  1089. package/lib/index.js +637 -0
  1090. package/lib/mappings/external-events/mapExternalEventPayload.js +33 -0
  1091. package/lib/mappings/external-events/mappers/addItemMapper.js +103 -0
  1092. package/lib/mappings/external-events/mappers/ccdfMapper.js +104 -0
  1093. package/lib/mappings/external-events/mappers/ccdfToCDSMapper.js +56 -0
  1094. package/lib/mappings/external-events/mappers/changeDoorStyleMapper.js +44 -0
  1095. package/lib/mappings/external-events/mappers/loadProjectMapper.js +70 -0
  1096. package/lib/mappings/holesToCatalog.js +148 -0
  1097. package/lib/models.js +540 -0
  1098. package/lib/plugins/SVGLoader.js +1419 -0
  1099. package/lib/plugins/console-debugger.js +42 -0
  1100. package/lib/plugins/export.js +25 -0
  1101. package/lib/plugins/keyboard.js +117 -0
  1102. package/lib/reducers/areas-reducer.js +19 -0
  1103. package/lib/reducers/export.js +89 -0
  1104. package/lib/reducers/groups-reducer.js +45 -0
  1105. package/lib/reducers/holes-reducer.js +69 -0
  1106. package/lib/reducers/items-reducer.js +146 -0
  1107. package/lib/reducers/lines-reducer.js +52 -0
  1108. package/lib/reducers/project-reducer.js +143 -0
  1109. package/lib/reducers/reducer.js +25 -0
  1110. package/lib/reducers/scene-reducer.js +35 -0
  1111. package/lib/reducers/vertices-reducer.js +26 -0
  1112. package/lib/reducers/viewer2d-reducer.js +84 -0
  1113. package/lib/reducers/viewer3d-reducer.js +65 -0
  1114. package/lib/shared/concurrency/async-pool.js +78 -0
  1115. package/lib/shared/domain/asset/load-asset-json.js +60 -0
  1116. package/lib/shared/domain/asset/sanitize-asset-url.js +31 -0
  1117. package/lib/shared/domain/cabinet-corner.js +12 -0
  1118. package/lib/shared/domain/cabinet-mirror.js +13 -0
  1119. package/lib/shared/domain/cabinet-warning.js +18 -0
  1120. package/lib/shared/math/line-metrics.js +40 -0
  1121. package/lib/shared/network/load-json.js +51 -0
  1122. package/lib/shared/objects/immutable.js +9 -0
  1123. package/lib/shared-style.js +72 -0
  1124. package/lib/translator/en.js +111 -0
  1125. package/lib/translator/it.js +86 -0
  1126. package/lib/translator/ru.js +86 -0
  1127. package/lib/translator/translator.js +87 -0
  1128. package/lib/utils/browser.js +40 -0
  1129. package/lib/utils/convert-units-lite.js +44 -0
  1130. package/lib/utils/email-validator.js +10 -0
  1131. package/lib/utils/export.js +56 -0
  1132. package/lib/utils/geometry/overlap/index.js +12 -0
  1133. package/lib/utils/geometry/overlap/overlapHelpers.js +30 -0
  1134. package/lib/utils/geometry/overlap/pointHelpers.js +31 -0
  1135. package/lib/utils/geometry/overlap/relationshipOfTwoOverlappedLines2.js +381 -0
  1136. package/lib/utils/geometry.js +2903 -0
  1137. package/lib/utils/get-edges-of-subgraphs.js +33 -0
  1138. package/lib/utils/graph-cycles.js +239 -0
  1139. package/lib/utils/graph-inner-cycles.js +54 -0
  1140. package/lib/utils/graph.js +153 -0
  1141. package/lib/utils/helper.js +477 -0
  1142. package/lib/utils/history.js +48 -0
  1143. package/lib/utils/id-broker.js +22 -0
  1144. package/lib/utils/logger.js +14 -0
  1145. package/lib/utils/math.js +57 -0
  1146. package/lib/utils/molding.js +1146 -0
  1147. package/lib/utils/name-generator.js +21 -0
  1148. package/lib/utils/objects-utils.js +62 -0
  1149. package/lib/utils/phone-validator.js +10 -0
  1150. package/lib/utils/process-black-list.js +22 -0
  1151. package/lib/utils/react-if.js +25 -0
  1152. package/lib/utils/ruler.js +63 -0
  1153. package/lib/utils/skinPanelEngine.js +639 -0
  1154. package/lib/utils/snap-scene.js +101 -0
  1155. package/lib/utils/snap.js +245 -0
  1156. package/lib/utils/summarizeCart.js +30 -0
  1157. package/lib/utils/threeCSG.es6.js +504 -0
  1158. package/lib/version.js +7 -0
  1159. package/package.json +136 -0
@@ -0,0 +1,2903 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ var _typeof = require("@babel/runtime/helpers/typeof");
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.ContainsPoint = ContainsPoint;
9
+ exports._twoLineSegmentsIntersection = _twoLineSegmentsIntersection;
10
+ exports.absAngleBetweenTwoPoints = absAngleBetweenTwoPoints;
11
+ exports.almostEqual = void 0;
12
+ exports.angleBetweenTwoLines = angleBetweenTwoLines;
13
+ exports.angleBetweenTwoPoints = angleBetweenTwoPoints;
14
+ exports.angleBetweenTwoPointsAndOrigin = angleBetweenTwoPointsAndOrigin;
15
+ exports.buildRectFromLines = buildRectFromLines;
16
+ exports.calcCreateSnap = calcCreateSnap;
17
+ exports.calcDistancesFromHoleToNearestOneOrWall = calcDistancesFromHoleToNearestOneOrWall;
18
+ exports.calcDistancesFromItemToWalls = calcDistancesFromItemToWalls;
19
+ exports.calcSnap = calcSnap;
20
+ exports.calcSnap1 = calcSnap1;
21
+ exports.calcSnap2 = calcSnap2;
22
+ exports.calcSnap3 = calcSnap3;
23
+ exports.clone_point = clone_point;
24
+ exports.closestPointFromLine = closestPointFromLine;
25
+ exports.closestPointFromLineSegment = closestPointFromLineSegment;
26
+ exports.compareVertices = compareVertices;
27
+ exports.containLine = containLine;
28
+ exports.containPointInRect = containPointInRect;
29
+ exports.cosWithThreshold = cosWithThreshold;
30
+ exports.crossprod = crossprod;
31
+ exports.diff = diff;
32
+ exports.distancePointFromLine = distancePointFromLine;
33
+ exports.distancePointFromLineSegment = distancePointFromLineSegment;
34
+ exports.dotprod = dotprod;
35
+ exports.downcrossLine = downcrossLine;
36
+ exports.extendLine = extendLine;
37
+ exports.findCatalogElement = findCatalogElement;
38
+ exports.getAllArea = getAllArea;
39
+ exports.getAllAreaLines = getAllAreaLines;
40
+ exports.getAllCurSnap = getAllCurSnap;
41
+ exports.getAllHoleRect = getAllHoleRect;
42
+ exports.getAllItemSnap = getAllItemSnap;
43
+ exports.getAllItemSpecified = getAllItemSpecified;
44
+ exports.getAllItems = getAllItems;
45
+ exports.getAllLineSnap = getAllLineSnap;
46
+ exports.getAllLines = getAllLines;
47
+ exports.getCalcRectFromItem = getCalcRectFromItem;
48
+ exports.getCalcRectFromItem3D = getCalcRectFromItem3D;
49
+ exports.getCalcRectFromLine = getCalcRectFromLine;
50
+ exports.getCentroidOfPolygon = getCentroidOfPolygon;
51
+ exports.getHoleItems = getHoleItems;
52
+ exports.getInterSect = getInterSect;
53
+ exports.getLineInterSect = getLineInterSect;
54
+ exports.getLineSnapPointsOfItem = getLineSnapPointsOfItem;
55
+ exports.getNormaline = getNormaline;
56
+ exports.getPoylgonPoints = getPoylgonPoints;
57
+ exports.getRelatedLines = void 0;
58
+ exports.getRelatedVertices = getRelatedVertices;
59
+ exports.getSnappedWallLines = getSnappedWallLines;
60
+ exports.horizontalLine = horizontalLine;
61
+ exports.intersectRect = intersectRect;
62
+ exports.isBackWall = isBackWall;
63
+ exports.isFrontWall = isFrontWall;
64
+ exports.isLeftWall = isLeftWall;
65
+ exports.isOverlappedTwoItemsOnOneLine = isOverlappedTwoItemsOnOneLine;
66
+ exports.isPointInArea = isPointInArea;
67
+ exports.isPointInRect = isPointInRect;
68
+ exports.isPointOnLineSegment = isPointOnLineSegment;
69
+ exports.isRightWall = isRightWall;
70
+ exports.isSnappedLine = isSnappedLine;
71
+ exports.isSnappedSideLine = isSnappedSideLine;
72
+ exports.itemInfo = itemInfo;
73
+ exports.linePassingThroughTwoPoints = linePassingThroughTwoPoints;
74
+ exports.mapRange = mapRange;
75
+ exports.maxVertex = maxVertex;
76
+ exports.midPoint = midPoint;
77
+ exports.minVertex = minVertex;
78
+ exports.needSnap = needSnap;
79
+ exports.orderVertices = orderVertices;
80
+ exports.pointPositionOnLineSegment = pointPositionOnLineSegment;
81
+ exports.pointsDistance = pointsDistance;
82
+ exports.relationshipOfTwoOverlappedLines = relationshipOfTwoOverlappedLines;
83
+ exports.relationshipOfTwoOverlappedLines1 = relationshipOfTwoOverlappedLines1;
84
+ exports.rotatePointAroundPoint = rotatePointAroundPoint;
85
+ exports.roundVertex = roundVertex;
86
+ exports.sameDistances = sameDistances;
87
+ exports.sameMDistances = sameMDistances;
88
+ exports.sameMPoints = sameMPoints;
89
+ exports.samePoints = samePoints;
90
+ exports.shrinkRect = shrinkRect;
91
+ exports.sinWithThreshold = sinWithThreshold;
92
+ exports.snapAngleByUnit = snapAngleByUnit;
93
+ exports.twoLineSegmentsIntersection = twoLineSegmentsIntersection;
94
+ exports.twoLinesIntersection = twoLinesIntersection;
95
+ exports.upcrossLine = upcrossLine;
96
+ exports.validInterSect = validInterSect;
97
+ exports.validRect = validRect;
98
+ exports.validSnap = validSnap;
99
+ exports.validateLineSnaps = validateLineSnaps;
100
+ exports.validateSnaps = validateSnaps;
101
+ exports.verticalLine = verticalLine;
102
+ exports.verticesDistance = verticesDistance;
103
+ exports.verticesMidPoint = verticesMidPoint;
104
+ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
105
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
106
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
107
+ var _math = require("./math.js");
108
+ var _constants = require("../constants");
109
+ var _applianceCategories = require("../constants/applianceCategories");
110
+ var _viewerUtils = require("../engine/2d/viewer-utils.js");
111
+ var _convertUnitsLite = require("./convert-units-lite");
112
+ var Three = _interopRequireWildcard(require("three"));
113
+ var _utils = require("../components/viewer2d/utils.js");
114
+ var _helper = require("./helper.js");
115
+ var _export = require("./export.js");
116
+ var _cabinetCorner = require("../shared/domain/cabinet-corner.js");
117
+ var _index = require("./geometry/overlap/index.js");
118
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
119
+ 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; }
120
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
121
+ 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; } } }; }
122
+ 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; } }
123
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; } /** @description Determines the distance between two points
124
+ * @param {number} x0 Vertex 0 x
125
+ * @param {number} y0 Vertex 0 y
126
+ * @param {number} x1 Vertex 1 x
127
+ * @param {number} y1 Vertex 1 y
128
+ * @return {number}
129
+ */
130
+ function compareVertices(v0, v1) {
131
+ return v0.x === v1.x ? v0.y - v1.y : v0.x - v1.x;
132
+ }
133
+ function minVertex(v0, v1) {
134
+ return compareVertices(v0, v1) > 0 ? v1 : v0;
135
+ }
136
+ function maxVertex(v0, v1) {
137
+ return compareVertices(v0, v1) > 0 ? v0 : v1;
138
+ }
139
+ function orderVertices(vertices) {
140
+ return vertices.sort(compareVertices);
141
+ }
142
+ function pointsDistance(x0, y0, x1, y1) {
143
+ var diff_x = x0 - x1;
144
+ var diff_y = y0 - y1;
145
+ return Math.sqrt(diff_x * diff_x + diff_y * diff_y);
146
+ }
147
+ function verticesDistance(v1, v2) {
148
+ var x0 = v1.x,
149
+ y0 = v1.y;
150
+ var x1 = v2.x,
151
+ y1 = v2.y;
152
+ return pointsDistance(x0, y0, x1, y1);
153
+ }
154
+ function horizontalLine(y) {
155
+ return {
156
+ a: 0,
157
+ b: 1,
158
+ c: -y
159
+ };
160
+ }
161
+ var almostEqual = exports.almostEqual = function almostEqual(x, y) {
162
+ return Math.abs(x - y) < _constants.EPSILON;
163
+ };
164
+ function verticalLine(x) {
165
+ return {
166
+ a: 1,
167
+ b: 0,
168
+ c: -x
169
+ };
170
+ }
171
+ function upcrossLine(x, y) {
172
+ return {
173
+ a: 1,
174
+ b: 1,
175
+ c: -x - y
176
+ };
177
+ }
178
+ function downcrossLine(x, y) {
179
+ return {
180
+ a: 1,
181
+ b: -1,
182
+ c: -x + y
183
+ };
184
+ }
185
+ function linePassingThroughTwoPoints(x1, y1, x2, y2) {
186
+ if (x1 === x2 && y1 == y2) throw new Error('Geometry error');
187
+ //if (x1 === x2) return verticalLine(x1);
188
+ //if (y1 === y2) return horizontalLine(y1);
189
+
190
+ return {
191
+ a: y1 - y2,
192
+ b: x2 - x1,
193
+ c: y2 * x1 - x2 * y1
194
+ };
195
+ }
196
+ function getNormaline(x1, y1, x2, y2) {
197
+ var lineFunction = linePassingThroughTwoPoints(x1, y1, x2, y2);
198
+ return {
199
+ x: lineFunction.a / Math.sqrt(lineFunction.a * lineFunction.a + lineFunction.b * lineFunction.b),
200
+ y: lineFunction.b / Math.sqrt(lineFunction.a * lineFunction.a + lineFunction.b * lineFunction.b)
201
+ };
202
+ }
203
+ function distancePointFromLine(a, b, c, x, y) {
204
+ //https://en.wikipedia.org/wiki/Distance_from_a_point_to_a_line
205
+ return (0, _math.fAbs)(a * x + b * y + c) / Math.sqrt(a * a + b * b);
206
+ }
207
+ function closestPointFromLine(a, b, c, x, y) {
208
+ //https://en.wikipedia.org/wiki/Distance_from_a_point_to_a_line
209
+ var denom = a * a + b * b;
210
+ return {
211
+ x: (b * (b * x - a * y) - a * c) / denom,
212
+ y: (a * -b * x + a * y - b * c) / denom
213
+ };
214
+ }
215
+
216
+ /** @description Get point of intersection between two lines using ax+by+c line's equation
217
+ * @param {number} a x coefficent of first line
218
+ * @param {number} b y coefficent of first line
219
+ * @param {number} c costant of first line
220
+ * @param {number} j x coefficent of second line
221
+ * @param {number} k y coefficent of second line
222
+ * @param {number} l costant of second line
223
+ * @return {object} {x,y} point's coordinates
224
+ */
225
+ function twoLinesIntersection(a, b, c, j, k, l) {
226
+ var angularCoefficientsDiff = b * j - a * k;
227
+ if (angularCoefficientsDiff === 0) return undefined; //no intersection
228
+
229
+ var y = (a * l - c * j) / angularCoefficientsDiff;
230
+ var x = (c * k - b * l) / angularCoefficientsDiff;
231
+ return {
232
+ x: x,
233
+ y: y
234
+ };
235
+ }
236
+ function twoLineSegmentsIntersection(p1, p2, p3, p4) {
237
+ return _twoLineSegmentsIntersection(p1, p2, p3.toJS(), p4.toJS());
238
+ }
239
+ function _twoLineSegmentsIntersection(p1, p2, p3, p4) {
240
+ //https://github.com/psalaets/line-intersect/blob/master/lib/check-intersection.js
241
+
242
+ var x1 = p1.x,
243
+ y1 = p1.y;
244
+ var x2 = p2.x,
245
+ y2 = p2.y;
246
+ var x3 = p3.x,
247
+ y3 = p3.y;
248
+ var x4 = p4.x,
249
+ y4 = p4.y;
250
+ var denom = (y4 - y3) * (x2 - x1) - (x4 - x3) * (y2 - y1);
251
+ var numA = (x4 - x3) * (y1 - y3) - (y4 - y3) * (x1 - x3);
252
+ var numB = (x2 - x1) * (y1 - y3) - (y2 - y1) * (x1 - x3);
253
+ if ((0, _math.fAbs)(denom) <= _constants.LINE_EPSILON) {
254
+ if ((0, _math.fAbs)(numA) <= _constants.LINE_EPSILON && (0, _math.fAbs)(numB) <= _constants.LINE_EPSILON) {
255
+ var comparator = function comparator(pa, pb) {
256
+ return pa.x === pb.x ? pa.y - pb.y : pa.x - pb.x;
257
+ };
258
+ var line0 = [p1, p2].sort(comparator);
259
+ var line1 = [p3, p4].sort(comparator);
260
+ var _sort = [line0, line1].sort(function (lineA, lineB) {
261
+ return comparator(lineA[0], lineB[0]);
262
+ }),
263
+ _sort2 = (0, _slicedToArray2["default"])(_sort, 2),
264
+ lineSX = _sort2[0],
265
+ lineDX = _sort2[1];
266
+ comparator(lineSX[1], lineDX[0]) < 0 ? 'colinear' : 'none';
267
+ if (lineSX[1].x === lineDX[0].x) {
268
+ return {
269
+ type: lineDX[0].y <= lineSX[1].y ? 'colinear' : 'none'
270
+ };
271
+ } else {
272
+ return {
273
+ type: lineDX[0].x <= lineSX[1].x ? 'colinear' : 'none'
274
+ };
275
+ }
276
+ }
277
+ return {
278
+ type: 'parallel'
279
+ };
280
+ }
281
+ var uA = numA / denom;
282
+ var uB = numB / denom;
283
+ if (uA >= 0 - _constants.LINE_EPSILON && uA <= 1 + _constants.LINE_EPSILON && uB >= 0 - _constants.LINE_EPSILON && uB <= 1 + _constants.LINE_EPSILON) {
284
+ var _point = {
285
+ x: x1 + uA * (x2 - x1),
286
+ y: y1 + uA * (y2 - y1)
287
+ };
288
+ return {
289
+ type: 'intersecting',
290
+ point: _point
291
+ };
292
+ }
293
+ return {
294
+ type: 'none'
295
+ };
296
+ }
297
+ function distancePointFromLineSegment(v1, v2, xp, yp) {
298
+ //http://stackoverflow.com/a/6853926/1398836
299
+ var x1 = v1.x,
300
+ y1 = v1.y;
301
+ var x2 = v2.x,
302
+ y2 = v2.y;
303
+ var A = xp - x1;
304
+ var B = yp - y1;
305
+ var C = x2 - x1;
306
+ var D = y2 - y1;
307
+ var dot = A * C + B * D;
308
+ var len_sq = C * C + D * D;
309
+ var param = -1;
310
+ if (len_sq != 0)
311
+ //in case of 0 length line
312
+ param = dot / len_sq;
313
+ var xx, yy;
314
+ if (param < 0) {
315
+ xx = x1;
316
+ yy = y1;
317
+ } else if (param > 1) {
318
+ xx = x2;
319
+ yy = y2;
320
+ } else {
321
+ xx = x1 + param * C;
322
+ yy = y1 + param * D;
323
+ }
324
+ var dx = xp - xx;
325
+ var dy = yp - yy;
326
+ return Math.sqrt(dx * dx + dy * dy);
327
+ }
328
+
329
+ /**
330
+ *
331
+ * @param x1 {number} x for first vertex of the segment
332
+ * @param y1 {number} y for first vertex of the segment
333
+ * @param x2 {number} x for second vertex of the segment
334
+ * @param y2 {number} y for second vertex of the segment
335
+ * @param xp {number} x for point we want to verify
336
+ * @param yp {number} y for point we want to verify
337
+ * @param maxDistance {number} the epsilon value used for comparisons
338
+ * @returns {boolean} true if the point lies on the line segment false otherwise
339
+ */
340
+ function isPointOnLineSegment(x1, y1, x2, y2, xp, yp) {
341
+ var maxDistance = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : _constants.EPSILON;
342
+ return distancePointFromLineSegment({
343
+ x: x1,
344
+ y: y1
345
+ }, {
346
+ x: x2,
347
+ y: y2
348
+ }, xp, yp) <= maxDistance;
349
+ }
350
+ function closestPointFromLineSegment(x1, y1, x2, y2, xp, yp) {
351
+ if (x1 === x2) return {
352
+ x: x1,
353
+ y: yp
354
+ };
355
+ if (y1 === y2) return {
356
+ x: xp,
357
+ y: y1
358
+ };
359
+ var m = (y2 - y1) / (x2 - x1);
360
+ var q = y1 - m * x1;
361
+ var mi = -1 / m;
362
+ var qi = yp - mi * xp;
363
+ var x = (qi - q) / (m - mi);
364
+ var y = m * x + q;
365
+ return {
366
+ x: x,
367
+ y: y
368
+ };
369
+ }
370
+ function pointPositionOnLineSegment(x1, y1, x2, y2, xp, yp) {
371
+ var length = pointsDistance(x1, y1, x2, y2);
372
+ var distance = pointsDistance(x1, y1, xp, yp);
373
+ var offset = distance / length;
374
+ /*
375
+ if (x1 > x2) offset = 1 - offset;
376
+ if (y1 > y2) offset = 1 - offset;
377
+ */
378
+ return offset;
379
+ }
380
+ function mapRange(value, low1, high1, low2, high2) {
381
+ return low2 + (high2 - low2) * (value - low1) / (high1 - low1);
382
+ }
383
+ function angleBetweenTwoPointsAndOrigin(x1, y1, x2, y2) {
384
+ return -Math.atan2(y1 - y2, x2 - x1) * 180 / Math.PI;
385
+ }
386
+ function angleBetweenTwoPoints(x1, y1, x2, y2) {
387
+ return Math.atan2(y2 - y1, x2 - x1);
388
+ }
389
+ function angleBetweenTwoLines(line, drawingLine, vertices) {
390
+ var points = [];
391
+
392
+ // safety guards
393
+ var lv = Array.isArray(line === null || line === void 0 ? void 0 : line.vertices) ? line.vertices : [];
394
+ var dv = Array.isArray(drawingLine === null || drawingLine === void 0 ? void 0 : drawingLine.vertices) ? drawingLine.vertices : [];
395
+
396
+ // 1) push common vertices (in order of line.vertices)
397
+ var _iterator = _createForOfIteratorHelper(lv),
398
+ _step;
399
+ try {
400
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
401
+ var vt = _step.value;
402
+ if (dv.includes(vt) && !points.includes(vt)) points.push(vt);
403
+ }
404
+
405
+ // 2) push remaining vertices from line.vertices
406
+ } catch (err) {
407
+ _iterator.e(err);
408
+ } finally {
409
+ _iterator.f();
410
+ }
411
+ var _iterator2 = _createForOfIteratorHelper(lv),
412
+ _step2;
413
+ try {
414
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
415
+ var _vt = _step2.value;
416
+ if (!points.includes(_vt)) points.push(_vt);
417
+ }
418
+
419
+ // 3) push remaining vertices from drawingLine.vertices
420
+ } catch (err) {
421
+ _iterator2.e(err);
422
+ } finally {
423
+ _iterator2.f();
424
+ }
425
+ var _iterator3 = _createForOfIteratorHelper(dv),
426
+ _step3;
427
+ try {
428
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
429
+ var _vt2 = _step3.value;
430
+ if (!points.includes(_vt2)) points.push(_vt2);
431
+ }
432
+
433
+ // If no points at all, nothing to compute — return 0 (safe fallback)
434
+ } catch (err) {
435
+ _iterator3.e(err);
436
+ } finally {
437
+ _iterator3.f();
438
+ }
439
+ if (points.length === 0) return 0;
440
+
441
+ // Ensure we have at least 3 entries (same behaviour as original)
442
+ while (points.length < 3) points.push(points[points.length - 1]);
443
+ var _points$slice$map = points.slice(0, 3).map(function (idx) {
444
+ var v = vertices === null || vertices === void 0 ? void 0 : vertices[idx];
445
+ return v ? new Three.Vector2(v.x, v.y) : new Three.Vector2(0, 0);
446
+ }),
447
+ _points$slice$map2 = (0, _slicedToArray2["default"])(_points$slice$map, 3),
448
+ c = _points$slice$map2[0],
449
+ p1 = _points$slice$map2[1],
450
+ p2 = _points$slice$map2[2];
451
+ var vec1 = p1.clone().sub(c).normalize();
452
+ var vec2 = p2.clone().sub(c).normalize();
453
+ return Math.floor(vec1.angle() * 180 / Math.PI - vec2.angle() * 180 / Math.PI + 0.5);
454
+ }
455
+ var getRelatedLines = exports.getRelatedLines = function getRelatedLines(tlines, drawingLine, vertices, lines) {
456
+ var exceptLineId = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
457
+ if (!(drawingLine !== null && drawingLine !== void 0 && drawingLine.vertices) || !Array.isArray(drawingLine.vertices)) return;
458
+ var seen = new Set();
459
+ var _iterator4 = _createForOfIteratorHelper(drawingLine.vertices),
460
+ _step4;
461
+ try {
462
+ for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
463
+ var vIdx = _step4.value;
464
+ var vertex = vertices === null || vertices === void 0 ? void 0 : vertices[vIdx];
465
+ if (!(vertex !== null && vertex !== void 0 && vertex.lines)) continue;
466
+ var _iterator5 = _createForOfIteratorHelper(vertex.lines),
467
+ _step5;
468
+ try {
469
+ for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
470
+ var lineId = _step5.value;
471
+ if (lineId !== drawingLine.id && lineId !== exceptLineId && !(0, _helper.isEmpty)(lines === null || lines === void 0 ? void 0 : lines[lineId]) && !seen.has(lineId)) {
472
+ seen.add(lineId);
473
+ tlines.push(lines[lineId]);
474
+ }
475
+ }
476
+ } catch (err) {
477
+ _iterator5.e(err);
478
+ } finally {
479
+ _iterator5.f();
480
+ }
481
+ }
482
+ } catch (err) {
483
+ _iterator4.e(err);
484
+ } finally {
485
+ _iterator4.f();
486
+ }
487
+ };
488
+ function snapAngleByUnit(lineAngle, vertices, drawingLine, x, y, dragVertexId) {
489
+ var tx, ty;
490
+ var absAngle = Math.abs(lineAngle);
491
+ // angle snapping as a value of UNIT_ANGLE
492
+ var rest = absAngle % _constants.UNIT_ANGLE;
493
+ var missAngle = _constants.UNIT_ANGLE - rest;
494
+ var isSingleLine = !drawingLine.vertices.some(function (vetID) {
495
+ return vertices[vetID].lines.some(function (lineID) {
496
+ return lineID !== drawingLine.id;
497
+ });
498
+ });
499
+ // the origin point of rotation(snapping)
500
+ var originVerIndex = drawingLine.vertices.findIndex(function (vertice) {
501
+ return vertice !== dragVertexId;
502
+ });
503
+ var originVerId = originVerIndex < 0 ? drawingLine.vertices[0] : drawingLine.vertices[originVerIndex];
504
+ var ox = vertices[originVerId].x;
505
+ var oy = vertices[originVerId].y;
506
+ // check whether the line is snapped to before point.
507
+ if (rest <= _constants.UNIT_ANGLE / 2) {
508
+ // determine the direction of rotation.
509
+ rest = lineAngle > 0 ? rest : -rest;
510
+ rest = isSingleLine ? -rest : rest;
511
+ // rotate the current point to last point around the first point of drawing line.
512
+ tx = rotatePointAroundPoint(x, y, ox, oy, rest).x;
513
+ ty = rotatePointAroundPoint(x, y, ox, oy, rest).y;
514
+ }
515
+ // check whether the line is snapped to next new point.
516
+ else if (rest > _constants.UNIT_ANGLE / 2) {
517
+ // determine the direction of rotation.
518
+ missAngle = lineAngle > 0 ? -missAngle : missAngle;
519
+ missAngle = isSingleLine ? -missAngle : missAngle;
520
+ // rotate the current point to last point around the first point of drawing line.
521
+ tx = rotatePointAroundPoint(x, y, ox, oy, missAngle).x;
522
+ ty = rotatePointAroundPoint(x, y, ox, oy, missAngle).y;
523
+ }
524
+ var resPoint = {
525
+ x: tx,
526
+ y: ty
527
+ };
528
+ return resPoint;
529
+ }
530
+ function absAngleBetweenTwoPoints(x1, y1, x2, y2) {
531
+ return Math.atan2(y2 - y1, Math.abs(x2 - x1));
532
+ }
533
+ function samePoints(_ref, _ref2) {
534
+ var x1 = _ref.x,
535
+ y1 = _ref.y;
536
+ var x2 = _ref2.x,
537
+ y2 = _ref2.y;
538
+ return (0, _math.fAbs)(x1 - x2) <= _constants.EPSILON && (0, _math.fAbs)(y1 - y2) <= _constants.EPSILON;
539
+ }
540
+ function sameDistances(dis1, dis2) {
541
+ return (0, _math.fAbs)(dis1 - dis2) <= _constants.EPSILON;
542
+ }
543
+ function sameMPoints(_ref3, _ref4) {
544
+ var x1 = _ref3.x,
545
+ y1 = _ref3.y;
546
+ var x2 = _ref4.x,
547
+ y2 = _ref4.y;
548
+ return (0, _math.fAbs)(x1 - x2) <= _constants.MEPSILON && (0, _math.fAbs)(y1 - y2) <= _constants.MEPSILON;
549
+ }
550
+ function sameMDistances(dis1, dis2) {
551
+ return (0, _math.fAbs)(dis1 - dis2) <= _constants.MEPSILON;
552
+ }
553
+ function isPointInRect(rect, point) {
554
+ var result = true;
555
+ for (var i = 0; i < rect.length; i++) {
556
+ var pos1 = rect[i];
557
+ var pos2 = rect[(i + 1) % rect.length];
558
+ if (isPointOnLineSegment(pos1.x, pos1.y, pos2.x, pos2.y, point.x, point.y)) {
559
+ result = false;
560
+ }
561
+ }
562
+ return result;
563
+ }
564
+
565
+ /** @description Extend line based on coordinates and new line length
566
+ * @param {number} x1 Vertex 1 x
567
+ * @param {number} y1 Vertex 1 y
568
+ * @param {number} x2 Vertex 2 x
569
+ * @param {number} y2 Vertex 2 y
570
+ * @param {number} newDistance New line length
571
+ * @return {object}
572
+ */
573
+ function extendLine(x1, y1, x2, y2, newDistance) {
574
+ var precision = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 6;
575
+ var rad = angleBetweenTwoPoints(x1, y1, x2, y2);
576
+ return {
577
+ x: (0, _math.toFixedFloat)(x1 + Math.cos(rad) * newDistance, precision),
578
+ y: (0, _math.toFixedFloat)(y1 + Math.sin(rad) * newDistance, precision)
579
+ };
580
+ }
581
+ function roundVertex(vertex) {
582
+ var precision = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 6;
583
+ vertex.set('x', (0, _math.toFixedFloat)(vertex.get('x'), precision));
584
+ vertex.set('y', (0, _math.toFixedFloat)(vertex.get('y'), precision));
585
+ return vertex;
586
+ }
587
+
588
+ //https://github.com/MartyWallace/PolyK
589
+ function ContainsPoint(polygon, pointX, pointY) {
590
+ var n = polygon.length >> 1;
591
+ var ax, lup;
592
+ var ay = polygon[2 * n - 3] - pointY;
593
+ var bx = polygon[2 * n - 2] - pointX;
594
+ var by = polygon[2 * n - 1] - pointY;
595
+ if (bx === 0 && by === 0) return false; // point on edge
596
+
597
+ // let lup = by > ay;
598
+ for (var ii = 0; ii < n; ii++) {
599
+ ax = bx;
600
+ ay = by;
601
+ bx = polygon[2 * ii] - pointX;
602
+ by = polygon[2 * ii + 1] - pointY;
603
+ if (bx === 0 && by === 0) return false; // point on edge
604
+ if (ay === by) continue;
605
+ lup = by > ay;
606
+ }
607
+ var depth = 0;
608
+ for (var i = 0; i < n; i++) {
609
+ ax = bx;
610
+ ay = by;
611
+ bx = polygon[2 * i] - pointX;
612
+ by = polygon[2 * i + 1] - pointY;
613
+ if (ay < 0 && by < 0) continue; // both 'up' or both 'down'
614
+ if (ay > 0 && by > 0) continue; // both 'up' or both 'down'
615
+ if (ax < 0 && bx < 0) continue; // both points on the left
616
+
617
+ if (ay === by && Math.min(ax, bx) < 0) return true;
618
+ if (ay === by) continue;
619
+ var lx = ax + (bx - ax) * -ay / (by - ay);
620
+ if (lx === 0) return false; // point on edge
621
+ if (lx > 0) depth++;
622
+ if (ay === 0 && lup && by > ay) depth--; // hit vertex, both up
623
+ if (ay === 0 && !lup && by < ay) depth--; // hit vertex, both down
624
+ lup = by > ay;
625
+ }
626
+ return (depth & 1) === 1;
627
+ }
628
+ function cosWithThreshold(alpha, threshold) {
629
+ var cos = Math.cos(alpha);
630
+ return cos < threshold ? 0 : cos;
631
+ }
632
+ function sinWithThreshold(alpha, threshold) {
633
+ var sin = Math.sin(alpha);
634
+ return sin < threshold ? 0 : sin;
635
+ }
636
+ function midPoint(x1, y1, x2, y2) {
637
+ return {
638
+ x: (x1 + x2) / 2,
639
+ y: (y1 + y2) / 2
640
+ };
641
+ }
642
+ function verticesMidPoint(verticesArray) {
643
+ var res = verticesArray.reduce(function (incr, vertex) {
644
+ return {
645
+ x: incr.x + vertex.x,
646
+ y: incr.y + vertex.y
647
+ };
648
+ }, {
649
+ x: 0,
650
+ y: 0
651
+ });
652
+ return {
653
+ x: res.x / verticesArray.length,
654
+ y: res.y / verticesArray.length
655
+ };
656
+ }
657
+ function rotatePointAroundPoint(px, py, ox, oy, theta) {
658
+ var thetaRad = theta * Math.PI / 180;
659
+ var cos = Math.cos(thetaRad);
660
+ var sin = Math.sin(thetaRad);
661
+ var deltaX = px - ox;
662
+ var deltaY = py - oy;
663
+ return {
664
+ x: cos * deltaX - sin * deltaY + ox,
665
+ y: sin * deltaX + cos * deltaY + oy
666
+ };
667
+ }
668
+
669
+ // point: x,y
670
+ // itemrectInfo: pos(x,y),rotRad,size,layoutpos,is_corner
671
+ // calcRect: rect(point[4]),pos(x,y),rotRad,size,layoutpos,is_corner
672
+
673
+ function point(x, y) {
674
+ return {
675
+ x: x,
676
+ y: y
677
+ };
678
+ }
679
+ function itemrectInfo(x, y, rotRad, size, layoutpos, is_corner) {
680
+ return {
681
+ pos: {
682
+ x: x,
683
+ y: y
684
+ },
685
+ rotRad: rotRad,
686
+ size: size,
687
+ layoutpos: layoutpos,
688
+ is_corner: is_corner
689
+ };
690
+ }
691
+ function getCalcRectFromItem(item) {
692
+ var itemInfo;
693
+ if (item === undefined) itemInfo = [];else itemInfo = item.item;
694
+ var x = item.pos.x;
695
+ var y = item.pos.y;
696
+ var rotRad = item.rotRad;
697
+ var w = item.size && item.size.width / 2;
698
+ var h = item.size && item.size.height / 2;
699
+ var mx = x - w * Math.cos(rotRad);
700
+ var my = y - w * Math.sin(rotRad);
701
+ var x0 = mx + h * Math.sin(rotRad);
702
+ var y0 = my - h * Math.cos(rotRad);
703
+ var x3 = mx * 2 - x0;
704
+ var y3 = my * 2 - y0;
705
+ var x1 = x * 2 - x3;
706
+ var y1 = y * 2 - y3;
707
+ var x2 = x * 2 - x0;
708
+ var y2 = y * 2 - y0;
709
+ return {
710
+ rect: [point(x0, y0), point(x1, y1), point(x2, y2), point(x3, y3)],
711
+ pos: point(x, y),
712
+ rotRad: rotRad,
713
+ size: item.size,
714
+ layoutpos: item.layoutpos,
715
+ is_corner: item.is_corner,
716
+ itemInfo: itemInfo
717
+ };
718
+ }
719
+ function getCalcRectFromItem3D(item) {
720
+ var itemInfo;
721
+ if (item === undefined) itemInfo = [];else itemInfo = item.item;
722
+ var x = item.pos.x;
723
+ var y = item.pos.y;
724
+ var rotRad = item.rotRad;
725
+ var w = item.size.width / 2;
726
+ var h = item.size.depth / 2;
727
+ var mx = x - w * Math.cos(rotRad);
728
+ var my = y - w * Math.sin(rotRad);
729
+ var x0 = mx + h * Math.sin(rotRad);
730
+ var y0 = my - h * Math.cos(rotRad);
731
+ var x3 = mx * 2 - x0;
732
+ var y3 = my * 2 - y0;
733
+ var x1 = x * 2 - x3;
734
+ var y1 = y * 2 - y3;
735
+ var x2 = x * 2 - x0;
736
+ var y2 = y * 2 - y0;
737
+ return {
738
+ rect: [point(x0, y0), point(x1, y1), point(x2, y2), point(x3, y3)],
739
+ pos: point(x, y),
740
+ rotRad: rotRad,
741
+ size: item.size,
742
+ layoutpos: item.layoutpos,
743
+ is_corner: item.is_corner,
744
+ itemInfo: itemInfo
745
+ };
746
+ }
747
+ function getAllItems(scene, catalog, allLineRects) {
748
+ var layerID = scene.selectedLayer;
749
+ var layer = scene.layers.get(layerID);
750
+ var curiteminfo;
751
+ var iteminfo = [];
752
+ var otherItems = [];
753
+ var selectedItem;
754
+ var currentItem;
755
+ if (layer.selected.items.size > 0) {
756
+ selectedItem = layer.getIn(['items', layer.selected.items.get(0)]);
757
+ var catid = selectedItem.type;
758
+ var cat = catalog.elements[catid];
759
+ if (!cat) cat = catalog.elements[(0, _utils.returnReplaceableDeepSearchType)(catid)];
760
+ currentItem = {
761
+ selectedItem: selectedItem,
762
+ cat: cat
763
+ };
764
+ }
765
+ layer.items.forEach(function (item) {
766
+ var val = {
767
+ pos: {
768
+ x: item.x,
769
+ y: item.y
770
+ },
771
+ rotRad: item.rotation / 180 * Math.PI
772
+ };
773
+ var catid = item.type;
774
+ var cat = catalog.elements[catid];
775
+ if (!cat) {
776
+ cat = catalog.elements[(0, _utils.returnReplaceableDeepSearchType)(catid)];
777
+ }
778
+ var sizeinfo = [];
779
+ var width, height, depth;
780
+ sizeinfo = {
781
+ width: item.properties.get('width').get('_length'),
782
+ height: item.properties.get('height').get('_length'),
783
+ depth: item.properties.get('depth').get('_length'),
784
+ widthUnit: item.properties.get('width').get('_unit'),
785
+ heightUnit: item.properties.get('height').get('_unit'),
786
+ depthUnit: item.properties.get('depth').get('_unit')
787
+ };
788
+ sizeinfo = _objectSpread(_objectSpread({}, sizeinfo), {}, {
789
+ layoutpos: cat && cat.info.layoutpos,
790
+ is_corner: cat && cat.info.is_corner
791
+ });
792
+ width = (0, _convertUnitsLite.convert)(sizeinfo.width).from(sizeinfo.widthUnit).to(scene.unit);
793
+ height = (0, _convertUnitsLite.convert)(sizeinfo.depth).from(sizeinfo.depthUnit).to(scene.unit);
794
+ depth = (0, _convertUnitsLite.convert)(sizeinfo.height).from(sizeinfo.heightUnit).to(scene.unit);
795
+ val.size = {
796
+ width: width,
797
+ height: height,
798
+ depth: depth
799
+ };
800
+ val.layoutpos = sizeinfo.layoutpos;
801
+ val.is_corner = sizeinfo.is_corner;
802
+ val.doorStyle = item.doorStyle;
803
+ val.item = item;
804
+ var otherItem = {
805
+ item: item,
806
+ cat: cat
807
+ };
808
+ if (!needSnap(currentItem, otherItem)) {
809
+ return;
810
+ }
811
+ if (item.selected) {
812
+ curiteminfo = getCalcRectFromItem(val);
813
+ } else {
814
+ var calcrect = getCalcRectFromItem(val);
815
+ calcrect.isSnappedLine = isSnappedLine(calcrect, allLineRects);
816
+ iteminfo.push(calcrect);
817
+ otherItems.push(otherItem);
818
+ }
819
+ });
820
+ return {
821
+ cur: curiteminfo,
822
+ others: iteminfo,
823
+ currentItem: currentItem,
824
+ otherItems: otherItems
825
+ };
826
+ }
827
+ function getAllItemSpecified(scene, catalog, filter) {
828
+ var _scene$layers, _scene$layers$get;
829
+ var snappedLineRect = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
830
+ var layerID = scene === null || scene === void 0 ? void 0 : scene.selectedLayer;
831
+ 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);
832
+ if (!layer || !layer.items) return {
833
+ cur: null,
834
+ others: []
835
+ };
836
+ var curiteminfo;
837
+ var iteminfo = [];
838
+ var excludedApplianceCategories = new Set(_applianceCategories.EXCLUDED_APPLIANCE_CATEGORIES);
839
+ layer.items.forEach(function (item) {
840
+ var _cat$obj, _cat$obj2;
841
+ if (!item) return;
842
+ var val = {
843
+ pos: {
844
+ x: item.x,
845
+ y: item.y
846
+ },
847
+ rotRad: item.rotation / 180 * Math.PI
848
+ };
849
+ var cat = item.type ? findCatalogElement(catalog, item.type) : null;
850
+ val.layoutpos = item.layoutpos;
851
+ val.is_corner = item.is_corner;
852
+ var props = item.properties;
853
+ var getSize = function getSize(key) {
854
+ var _props$getIn, _props$getIn2, _props$getIn3;
855
+ var length = props === null || props === void 0 || (_props$getIn = props.getIn) === null || _props$getIn === void 0 ? void 0 : _props$getIn.call(props, [key, '_length']);
856
+ return length != null ? (0, _convertUnitsLite.convert)(length).from((_props$getIn2 = props === null || props === void 0 || (_props$getIn3 = props.getIn) === null || _props$getIn3 === void 0 ? void 0 : _props$getIn3.call(props, [key, '_unit'])) !== null && _props$getIn2 !== void 0 ? _props$getIn2 : 'in').to(scene.unit) : 0;
857
+ };
858
+ val.size = {
859
+ width: getSize('width'),
860
+ height: getSize('height'),
861
+ depth: getSize('depth')
862
+ };
863
+ val.item = item;
864
+
865
+ // Filter check
866
+ var isExcludedItem = (0, _helper.isEmpty)(cat) || (cat === null || cat === void 0 ? void 0 : cat.type) === 'appliance' && excludedApplianceCategories.has(cat === null || cat === void 0 || (_cat$obj = cat.obj) === null || _cat$obj === void 0 ? void 0 : _cat$obj.category) || excludedApplianceCategories.has(cat === null || cat === void 0 || (_cat$obj2 = cat.obj) === null || _cat$obj2 === void 0 ? void 0 : _cat$obj2.cabinet_category);
867
+ var layoutMatches = Array.isArray(filter) ? !!val.layoutpos && filter.includes(val.layoutpos) : val.layoutpos === filter;
868
+ if (!layoutMatches || isExcludedItem) return;
869
+
870
+ // Current vs others
871
+ var rect = getCalcRectFromItem3D(val);
872
+
873
+ // check current item is snapped to the [snappedLineRect]
874
+ if (!(0, _helper.isEmpty)(snappedLineRect)) {
875
+ var isSnapped = false;
876
+ var overlapList = [_constants.OVERLAP_INCLUDED, _constants.OVERLAP_SAME, _constants.OVERLAP_SOME];
877
+ for (var i = 0; i < (rect === null || rect === void 0 || (_rect$rect = rect.rect) === null || _rect$rect === void 0 ? void 0 : _rect$rect.length); i++) {
878
+ var _rect$rect;
879
+ if (isSnapped) break;
880
+ var curItemPt = rect.rect[i];
881
+ var nextItemPt = i === rect.rect.length - 1 ? rect.rect[0] : rect.rect[i + 1];
882
+ var srcLine = {
883
+ x1: curItemPt.x,
884
+ y1: curItemPt.y,
885
+ x2: nextItemPt.x,
886
+ y2: nextItemPt.y
887
+ };
888
+ for (var j = 0; j < (snappedLineRect === null || snappedLineRect === void 0 ? void 0 : snappedLineRect.length); j++) {
889
+ var curLineRectPt = snappedLineRect[j];
890
+ var nextLineRectPt = j === snappedLineRect.length - 1 ? snappedLineRect[0] : snappedLineRect[j + 1];
891
+ var destLine = {
892
+ x1: curLineRectPt.x,
893
+ y1: curLineRectPt.y,
894
+ x2: nextLineRectPt.x,
895
+ y2: nextLineRectPt.y
896
+ };
897
+ if (overlapList.includes(relationshipOfTwoOverlappedLines(srcLine, destLine).result)) {
898
+ isSnapped = true;
899
+ break;
900
+ }
901
+ }
902
+ }
903
+ if (!isSnapped) return;
904
+ }
905
+ if (item.selected) {
906
+ curiteminfo = rect;
907
+ } else {
908
+ iteminfo.push(rect);
909
+ }
910
+ });
911
+ return {
912
+ cur: curiteminfo,
913
+ others: iteminfo
914
+ };
915
+ }
916
+ function findCatalogElement(catalog, elementName) {
917
+ if (!elementName || !catalog) return null;
918
+ var variants = [elementName, elementName.toLowerCase()];
919
+ var deepVariants = variants.map(function (v) {
920
+ return (0, _utils.returnReplaceableDeepSearchType)(v);
921
+ }).filter(Boolean);
922
+ var allCandidates = [].concat(variants, (0, _toConsumableArray2["default"])(deepVariants));
923
+ var getElement = function getElement(catid) {
924
+ if (!catid) return null;
925
+
926
+ // Immutable.js Map
927
+ if (typeof catalog.getIn === 'function') {
928
+ return catalog.getIn(['elements', catid]);
929
+ }
930
+
931
+ // Plain JS object
932
+ if (catalog.elements && catalog.elements[catid]) {
933
+ return catalog.elements[catid];
934
+ }
935
+ return null;
936
+ };
937
+ var _iterator6 = _createForOfIteratorHelper(allCandidates),
938
+ _step6;
939
+ try {
940
+ for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
941
+ var name = _step6.value;
942
+ var cat = getElement(name);
943
+ if (cat) return cat;
944
+ }
945
+ } catch (err) {
946
+ _iterator6.e(err);
947
+ } finally {
948
+ _iterator6.f();
949
+ }
950
+ return null;
951
+ }
952
+ function isSnappedLine(calcrect, allLineRects) {
953
+ if (allLineRects === undefined) return false;
954
+ var r2 = calcrect.rect[2];
955
+ var r3 = calcrect.rect[3];
956
+ var result = allLineRects.some(function (linerect) {
957
+ var l2 = linerect.rect[2];
958
+ var l3 = linerect.rect[3];
959
+ var delta = verticesDistance(l2, r3) + verticesDistance(r3, r2) + verticesDistance(r2, l3) - verticesDistance(l3, l2);
960
+ if (delta < _constants.EPSILON) {
961
+ return true;
962
+ } else {
963
+ l2 = linerect.rect[3];
964
+ l3 = linerect.rect[2];
965
+ delta = verticesDistance(l2, r3) + verticesDistance(r3, r2) + verticesDistance(r2, l3) - verticesDistance(l3, l2);
966
+ return delta < _constants.EPSILON;
967
+ }
968
+ });
969
+ return result;
970
+ }
971
+ function isSnappedSideLine(calcrect, allLineRects) {
972
+ if (allLineRects === undefined) return 0;
973
+ var r2 = calcrect.rect[1];
974
+ var r3 = calcrect.rect[2];
975
+ var result = allLineRects.some(function (linerect) {
976
+ var l2 = linerect.rect[2];
977
+ var l3 = linerect.rect[3];
978
+ var delta = verticesDistance(l2, r3) + verticesDistance(r3, r2) + verticesDistance(r2, l3) - verticesDistance(l3, l2);
979
+ return delta < _constants.EPSILON;
980
+ });
981
+ return result;
982
+ }
983
+
984
+ /** Calculate candidate positions */
985
+ function getAllItemSnap(allItemRects) {
986
+ var allItemSnap = [];
987
+ var cur = allItemRects.cur;
988
+
989
+ // For development
990
+ var otherItems = allItemRects.otherItems,
991
+ currentItem = allItemRects.currentItem;
992
+ allItemRects.others.forEach(function (rect, index) {
993
+ var cw = cur && cur.size.width / 2;
994
+ var ch = cur && cur.size.height / 2;
995
+ var cos = Math.cos(rect.rotRad);
996
+ var sin = Math.sin(rect.rotRad);
997
+ var ox0 = cw * cos - ch * sin; // (cw, ch) rot
998
+ var oy0 = cw * sin + ch * cos;
999
+ var ox1 = -cw * cos - ch * sin; // (-cw, ch) rot
1000
+ var oy1 = -cw * sin + ch * cos;
1001
+ var ox2 = ch * sin - cw * cos;
1002
+ var oy2 = -ch * cos - cw * sin;
1003
+ var ox3 = ch * sin + cw * cos;
1004
+ var oy3 = -ch * cos + cw * sin;
1005
+ var nrot = rect.rotRad + Math.PI;
1006
+ if (nrot >= Math.PI) nrot -= Math.PI * 2;
1007
+ var snap1 = itemrectInfo(rect.rect[2].x + ox3, rect.rect[2].y + oy3, rect.rotRad, cur && cur.size, rect.layoutpos, rect.is_corner);
1008
+ var snap2 = itemrectInfo(rect.rect[3].x + ox2, rect.rect[3].y + oy2, rect.rotRad, cur && cur.size, rect.layoutpos, rect.is_corner);
1009
+ var snap3 = itemrectInfo(rect.rect[2].x + ox1, rect.rect[2].y + oy1, nrot, cur && cur.size, rect.layoutpos, rect.is_corner);
1010
+ var snap4 = itemrectInfo(rect.rect[3].x + ox0, rect.rect[3].y + oy0, nrot, cur && cur.size, rect.layoutpos, rect.is_corner);
1011
+ var sizeinfo = otherItems[index].cat && otherItems[index].cat.info.sizeinfo;
1012
+ if (sizeinfo) {
1013
+ var leftBlindLength = sizeinfo.leftBlindLength,
1014
+ rightBlindLength = sizeinfo.rightBlindLength;
1015
+ if (leftBlindLength > 0) {
1016
+ var vx = leftBlindLength - ch;
1017
+ var vy = cw;
1018
+ var dx = vx * cos + vy * sin;
1019
+ var dy = vx * sin - vy * cos;
1020
+ 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);
1021
+ allItemSnap.push(snap6);
1022
+ }
1023
+ if (rightBlindLength > 0) {
1024
+ var _vx = ch - rightBlindLength;
1025
+ var _vy = cw;
1026
+ var _dx = _vx * cos + _vy * sin;
1027
+ var _dy = _vx * sin - _vy * cos;
1028
+ 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);
1029
+ allItemSnap.push(snap7);
1030
+ }
1031
+ }
1032
+ if (rect.isSnappedLine) {
1033
+ snap1.isSnappedLine = true;
1034
+ snap2.isSnappedLine = true;
1035
+ }
1036
+ if ((0, _cabinetCorner.isCorner)(rect.is_corner)) {
1037
+ var _nrot = rect.rotRad + Math.PI * 3 / 2;
1038
+ if (_nrot >= Math.PI) _nrot -= Math.PI * 2;
1039
+ var snap5 = itemrectInfo(rect.rect[1].x - oy1, rect.rect[1].y + ox1, _nrot, cur && cur.size, rect.layoutpos, rect.is_corner);
1040
+ allItemSnap.push(snap2);
1041
+ allItemSnap.push(snap5);
1042
+ } else {
1043
+ allItemSnap.push(snap1);
1044
+ allItemSnap.push(snap2);
1045
+ allItemSnap.push(snap3);
1046
+ allItemSnap.push(snap4);
1047
+ }
1048
+ });
1049
+ return allItemSnap;
1050
+ }
1051
+ function getAllArea(layer) {
1052
+ var allAreaLines = [];
1053
+ var allLines = [];
1054
+ var verticesArray = [];
1055
+ var vertexID_to_verticesArrayIndex = {};
1056
+ layer.vertices.forEach(function (vertex) {
1057
+ var verticesCount = verticesArray.push([vertex.x, vertex.y]);
1058
+ var latestVertexIndex = verticesCount - 1;
1059
+ vertexID_to_verticesArrayIndex[vertex.id] = latestVertexIndex;
1060
+ });
1061
+ layer.areas.forEach(function (area) {
1062
+ allAreaLines.push(area.vertices);
1063
+ });
1064
+ allAreaLines.forEach(function (area) {
1065
+ var pt = [];
1066
+ area.forEach(function (element) {
1067
+ pt.push({
1068
+ x: verticesArray[vertexID_to_verticesArrayIndex[element]][0],
1069
+ y: verticesArray[vertexID_to_verticesArrayIndex[element]][1]
1070
+ });
1071
+ });
1072
+ allLines.push(pt);
1073
+ });
1074
+ return allLines;
1075
+ }
1076
+
1077
+ /** Get all lines of the scene */
1078
+ function getAllLines(layer) {
1079
+ var allArea = getAllArea(layer);
1080
+ var allAreaLines = [];
1081
+ var allVertices = layer.get('vertices').toJS();
1082
+ layer.lines.forEach(function (tline) {
1083
+ var line = tline.toJS();
1084
+ if (isPointInArea(allArea, allVertices[line.vertices[0]]) || isPointInArea(allArea, allVertices[line.vertices[1]])) {
1085
+ allAreaLines.push(line.vertices.reverse());
1086
+ }
1087
+ });
1088
+ var allLines = [];
1089
+ //let allNonAreaLines = [];
1090
+ var thick = _constants.LINE_THICKNESS / 2;
1091
+ layer.lines.forEach(function (line) {
1092
+ var i = containLine(allAreaLines, line);
1093
+ // let thick = line.properties.getIn(['thickness', 'length']);
1094
+ if (i < 0) {
1095
+ var vertices = line.vertices.toJS();
1096
+ var tmp_vertices = {
1097
+ x1: layer.vertices.get(vertices[0]).x,
1098
+ y1: layer.vertices.get(vertices[0]).y,
1099
+ x2: layer.vertices.get(vertices[1]).x,
1100
+ y2: layer.vertices.get(vertices[1]).y
1101
+ };
1102
+ if (tmp_vertices.x1 == tmp_vertices.x2 && tmp_vertices.y1 == tmp_vertices.y2) return;
1103
+ var addIdx = allLines.length;
1104
+ var flag = 0;
1105
+ allLines.forEach(function (element, idx) {
1106
+ if (flag == 0) {
1107
+ var el = element[0];
1108
+ var tmp_el = {
1109
+ x1: layer.vertices.get(el[0]).x,
1110
+ y1: layer.vertices.get(el[0]).y,
1111
+ x2: layer.vertices.get(el[1]).x,
1112
+ y2: layer.vertices.get(el[1]).y
1113
+ };
1114
+ if (tmp_el.x1 == tmp_vertices.x1 && tmp_el.y1 == tmp_vertices.y1) {
1115
+ var tmp = vertices[0];
1116
+ vertices[0] = vertices[1];
1117
+ vertices[1] = tmp;
1118
+ addIdx = idx == 0 ? 0 : idx - 1;
1119
+ flag = 1;
1120
+ } else if (tmp_el.x2 == tmp_vertices.x1 && tmp_el.y2 == tmp_vertices.y1) {
1121
+ addIdx = idx;
1122
+ flag = 1;
1123
+ } else if (tmp_el.x1 == tmp_vertices.x2 && tmp_el.y1 == tmp_vertices.y2) {
1124
+ addIdx = idx == 0 ? 0 : idx - 1;
1125
+ flag = 1;
1126
+ } else if (tmp_el.x2 == tmp_vertices.x2 && tmp_el.y2 == tmp_vertices.y2) {
1127
+ var _tmp = vertices[0];
1128
+ vertices[0] = vertices[1];
1129
+ vertices[1] = _tmp;
1130
+ addIdx = idx;
1131
+ flag = 1;
1132
+ }
1133
+ }
1134
+ });
1135
+ allLines.splice(addIdx, 0, [vertices, thick, line.id]);
1136
+ } else {
1137
+ allLines.push([allAreaLines[i], thick, line.id]);
1138
+ }
1139
+ });
1140
+ return allLines;
1141
+ }
1142
+
1143
+ /** Get lines that wraps the area */
1144
+ function getAllAreaLines(layer) {
1145
+ var areainfo = [];
1146
+ layer.areas.forEach(function (area) {
1147
+ var sz = area.vertices.size;
1148
+ for (var i = 0; i < sz; i++) {
1149
+ areainfo.push([area.vertices.get(i), area.vertices.get((i + 1) % sz)]);
1150
+ }
1151
+ });
1152
+ return areainfo;
1153
+ }
1154
+ function containLine(lines, line) {
1155
+ // lines: [array]
1156
+ var sz = lines.length;
1157
+ for (var i = 0; i < sz; i++) {
1158
+ var l = lines[i];
1159
+ 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]) {
1160
+ return i;
1161
+ }
1162
+ }
1163
+ return -1;
1164
+ }
1165
+ function buildRectFromLines(layer, lines) {
1166
+ var rect = [];
1167
+ lines.forEach(function (line) {
1168
+ var vxys = []; // 0: x0, 1: y0, 2: x1, 3: y1
1169
+ line[0].forEach(function (vertex) {
1170
+ var vert = layer.vertices.get(vertex);
1171
+ vxys.push(vert.x);
1172
+ vxys.push(vert.y);
1173
+ });
1174
+ var thick = line[1];
1175
+ var x0 = vxys[0];
1176
+ var y0 = vxys[1];
1177
+ var x1 = vxys[2];
1178
+ var y1 = vxys[3];
1179
+ var rectLine = getCalcRectFromLine(x0, y0, x1, y1, thick, layer);
1180
+ rectLine.lineId = line.length > 2 ? line[2] : null;
1181
+ rect.push(rectLine);
1182
+ });
1183
+ return rect;
1184
+ }
1185
+ function getRelatedVertices(x0, y0, x1, y1, layer) {
1186
+ var verticesArray = [];
1187
+ var mapVertIDtoIndex = {};
1188
+ layer.vertices.forEach(function (vertex) {
1189
+ var verticesCount = verticesArray.push([vertex.x, vertex.y]);
1190
+ var latestVertexIndex = verticesCount - 1;
1191
+ mapVertIDtoIndex[vertex.id] = latestVertexIndex;
1192
+ });
1193
+ var relVerts = [];
1194
+ layer.lines.some(function (line) {
1195
+ var vertID0 = line.vertices.get(0);
1196
+ var vertID1 = line.vertices.get(1);
1197
+ var pt0 = {
1198
+ x: verticesArray[mapVertIDtoIndex[vertID0]][0],
1199
+ y: verticesArray[mapVertIDtoIndex[vertID0]][1]
1200
+ };
1201
+ var pt1 = {
1202
+ x: verticesArray[mapVertIDtoIndex[vertID1]][0],
1203
+ y: verticesArray[mapVertIDtoIndex[vertID1]][1]
1204
+ };
1205
+ if (Math.abs(pt0.x - x0) < _constants.EPSILON && Math.abs(pt0.y - y0) < _constants.EPSILON && Math.abs(pt1.x - x1) < _constants.EPSILON && Math.abs(pt1.y - y1) < _constants.EPSILON || Math.abs(pt0.x - x1) < _constants.EPSILON && Math.abs(pt0.y - y1) < _constants.EPSILON && Math.abs(pt1.x - x0) < _constants.EPSILON && Math.abs(pt1.y - y0) < _constants.EPSILON) {
1206
+ if (line.relatedVertices.size == 2) {
1207
+ var relPt0 = point(x0, y0);
1208
+ var relPt1 = point(x1, y1);
1209
+ line.relatedVertices.forEach(function (relatedVertice, index) {
1210
+ if (relatedVertice.index == undefined) relatedVertice = relatedVertice.toJSON();
1211
+ if (relatedVertice.index == 0) relPt0 = point(relatedVertice.point.x, relatedVertice.point.y);else relPt1 = point(relatedVertice.point.x, relatedVertice.point.y);
1212
+ });
1213
+ relVerts.push(relPt0);
1214
+ relVerts.push(relPt1);
1215
+ }
1216
+ return true;
1217
+ }
1218
+ });
1219
+ return relVerts;
1220
+ }
1221
+ function getCalcRectFromLine(x0, y0, x1, y1, thick, layer) {
1222
+ // get line from vertex coordinate
1223
+ var relVerts = getRelatedVertices(x0, y0, x1, y1, layer);
1224
+ var dx = x1 - x0;
1225
+ var dy = y1 - y0;
1226
+ var dl = Math.sqrt(dx * dx + dy * dy);
1227
+ var ox = -dy / dl * thick;
1228
+ var oy = dx / dl * thick;
1229
+ var rot = Math.atan2(dy, dx);
1230
+ if (relVerts.length == 2) {
1231
+ var vN = point(ox, oy);
1232
+ var vR = point(relVerts[0].x - x0, relVerts[0].y - y0);
1233
+ if (dotprod(vN, vR) < 0) {
1234
+ ox = -ox;
1235
+ oy = -oy;
1236
+ } else {
1237
+ rot += Math.PI;
1238
+ }
1239
+ } else {
1240
+ ox = -ox;
1241
+ oy = -oy;
1242
+ }
1243
+ return {
1244
+ rectEnd: [point(x0 + ox / 2, y0 + oy / 2), point(x1 + ox / 2, y1 + oy / 2)],
1245
+ rect: [point(x0 + ox, y0 + oy), point(x1 + ox, y1 + oy), point(x1, y1), point(x0, y0)],
1246
+ pos: point((x0 + x1 + ox) / 2, (y0 + y1 + ox) / 2),
1247
+ rotRad: rot,
1248
+ size: {
1249
+ width: dl,
1250
+ height: thick / 2
1251
+ }
1252
+ };
1253
+ }
1254
+ function getAllLineSnap(allLineRects, curItemRect) {
1255
+ var allLineSnap = [];
1256
+ var cur = curItemRect;
1257
+ if (cur === undefined || cur === null) return;else allLineRects.forEach(function (rect) {
1258
+ var cw = cur.size.width / 2;
1259
+ var ch = cur.size.height / 2;
1260
+ var cos = Math.cos(rect.rotRad);
1261
+ var sin = Math.sin(rect.rotRad);
1262
+ var ox0 = cw * cos - ch * sin; // (cw, ch) rot
1263
+ var oy0 = cw * sin + ch * cos;
1264
+ var ox1 = -cw * cos - ch * sin; // (-cw, ch) rot
1265
+ var oy1 = -cw * sin + ch * cos;
1266
+ var nrot = rect.rotRad + Math.PI;
1267
+ if (nrot >= Math.PI) nrot -= Math.PI * 2;
1268
+ var thick = rect.size.height;
1269
+ var snap3 = itemInfo(rect.rect[2].x + ox1, rect.rect[2].y + oy1, nrot, cur.size);
1270
+ var snap4 = itemInfo(rect.rect[3].x + ox0, rect.rect[3].y + oy0, nrot, cur.size);
1271
+ if (!(0, _cabinetCorner.isCorner)(cur.is_corner)) {
1272
+ allLineSnap.push(snap3);
1273
+ }
1274
+ allLineSnap.push(snap4);
1275
+ });
1276
+ return allLineSnap;
1277
+ }
1278
+ function validateSnaps(allSnaps, allRects) {
1279
+ var validSnaps = [];
1280
+ if (allSnaps !== undefined && allSnaps !== null && allSnaps.length > 0) allSnaps.forEach(function (snap) {
1281
+ if (validSnap(snap, allRects)) {
1282
+ validSnaps.push(snap);
1283
+ }
1284
+ });
1285
+ return validSnaps;
1286
+ }
1287
+ function validateLineSnaps(allSnaps, allItemSnap, allLineSnap, allItemRects, allLineRects, allRects) {
1288
+ var validSnaps = [];
1289
+ var addFlag = true;
1290
+ allSnaps.forEach(function (snap) {
1291
+ if (validSnap(snap, allRects)) {
1292
+ validSnaps.push(snap);
1293
+ } else if (addFlag) {
1294
+ allItemSnap.forEach(function (snap) {
1295
+ validSnaps.push(snap);
1296
+ });
1297
+ allLineSnap.forEach(function (snap) {
1298
+ validSnaps.push(snap);
1299
+ });
1300
+ addFlag = false;
1301
+ }
1302
+ });
1303
+ return validSnaps;
1304
+ }
1305
+ function validSnap(snap, rects) {
1306
+ var snaprect = getCalcRectFromItem(snap);
1307
+ return rects.every(function (rect) {
1308
+ return !intersectRect(rect.rect, snaprect.rect);
1309
+ });
1310
+ }
1311
+ function itemInfo(x, y, rotRad, size) {
1312
+ return {
1313
+ pos: {
1314
+ x: x,
1315
+ y: y
1316
+ },
1317
+ rotRad: rotRad,
1318
+ size: size
1319
+ };
1320
+ }
1321
+ function intersectRect(rect1, rect2) {
1322
+ var ret = false;
1323
+ rect1 = shrinkRect(rect1);
1324
+ rect2 = shrinkRect(rect2);
1325
+ ret = ret || getInterSect(rect1, rect2);
1326
+ ret = ret || rect1.some(function (pt) {
1327
+ return containPointInRect(pt, rect2);
1328
+ });
1329
+ ret = ret || rect2.some(function (pt) {
1330
+ return containPointInRect(pt, rect1);
1331
+ });
1332
+ return ret;
1333
+ }
1334
+ function containPointInRect(point, rect) {
1335
+ // true: contain, false: not contain
1336
+ for (var i = 0; i < rect.length; i++) {
1337
+ var ni = (i + 1) % rect.length;
1338
+ if (crossprod(diff(point, rect[i]), diff(rect[i], rect[ni])) < 0) {
1339
+ return false;
1340
+ }
1341
+ }
1342
+ return true;
1343
+ }
1344
+ function diff(v0, v1) {
1345
+ return {
1346
+ x: v0.x - v1.x,
1347
+ y: v0.y - v1.y
1348
+ };
1349
+ }
1350
+ function crossprod(v0, v1) {
1351
+ return v0.x * v1.y - v0.y * v1.x;
1352
+ }
1353
+ function shrinkRect(rect) {
1354
+ var v02x = rect[2].x - rect[0].x;
1355
+ var v02y = rect[2].y - rect[0].y;
1356
+ var d02 = Math.sqrt(v02x * v02x + v02y * v02y);
1357
+ var o02x = v02x / d02 * 0.1;
1358
+ var o02y = v02y / d02 * 0.1;
1359
+ var v13x = rect[3].x - rect[1].x;
1360
+ var v13y = rect[3].y - rect[1].y;
1361
+ var d13 = Math.sqrt(v02x * v02x + v02y * v02y);
1362
+ var o13x = v13x / d13 * 0.1;
1363
+ var o13y = v13y / d13 * 0.1;
1364
+ 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)];
1365
+ }
1366
+ function getInterSect(shape1, shape2) {
1367
+ // return result of intersect of two shape
1368
+ var count = 0;
1369
+ for (var i = 0; i < shape1.length; i++) {
1370
+ var sl1 = {
1371
+ x: shape1[i].x,
1372
+ y: shape1[i].y
1373
+ };
1374
+ var sl2 = {
1375
+ x: shape1[(i + 1) % shape1.length].x,
1376
+ y: shape1[(i + 1) % shape1.length].y
1377
+ };
1378
+ for (var j = 0; j < shape2.length; j++) {
1379
+ var el1 = {
1380
+ x: shape2[j].x,
1381
+ y: shape2[j].y
1382
+ };
1383
+ var el2 = {
1384
+ x: shape2[(j + 1) % shape2.length].x,
1385
+ y: shape2[(j + 1) % shape2.length].y
1386
+ };
1387
+ var flag = getLineInterSect(sl1.x, sl1.y, sl2.x, sl2.y, el1.x, el1.y, el2.x, el2.y);
1388
+ if (flag) {
1389
+ count++;
1390
+ if (count > 1) return true;
1391
+ }
1392
+ }
1393
+ }
1394
+ return false;
1395
+ }
1396
+ function getLineInterSect(s1x, s1y, e1x, e1y, s2x, s2y, e2x, e2y) {
1397
+ var ax = s1x;
1398
+ var ay = s1y;
1399
+ var bx = e1x - s1x;
1400
+ var by = e1y - s1y;
1401
+ var cx = s2x;
1402
+ var cy = s2y;
1403
+ var dx = e2x - s2x;
1404
+ var dy = e2y - s2y;
1405
+ if (Math.abs(bx * dy - by * dx) < 0.00000001) {
1406
+ if (Math.abs((cx - ax) * by - (cy - ay) * bx) < 0.00000001) {
1407
+ var maxX = ax;
1408
+ var minX = ax;
1409
+ var maxY = ay;
1410
+ var minY = ay;
1411
+ if (maxX < e1x) maxX = e1x;
1412
+ if (maxX < cx) maxX = cx;
1413
+ if (maxX < e2x) maxX = e2x;
1414
+ if (minX > e1x) minX = e1x;
1415
+ if (minX > cx) minX = cx;
1416
+ if (minX > e2x) minX = e2x;
1417
+ if (maxY < e1y) maxY = e1y;
1418
+ if (maxY < cy) maxY = cy;
1419
+ if (maxY < e2y) maxY = e2y;
1420
+ if (minY > e1y) minY = e1y;
1421
+ if (minY > cy) minY = cy;
1422
+ if (minY > e2y) minX = e2y;
1423
+ var len = Math.sqrt((maxX - minX) * (maxX - minX) + (maxY - minY) * (maxY - minY));
1424
+ var len1 = Math.sqrt(bx * bx + by * by);
1425
+ var len2 = Math.sqrt(dx * dx + dy * dy);
1426
+ if (len < len1 + len2) {
1427
+ return true;
1428
+ } else {
1429
+ return false;
1430
+ }
1431
+ } else {
1432
+ return false;
1433
+ }
1434
+ } else {
1435
+ var t = (dx * (ay - cy) + dy * (cx - ax)) / (bx * dy - by * dx);
1436
+ var u = (bx * (cy - ay) + by * (ax - cx)) / (dx * by - dy * bx);
1437
+ var ret = u < 1 && u > 0 && t > 0 && t < 1;
1438
+ return ret;
1439
+ }
1440
+ }
1441
+ function isPointInArea(allArea, pt) {
1442
+ var x = pt.x;
1443
+ var y = pt.y;
1444
+ var result = false;
1445
+ result = allArea.some(function (area) {
1446
+ var sum = 0,
1447
+ alpha = 0;
1448
+ for (var i = 0; i < area.length; i++) {
1449
+ var x0 = area[i].x;
1450
+ var y0 = area[i].y;
1451
+ var x1 = area[(i + 1) % area.length].x;
1452
+ var y1 = area[(i + 1) % area.length].y;
1453
+ var v0 = {
1454
+ x: x0 - x,
1455
+ y: y0 - y
1456
+ };
1457
+ var v1 = {
1458
+ x: x1 - x,
1459
+ y: y1 - y
1460
+ };
1461
+ if (Math.abs(v0.x) < _constants.EPSILON && Math.abs(v0.y) < _constants.EPSILON)
1462
+ // check if pt is area point
1463
+ return true;
1464
+
1465
+ // check if pt is in area line
1466
+ var lineLen = Math.sqrt((x1 - x0) * (x1 - x0) + (y1 - y0) * (y1 - y0));
1467
+ var v0Len = Math.sqrt(v0.x * v0.x + v0.y * v0.y);
1468
+ var vPt = {
1469
+ x: -v0.x / v0Len,
1470
+ y: -v0.y / v0Len
1471
+ };
1472
+ var xE = x0 + vPt.x * lineLen;
1473
+ var yE = y0 + vPt.y * lineLen;
1474
+ if (v0Len <= lineLen && Math.abs(xE - x1) < _constants.EPSILON && Math.abs(yE - y1) < _constants.EPSILON) return true;
1475
+ alpha = Math.atan2(v0.x * v1.y - v1.x * v0.y, v0.x * v1.x + v0.y * v1.y);
1476
+ sum += alpha;
1477
+ }
1478
+ if (Math.abs(Math.abs(sum) - Math.PI * 2) < _constants.EPSILON) return true;
1479
+ });
1480
+ return result;
1481
+ }
1482
+ function calcSnap(allItemRect, allItemSnap, allLineRects, allLineSnap, allRect, x, y, allAreaLines) {
1483
+ return calcSnap2(allItemRect, allItemSnap, allLineRects, allLineSnap, allRect, x, y, allAreaLines);
1484
+ }
1485
+ function calcCreateSnap(allItemRect, allItemSnap, allLineRects, allLineSnap, allRect, x, y, polygonPoint) {
1486
+ // Validate required input and guard against missing `.cur`
1487
+ if (!allItemRect || !allItemRect.cur) return;
1488
+ var cur = allItemRect.cur; // safe alias
1489
+ var cx = x;
1490
+ var cy = y;
1491
+ var ndist = 5000;
1492
+ var rotRad = cur.rotRad;
1493
+
1494
+ // Get candidate snaps and validate them as before
1495
+ var allCurSnap = getAllCurSnap(allLineRects, x, y, cur);
1496
+ allCurSnap = validateLineSnaps(allCurSnap, allItemSnap, allLineSnap, allItemRect, allLineRects, allRect);
1497
+ var getSnap = false;
1498
+ var snapdist = [];
1499
+
1500
+ // Build distances for snaps that lie inside polygonPoint (if any)
1501
+ if (Array.isArray(allCurSnap)) {
1502
+ allCurSnap.forEach(function (snap) {
1503
+ if (!snap || !snap.pos) return;
1504
+ var inside = ContainsPoint(polygonPoint, snap.pos.x, snap.pos.y);
1505
+ if (inside) {
1506
+ var dx = snap.pos.x - x;
1507
+ var dy = snap.pos.y - y;
1508
+ snapdist.push(dx * dx + dy * dy);
1509
+ }
1510
+ });
1511
+ }
1512
+
1513
+ // Find minimum distance (Infinity if none)
1514
+ var edist = snapdist.length ? Math.min.apply(Math, snapdist) : Infinity;
1515
+
1516
+ // Choose the snap with distance === edist
1517
+ if (Array.isArray(allCurSnap)) {
1518
+ allCurSnap.forEach(function (snap) {
1519
+ if (!snap || !snap.pos) return;
1520
+ var dx = snap.pos.x - x;
1521
+ var dy = snap.pos.y - y;
1522
+ var dist = dx * dx + dy * dy;
1523
+ if (dist === edist) {
1524
+ var _snap$rotRad;
1525
+ ndist = dist;
1526
+ cx = snap.pos.x;
1527
+ cy = snap.pos.y;
1528
+ rotRad = (_snap$rotRad = snap.rotRad) !== null && _snap$rotRad !== void 0 ? _snap$rotRad : rotRad; // nullish coalescing
1529
+ getSnap = true;
1530
+ }
1531
+ });
1532
+ }
1533
+ var crot = rotRad / Math.PI * 180;
1534
+ return {
1535
+ cx: cx,
1536
+ cy: cy,
1537
+ crot: crot,
1538
+ rotRad: rotRad
1539
+ };
1540
+ }
1541
+
1542
+ ////////////
1543
+ function calcSnap1(allItemRect, allItemSnap, allLineRects, allLineSnap, allRect, x, y) {
1544
+ var cx = allItemRect.cur.pos.x;
1545
+ var cy = allItemRect.cur.pos.y;
1546
+ var nx = x;
1547
+ var ny = y;
1548
+ var cursize = allItemRect.cur.size;
1549
+ var ndist = cursize.width * cursize.width + cursize.height * cursize.height;
1550
+ ndist = ndist / 4;
1551
+ var rotRad = allItemRect.cur.rotRad;
1552
+ var allCurSnap = getAllCurSnap(allLineRects, x, y, allItemRect.cur);
1553
+ allCurSnap = validateSnaps(allCurSnap, allRect);
1554
+ var getSnap = false;
1555
+ allCurSnap.forEach(function (snap) {
1556
+ var dist = (snap.pos.x - x) * (snap.pos.x - x) + (snap.pos.y - y) * (snap.pos.y - y);
1557
+ if (dist < ndist) {
1558
+ ndist = dist;
1559
+ nx = snap.pos.x;
1560
+ ny = snap.pos.y;
1561
+ rotRad = snap.rotRad;
1562
+ getSnap = true;
1563
+ }
1564
+ });
1565
+ if (!getSnap) {
1566
+ allLineSnap.concat(allItemSnap).forEach(function (snap) {
1567
+ var dist = (snap.pos.x - x) * (snap.pos.x - x) + (snap.pos.y - y) * (snap.pos.y - y);
1568
+ if (dist < ndist) {
1569
+ ndist = dist;
1570
+ nx = snap.pos.x;
1571
+ ny = snap.pos.y;
1572
+ rotRad = snap.rotRad;
1573
+ }
1574
+ });
1575
+ }
1576
+ var rot = rotRad / Math.PI * 180;
1577
+ var ret = {
1578
+ nx: nx,
1579
+ ny: ny,
1580
+ rot: rot,
1581
+ rotRad: rotRad
1582
+ };
1583
+ return ret;
1584
+ }
1585
+
1586
+ ////////////
1587
+ function calcSnap2(allItemRect, allItemSnap, allLineRects, allLineSnap, allRect, x, y, allArea) {
1588
+ var nx = x;
1589
+ var ny = y;
1590
+ var ndist = 20;
1591
+ var rotRad = allItemRect.cur && allItemRect.cur.rotRad;
1592
+ var val = {
1593
+ pos: {
1594
+ x: x,
1595
+ y: y
1596
+ },
1597
+ rotRad: rotRad
1598
+ };
1599
+ val.size = allItemRect.cur && allItemRect.cur.size;
1600
+ val.layoutpos = allItemRect.cur && allItemRect.cur.layoutpos;
1601
+ val.is_corner = allItemRect.cur && allItemRect.cur.is_corner;
1602
+ var curitem = getCalcRectFromItem(val);
1603
+ var allCurSnap = [];
1604
+ allCurSnap = getAllCurSnap(allLineRects, x, y, allItemRect.cur);
1605
+ allCurSnap = validateSnaps(allCurSnap, allRect);
1606
+ var getSnap = false;
1607
+ var snapdist = [];
1608
+ //console.log("allItemSnap", allItemSnap.filter(e => e.isSnappedLine))
1609
+ //console.log("~~~~start~~~~");
1610
+ allItemSnap.filter(function (e) {
1611
+ return e.isSnappedLine;
1612
+ }).forEach(function (snap) {
1613
+ var dist = (snap.pos.x - x) * (snap.pos.x - x) + (snap.pos.y - y) * (snap.pos.y - y);
1614
+ snapdist.push(dist);
1615
+ //console.log("dist", snap)
1616
+ if (isPointInArea(allArea, snap.pos) || !allArea.length) if (dist < 100) {
1617
+ ndist = dist;
1618
+ nx = snap.pos.x;
1619
+ ny = snap.pos.y;
1620
+ rotRad = snap.rotRad;
1621
+ getSnap = true;
1622
+
1623
+ //console.log("SUCCESS!!!!");
1624
+ }
1625
+ });
1626
+ //console.log("====end====");
1627
+ if (getSnap == false) {
1628
+ allCurSnap.forEach(function (snap) {
1629
+ var dist = (snap.pos.x - x) * (snap.pos.x - x) + (snap.pos.y - y) * (snap.pos.y - y);
1630
+ snapdist.push(dist);
1631
+ if (isPointInArea(allArea, snap.pos) || !allArea.length) if (dist < ndist) {
1632
+ ndist = dist;
1633
+ nx = snap.pos.x;
1634
+ ny = snap.pos.y;
1635
+ rotRad = snap.rotRad;
1636
+ getSnap = true;
1637
+ //console.log("SUCCE!!!!");
1638
+ }
1639
+ });
1640
+ if (!getSnap && allLineRects.some(function (others) {
1641
+ return intersectRect(others.rect, curitem.rect);
1642
+ })) {
1643
+ var edist = Math.min.apply(null, snapdist);
1644
+ allCurSnap.forEach(function (snap) {
1645
+ var dist = (snap.pos.x - x) * (snap.pos.x - x) + (snap.pos.y - y) * (snap.pos.y - y);
1646
+ if (isPointInArea(allArea, snap.pos) || !allArea.length) if (dist === edist) {
1647
+ ndist = dist;
1648
+ nx = snap.pos.x;
1649
+ ny = snap.pos.y;
1650
+ rotRad = snap.rotRad;
1651
+ getSnap = true;
1652
+ }
1653
+ });
1654
+ }
1655
+ if (getSnap === true) {
1656
+ allItemSnap.filter(function (e) {
1657
+ return e.isSnappedLine;
1658
+ }).forEach(function (snap) {
1659
+ var dist = (snap.pos.x - nx) * (snap.pos.x - nx) + (snap.pos.y - ny) * (snap.pos.y - ny);
1660
+ //console.log("dist", snap)
1661
+ if (isPointInArea(allArea, snap.pos) || !allArea.length) if (dist < 100) {
1662
+ ndist = dist;
1663
+ nx = snap.pos.x;
1664
+ ny = snap.pos.y;
1665
+ rotRad = snap.rotRad;
1666
+ getSnap = true;
1667
+
1668
+ //console.log("SUCCESS!!!!");
1669
+ }
1670
+ });
1671
+ }
1672
+ if (getSnap === false) {
1673
+ var nearRect = null;
1674
+ var minDist = Infinity;
1675
+ allLineRects.forEach(function (rect) {
1676
+ var e = rect.rectEnd[0];
1677
+ e = clone_point(e);
1678
+ e.x -= curitem.pos.x;
1679
+ e.y -= curitem.pos.y;
1680
+ var nRot = rect.rotRad + Math.PI / 2;
1681
+ var dist = Math.abs(e.x * Math.cos(nRot) + e.y * Math.sin(nRot));
1682
+ if (minDist > dist) {
1683
+ minDist = dist;
1684
+ nearRect = rect;
1685
+ }
1686
+ });
1687
+ var containrect = nearRect && intersectRect(nearRect.rect, curitem.rect);
1688
+ if (containrect) {
1689
+ var filter_func = function filter_func(snap) {
1690
+ var diff = Math.abs(snap.rotRad - nearRect.rotRad - Math.PI);
1691
+ return diff == 0 || diff == 2 * Math.PI;
1692
+ };
1693
+ var tempSnap = allLineSnap.filter(filter_func);
1694
+ tempSnap = tempSnap.concat(allLineSnap.filter(function (snap) {
1695
+ return !filter_func(snap);
1696
+ }));
1697
+ tempSnap.some(function (snap) {
1698
+ var dist = (snap.pos.x - x) * (snap.pos.x - x) + (snap.pos.y - y) * (snap.pos.y - y);
1699
+ if (isPointInArea(allArea, snap.pos) || !allArea.length) if (dist < 5000) {
1700
+ nx = snap.pos.x;
1701
+ ny = snap.pos.y;
1702
+ rotRad = snap.rotRad;
1703
+ getSnap = true;
1704
+ return true;
1705
+ }
1706
+ return false;
1707
+ });
1708
+ }
1709
+ }
1710
+ if (allItemRect.others.some(function (others) {
1711
+ return intersectRect(others.rect, curitem.rect);
1712
+ })) {
1713
+ getSnap = false;
1714
+ }
1715
+ if (!getSnap) {
1716
+ var _snapdist = [];
1717
+ allItemSnap.forEach(function (snap) {
1718
+ var dist = (snap.pos.x - x) * (snap.pos.x - x) + (snap.pos.y - y) * (snap.pos.y - y);
1719
+ _snapdist.push(dist);
1720
+ if (isPointInArea(allArea, snap.pos) || !allArea.length) if (dist < ndist) {
1721
+ ndist = dist;
1722
+ nx = snap.pos.x;
1723
+ ny = snap.pos.y;
1724
+ rotRad = snap.rotRad;
1725
+ getSnap = true;
1726
+ }
1727
+ });
1728
+ if (!getSnap && allItemRect.others.some(function (others) {
1729
+ return intersectRect(others.rect, curitem.rect);
1730
+ })) {
1731
+ var _edist = Math.min.apply(null, _snapdist);
1732
+ allItemSnap.forEach(function (snap) {
1733
+ var dist = (snap.pos.x - x) * (snap.pos.x - x) + (snap.pos.y - y) * (snap.pos.y - y);
1734
+ if (isPointInArea(allArea, snap.pos) || !allArea.length) if (dist === _edist) {
1735
+ ndist = dist;
1736
+ nx = snap.pos.x;
1737
+ ny = snap.pos.y;
1738
+ rotRad = snap.rotRad;
1739
+ }
1740
+ });
1741
+ if (allItemRect.cur.itemInfo.name.includes(_applianceCategories.APPLIANCE_CATEGORY_COOK_TOP)) {
1742
+ var intersects = allItemRect.others.filter(function (others) {
1743
+ return intersectRect(others.rect, curitem.rect);
1744
+ });
1745
+ intersects.forEach(function (rect) {
1746
+ if (isPointInArea(allArea, rect.itemInfo) || !allArea.length) if (rect.itemInfo.layoutpos.includes(_constants.BASE_CABINET_LAYOUTPOS)) {
1747
+ nx = rect.itemInfo.x;
1748
+ ny = rect.itemInfo.y;
1749
+ rotRad = rect.itemInfo.rotation * Math.PI / 180;
1750
+ }
1751
+ });
1752
+ }
1753
+ if ((0, _viewerUtils.shouldBypassItemIntersectionValidation)(allItemRect.cur)) {
1754
+ var _intersects = allItemRect.others.filter(function (others) {
1755
+ return intersectRect(others.rect, curitem.rect);
1756
+ });
1757
+ _intersects.forEach(function (rect) {
1758
+ if ((isPointInArea(allArea, rect.itemInfo) || !allArea.length) && (0, _viewerUtils.shouldBypassItemIntersectionValidation)(rect)) {
1759
+ nx = rect.itemInfo.x;
1760
+ ny = rect.itemInfo.y;
1761
+ rotRad = rect.itemInfo.rotation * Math.PI / 180;
1762
+ }
1763
+ });
1764
+ }
1765
+ }
1766
+ }
1767
+ }
1768
+ var rot = rotRad / Math.PI * 180;
1769
+
1770
+ //Check case.
1771
+ //If item is 'blind base cabinet', it must be pulled from other 3".
1772
+ if (allItemRect.cur && allItemRect.cur.itemInfo.sku_number.startsWith('BBC')) {
1773
+ var offset3inch = (0, _convertUnitsLite.convert)(3).from('in').to('cm');
1774
+ var tx = nx,
1775
+ ty = ny;
1776
+ if (allItemRect.cur && allItemRect.cur.itemInfo.sku_number.endsWith('-L')) {
1777
+ if (rot == 0 || rot == -180) {
1778
+ tx -= offset3inch * Math.cos(rotRad);
1779
+ }
1780
+ if (rot == 90 || rot == -90) {
1781
+ ty -= offset3inch * Math.sin(rotRad);
1782
+ }
1783
+ }
1784
+ if (allItemRect.cur && allItemRect.cur.itemInfo.sku_number.endsWith('-R')) {
1785
+ if (rot == 0 || rot == -180) {
1786
+ tx += offset3inch * Math.cos(rotRad);
1787
+ }
1788
+ if (rot == 90 || rot == -90) {
1789
+ ty += offset3inch * Math.sin(rotRad);
1790
+ }
1791
+ }
1792
+ var t_val = {
1793
+ pos: {
1794
+ x: tx,
1795
+ y: ty
1796
+ },
1797
+ rotRad: rotRad,
1798
+ size: allItemRect.cur.size,
1799
+ layoutpos: allItemRect.cur.layoutpos,
1800
+ is_corner: allItemRect.cur.is_corner
1801
+ };
1802
+ var isItemRectSect = validInterSect(allItemRect.others, t_val);
1803
+ var isWallRectSect = validInterSect(allLineRects, t_val);
1804
+ if (isItemRectSect && isWallRectSect) {
1805
+ nx = tx;
1806
+ ny = ty;
1807
+ }
1808
+ }
1809
+ return {
1810
+ nx: nx,
1811
+ ny: ny,
1812
+ rot: rot,
1813
+ rotRad: rotRad
1814
+ };
1815
+ }
1816
+
1817
+ ////////////
1818
+ function calcSnap3(allItemRect, allItemSnap, allLineRects, allLineSnap, allRect, x, y) {
1819
+ // let layer = scene.layers.get(layerID);
1820
+ // let cx = allItemRect.cur.pos.x;
1821
+ // let cy = allItemRect.cur.pos.y;
1822
+ var nx = x;
1823
+ var ny = y;
1824
+ var ndist = 20;
1825
+ var rotRad = allItemRect.cur.rotRad;
1826
+ var val = {
1827
+ pos: {
1828
+ x: x,
1829
+ y: y
1830
+ },
1831
+ rotRad: rotRad
1832
+ };
1833
+ val.size = allItemRect.cur.size;
1834
+ val.layoutpos = allItemRect.cur.layoutpos;
1835
+ val.is_corner = allItemRect.cur.is_corner;
1836
+ var curitem = getCalcRectFromItem3D(val);
1837
+ var allCurSnap = getAllCurSnap(allLineRects, x, y, allItemRect.cur);
1838
+ allCurSnap = validateSnaps(allCurSnap, allRect);
1839
+ var getSnap = false;
1840
+ var snapdist = [];
1841
+ allCurSnap.forEach(function (snap) {
1842
+ var dist = (snap.pos.x - x) * (snap.pos.x - x) + (snap.pos.y - y) * (snap.pos.y - y);
1843
+ snapdist.push(dist);
1844
+ if (dist < ndist) {
1845
+ ndist = dist;
1846
+ nx = snap.pos.x;
1847
+ ny = snap.pos.y;
1848
+ rotRad = snap.rotRad;
1849
+ getSnap = true;
1850
+ } else {
1851
+ var i = 0;
1852
+ allLineRects.forEach(function (others) {
1853
+ var containrect = intersectRect(others.rect, curitem.rect);
1854
+ if (containrect) {
1855
+ var edist = Math.min.apply(null, snapdist);
1856
+ allCurSnap.forEach(function (snap) {
1857
+ var dist = (snap.pos.x - x) * (snap.pos.x - x) + (snap.pos.y - y) * (snap.pos.y - y);
1858
+ if (dist === edist) {
1859
+ ndist = dist;
1860
+ nx = snap.pos.x;
1861
+ ny = snap.pos.y;
1862
+ rotRad = snap.rotRad;
1863
+ getSnap = true;
1864
+ }
1865
+ });
1866
+ }
1867
+ });
1868
+ }
1869
+ });
1870
+ if (getSnap === false) {
1871
+ allLineRects.forEach(function (others) {
1872
+ var containrect = intersectRect(others.rect, curitem.rect);
1873
+ if (containrect) {
1874
+ allLineSnap.forEach(function (snap) {
1875
+ var dist = (snap.pos.x - x) * (snap.pos.x - x) + (snap.pos.y - y) * (snap.pos.y - y);
1876
+ if (dist < 5000) {
1877
+ nx = snap.pos.x;
1878
+ ny = snap.pos.y;
1879
+ rotRad = snap.rotRad;
1880
+ getSnap = true;
1881
+ }
1882
+ });
1883
+ }
1884
+ });
1885
+ }
1886
+ allItemRect.others.forEach(function (others) {
1887
+ if (!(others.layoutpos === 'base' && allItemRect.cur.layoutpos === 'wall') || !(others.layoutpos === 'wall' && allItemRect.cur.layoutpos === 'base')) {
1888
+ var containrect = intersectRect(others.rect, curitem.rect);
1889
+ if (containrect) {
1890
+ getSnap = false;
1891
+ }
1892
+ }
1893
+ });
1894
+ if (!getSnap) {
1895
+ var _snapdist2 = [];
1896
+ allItemSnap.forEach(function (snap) {
1897
+ var dist = (snap.pos.x - x) * (snap.pos.x - x) + (snap.pos.y - y) * (snap.pos.y - y);
1898
+ _snapdist2.push(dist);
1899
+ if (dist < ndist) {
1900
+ ndist = dist;
1901
+ nx = snap.pos.x;
1902
+ ny = snap.pos.y;
1903
+ rotRad = snap.rotRad;
1904
+ } else {
1905
+ allItemRect.others.forEach(function (others) {
1906
+ if (!(others.layoutpos === 'base' && allItemRect.cur.layoutpos === 'wall') || !(others.layoutpos === 'wall' && allItemRect.cur.layoutpos === 'base')) {
1907
+ var containrect = intersectRect(others.rect, curitem.rect);
1908
+ if (containrect) {
1909
+ var edist = Math.min.apply(null, _snapdist2);
1910
+ allItemSnap.forEach(function (snap) {
1911
+ var dist = (snap.pos.x - x) * (snap.pos.x - x) + (snap.pos.y - y) * (snap.pos.y - y);
1912
+ if (dist === edist) {
1913
+ ndist = dist;
1914
+ nx = snap.pos.x;
1915
+ ny = snap.pos.y;
1916
+ rotRad = snap.rotRad;
1917
+ }
1918
+ });
1919
+ }
1920
+ }
1921
+ });
1922
+ }
1923
+ });
1924
+ }
1925
+ var rot = rotRad / Math.PI * 180;
1926
+ return {
1927
+ nx: nx,
1928
+ ny: ny,
1929
+ rot: rot,
1930
+ rotRad: rotRad
1931
+ };
1932
+ }
1933
+ function getAllCurSnap(allLineRects, x, y, curItemRect) {
1934
+ if (!curItemRect) return;
1935
+ var allCurSnap = [];
1936
+ var thick = _constants.LINE_THICKNESS / 2;
1937
+ allLineRects.forEach(function (linerect) {
1938
+ //allLineRects:left, right, top, bottom line
1939
+ var p0 = clone_point(linerect.rect[2]); //point 2(x, y) inside of line
1940
+ var p1 = clone_point(linerect.rect[3]); //point 3(x, y) inside of line
1941
+ var q = point(x, y); // point of item
1942
+ var cos = Math.cos(linerect.rotRad);
1943
+ var sin = Math.sin(linerect.rotRad);
1944
+ p0.x -= cos * curItemRect.size.width / 2;
1945
+ p0.y -= sin * curItemRect.size.width / 2;
1946
+ p1.x += cos * curItemRect.size.width / 2;
1947
+ p1.y += sin * curItemRect.size.width / 2;
1948
+ var n = point(-sin, cos);
1949
+ var v3to0 = {
1950
+ x: linerect.rect[0].x - p1.x,
1951
+ y: linerect.rect[0].y - p1.y
1952
+ };
1953
+ var fDot = dotprod(n, v3to0);
1954
+ if (fDot > 0) {
1955
+ // normal vector is crossing the wall
1956
+ n.x = -n.x;
1957
+ n.y = -n.y;
1958
+ }
1959
+ var dist = dotprod(diff(p1, q), n);
1960
+ var h = point(q.x + dist * n.x, q.y + dist * n.y);
1961
+ var nrot = linerect.rotRad + Math.PI;
1962
+ if (nrot >= Math.PI) nrot -= Math.PI * 2;
1963
+ 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);
1964
+ allCurSnap.push(o);
1965
+ nrot = nrot + Math.PI;
1966
+ 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);
1967
+ allCurSnap.push(o);
1968
+ });
1969
+ return allCurSnap;
1970
+ }
1971
+ function clone_point(pt) {
1972
+ return point(pt.x, pt.y);
1973
+ }
1974
+ function dotprod(v0, v1) {
1975
+ return v0.x * v1.x + v0.y * v1.y;
1976
+ }
1977
+
1978
+ //////////
1979
+ function validInterSect(rect, val) {
1980
+ var curitem = getCalcRectFromItem(val);
1981
+ var datas = [];
1982
+ rect.forEach(function (line) {
1983
+ datas.push(line);
1984
+ });
1985
+ for (var i = 0; i < datas.length; i++) {
1986
+ var data = datas[i];
1987
+ var containrect = intersectRect(data.rect, curitem.rect);
1988
+ if (containrect) {
1989
+ return false;
1990
+ }
1991
+ }
1992
+ return true;
1993
+ }
1994
+ var lineRect = function lineRect(layer) {
1995
+ var areainfo = [];
1996
+ layer.areas.forEach(function (area) {
1997
+ var sz = area.vertices.size;
1998
+ for (var i = 0; i < sz; i++) {
1999
+ areainfo.push(area.vertices.get(i));
2000
+ }
2001
+ });
2002
+ var rect = [];
2003
+ areainfo.forEach(function (area) {
2004
+ var vert = layer.vertices.get(area);
2005
+ rect.push(vert.x, vert.y);
2006
+ });
2007
+ return rect;
2008
+ };
2009
+ function getAllHoleRect(scene, val) {
2010
+ var layerID = scene.selectedLayer;
2011
+ var layer = scene.layers.get(layerID);
2012
+ var selectedItem = layer.getIn(['items', layer.selected.items.get(0)]);
2013
+ if (selectedItem !== undefined) {
2014
+ if (selectedItem.category != 'cabinet') {
2015
+ // If selected Item type is not `cabinet` then do not snap at windows
2016
+ return {
2017
+ isSect: true,
2018
+ snap: null
2019
+ };
2020
+ }
2021
+ } else {
2022
+ return {
2023
+ isSect: false,
2024
+ snap: null
2025
+ };
2026
+ }
2027
+ var holes = [];
2028
+ var itemRect = getCalcRectFromItem(val);
2029
+ layer.lines.forEach(function (line) {
2030
+ line.holes.forEach(function (holeID) {
2031
+ var hole = layer.holes.get(holeID);
2032
+ if (hole) holes.push(hole);
2033
+ });
2034
+ });
2035
+ var i = 0;
2036
+ for (; i < holes.length; i++) {
2037
+ var twidth = holes[i].properties.getIn(['width', 'length']);
2038
+ var theight = holes[i].properties.getIn(['thickness', 'length']) + 1;
2039
+ var tdepth = holes[i].properties.getIn(['altitude', 'length']);
2040
+ //let trot = holes[i].rotation;
2041
+ var verticeIDs = scene.getIn(['layers', layerID, 'lines', holes[i].line, 'vertices'])._tail.array;
2042
+ var vertice0 = scene.getIn(['layers', layerID, 'vertices', verticeIDs[0]]);
2043
+ var vertice1 = scene.getIn(['layers', layerID, 'vertices', verticeIDs[1]]);
2044
+ var point0 = {
2045
+ x: vertice0.x,
2046
+ y: vertice0.y
2047
+ };
2048
+ var point1 = {
2049
+ x: vertice1.x,
2050
+ y: vertice1.y
2051
+ };
2052
+ var rotation = Math.atan2(point1.y - point0.y, point1.x - point0.x);
2053
+ var rectInfo = getCalcRectFromLine(point1.x, point1.y, point0.x, point0.y, _constants.LINE_THICKNESS, layer);
2054
+ var vN = point(rectInfo.rect[0].x - rectInfo.rect[3].x, rectInfo.rect[0].y - rectInfo.rect[3].y);
2055
+ var lenN = Math.sqrt(vN.x * vN.x + vN.y * vN.y);
2056
+ vN.x /= lenN;
2057
+ vN.y /= lenN;
2058
+ var hx = holes[i].x;
2059
+ var hy = holes[i].y;
2060
+ hx += theight / 2 * vN.x;
2061
+ hy += theight / 2 * vN.y;
2062
+ var tval = {
2063
+ pos: {
2064
+ x: hx,
2065
+ y: hy
2066
+ },
2067
+ rotRad: rotation
2068
+ };
2069
+ tval.size = {
2070
+ width: twidth,
2071
+ height: theight
2072
+ };
2073
+ var hole_rect = getCalcRectFromItem(tval);
2074
+ if (intersectRect(itemRect.rect, hole_rect.rect)) {
2075
+ if (tdepth > itemRect.size.depth && itemRect.layoutpos !== _constants.WALL_CABINET_LAYOUTPOS) {
2076
+ var dist = itemRect.size.height / 2 + theight / 2;
2077
+ var snap = [];
2078
+ var p0 = {
2079
+ x: hx + dist * Math.cos(rotation + Math.PI / 2),
2080
+ y: hy + dist * Math.sin(rotation + Math.PI / 2)
2081
+ };
2082
+ var p1 = {
2083
+ x: hx - dist * Math.cos(rotation + Math.PI / 2),
2084
+ y: hy - dist * Math.sin(rotation + Math.PI / 2)
2085
+ };
2086
+ var allArea = getAllArea(layer);
2087
+ if (isPointInArea(allArea, p0)) {
2088
+ snap.push(p0);
2089
+ }
2090
+ if (isPointInArea(allArea, p1)) {
2091
+ snap.push(p1);
2092
+ }
2093
+ return {
2094
+ isSect: true,
2095
+ snap: snap
2096
+ };
2097
+ } else return {
2098
+ isSect: false,
2099
+ snap: null
2100
+ };
2101
+ }
2102
+ }
2103
+ return {
2104
+ isSect: true,
2105
+ snap: null
2106
+ };
2107
+ }
2108
+ function getHoleItems(layer) {
2109
+ var holeItems = [];
2110
+ layer.holes.map(function (hole) {
2111
+ var width = hole.properties.getIn(['width', 'length']);
2112
+ var altitude = hole.properties.getIn(['altitude', 'length']);
2113
+ holeItems.push({
2114
+ x: hole.x,
2115
+ y: hole.y,
2116
+ width: width,
2117
+ altitude: altitude
2118
+ });
2119
+ });
2120
+ return holeItems;
2121
+ }
2122
+ function needSnap(curItem, othItem) {
2123
+ var blSnap = false;
2124
+ if (curItem == undefined || curItem == null) return false;
2125
+ var altitude = curItem.selectedItem.properties.get('altitude');
2126
+ var heightFromFloor = (0, _convertUnitsLite.convert)(altitude.get('_length')).from(altitude.get('_unit')).to('in');
2127
+ var height = curItem.cat.info.sizeinfo.height;
2128
+ var currentItem = {
2129
+ heightFromFloor: heightFromFloor,
2130
+ height: height
2131
+ };
2132
+ altitude = othItem.item.properties.get('altitude');
2133
+ heightFromFloor = (0, _convertUnitsLite.convert)(altitude.get('_length')).from(altitude.get('_unit')).to('in');
2134
+ height = othItem.cat && othItem.cat.info.sizeinfo.height;
2135
+ var otherItem = {
2136
+ heightFromFloor: heightFromFloor,
2137
+ height: height
2138
+ };
2139
+ var curFloor = currentItem.heightFromFloor;
2140
+ var otherFloor = otherItem.heightFromFloor;
2141
+ var delta;
2142
+ curFloor > otherFloor ? delta = otherItem.height : delta = currentItem.height;
2143
+ if (Math.abs(curFloor - otherFloor) < delta) blSnap = true;
2144
+ var isBlsnapOth = othItem.item.category === 'cabinet' && othItem.item.layoutpos === _constants.BASE_CABINET_LAYOUTPOS && Math.abs(curFloor - otherFloor) >= delta;
2145
+ var isBlsnapCur = curItem.selectedItem.category === 'cabinet' && curItem.selectedItem.layoutpos === _constants.BASE_CABINET_LAYOUTPOS && Math.abs(curFloor - otherFloor) >= delta;
2146
+ if (curItem.cat.hasOwnProperty('long_name') || othItem.cat && othItem.cat.hasOwnProperty('long_name')) {
2147
+ if (curItem.cat.long_name.includes(_applianceCategories.APPLIANCE_CATEGORY_HOOD) || othItem.cat && othItem.cat.long_name.includes(_applianceCategories.APPLIANCE_CATEGORY_HOOD)) blSnap = true;
2148
+ if (curItem.cat.long_name.includes(_applianceCategories.APPLIANCE_CATEGORY_HOOD) && othItem.cat && isBlsnapOth || isBlsnapCur && othItem.cat.long_name.includes(_applianceCategories.APPLIANCE_CATEGORY_HOOD)) blSnap = false;
2149
+ if (curItem.cat.long_name.includes(_applianceCategories.APPLIANCE_CATEGORY_COOK_TOP) && othItem.cat && othItem.cat.long_name.includes('Cabinet') || curItem.cat.long_name.includes('Cabinet') && othItem.cat && othItem.cat.long_name.includes(_applianceCategories.APPLIANCE_CATEGORY_COOK_TOP)) blSnap = true;
2150
+ }
2151
+ return blSnap;
2152
+ }
2153
+ function isFrontWall(v0, v1) {
2154
+ var x1 = v0.x,
2155
+ y1 = v0.y;
2156
+ var x2 = v1.x,
2157
+ y2 = v1.y;
2158
+ var alpha = angleBetweenTwoPoints(x1, y1, x2, y2);
2159
+ return almostEqual(y1, y2) && x1 < x2 || -Math.PI / 2 < alpha && alpha < Math.PI / 2;
2160
+ }
2161
+ function isBackWall(v0, v1) {
2162
+ var x1 = v0.x,
2163
+ y1 = v0.y;
2164
+ var x2 = v1.x,
2165
+ y2 = v1.y;
2166
+ var alpha = angleBetweenTwoPoints(x1, y1, x2, y2);
2167
+ return almostEqual(y1, y2) && x1 > x2 || -Math.PI / 2 > alpha || alpha > Math.PI / 2;
2168
+ }
2169
+ function isLeftWall(v0, v1) {
2170
+ var x1 = v0.x,
2171
+ y1 = v0.y;
2172
+ var x2 = v1.x,
2173
+ y2 = v1.y;
2174
+ var alpha = angleBetweenTwoPoints(x1, y1, x2, y2);
2175
+ return almostEqual(x1, x2) && y1 < y2 || Math.PI > alpha && alpha > 0;
2176
+ }
2177
+ function isRightWall(v0, v1) {
2178
+ var x1 = v0.x,
2179
+ y1 = v0.y;
2180
+ var x2 = v1.x,
2181
+ y2 = v1.y;
2182
+ var alpha = angleBetweenTwoPoints(x1, y1, x2, y2);
2183
+ return almostEqual(x1, x2) && y1 > y2 || -Math.PI < alpha && alpha < 0;
2184
+ }
2185
+
2186
+ /**
2187
+ * Calculate the overlapping relationship of two lines
2188
+ * @param {*} srcLine // source line
2189
+ * @param {*} destLine // destination line
2190
+ * @returns overlapping status (OVERLAP_NONE | OVERLAP_SAME | OVERLAP_LINK | OVERLAP_INCLUDED | OVERLAP_SOME) and line segments of srcLine which broken with destLine
2191
+ * OVERLAP_NONE: two lines are not overlapped
2192
+ * OVERLAP_SAME: the start point and endpoint of two lines are same
2193
+ * OVERLAP_LINK: two lines are linked at the common point, so they can be merged to one line
2194
+ * OVERLAP_INCLUDED: destLine includes srcLine
2195
+ * OVERLAP_SOME: two lines are overlapped with some common range, then returns the trimmed segments of srcLine
2196
+ *
2197
+ * //////// test - start /////////////
2198
+ const p1 = { x1: 1413.1313131313132, y1: 1044.949494949495 };
2199
+ const p2 = { x1: 1476.2626262626263, y1: 1108.0808080808079 };
2200
+ const p3 = { x1: 1596.969696969697, y1: 1228.7878787878785 };
2201
+ const p4 = { x1: 1664.1414141414139, y1: 1295.9595959595958 };
2202
+ const tempRet = GeometryUtils.relationshipOfTwoOverlappedLines(
2203
+ { x1: p3.x1, y1: p3.y1, x2: p1.x1, y2: p1.y1 },
2204
+ { x1: p1.x1, y1: p1.y1, x2: p3.x1, y2: p3.y1 }
2205
+ );
2206
+ console.log(tempRet);
2207
+ //////// test - end /////////////
2208
+
2209
+ */
2210
+ function relationshipOfTwoOverlappedLines(srcLine, destLine) {
2211
+ // let res1 = relationshipOfTwoOverlappedLines1(srcLine, destLine);
2212
+ var res2 = (0, _index.relationshipOfTwoOverlappedLines2)(srcLine, destLine);
2213
+ // if (res1.result !== 0 || res2.result !== 0) {
2214
+ // console.group(res1.result);
2215
+ // console.log(res1);
2216
+ // console.log(res2);
2217
+ // console.log(srcLine, destLine);
2218
+ // console.groupEnd();
2219
+ // }
2220
+ return res2;
2221
+ }
2222
+ function relationshipOfTwoOverlappedLines1(srcLine, destLine) {
2223
+ var INFINITY = 1000000;
2224
+ var ZERO_DELTA = 0.01;
2225
+ // geometric equation of srcLine
2226
+ var dx1 = srcLine.x2 - srcLine.x1;
2227
+ dx1 = _export.MathUtils.fAbs(dx1) < ZERO_DELTA ? 0 : dx1;
2228
+ var dy1 = srcLine.y2 - srcLine.y1;
2229
+ dy1 = _export.MathUtils.fAbs(dy1) < ZERO_DELTA ? 0 : dy1;
2230
+ var a1 = dx1 === 0 ? INFINITY : dy1 / dx1;
2231
+ var b1 = a1 === INFINITY ? srcLine.x1 : srcLine.y1 - a1 * srcLine.x1;
2232
+ // geometric equation of destLine
2233
+ var dx2 = destLine.x2 - destLine.x1;
2234
+ dx2 = _export.MathUtils.fAbs(dx2) < ZERO_DELTA ? 0 : dx2;
2235
+ var dy2 = destLine.y2 - destLine.y1;
2236
+ dy2 = _export.MathUtils.fAbs(dy2) < ZERO_DELTA ? 0 : dy2;
2237
+ var a2 = dx2 === 0 ? INFINITY : dy2 / dx2;
2238
+ var b2 = a2 === INFINITY ? destLine.x1 : destLine.y1 - a2 * destLine.x1;
2239
+ if (_export.MathUtils.fAbs(_export.MathUtils.fAbs(a1) - _export.MathUtils.fAbs(a2)) > ZERO_DELTA)
2240
+ // two lines are not parallel
2241
+ return {
2242
+ result: _constants.OVERLAP_NONE
2243
+ };
2244
+ if (_export.MathUtils.fAbs(_export.MathUtils.fAbs(b1) - _export.MathUtils.fAbs(b2)) > ZERO_DELTA)
2245
+ // two lines are parallel but not overlap
2246
+ return {
2247
+ result: _constants.OVERLAP_NONE
2248
+ };
2249
+
2250
+ // parametric equation of destLine
2251
+ var sk1 = dx1 === 0 ? INFINITY : _export.MathUtils.toFixedFloat((destLine.x1 - srcLine.x1) / dx1, 3);
2252
+ var sk2 = dy1 === 0 ? INFINITY : _export.MathUtils.toFixedFloat((destLine.y1 - srcLine.y1) / dy1, 3);
2253
+ var ek1 = dx1 === 0 ? INFINITY : _export.MathUtils.toFixedFloat((destLine.x2 - srcLine.x1) / dx1, 3);
2254
+ var ek2 = dy1 === 0 ? INFINITY : _export.MathUtils.toFixedFloat((destLine.y2 - srcLine.y1) / dy1, 3);
2255
+ if (sk1 !== INFINITY && sk2 !== INFINITY && ek1 !== INFINITY && ek2 !== INFINITY && (sk1 !== sk2 || ek1 !== ek2))
2256
+ // destLine does not overlap with srcLine
2257
+ return {
2258
+ result: _constants.OVERLAP_NONE
2259
+ };
2260
+
2261
+ // parameter of destLine on the start and end points
2262
+ var sk = Math.min(sk1, sk2);
2263
+ if (Math.abs(sk) < 0.05) sk = 0;else if (Math.abs(Math.abs(sk) - 1) < 0.05) sk = 1;
2264
+ var ek = Math.abs(Math.min(ek1, ek2)) > 0.05 ? Math.min(ek1, ek2) : 0;
2265
+ if (Math.abs(ek) < 0.05) ek = 0;else if (Math.abs(Math.abs(ek) - 1) < 0.05) ek = 1;
2266
+ // let ek = Math.min(ek1, ek2);
2267
+
2268
+ // check the relationship between srcLine and destLine
2269
+ if (sk < 0 && ek < 0 || sk > 1 && ek > 1)
2270
+ // not overlap
2271
+ return {
2272
+ result: _constants.OVERLAP_NONE
2273
+ };
2274
+ if (sk === 0 && ek === 1 || sk === 1 && ek === 0)
2275
+ // same lines
2276
+ return {
2277
+ result: _constants.OVERLAP_SAME
2278
+ };
2279
+ if (sk <= 0 && ek >= 1 || sk >= 1 && ek <= 0)
2280
+ // destLine includes srcLine
2281
+ return {
2282
+ result: _constants.OVERLAP_INCLUDED
2283
+ };
2284
+ if (sk === 0 && ek < 0 || sk === 1 && ek > 1 || ek === 0 && sk < 0 || ek === 1 && sk > 1) {
2285
+ // linked with one common point
2286
+ var linkedLine;
2287
+ if (sk === 0 && ek < 0) {
2288
+ // destE destS srcS srcE
2289
+ // |----------|------------|
2290
+ linkedLine = {
2291
+ x1: destLine.x2,
2292
+ y1: destLine.y2,
2293
+ x2: srcLine.x2,
2294
+ y2: srcLine.y2
2295
+ };
2296
+ } else if (sk === 1 && ek > 1) {
2297
+ // srcS srcE destS destE
2298
+ // |----------|------------|
2299
+ linkedLine = {
2300
+ x1: srcLine.x1,
2301
+ y1: srcLine.y1,
2302
+ x2: destLine.x2,
2303
+ y2: destLine.y2
2304
+ };
2305
+ } else if (ek === 0 && sk < 0) {
2306
+ // destS destE srcS srcE
2307
+ // |----------|------------|
2308
+ linkedLine = {
2309
+ x1: destLine.x1,
2310
+ y1: destLine.y1,
2311
+ x2: srcLine.x2,
2312
+ y2: srcLine.y2
2313
+ };
2314
+ } else if (ek === 1 && sk > 1) {
2315
+ // srcS srcE destE destS
2316
+ // |----------|------------|
2317
+ linkedLine = {
2318
+ x1: srcLine.x1,
2319
+ y1: srcLine.y1,
2320
+ x2: destLine.x1,
2321
+ y2: destLine.y1
2322
+ };
2323
+ }
2324
+ return {
2325
+ result: _constants.OVERLAP_LINK,
2326
+ linkedLine: linkedLine
2327
+ };
2328
+ }
2329
+ var trimmedSegment1 = null;
2330
+ var trimmedSegment2 = null;
2331
+ var ret = {
2332
+ result: _constants.OVERLAP_SOME,
2333
+ trimmedSegs: []
2334
+ };
2335
+ if (0 <= sk && sk <= 1 && 0 <= ek && ek <= 1) {
2336
+ // srcLine includes destLine
2337
+ if (sk < ek) {
2338
+ // srcS destS destE srcE
2339
+ // |------|---------|-------|
2340
+ if (sk > 0) trimmedSegment1 = {
2341
+ x1: srcLine.x1,
2342
+ y1: srcLine.y1,
2343
+ x2: destLine.x1,
2344
+ y2: destLine.y1
2345
+ };
2346
+ if (ek < 1) trimmedSegment2 = {
2347
+ x1: destLine.x2,
2348
+ y1: destLine.y2,
2349
+ x2: srcLine.x2,
2350
+ y2: srcLine.y2
2351
+ };
2352
+ } else {
2353
+ // srcS destE destS srcE
2354
+ // |------|---------|-------|
2355
+ if (ek > 0) trimmedSegment1 = {
2356
+ x1: srcLine.x1,
2357
+ y1: srcLine.y1,
2358
+ x2: destLine.x2,
2359
+ y2: destLine.y2
2360
+ };
2361
+ if (sk < 1) trimmedSegment2 = {
2362
+ x1: destLine.x1,
2363
+ y1: destLine.y1,
2364
+ x2: srcLine.x2,
2365
+ y2: srcLine.y2
2366
+ };
2367
+ }
2368
+ } else {
2369
+ // srcLine and destLine are overlapped with some range
2370
+ if (sk < 0) {
2371
+ // destS srcS destE srcE
2372
+ // |------|---------|-------|
2373
+ trimmedSegment1 = {
2374
+ x1: destLine.x2,
2375
+ y1: destLine.y2,
2376
+ x2: srcLine.x2,
2377
+ y2: srcLine.y2
2378
+ };
2379
+ } else if (ek < 0) {
2380
+ // destE srcS destS srcE
2381
+ // |------|---------|-------|
2382
+ trimmedSegment1 = {
2383
+ x1: destLine.x1,
2384
+ y1: destLine.y1,
2385
+ x2: srcLine.x2,
2386
+ y2: srcLine.y2
2387
+ };
2388
+ } else if (sk > 1) {
2389
+ // srcS destE srcE destS
2390
+ // |------|---------|-------|
2391
+ trimmedSegment1 = {
2392
+ x1: srcLine.x1,
2393
+ y1: srcLine.y1,
2394
+ x2: destLine.x2,
2395
+ y2: destLine.y2
2396
+ };
2397
+ } else if (ek > 1) {
2398
+ // srcS destS srcE destE
2399
+ // |------|---------|-------|
2400
+ trimmedSegment1 = {
2401
+ x1: srcLine.x1,
2402
+ y1: srcLine.y1,
2403
+ x2: destLine.x1,
2404
+ y2: destLine.y1
2405
+ };
2406
+ }
2407
+ }
2408
+ if (trimmedSegment1 !== null) ret.trimmedSegs.push(trimmedSegment1);
2409
+ if (trimmedSegment2 !== null) ret.trimmedSegs.push(trimmedSegment2);
2410
+ return ret;
2411
+ }
2412
+
2413
+ /**
2414
+ *
2415
+ * @param {Array} points points of polygon [[x0, y0], [x1, y1], ...]
2416
+ * @returns {Array} { x, y } position of centroid
2417
+ */
2418
+ function getCentroidOfPolygon(points) {
2419
+ var centroid = points.reduce(function (x, y) {
2420
+ return [x[0] + y[0] / points.length, x[1] + y[1] / points.length];
2421
+ }, [0, 0]);
2422
+ return {
2423
+ x: centroid[0],
2424
+ y: centroid[1]
2425
+ };
2426
+ }
2427
+
2428
+ /**
2429
+ * Return the polygon points of room
2430
+ * @param {Object} layer
2431
+ * @returns {Array} polygon points [x0, y0, x1, y1, ... ]
2432
+ */
2433
+ function getPoylgonPoints(layer) {
2434
+ var _layer$areas;
2435
+ var areainfo = [];
2436
+ (_layer$areas = layer.areas) === null || _layer$areas === void 0 || _layer$areas.forEach(function (area) {
2437
+ var _area$vertices;
2438
+ var sz = (_area$vertices = area.vertices) === null || _area$vertices === void 0 ? void 0 : _area$vertices.size;
2439
+ for (var i = 0; i < sz; i++) {
2440
+ areainfo.push(area.vertices.get(i));
2441
+ }
2442
+ });
2443
+ var rect = [];
2444
+ areainfo.forEach(function (area) {
2445
+ var _layer$vertices;
2446
+ var vert = (_layer$vertices = layer.vertices) === null || _layer$vertices === void 0 ? void 0 : _layer$vertices.get(area);
2447
+ rect.push(vert === null || vert === void 0 ? void 0 : vert.x, vert === null || vert === void 0 ? void 0 : vert.y);
2448
+ });
2449
+ return rect;
2450
+ }
2451
+ function validRect(itemRect, rects) {
2452
+ var updatedItemRect = getCalcRectFromItem(itemRect);
2453
+ return rects.every(function (rect) {
2454
+ return !intersectRect(rect.rect, updatedItemRect.rect);
2455
+ });
2456
+ }
2457
+ function getCalcRectFromItem2(itemInfo) {
2458
+ var x = itemInfo.pos.x;
2459
+ var y = itemInfo.pos.y;
2460
+ var w = itemInfo.size.width / 2;
2461
+ var h = itemInfo.size.height / 2;
2462
+ var rotRad = itemInfo.rotRad;
2463
+ var mx = x - w * Math.cos(rotRad);
2464
+ var my = y - w * Math.sin(rotRad);
2465
+ var m2x = x + w * Math.cos(rotRad);
2466
+ var m2y = y + w * Math.sin(rotRad);
2467
+ var m3x = x - h * Math.sin(rotRad);
2468
+ var m3y = y + h * Math.cos(rotRad);
2469
+ var m1x = x + h * Math.sin(rotRad);
2470
+ var m1y = y - h * Math.cos(rotRad);
2471
+ return {
2472
+ rectCenterPoint: [[point(mx, my), 180], [point(m1x, m1y), -90], [point(m2x, m2y), 0], [point(m3x, m3y), 90]]
2473
+ };
2474
+ }
2475
+ function getAllItems2(curItem, layer) {
2476
+ var rectarray = [];
2477
+ layer.items.forEach(function (item) {
2478
+ var val = {
2479
+ pos: {
2480
+ x: item.x,
2481
+ y: item.y
2482
+ },
2483
+ rotRad: item.rotation / 180 * Math.PI
2484
+ };
2485
+ var width = (0, _convertUnitsLite.convert)(item.properties.getIn(['width', '_length'])).from(curItem.get('properties').get('width').get('_unit')).to('cm');
2486
+ var height = (0, _convertUnitsLite.convert)(item.properties.getIn(['depth', '_length'])).from(curItem.get('properties').get('depth').get('_unit')).to('cm');
2487
+ val.size = {
2488
+ width: width,
2489
+ height: height
2490
+ };
2491
+ var curItemTall = (0, _convertUnitsLite.convert)(curItem.get('properties').get('height').get('_length')).from(curItem.get('properties').get('height').get('_unit')).to('cm');
2492
+ var zMinCurItem = (0, _convertUnitsLite.convert)(curItem.get('properties').get('altitude').get('_length')).from(curItem.get('properties').get('altitude').get('_unit')).to('cm');
2493
+ var zMaxCurItem = zMinCurItem + curItemTall;
2494
+ if (curItem.get('id') !== item.id) {
2495
+ var detectObjectsAtSameAltitudeFlag = false;
2496
+ var itemTall = (0, _convertUnitsLite.convert)(item.properties.getIn(['height', '_length'])).from(item.get('properties').get('height').get('_unit')).to('cm');
2497
+ var zMinItem = (0, _convertUnitsLite.convert)(item.properties.getIn(['altitude', '_length'])).from(item.get('properties').get('altitude').get('_unit')).to('cm');
2498
+ var zMaxItem = zMinItem + itemTall;
2499
+ if (zMinItem - zMinCurItem >= 0 && zMaxCurItem - zMinItem > _constants.EPSILON || zMinCurItem - zMinItem >= 0 && zMaxItem - zMinCurItem > _constants.EPSILON) detectObjectsAtSameAltitudeFlag = true;
2500
+ if (detectObjectsAtSameAltitudeFlag) {
2501
+ var x = val.pos.x;
2502
+ var y = val.pos.y;
2503
+ var rotRad = val.rotRad;
2504
+ var w = val.size.width / 2;
2505
+ var h = val.size.height / 2;
2506
+ var mx = x - w * Math.cos(rotRad);
2507
+ var my = y - w * Math.sin(rotRad);
2508
+ var x0 = mx + h * Math.sin(rotRad);
2509
+ var y0 = my - h * Math.cos(rotRad);
2510
+ var x3 = mx * 2 - x0;
2511
+ var y3 = my * 2 - y0;
2512
+ var x1 = x * 2 - x3;
2513
+ var y1 = y * 2 - y3;
2514
+ var x2 = x * 2 - x0;
2515
+ var y2 = y * 2 - y0;
2516
+ rectarray.push({
2517
+ rect: [point(x0, y0), point(x1, y1), point(x0, y0), point(x1, y1)]
2518
+ });
2519
+ rectarray.push({
2520
+ rect: [point(x1, y1), point(x2, y2), point(x1, y1), point(x2, y2)]
2521
+ });
2522
+ rectarray.push({
2523
+ rect: [point(x2, y2), point(x3, y3), point(x2, y2), point(x3, y3)]
2524
+ });
2525
+ rectarray.push({
2526
+ rect: [point(x3, y3), point(x0, y0), point(x3, y3), point(x0, y0)]
2527
+ });
2528
+ }
2529
+ }
2530
+ });
2531
+ return {
2532
+ others: rectarray
2533
+ };
2534
+ }
2535
+ function calcDistancesFromItemToWalls(curItem, layer) {
2536
+ if ((0, _helper.isEmpty)(curItem)) return [];
2537
+ var x = curItem.get('x');
2538
+ var y = curItem.get('y');
2539
+ var rotRad = curItem.get('rotation') / 180 * Math.PI;
2540
+ var width, height;
2541
+ if (curItem.get('properties').get('width') || curItem.get('properties').get('depth')) {
2542
+ width = (0, _convertUnitsLite.convert)(curItem.get('properties').get('width').get('_length')).from(curItem.get('properties').get('width').get('_unit')).to('cm');
2543
+ height = (0, _convertUnitsLite.convert)(curItem.get('properties').get('depth').get('_length')).from(curItem.get('properties').get('depth').get('_unit')).to('cm');
2544
+ } else {
2545
+ width = (0, _convertUnitsLite.convert)(curItem.info.sizeinfo.width).from('in').to('cm');
2546
+ height = (0, _convertUnitsLite.convert)(curItem.info.sizeinfo.depth).from('in').to('cm');
2547
+ }
2548
+ var center_x = x; // middle of front line of cabinet rect
2549
+ var center_y = y;
2550
+ var PointArray = [];
2551
+ var itemInfo = {
2552
+ pos: {
2553
+ x: x,
2554
+ y: y
2555
+ },
2556
+ rotRad: rotRad
2557
+ };
2558
+ itemInfo.size = {
2559
+ width: width,
2560
+ height: height
2561
+ };
2562
+ var curiteminfo = getCalcRectFromItem2(itemInfo);
2563
+ var allItemRect = getAllItems2(curItem, layer); // get all item edge rects
2564
+ var allLines = getAllLines(layer); // get all wall lines
2565
+ var allLineRects = buildRectFromLines(layer, allLines); // make line rects from wall lines
2566
+ var allRect = allLineRects.concat(allItemRect.others); // item edges + wall lines
2567
+ var _loop = function _loop(i) {
2568
+ // [rectCenterPoint] has four middle points of cabinet rect edges
2569
+ var centerpoint = curiteminfo.rectCenterPoint[i];
2570
+ var comparelength = []; // distance array from rectCenterPoint[i] to other lines(walls, other cabinet rect edges)
2571
+ var a;
2572
+ var RectLineFuction = linePassingThroughTwoPoints(centerpoint[0].x, centerpoint[0].y, center_x, center_y); // normal line of cabinet rect edge
2573
+
2574
+ allRect.forEach(function (linerect) {
2575
+ // calc distance to all other lines
2576
+ var p0 = clone_point(linerect.rect[2]);
2577
+ var p1 = clone_point(linerect.rect[3]);
2578
+ var lineFunction = {}; // other line function
2579
+ if (p0.x !== p1.x || p0.y !== p1.y) lineFunction = linePassingThroughTwoPoints(p0.x, p0.y, p1.x, p1.y);
2580
+ // intersection between normal line and other line
2581
+ var coordinatePoint = twoLinesIntersection(lineFunction.a, lineFunction.b, lineFunction.c, RectLineFuction.a, RectLineFuction.b, RectLineFuction.c);
2582
+ if (coordinatePoint !== undefined) {
2583
+ if (
2584
+ // intersection point is on the other line
2585
+ pointsDistance(p0.x, p0.y, p1.x, p1.y) > pointsDistance(p0.x, p0.y, coordinatePoint.x, coordinatePoint.y) && pointsDistance(p0.x, p0.y, p1.x, p1.y) > pointsDistance(p1.x, p1.y, coordinatePoint.x, coordinatePoint.y)) {
2586
+ // check the intersection point is outside direction of edge
2587
+ var isOutside = true;
2588
+ for (var j = 0; j < curiteminfo.rectCenterPoint.length; j++) {
2589
+ if (j === i) continue;
2590
+ var otherCenterPoint = curiteminfo.rectCenterPoint[j];
2591
+ if (isPointOnLineSegment(centerpoint[0].x, centerpoint[0].y, coordinatePoint.x, coordinatePoint.y, otherCenterPoint[0].x, otherCenterPoint[0].y)) isOutside = false;
2592
+ }
2593
+ if (isOutside && pointsDistance(coordinatePoint.x, coordinatePoint.y, center_x, center_y) > pointsDistance(centerpoint[0].x, centerpoint[0].y, coordinatePoint.x, coordinatePoint.y)) {
2594
+ comparelength.push(pointsDistance(centerpoint[0].x, centerpoint[0].y, coordinatePoint.x, coordinatePoint.y));
2595
+ a = Math.min.apply(null, comparelength);
2596
+ }
2597
+ }
2598
+ }
2599
+ });
2600
+ PointArray.push([a, centerpoint[1]]);
2601
+ };
2602
+ for (var i = 0; i < curiteminfo.rectCenterPoint.length; i++) {
2603
+ _loop(i);
2604
+ }
2605
+ PointArray.forEach(function (pointElement, index) {
2606
+ if (pointElement[0] == undefined) PointArray[index][0] = 0;
2607
+ });
2608
+ var cnt = 0;
2609
+ PointArray.forEach(function (pointElement) {
2610
+ if (pointElement[0] == 0) cnt++;
2611
+ });
2612
+ if (cnt == 4 || cnt == 3) {
2613
+ PointArray[0][0] = 100;
2614
+ PointArray[1][0] = 100;
2615
+ }
2616
+ return {
2617
+ PointArray: PointArray
2618
+ };
2619
+ }
2620
+ function calcDistancesFromHoleToNearestOneOrWall(curHole, layer) {
2621
+ var _layer$lines, _layer$vertices2, _line$vertices, _layer$vertices3, _line$vertices2, _curHole$properties$g, _curHole$properties, _line$get;
2622
+ var distArray = {
2623
+ distLeft: 0,
2624
+ distRight: 0
2625
+ };
2626
+ if ((0, _helper.isEmpty)(curHole)) return distArray;
2627
+ /***** calculate Left & Right distance from nearest hole ******/
2628
+ // parent line of curHole
2629
+ var line = (_layer$lines = layer.lines) === null || _layer$lines === void 0 ? void 0 : _layer$lines.get(curHole.line);
2630
+ var v0 = (_layer$vertices2 = layer.vertices) === null || _layer$vertices2 === void 0 ? void 0 : _layer$vertices2.get(line === null || line === void 0 || (_line$vertices = line.vertices) === null || _line$vertices === void 0 ? void 0 : _line$vertices.get(0));
2631
+ var v1 = (_layer$vertices3 = layer.vertices) === null || _layer$vertices3 === void 0 ? void 0 : _layer$vertices3.get(line === null || line === void 0 || (_line$vertices2 = line.vertices) === null || _line$vertices2 === void 0 ? void 0 : _line$vertices2.get(1));
2632
+ var lineLength = pointsDistance(v0.x, v0.y, v1.x, v1.y);
2633
+ if ((0, _helper.isEmpty)(line) || (0, _helper.isEmpty)(v0) || (0, _helper.isEmpty)(v1)) return distArray;
2634
+ var angle = angleBetweenTwoPoints(v0.x, v0.y, v1.x, v1.y);
2635
+
2636
+ // start point and end point of current hole
2637
+ var chw = (_curHole$properties$g = (_curHole$properties = curHole.properties) === null || _curHole$properties === void 0 || (_curHole$properties = _curHole$properties.get('width')) === null || _curHole$properties === void 0 ? void 0 : _curHole$properties.get('length')) !== null && _curHole$properties$g !== void 0 ? _curHole$properties$g : 0;
2638
+ var chPt = {
2639
+ x: v0.x + lineLength * curHole.offset * Math.cos(angle),
2640
+ y: v0.y + lineLength * curHole.offset * Math.sin(angle)
2641
+ };
2642
+ var chsp = {
2643
+ x: chPt.x - chw / 2 * Math.cos(angle),
2644
+ y: chPt.y - chw / 2 * Math.sin(angle)
2645
+ };
2646
+ var chep = {
2647
+ x: chPt.x + chw / 2 * Math.cos(angle),
2648
+ y: chPt.y + chw / 2 * Math.sin(angle)
2649
+ };
2650
+ distArray.distLeft = pointsDistance(v0.x, v0.y, chsp.x, chsp.y);
2651
+ distArray.distRight = pointsDistance(v1.x, v1.y, chep.x, chep.y);
2652
+ (_line$get = line.get('holes')) === null || _line$get === void 0 || _line$get.forEach(function (hId) {
2653
+ if (hId !== curHole.id) {
2654
+ var _layer$holes, _hole$properties$get$, _hole$properties;
2655
+ var hole = (_layer$holes = layer.holes) === null || _layer$holes === void 0 ? void 0 : _layer$holes.get(hId);
2656
+ // start point and end point of other hole
2657
+ var hw = (_hole$properties$get$ = (_hole$properties = hole.properties) === null || _hole$properties === void 0 || (_hole$properties = _hole$properties.get('width')) === null || _hole$properties === void 0 ? void 0 : _hole$properties.get('length')) !== null && _hole$properties$get$ !== void 0 ? _hole$properties$get$ : 0;
2658
+ var hPt = {
2659
+ x: v0.x + lineLength * hole.offset * Math.cos(angle),
2660
+ y: v0.y + lineLength * hole.offset * Math.sin(angle)
2661
+ };
2662
+ var hsp = {
2663
+ x: hPt.x - hw / 2 * Math.cos(angle),
2664
+ y: hPt.y - hw / 2 * Math.sin(angle)
2665
+ };
2666
+ var hep = {
2667
+ x: hPt.x + hw / 2 * Math.cos(angle),
2668
+ y: hPt.y + hw / 2 * Math.sin(angle)
2669
+ };
2670
+ var relation = relationshipOfTwoOverlappedLines({
2671
+ x1: chsp.x,
2672
+ y1: chsp.y,
2673
+ x2: chep.x,
2674
+ y2: chep.y
2675
+ }, {
2676
+ x1: hsp.x,
2677
+ y1: hsp.y,
2678
+ x2: hep.x,
2679
+ y2: hep.y
2680
+ });
2681
+ // two holes(current hole and other hole) are not overlaped, then get distance
2682
+ if (relation.result === _constants.OVERLAP_NONE || relation.result === _constants.OVERLAP_LINK) {
2683
+ if (hole.offset < curHole.offset)
2684
+ // other hole is on the left side
2685
+ distArray.distLeft = Math.min(distArray.distLeft, pointsDistance(chsp.x, chsp.y, hep.x, hep.y));
2686
+ // other hole is on the right side
2687
+ else distArray.distRight = Math.min(distArray.distRight, pointsDistance(chep.x, chep.y, hsp.x, hsp.y));
2688
+ }
2689
+ }
2690
+ });
2691
+ return distArray;
2692
+ }
2693
+ function getSnappedWallLines(item, layer, catalog) {
2694
+ var _element;
2695
+ var snappedWallLines = [];
2696
+ if ((0, _helper.isEmpty)(item)) return snappedWallLines;
2697
+ var vertexLines = getAllLines(layer);
2698
+ var rectLines = buildRectFromLines(layer, vertexLines);
2699
+ var outline = null;
2700
+ var element = catalog.elements[item.get('type')];
2701
+ if (!element) element = catalog.elements[(0, _utils.returnReplaceableDeepSearchType)(item.get('type'))];
2702
+ var newWidth = item.properties.get('width').get('_length');
2703
+ var wUnit = item.properties.get('width').get('_unit') || 'cm';
2704
+ newWidth = (0, _convertUnitsLite.convert)(newWidth).from(wUnit).to('cm');
2705
+ var newDepth = item.properties.get('depth').get('_length');
2706
+ var hUnit = item.properties.get('depth').get('_unit') || 'cm';
2707
+ newDepth = (0, _convertUnitsLite.convert)(newDepth).from(hUnit).to('cm');
2708
+ var overlapList = [_constants.OVERLAP_INCLUDED, _constants.OVERLAP_SAME, _constants.OVERLAP_SOME];
2709
+
2710
+ // Get Outline Data of Selected Item
2711
+ outline = (_element = element) === null || _element === void 0 || (_element = _element.info) === null || _element === void 0 ? void 0 : _element.outline;
2712
+ if (outline) {
2713
+ // Extract Points from `outline`
2714
+ var outlinePaths = outline.paths;
2715
+ var outlineWidth = outline.svgWidth;
2716
+ var outlineHeight = outline.svgHeight;
2717
+ var outlinePoints = []; // Hold Points Of SVG
2718
+ var _iterator7 = _createForOfIteratorHelper(outlinePaths),
2719
+ _step7;
2720
+ try {
2721
+ for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
2722
+ var path = _step7.value;
2723
+ var _iterator8 = _createForOfIteratorHelper(path.subPaths),
2724
+ _step8;
2725
+ try {
2726
+ for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
2727
+ var subPath = _step8.value;
2728
+ outlinePoints = outlinePoints.concat(subPath.getPoints());
2729
+ }
2730
+ } catch (err) {
2731
+ _iterator8.e(err);
2732
+ } finally {
2733
+ _iterator8.f();
2734
+ }
2735
+ }
2736
+ } catch (err) {
2737
+ _iterator7.e(err);
2738
+ } finally {
2739
+ _iterator7.f();
2740
+ }
2741
+ outline.reverse && outlinePoints.reverse();
2742
+ for (var i = 0; i < outlinePoints.length - 1; i++) {
2743
+ var v0 = rotatePointAroundPoint((outlinePoints[i].x / outlineWidth - 0.5) * newWidth + item.x, (outlinePoints[i].y / outlineHeight - 0.5) * newDepth + item.y, item.x, item.y, item.rotation + 90);
2744
+ var v1 = rotatePointAroundPoint((outlinePoints[i + 1].x / outlineWidth - 0.5) * newWidth + item.x, (outlinePoints[i + 1].y / outlineHeight - 0.5) * newDepth + item.y, item.x, item.y, item.rotation + 90);
2745
+ var srcLine = {
2746
+ x1: v0.x,
2747
+ y1: v0.y,
2748
+ x2: v1.x,
2749
+ y2: v1.y
2750
+ };
2751
+ var _loop2 = function _loop2(j) {
2752
+ var destLine1 = {
2753
+ x1: rectLines[j].rect[2].x,
2754
+ y1: rectLines[j].rect[2].y,
2755
+ x2: rectLines[j].rect[3].x,
2756
+ y2: rectLines[j].rect[3].y
2757
+ };
2758
+ var destLine2 = {
2759
+ x1: rectLines[j].rect[0].x,
2760
+ y1: rectLines[j].rect[0].y,
2761
+ x2: rectLines[j].rect[1].x,
2762
+ y2: rectLines[j].rect[1].y
2763
+ };
2764
+ if (overlapList.includes(relationshipOfTwoOverlappedLines(srcLine, destLine1).result) || overlapList.includes(relationshipOfTwoOverlappedLines(srcLine, destLine2).result)) {
2765
+ var idx = snappedWallLines.findIndex(function (v) {
2766
+ return v.id === rectLines[j].lineId;
2767
+ });
2768
+ var snapSide = 'unknown';
2769
+ if (idx < 0) snappedWallLines.push({
2770
+ id: rectLines[j].lineId,
2771
+ lineRect: rectLines[j].rect,
2772
+ snapSide: snapSide
2773
+ });else snappedWallLines[idx].snapSide = snapSide;
2774
+ }
2775
+ };
2776
+ for (var j = 0; j < (rectLines === null || rectLines === void 0 ? void 0 : rectLines.length); j++) {
2777
+ _loop2(j);
2778
+ }
2779
+ }
2780
+ } else {
2781
+ var pos = [[-1, -1], [1, -1], [1, 1], [-1, 1]];
2782
+ for (var _i = 0; _i < 4; _i++) {
2783
+ var _v = rotatePointAroundPoint(pos[_i][0] * newWidth / 2 + item.x, pos[_i][1] * newDepth / 2 + item.y, item.x, item.y, item.rotation);
2784
+ var _v2 = rotatePointAroundPoint(pos[(_i + 1) % 4][0] * newWidth / 2 + item.x, pos[(_i + 1) % 4][1] * newDepth / 2 + item.y, item.x, item.y, item.rotation);
2785
+ var _srcLine = {
2786
+ x1: _v.x,
2787
+ y1: _v.y,
2788
+ x2: _v2.x,
2789
+ y2: _v2.y
2790
+ };
2791
+ var _loop3 = function _loop3(_j) {
2792
+ var destLine1 = {
2793
+ x1: rectLines[_j].rect[2].x,
2794
+ y1: rectLines[_j].rect[2].y,
2795
+ x2: rectLines[_j].rect[3].x,
2796
+ y2: rectLines[_j].rect[3].y
2797
+ };
2798
+ var destLine2 = {
2799
+ x1: rectLines[_j].rect[0].x,
2800
+ y1: rectLines[_j].rect[0].y,
2801
+ x2: rectLines[_j].rect[1].x,
2802
+ y2: rectLines[_j].rect[1].y
2803
+ };
2804
+ if (overlapList.includes(relationshipOfTwoOverlappedLines(_srcLine, destLine1).result) || overlapList.includes(relationshipOfTwoOverlappedLines(_srcLine, destLine2).result)) {
2805
+ var idx = snappedWallLines.findIndex(function (v) {
2806
+ return v.id === rectLines[_j].lineId;
2807
+ });
2808
+ var snapSide = _i === 0 || _i === 2 ? 'front' : 'side';
2809
+ if (idx < 0) snappedWallLines.push({
2810
+ id: rectLines[_j].lineId,
2811
+ lineRect: rectLines[_j].rect,
2812
+ snapSide: snapSide
2813
+ });else snappedWallLines[idx].snapSide = snapSide;
2814
+ }
2815
+ };
2816
+ for (var _j = 0; _j < (rectLines === null || rectLines === void 0 ? void 0 : rectLines.length); _j++) {
2817
+ _loop3(_j);
2818
+ }
2819
+ }
2820
+ }
2821
+ return snappedWallLines;
2822
+ }
2823
+ function getLineSnapPointsOfItem(layer, curLine, item) {
2824
+ var _layer$lines2, _layer$vertices4, _line$vertices3, _layer$vertices5, _line$vertices4;
2825
+ // V0
2826
+ // /|
2827
+ // D0 /|-----------|
2828
+ // /| |
2829
+ // /| Item | ====> get D0, D1
2830
+ // /| |
2831
+ // D1 /|-----------|
2832
+ // /|
2833
+ // get v0, v1 of line
2834
+ var line = (_layer$lines2 = layer.lines) === null || _layer$lines2 === void 0 ? void 0 : _layer$lines2.get(curLine === null || curLine === void 0 ? void 0 : curLine.id);
2835
+ var v0 = (_layer$vertices4 = layer.vertices) === null || _layer$vertices4 === void 0 ? void 0 : _layer$vertices4.get(line === null || line === void 0 || (_line$vertices3 = line.vertices) === null || _line$vertices3 === void 0 ? void 0 : _line$vertices3.get(0));
2836
+ var v1 = (_layer$vertices5 = layer.vertices) === null || _layer$vertices5 === void 0 ? void 0 : _layer$vertices5.get(line === null || line === void 0 || (_line$vertices4 = line.vertices) === null || _line$vertices4 === void 0 ? void 0 : _line$vertices4.get(1));
2837
+ var pointGroup = [];
2838
+ if ((0, _helper.isEmpty)(v0) || (0, _helper.isEmpty)(v1)) return pointGroup;
2839
+ var itemRect = item === null || item === void 0 ? void 0 : item.rect;
2840
+ if (!(0, _helper.isEmpty)(itemRect)) {
2841
+ for (var i = 0; i < itemRect.length; i++) {
2842
+ if (distancePointFromLineSegment(v0, v1, itemRect[i].x, itemRect[i].y) < _constants.EPSILON) {
2843
+ pointGroup.push(itemRect[i]);
2844
+ }
2845
+ }
2846
+ }
2847
+ return pointGroup;
2848
+ }
2849
+ function isOverlappedTwoItemsOnOneLine(layer, curLine, srcItem, desItem) {
2850
+ var _layer$lines3, _layer$vertices6, _line$vertices5, _layer$vertices7, _line$vertices6, _S, _S2, _S3, _S4;
2851
+ if ((0, _helper.isEmpty)(layer) || (0, _helper.isEmpty)(curLine) || (0, _helper.isEmpty)(srcItem) || (0, _helper.isEmpty)(desItem) || (0, _helper.isEmpty)(desItem.D0) || (0, _helper.isEmpty)(desItem.D1)) return false;
2852
+ // get v0, v1 of line
2853
+ var line = (_layer$lines3 = layer.lines) === null || _layer$lines3 === void 0 ? void 0 : _layer$lines3.get(curLine === null || curLine === void 0 ? void 0 : curLine.id);
2854
+ var v0 = (_layer$vertices6 = layer.vertices) === null || _layer$vertices6 === void 0 ? void 0 : _layer$vertices6.get(line === null || line === void 0 || (_line$vertices5 = line.vertices) === null || _line$vertices5 === void 0 ? void 0 : _line$vertices5.get(0));
2855
+ var v1 = (_layer$vertices7 = layer.vertices) === null || _layer$vertices7 === void 0 ? void 0 : _layer$vertices7.get(line === null || line === void 0 || (_line$vertices6 = line.vertices) === null || _line$vertices6 === void 0 ? void 0 : _line$vertices6.get(1));
2856
+ var S0,
2857
+ S1,
2858
+ D0 = desItem === null || desItem === void 0 ? void 0 : desItem.D0,
2859
+ D1 = desItem === null || desItem === void 0 ? void 0 : desItem.D1;
2860
+ if ((0, _helper.isEmpty)(v0) || (0, _helper.isEmpty)(v1)) return false;
2861
+ // get distance from v0 to srcItem's S0, S1 and desItem(item or hole)'s D0, D1 are placed on line
2862
+ var srcPoints = getLineSnapPointsOfItem(layer, curLine, srcItem);
2863
+ if (srcPoints.length > 1) {
2864
+ S0 = srcPoints[0];
2865
+ S1 = srcPoints[1];
2866
+ }
2867
+ var disV0S0 = pointsDistance(v0.x, v0.y, (_S = S0) === null || _S === void 0 ? void 0 : _S.x, (_S2 = S0) === null || _S2 === void 0 ? void 0 : _S2.y);
2868
+ var disV0S1 = pointsDistance(v0.x, v0.y, (_S3 = S1) === null || _S3 === void 0 ? void 0 : _S3.x, (_S4 = S1) === null || _S4 === void 0 ? void 0 : _S4.y);
2869
+ var disV0D0 = pointsDistance(v0.x, v0.y, D0.x, D0.y);
2870
+ var disV0D1 = pointsDistance(v0.x, v0.y, D1.x, D1.y);
2871
+ // detect two items are overlapped
2872
+ var maxDisV0S = Math.max(disV0S0, disV0S1);
2873
+ var minDisV0S = Math.min(disV0S0, disV0S1);
2874
+ var maxDisV0D = Math.max(disV0D0, disV0D1);
2875
+ var minDisV0D = Math.min(disV0D0, disV0D1);
2876
+ if (maxDisV0S > maxDisV0D && maxDisV0D - minDisV0S > _constants.EPSILON) {
2877
+ // d0 s0 d1 s1 ===> maxDisV0S: v0s1, minDisV0S: v0s0, maxDisV0D: v0d1, minDisV0D: v0d0
2878
+ // v0 __________________________ v1
2879
+ // | | | |
2880
+ // | | | |
2881
+ // |__DI__|__| |
2882
+ // |__SI__|
2883
+ /////////////////////////////////////////
2884
+ // s0 d0 d1 s1 ===> maxDisV0S: v0s1, minDisV0S: v0s0, maxDisV0D: v0d1, minDisV0D: v0d0
2885
+ // v0 __________________________ v1
2886
+ // | | | |
2887
+ // | |__DI__| |
2888
+ // |_________SI_______|
2889
+ return true;
2890
+ } else if (minDisV0S - minDisV0D > _constants.EPSILON && maxDisV0D - maxDisV0S > _constants.EPSILON) {
2891
+ return true;
2892
+ } else if (minDisV0S < minDisV0D && maxDisV0S - minDisV0D > _constants.EPSILON) {
2893
+ // s0 d0 s1 d1 ===> maxDisV0S: v0s1, minDisV0S: v0s0, maxDisV0D: v0d1, minDisV0D: v0d0
2894
+ // v0 __________________________ v1
2895
+ // | | | |
2896
+ // | |__DI__|
2897
+ // |__SI_____|
2898
+ //
2899
+ return true;
2900
+ } else {
2901
+ return false;
2902
+ }
2903
+ }