kitchen-simulator 2.0.0 → 2.0.1-dot-color

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