@expofp/floorplan 3.0.0-alpha.3 → 3.0.0-alpha.5

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 (463) hide show
  1. package/dist/browser/{Debug-e8WG0DtG.js → Debug-C-eDLTyi.js} +2 -2
  2. package/dist/browser/{Demo-boypMSbE.js → Demo-Bz4sS4Cr.js} +3 -3
  3. package/dist/browser/{Free-CDDXe67y.js → Free-Dmh_yBTQ.js} +3 -3
  4. package/dist/browser/{Gallery-CzUOmw0W.js → Gallery-B0y19mXe.js} +3 -3
  5. package/dist/browser/{GpsLoader-fuJmNb6R.js → GpsLoader-CLuQFUMd.js} +3 -3
  6. package/dist/browser/{KioskStore-BFmurkVL.js → KioskStore-DfQRkubn.js} +3 -3
  7. package/dist/browser/{Mapbox-C51a0xP2.js → Mapbox-Bpxx-pxs.js} +4 -4
  8. package/dist/browser/{SetKioskMode-COh431a3.js → SetKioskMode-Dt6LsCTr.js} +4 -4
  9. package/dist/browser/{ShowKiosk-K-z2FMYd.js → ShowKiosk-nx3n9Hin.js} +3 -3
  10. package/dist/browser/{ThreeComponent-C8u-uHkz.js → ThreeComponent-DNb8u7Fd.js} +4 -4
  11. package/dist/browser/{boolean-editor-0qC2CaXN.js → boolean-editor-DngToQ6l.js} +3 -3
  12. package/dist/browser/bundle.json +25 -25
  13. package/dist/browser/{client-B3NWpX6M.js → client-JooIdiWR.js} +2 -2
  14. package/dist/browser/{data-B9sYqJWP.js → data-CquFs-CC.js} +2 -2
  15. package/dist/browser/{debug-overlay-w2mPZxWf.js → debug-overlay-uF5jExOh.js} +4 -4
  16. package/dist/browser/{debug-ui-BtilbmgE.js → debug-ui-KqARuDoS.js} +3 -3
  17. package/dist/browser/{fetch-retry.umd-BUYyExMA.js → fetch-retry.umd-BNw2UfCg.js} +1 -1
  18. package/dist/browser/{flex-C0ADIXpK.js → flex-DeTqedih.js} +2 -2
  19. package/dist/browser/{floorplan.ready-DOAwMGub.js → floorplan.ready-DlHsC7fv.js} +15 -15
  20. package/dist/browser/{index-saYO21xq.js → index-B85ohTnv.js} +4 -4
  21. package/dist/browser/{index-B2H3t32F.js → index-CETW_2Me.js} +1 -1
  22. package/dist/browser/{index-C6neMlVE.js → index-DDXYk8-M.js} +3 -3
  23. package/dist/browser/{index-cGFPJUkc.js → index-DLZUbodm.js} +2 -2
  24. package/dist/browser/{index-CvCRaJEu.js → index-J-CeK8EI.js} +2 -2
  25. package/dist/browser/{index-CKMnb1_8.js → index-tYEC7D5U.js} +4 -4
  26. package/dist/browser/index.js +1 -1
  27. package/dist/browser/{particles.min-qY9PxD2m.js → particles.min-ydes6zXA.js} +1 -1
  28. package/dist/esm/RouteCutIn.js +1 -1
  29. package/dist/esm/_misc_to_move/logBuildInfoImpl.js +1 -1
  30. package/dist/esm/components/Alert.js +1 -1
  31. package/dist/esm/components/Autocomplete.js +1 -1
  32. package/dist/esm/components/Badge.js +1 -1
  33. package/dist/esm/components/BaseFilterModal.js +1 -1
  34. package/dist/esm/components/Bookmarks.js +1 -1
  35. package/dist/esm/components/Booth/Booth.js +1 -1
  36. package/dist/esm/components/Booth/BoothOnHold.js +1 -1
  37. package/dist/esm/components/Booth/BoothReserved.js +1 -1
  38. package/dist/esm/components/Booth/BoothSpecial.js +1 -1
  39. package/dist/esm/components/Booth/BoothWithoutExhibitor.js +1 -1
  40. package/dist/esm/components/BoothRow.js +1 -1
  41. package/dist/esm/components/Button.js +1 -1
  42. package/dist/esm/components/Category.js +1 -1
  43. package/dist/esm/components/CategoryFilterModal.js +1 -1
  44. package/dist/esm/components/Checkbox.js +1 -1
  45. package/dist/esm/components/CheckboxButton.js +1 -1
  46. package/dist/esm/components/Controls.js +1 -1
  47. package/dist/esm/components/CookieConsent.js +1 -1
  48. package/dist/esm/components/Debug.js +1 -1
  49. package/dist/esm/components/Demo.js +1 -1
  50. package/dist/esm/components/Draggable.js +1 -1
  51. package/dist/esm/components/EntityItem.js +1 -1
  52. package/dist/esm/components/EntityList.js +1 -1
  53. package/dist/esm/components/EntityListRow.js +1 -1
  54. package/dist/esm/components/Event.js +1 -1
  55. package/dist/esm/components/EventBadge.js +1 -1
  56. package/dist/esm/components/Exhibitor.js +1 -1
  57. package/dist/esm/components/ExhibitorRow.js +1 -1
  58. package/dist/esm/components/Filter.js +1 -1
  59. package/dist/esm/components/Free.js +1 -1
  60. package/dist/esm/components/Gallery/Gallery.js +1 -1
  61. package/dist/esm/components/Gallery/GalleryBadges/GalleryBadges.js +1 -1
  62. package/dist/esm/components/Gallery/GalleryControls/GalleryControls.js +1 -1
  63. package/dist/esm/components/Gallery/GalleryImg/GalleryImg.js +1 -1
  64. package/dist/esm/components/Gallery/GalleryItem/GalleryItem.js +1 -1
  65. package/dist/esm/components/Gallery/GalleryModal/GalleryModal.js +1 -1
  66. package/dist/esm/components/Gallery/GalleryPreLoader.js +1 -1
  67. package/dist/esm/components/Gallery/TransformImg/TransformImg.js +1 -1
  68. package/dist/esm/components/GlobalErrorMessage.js +1 -1
  69. package/dist/esm/components/GpsLoader.js +1 -1
  70. package/dist/esm/components/HeatmapLegend.js +1 -1
  71. package/dist/esm/components/HighlightText.js +1 -1
  72. package/dist/esm/components/Kiosk/KioskStore.js +1 -1
  73. package/dist/esm/components/Kiosk/SetKiosk/Confirm/ConfirmDialog.js +1 -1
  74. package/dist/esm/components/Kiosk/SetKiosk/FormInput/RangeInput.js +1 -1
  75. package/dist/esm/components/Kiosk/SetKiosk/Message/InfoMessage.js +1 -1
  76. package/dist/esm/components/Kiosk/SetKiosk/SetKioskComponent.js +1 -1
  77. package/dist/esm/components/Kiosk/SetKiosk/SetKioskForm.js +1 -1
  78. package/dist/esm/components/Kiosk/SetKiosk/SetKioskStatusMessages.js +1 -1
  79. package/dist/esm/components/Kiosk/SetKioskMode.js +1 -1
  80. package/dist/esm/components/Kiosk/ShowKiosk.js +1 -1
  81. package/dist/esm/components/Kiosk/integrateKiosk.js +1 -1
  82. package/dist/esm/components/Kiosk/kioskUrlParam.js +1 -1
  83. package/dist/esm/components/Kiosk/recoverKioskFromUrlPrams.js +1 -1
  84. package/dist/esm/components/Kiosk/requestKioskKey.js +1 -1
  85. package/dist/esm/components/Language.js +1 -1
  86. package/dist/esm/components/LanguageRow.js +1 -1
  87. package/dist/esm/components/LargeMessage.js +1 -1
  88. package/dist/esm/components/LayersLoading.js +1 -1
  89. package/dist/esm/components/Layout.js +1 -1
  90. package/dist/esm/components/LevelBadge.js +1 -1
  91. package/dist/esm/components/LevelSelector.js +1 -1
  92. package/dist/esm/components/List.js +1 -1
  93. package/dist/esm/components/LogoOverlay.js +1 -1
  94. package/dist/esm/components/Map/Map.js +1 -1
  95. package/dist/esm/components/Map/booth-by-xy.js +1 -1
  96. package/dist/esm/components/Map/drawing/config/BoothShape.js +1 -1
  97. package/dist/esm/components/Map/drawing/config/Rect.js +1 -1
  98. package/dist/esm/components/Map/drawing/config/TextFitter.js +1 -1
  99. package/dist/esm/components/Map/drawing/config/canvases.js +1 -1
  100. package/dist/esm/components/Map/drawing/config/config-all.js +1 -1
  101. package/dist/esm/components/Map/drawing/config/config-bg.js +1 -1
  102. package/dist/esm/components/Map/drawing/config/config-booth-bg.js +1 -1
  103. package/dist/esm/components/Map/drawing/config/config-booth-bookmark.js +1 -1
  104. package/dist/esm/components/Map/drawing/config/config-booth-border.js +1 -1
  105. package/dist/esm/components/Map/drawing/config/config-booth-labels-special.d.ts +1 -1
  106. package/dist/esm/components/Map/drawing/config/config-booth-labels-special.js +2 -2
  107. package/dist/esm/components/Map/drawing/config/config-booth-labels.d.ts +1 -1
  108. package/dist/esm/components/Map/drawing/config/config-booth-labels.js +1 -1
  109. package/dist/esm/components/Map/drawing/config/config-booth-scaled.js +1 -1
  110. package/dist/esm/components/Map/drawing/config/config-booths.js +1 -1
  111. package/dist/esm/components/Map/drawing/config/config-load-layer.js +1 -1
  112. package/dist/esm/components/Map/drawing/config/config-markers.js +1 -1
  113. package/dist/esm/components/Map/drawing/config/config-wf.js +1 -1
  114. package/dist/esm/components/Map/drawing/config/config-yah.js +1 -1
  115. package/dist/esm/components/Map/drawing/config/engine-core/animation.js +1 -1
  116. package/dist/esm/components/Map/drawing/config/engine-core/canvases.js +1 -1
  117. package/dist/esm/components/Map/drawing/config/engine-core/defs.js +3 -3
  118. package/dist/esm/components/Map/drawing/config/engine-core/fonts.js +1 -1
  119. package/dist/esm/components/Map/drawing/config/engine-core/index.js +1 -1
  120. package/dist/esm/components/Map/drawing/config/engine-core/renderer.js +1 -1
  121. package/dist/esm/components/Map/drawing/config/engine-core/update-def.js +1 -1
  122. package/dist/esm/components/Map/drawing/config/engine-core/utils/rotation.js +1 -1
  123. package/dist/esm/components/Map/drawing/config/loadBoothsImages.js +1 -1
  124. package/dist/esm/components/Map/drawing/config/route-snapping/snapPositionToRoute.js +1 -1
  125. package/dist/esm/components/Map/drawing/config/route-snapping/splitRouteByPoint.js +1 -1
  126. package/dist/esm/components/Map/drawing/config/route-snapping/utils.js +1 -1
  127. package/dist/esm/components/Map/traffic/trafficLayers.js +1 -1
  128. package/dist/esm/components/Map/traffic/useBuildRoute.js +5 -5
  129. package/dist/esm/components/Map/traffic/useManageTraffic.js +1 -1
  130. package/dist/esm/components/Map/visibleArea.js +1 -1
  131. package/dist/esm/components/MapControls.js +1 -1
  132. package/dist/esm/components/Mapbox/Button.js +1 -1
  133. package/dist/esm/components/Mapbox/Dot.js +1 -1
  134. package/dist/esm/components/Mapbox/MapLoader.js +1 -1
  135. package/dist/esm/components/Mapbox/Mapbox.js +1 -1
  136. package/dist/esm/components/Mapbox/utils/data.js +1 -1
  137. package/dist/esm/components/MarketMaterialList.js +1 -1
  138. package/dist/esm/components/Menu.js +2 -2
  139. package/dist/esm/components/MobileToggleButton.js +1 -1
  140. package/dist/esm/components/Modal.js +1 -1
  141. package/dist/esm/components/MultiSelectGroups.js +1 -1
  142. package/dist/esm/components/Overlay.js +1 -1
  143. package/dist/esm/components/OverlayContainer.js +1 -1
  144. package/dist/esm/components/OverlayGrip.js +1 -1
  145. package/dist/esm/components/OverlayParticles.js +1 -1
  146. package/dist/esm/components/PermissionNotice/PermissionNotice.js +1 -1
  147. package/dist/esm/components/Radio.js +1 -1
  148. package/dist/esm/components/RebookingNotes.js +1 -1
  149. package/dist/esm/components/RebookingRadioGroup.js +1 -1
  150. package/dist/esm/components/RouteQR.js +1 -1
  151. package/dist/esm/components/Schedule.js +1 -1
  152. package/dist/esm/components/ScheduleRow.js +1 -1
  153. package/dist/esm/components/ScrollableRow.js +1 -1
  154. package/dist/esm/components/Search.js +1 -1
  155. package/dist/esm/components/SearchBox.js +1 -1
  156. package/dist/esm/components/SearchButtons/SearchButton.js +1 -1
  157. package/dist/esm/components/SearchButtons/SearchButtons.js +1 -1
  158. package/dist/esm/components/SearchButtons/SearchSubButton.js +1 -1
  159. package/dist/esm/components/SearchButtons/SearchSubButtons.js +1 -1
  160. package/dist/esm/components/Sessions.js +1 -1
  161. package/dist/esm/components/SessionsFiltersModal.js +1 -1
  162. package/dist/esm/components/Share.js +1 -1
  163. package/dist/esm/components/Shortcuts/ShortcutButton.js +1 -1
  164. package/dist/esm/components/Shortcuts/ShortcutsFiltersButton.js +1 -1
  165. package/dist/esm/components/Shortcuts/ShortcutsToolbar.js +1 -1
  166. package/dist/esm/components/SidebarActions.js +1 -1
  167. package/dist/esm/components/SimpleRow.js +1 -1
  168. package/dist/esm/components/Speaker.js +1 -1
  169. package/dist/esm/components/Speakers.js +1 -1
  170. package/dist/esm/components/SpeakersFiltersModal.js +1 -1
  171. package/dist/esm/components/Threejs/ThreeComponent.js +1 -1
  172. package/dist/esm/components/Threejs/UIManager.js +1 -1
  173. package/dist/esm/components/Threejs/common/BoothMesh.js +1 -1
  174. package/dist/esm/components/Threejs/common/SpriteMesh.js +1 -1
  175. package/dist/esm/components/Threejs/common/dataLoader.js +1 -1
  176. package/dist/esm/components/Threejs/common/modelLoader.js +1 -1
  177. package/dist/esm/components/Threejs/common/sceneLoader.js +1 -1
  178. package/dist/esm/components/Threejs/index.js +1 -1
  179. package/dist/esm/components/Threejs/mapbox/index_mapbox.js +1 -1
  180. package/dist/esm/components/Threejs/utils/textureMerger.js +1 -1
  181. package/dist/esm/components/Toast/ToastContainer.js +1 -1
  182. package/dist/esm/components/Toast/ToastProvider.js +1 -1
  183. package/dist/esm/components/ToggleButton.js +1 -1
  184. package/dist/esm/components/ToggleSwitch.js +1 -1
  185. package/dist/esm/components/TouchHand.js +1 -1
  186. package/dist/esm/components/TourPoints.js +1 -1
  187. package/dist/esm/components/Tours.js +1 -1
  188. package/dist/esm/components/ToursList.js +1 -1
  189. package/dist/esm/components/Visited.js +1 -1
  190. package/dist/esm/components/WayInformation.js +1 -1
  191. package/dist/esm/components/Wayfinding.js +1 -1
  192. package/dist/esm/components/WayfindingFloorSelector.js +1 -1
  193. package/dist/esm/components/WayfindingTemplate.js +1 -1
  194. package/dist/esm/components/Ws.js +1 -1
  195. package/dist/esm/components/YahRow.js +1 -1
  196. package/dist/esm/components/gps/GpsManager.js +1 -1
  197. package/dist/esm/components/gps/GpsPermissionRequest.js +1 -1
  198. package/dist/esm/components/gps/useUserLocationAndHeading.js +1 -1
  199. package/dist/esm/components/gps/utils.js +1 -1
  200. package/dist/esm/components/stories/Alert.stories.js +1 -1
  201. package/dist/esm/components/stories/Autocomplete.stories.js +1 -1
  202. package/dist/esm/components/stories/Badge.stories.js +1 -1
  203. package/dist/esm/components/stories/Button.stories.js +1 -1
  204. package/dist/esm/components/stories/Checkbox.stories.js +1 -1
  205. package/dist/esm/components/stories/CheckboxButton.stories.js +1 -1
  206. package/dist/esm/components/stories/CookieConsent.stories.js +1 -1
  207. package/dist/esm/components/stories/Loading.stories.js +1 -1
  208. package/dist/esm/components/stories/MapControls.stories.js +1 -1
  209. package/dist/esm/components/stories/Modal.storiesss.js +1 -1
  210. package/dist/esm/components/stories/Overlay.stories.js +1 -1
  211. package/dist/esm/components/stories/RebookingNotes.stories.js +1 -1
  212. package/dist/esm/components/stories/RebookingRadioGroup.stories.js +1 -1
  213. package/dist/esm/components/stories/Share.storiesSS.js +1 -1
  214. package/dist/esm/components/stories/SidebarActions.stories.js +1 -1
  215. package/dist/esm/components/stories/Toast.stories.js +1 -1
  216. package/dist/esm/components/stories/ToggleButton.stories.js +1 -1
  217. package/dist/esm/components/stories/ToggleSwitch.stories.js +1 -1
  218. package/dist/esm/components/stories/TouchHand.stories.js +1 -1
  219. package/dist/esm/components/stories/WayfindingFloorSelector.storiesss.js +1 -1
  220. package/dist/esm/components/stories/WayfindingTemplate.storiesss.js +1 -1
  221. package/dist/esm/core/Line.js +1 -1
  222. package/dist/esm/core/Polygon.js +1 -1
  223. package/dist/esm/core/Rect.js +1 -1
  224. package/dist/esm/data/index.js +1 -1
  225. package/dist/esm/data/svg.js +1 -1
  226. package/dist/esm/data/validate-data.js +1 -1
  227. package/dist/esm/expofp-debug.js +1 -1
  228. package/dist/esm/floorplan.loader.js +1 -1
  229. package/dist/esm/floorplan.ready.js +1 -1
  230. package/dist/esm/hooks/useDragGesture.js +1 -1
  231. package/dist/esm/hooks/useURLFilters.js +1 -1
  232. package/dist/esm/hooks/useWindowSize.js +1 -1
  233. package/dist/esm/load.js +3 -3
  234. package/dist/esm/offline/offlineManager.js +1 -1
  235. package/dist/esm/offline/sw.js +1 -1
  236. package/dist/esm/services/URLFilterManager.js +1 -1
  237. package/dist/esm/services/routing.js +1 -1
  238. package/dist/esm/store/BaseFilterStore.js +1 -1
  239. package/dist/esm/store/BoothStore.js +1 -1
  240. package/dist/esm/store/CategoryFilterStore.js +1 -1
  241. package/dist/esm/store/CategoryStore.js +1 -1
  242. package/dist/esm/store/EventStore.js +1 -1
  243. package/dist/esm/store/ExhibitorStore.js +1 -1
  244. package/dist/esm/store/FuzzySearchEngineStore.js +1 -1
  245. package/dist/esm/store/HeatmapStore.js +1 -1
  246. package/dist/esm/store/LanguageStore.js +1 -1
  247. package/dist/esm/store/LayerStore.js +1 -1
  248. package/dist/esm/store/MapboxStore.js +1 -1
  249. package/dist/esm/store/RootStore.js +1 -1
  250. package/dist/esm/store/RouteStore.js +1 -1
  251. package/dist/esm/store/SearchStore.js +1 -1
  252. package/dist/esm/store/SessionsFilterStore.js +1 -1
  253. package/dist/esm/store/ShortcutRegistry.js +1 -1
  254. package/dist/esm/store/SpeakerFilterStore.js +1 -1
  255. package/dist/esm/store/SpeakerStore.js +1 -1
  256. package/dist/esm/store/ToursStore.js +1 -1
  257. package/dist/esm/store/UIState.d.ts +1 -1
  258. package/dist/esm/store/UIState.js +1 -1
  259. package/dist/esm/store/index.js +1 -1
  260. package/dist/esm/store/init/index.js +1 -1
  261. package/dist/esm/store/init/init-booths.js +1 -1
  262. package/dist/esm/store/init/init-categories.js +1 -1
  263. package/dist/esm/store/init/init-events.js +1 -1
  264. package/dist/esm/store/init/init-exhibitors.js +1 -1
  265. package/dist/esm/store/init/init-heatmap.js +1 -1
  266. package/dist/esm/store/init/init-language.js +1 -1
  267. package/dist/esm/store/init/init-layers.js +1 -1
  268. package/dist/esm/store/init/init-speakers.js +1 -1
  269. package/dist/esm/store/init/init-ui.js +1 -1
  270. package/dist/esm/store/providers/SearchShortcutProvider.js +1 -1
  271. package/dist/esm/store/providers/SessionsShortcutProvider.js +1 -1
  272. package/dist/esm/store/providers/SessionsSubButtonProvider.js +1 -1
  273. package/dist/esm/store/providers/SpeakerShortcutProvider.js +1 -1
  274. package/dist/esm/store/search-buttons/SearchButtonsActions.js +1 -1
  275. package/dist/esm/store/search-buttons/SearchButtonsFactory.js +1 -1
  276. package/dist/esm/store/search-buttons/SearchButtonsFilters.js +1 -1
  277. package/dist/esm/store/search-buttons/SearchButtonsState.js +1 -1
  278. package/dist/esm/store/search-buttons/SearchButtonsStore.js +1 -1
  279. package/dist/esm/store/search-buttons/constants.js +1 -1
  280. package/dist/esm/store/search-buttons/utils.js +1 -1
  281. package/dist/esm/storybook/decorators/StoryWrapper.js +1 -1
  282. package/dist/esm/storybook/decorators/WithResize.js +1 -1
  283. package/dist/esm/tools/Color.js +1 -1
  284. package/dist/esm/tools/debounce.js +1 -1
  285. package/dist/esm/tools/gtag.js +1 -1
  286. package/dist/esm/tools/handleDebugMode.js +1 -1
  287. package/dist/esm/tools/loaders.js +1 -1
  288. package/dist/esm/tools/logger.js +1 -1
  289. package/dist/esm/tools/report-error.js +3 -3
  290. package/dist/esm/tools/reset.js +1 -1
  291. package/dist/esm/tools/sentry.js +1 -1
  292. package/dist/esm/tools/settings.js +1 -1
  293. package/dist/esm/tools/slug.js +1 -1
  294. package/dist/esm/tools/track-event.js +1 -1
  295. package/dist/esm/tools/webgl-logger.js +1 -1
  296. package/dist/esm/utils/calcSpeed.js +1 -1
  297. package/dist/esm/utils/customCommands.js +1 -1
  298. package/dist/esm/utils/detectLimitedModeViaImage.js +1 -1
  299. package/dist/esm/utils/entity-storage.js +1 -1
  300. package/dist/esm/utils/eventFullBadge.js +1 -1
  301. package/dist/esm/utils/eventTime.js +1 -1
  302. package/dist/esm/utils/getContrastTextColor.js +1 -1
  303. package/dist/esm/utils/getLogoUrl.js +1 -1
  304. package/dist/esm/utils/getMostFrequent.js +1 -1
  305. package/dist/esm/utils/getRenderTargetFromRoot.js +1 -1
  306. package/dist/esm/utils/gps.js +1 -1
  307. package/dist/esm/utils/i18n.js +1 -1
  308. package/dist/esm/utils/imageloader.js +1 -1
  309. package/dist/esm/utils/is-iframe.js +1 -1
  310. package/dist/esm/utils/loadCustomCss.js +1 -1
  311. package/dist/esm/utils/loadIcons.js +1 -1
  312. package/dist/esm/utils/loadImagesInBatches.js +1 -1
  313. package/dist/esm/utils/mapEntity.js +1 -1
  314. package/dist/esm/utils/mobx.js +1 -1
  315. package/dist/esm/utils/preview-exhibitor.js +1 -1
  316. package/dist/esm/utils/responsiveClass.js +1 -1
  317. package/dist/esm/utils/sanitizeHtml.js +1 -1
  318. package/dist/esm/utils/sanitizeText.js +1 -1
  319. package/dist/esm/utils/strEqual.js +1 -1
  320. package/dist/esm/utils/toRadians.js +1 -1
  321. package/dist/esm/utils/urlEncoding.js +1 -1
  322. package/dist/esm/utils/useHeatmapData.js +1 -1
  323. package/dist/esm/utils/useHeatmapOverlay.js +1 -1
  324. package/dist/esm/utils/useOnClickOutside.js +1 -1
  325. package/dist/esm/utils/useRenderTarget.js +1 -1
  326. package/dist/esm/utils/useTimeout.js +1 -1
  327. package/dist/esm/utils/wayfinding.js +1 -1
  328. package/dist/stats.html +1 -1
  329. package/package.json +14 -4
  330. package/dist/esm/components/Map/_NEW_booth-by-xy.d.ts +0 -11
  331. package/dist/esm/components/Map/_NEW_booth-by-xy.js +0 -1
  332. package/dist/esm/components/Map/drawing/Drawer1.d.ts +0 -28
  333. package/dist/esm/components/Map/drawing/Drawer1.js +0 -1
  334. package/dist/esm/components/Map/drawing/Matrix.d.ts +0 -33
  335. package/dist/esm/components/Map/drawing/Matrix.js +0 -1
  336. package/dist/esm/components/Map/drawing/config/NumberObserver.d.ts +0 -10
  337. package/dist/esm/components/Map/drawing/config/NumberObserver.js +0 -1
  338. package/dist/esm/components/Map/drawing/config/animate.d.ts +0 -2
  339. package/dist/esm/components/Map/drawing/config/animate.js +0 -1
  340. package/dist/esm/components/Map/drawing/config/config-canvas.d.ts +0 -3
  341. package/dist/esm/components/Map/drawing/config/config-canvas.js +0 -1
  342. package/dist/esm/components/Map/drawing/config/config-debug-circles.d.ts +0 -3
  343. package/dist/esm/components/Map/drawing/config/config-debug-circles.js +0 -1
  344. package/dist/esm/components/Map/drawing/config/config-dim.d.ts +0 -3
  345. package/dist/esm/components/Map/drawing/config/config-dim.js +0 -1
  346. package/dist/esm/components/Map/drawing/config/config-gps.d.ts +0 -2
  347. package/dist/esm/components/Map/drawing/config/config-gps.js +0 -1
  348. package/dist/esm/components/Map/drawing/config/config-img.d.ts +0 -4
  349. package/dist/esm/components/Map/drawing/config/config-img.js +0 -1
  350. package/dist/esm/components/Map/drawing/config/config-matrix.d.ts +0 -6
  351. package/dist/esm/components/Map/drawing/config/config-matrix.js +0 -1
  352. package/dist/esm/components/Map/drawing/config/config-sizes.d.ts +0 -3
  353. package/dist/esm/components/Map/drawing/config/config-sizes.js +0 -1
  354. package/dist/esm/components/Map/drawing/painters/BgPainter.d.ts +0 -28
  355. package/dist/esm/components/Map/drawing/painters/BgPainter.js +0 -25
  356. package/dist/esm/components/Map/drawing/painters/ImagePainter.d.ts +0 -82
  357. package/dist/esm/components/Map/drawing/painters/ImagePainter.js +0 -74
  358. package/dist/esm/components/Map/drawing/painters/Painter.d.ts +0 -12
  359. package/dist/esm/components/Map/drawing/painters/Painter.js +0 -1
  360. package/dist/esm/components/Map/drawing/painters/RectPainter.d.ts +0 -123
  361. package/dist/esm/components/Map/drawing/painters/RectPainter.js +0 -86
  362. package/dist/esm/components/Map/drawing/painters/Sprite.d.ts +0 -14
  363. package/dist/esm/components/Map/drawing/painters/Sprite.js +0 -1
  364. package/dist/esm/components/Map/drawing/painters/TrianglePainter.d.ts +0 -53
  365. package/dist/esm/components/Map/drawing/painters/TrianglePainter.js +0 -29
  366. package/dist/esm/components/Map/drawing/painters/common-glsl.d.ts +0 -2
  367. package/dist/esm/components/Map/drawing/painters/common-glsl.js +0 -14
  368. package/dist/esm/components/Map/marker-by-xy.d.ts +0 -3
  369. package/dist/esm/components/Map/marker-by-xy.js +0 -1
  370. package/dist/esm/components/Map/utils.d.ts +0 -3
  371. package/dist/esm/components/Map/utils.js +0 -1
  372. package/dist/esm/components/Map/zoom-bound.d.ts +0 -6
  373. package/dist/esm/components/Map/zoom-bound.js +0 -1
  374. package/dist/esm/components/Map/zoom-inertia.d.ts +0 -3
  375. package/dist/esm/components/Map/zoom-inertia.js +0 -1
  376. package/dist/esm/components/Map1/Map.d.ts +0 -25
  377. package/dist/esm/components/Map1/Map.js +0 -1
  378. package/dist/esm/components/Map1/booth-by-xy.d.ts +0 -3
  379. package/dist/esm/components/Map1/booth-by-xy.js +0 -1
  380. package/dist/esm/components/Map1/drawing/config/BoothDrawerBase.d.ts +0 -8
  381. package/dist/esm/components/Map1/drawing/config/BoothDrawerBase.js +0 -1
  382. package/dist/esm/components/Map1/drawing/config/BoothShape.d.ts +0 -8
  383. package/dist/esm/components/Map1/drawing/config/BoothShape.js +0 -1
  384. package/dist/esm/components/Map1/drawing/config/Rect.d.ts +0 -7
  385. package/dist/esm/components/Map1/drawing/config/Rect.js +0 -1
  386. package/dist/esm/components/Map1/drawing/config/TextFitter.d.ts +0 -11
  387. package/dist/esm/components/Map1/drawing/config/TextFitter.js +0 -1
  388. package/dist/esm/components/Map1/drawing/config/canvases.d.ts +0 -8
  389. package/dist/esm/components/Map1/drawing/config/canvases.js +0 -1
  390. package/dist/esm/components/Map1/drawing/config/config-all.d.ts +0 -5
  391. package/dist/esm/components/Map1/drawing/config/config-all.js +0 -1
  392. package/dist/esm/components/Map1/drawing/config/config-bg.d.ts +0 -9
  393. package/dist/esm/components/Map1/drawing/config/config-bg.js +0 -1
  394. package/dist/esm/components/Map1/drawing/config/config-booth-bg.d.ts +0 -20
  395. package/dist/esm/components/Map1/drawing/config/config-booth-bg.js +0 -1
  396. package/dist/esm/components/Map1/drawing/config/config-booth-bookmark.d.ts +0 -20
  397. package/dist/esm/components/Map1/drawing/config/config-booth-bookmark.js +0 -1
  398. package/dist/esm/components/Map1/drawing/config/config-booth-border.d.ts +0 -12
  399. package/dist/esm/components/Map1/drawing/config/config-booth-border.js +0 -1
  400. package/dist/esm/components/Map1/drawing/config/config-booth-labels-special.d.ts +0 -18
  401. package/dist/esm/components/Map1/drawing/config/config-booth-labels-special.js +0 -2
  402. package/dist/esm/components/Map1/drawing/config/config-booth-labels.d.ts +0 -43
  403. package/dist/esm/components/Map1/drawing/config/config-booth-labels.js +0 -1
  404. package/dist/esm/components/Map1/drawing/config/config-booth-scaled.d.ts +0 -14
  405. package/dist/esm/components/Map1/drawing/config/config-booth-scaled.js +0 -1
  406. package/dist/esm/components/Map1/drawing/config/config-booths.d.ts +0 -6
  407. package/dist/esm/components/Map1/drawing/config/config-booths.js +0 -1
  408. package/dist/esm/components/Map1/drawing/config/config-load-layer.d.ts +0 -5
  409. package/dist/esm/components/Map1/drawing/config/config-load-layer.js +0 -1
  410. package/dist/esm/components/Map1/drawing/config/config-markers.d.ts +0 -6
  411. package/dist/esm/components/Map1/drawing/config/config-markers.js +0 -1
  412. package/dist/esm/components/Map1/drawing/config/config-wf.d.ts +0 -11
  413. package/dist/esm/components/Map1/drawing/config/config-wf.js +0 -1
  414. package/dist/esm/components/Map1/drawing/config/config-yah.d.ts +0 -2
  415. package/dist/esm/components/Map1/drawing/config/config-yah.js +0 -1
  416. package/dist/esm/components/Map1/drawing/config/engine-core/animation.d.ts +0 -3
  417. package/dist/esm/components/Map1/drawing/config/engine-core/animation.js +0 -1
  418. package/dist/esm/components/Map1/drawing/config/engine-core/canvases.d.ts +0 -5
  419. package/dist/esm/components/Map1/drawing/config/engine-core/canvases.js +0 -1
  420. package/dist/esm/components/Map1/drawing/config/engine-core/defs.d.ts +0 -16
  421. package/dist/esm/components/Map1/drawing/config/engine-core/defs.js +0 -3
  422. package/dist/esm/components/Map1/drawing/config/engine-core/fonts.d.ts +0 -9
  423. package/dist/esm/components/Map1/drawing/config/engine-core/fonts.js +0 -1
  424. package/dist/esm/components/Map1/drawing/config/engine-core/index.d.ts +0 -20
  425. package/dist/esm/components/Map1/drawing/config/engine-core/index.js +0 -1
  426. package/dist/esm/components/Map1/drawing/config/engine-core/renderer.d.ts +0 -5
  427. package/dist/esm/components/Map1/drawing/config/engine-core/renderer.js +0 -1
  428. package/dist/esm/components/Map1/drawing/config/engine-core/settings.d.ts +0 -4
  429. package/dist/esm/components/Map1/drawing/config/engine-core/settings.js +0 -1
  430. package/dist/esm/components/Map1/drawing/config/engine-core/types.d.ts +0 -39
  431. package/dist/esm/components/Map1/drawing/config/engine-core/types.js +0 -1
  432. package/dist/esm/components/Map1/drawing/config/engine-core/update-def.d.ts +0 -12
  433. package/dist/esm/components/Map1/drawing/config/engine-core/update-def.js +0 -1
  434. package/dist/esm/components/Map1/drawing/config/engine-core/utils/rotation.d.ts +0 -5
  435. package/dist/esm/components/Map1/drawing/config/engine-core/utils/rotation.js +0 -1
  436. package/dist/esm/components/Map1/drawing/config/loadBoothsImages.d.ts +0 -12
  437. package/dist/esm/components/Map1/drawing/config/loadBoothsImages.js +0 -1
  438. package/dist/esm/components/Map1/drawing/config/route-snapping/index.d.ts +0 -6
  439. package/dist/esm/components/Map1/drawing/config/route-snapping/index.js +0 -1
  440. package/dist/esm/components/Map1/drawing/config/route-snapping/snapPositionToRoute.d.ts +0 -20
  441. package/dist/esm/components/Map1/drawing/config/route-snapping/snapPositionToRoute.js +0 -1
  442. package/dist/esm/components/Map1/drawing/config/route-snapping/snapThreshold.d.ts +0 -23
  443. package/dist/esm/components/Map1/drawing/config/route-snapping/snapThreshold.js +0 -1
  444. package/dist/esm/components/Map1/drawing/config/route-snapping/splitRouteByPoint.d.ts +0 -6
  445. package/dist/esm/components/Map1/drawing/config/route-snapping/splitRouteByPoint.js +0 -1
  446. package/dist/esm/components/Map1/drawing/config/route-snapping/types.d.ts +0 -20
  447. package/dist/esm/components/Map1/drawing/config/route-snapping/types.js +0 -1
  448. package/dist/esm/components/Map1/traffic/UpdateQueue.d.ts +0 -13
  449. package/dist/esm/components/Map1/traffic/UpdateQueue.js +0 -1
  450. package/dist/esm/components/Map1/traffic/trafficLayers.d.ts +0 -17
  451. package/dist/esm/components/Map1/traffic/trafficLayers.js +0 -1
  452. package/dist/esm/components/Map1/traffic/useBuildRoute.d.ts +0 -10
  453. package/dist/esm/components/Map1/traffic/useBuildRoute.js +0 -7
  454. package/dist/esm/components/Map1/traffic/useManageTraffic.d.ts +0 -11
  455. package/dist/esm/components/Map1/traffic/useManageTraffic.js +0 -1
  456. package/dist/esm/components/Map1/visibleArea.d.ts +0 -15
  457. package/dist/esm/components/Map1/visibleArea.js +0 -1
  458. package/dist/esm/lib/floorplan.d.ts +0 -2
  459. package/dist/esm/lib/floorplan.js +0 -1
  460. package/dist/esm/tools/debug.d.ts +0 -5
  461. package/dist/esm/tools/debug.js +0 -1
  462. package/dist/esm/tools/pdf.d.ts +0 -2
  463. package/dist/esm/tools/pdf.js +0 -1
@@ -1,2 +1,2 @@
1
- import{SpecialBooth as x}from"../../../../store/BoothStore";import L from"../../../../tools/settings";import{heatmapStore as S,uiState as c,boothStore as D,layersStore as v}from"../../../../store";import y from"./TextFitter";import{Rect as p}from"./Rect";import{getFont as F}from"./canvases";import{BoothLabelDrawer as T,getFontUrlByWeight as C,getMinZoomFactorForDot as I,isDirectionsMode as P}from"./config-booth-labels";import{reaction as f}from"mobx";import{updateRenderer as w,createTextDef as z,updateTextDefRotation as M,getRotation as V,shouldFlip as B,updateRectRotation as H,getRollValue as _}from"./engine-core";import{FONT_WEIGHT_PRIMARY_BOOTH as k,FONT_WEIGHT_PRIMARY_SPECIAL as W}from"../../../../constants";const d=new Map;function N(a){let t=d.get(a);if(!t){const s=[18,16,14,12,10,7].map(n=>n*a),h=14*a;t=new y(F,s,h),d.set(a,t),setTimeout(()=>d.delete(a),5e3)}return t}export default function O(a,t){if(!(!(t instanceof x)||t.noLabels))return new A(a,t)}class A extends T{steps;labelIsVertical;text;constructor(t,s){super(t,s);const h=s.borderWidth/2||D.borderWidth/2,n=this.booth.rect,R=Number(getComputedStyle(document.body).getPropertyValue(W))||Number(getComputedStyle(document.body).getPropertyValue(k))||500,g=C(R,this.renderer.fontUrls),b=n.withPadding(n.w*.05+h,n.h*.05+h);this.setText(),this.canvasRect=p.fromCoreRect(b,s.rotate),this.setFactors(this.text),this.labelIsVertical=Math.abs(Math.abs(s.rotate)-Math.PI/2)<.01,this.fontSizes=[this.steps,[]],this.minZoomDotVisible=I(this.steps.map(e=>e.scaleFactor)),this.shapeLabel=z([{text:this.text,color:s.labelColor||L.boothLabelColor,fontUrl:g,fontSize:0}],p.fromCoreRect(b,s.rotate),[h,h],{horizontal:"center",text:"center",vertical:"center"}),this.getShapeDot(),f(()=>[this.booth.skipDim,c.selectedRoute,v.layersLoaded],()=>{const e=P();this.shapeLabel.dim=e||this.booth.skipDim?!1:void 0,this.shapeDot.dim=e||this.booth.skipDim?!1:void 0,w(t,this.shapeLabel,this.shapeDot)});const m=e=>{let o=this.steps.find(i=>i.scaleFactor<1/e);return o?(this.shapeLabel.lines[0].fontSize=o.value/devicePixelRatio*e,this.shapeLabel.lines[0].text=o.lines.join(`
2
- `),this.shapeLabel.padding=[this.paddingScaled[0]*e+this.padding,this.paddingScaled[1]*e+this.padding],this.shapeLabel):(this.shapeLabel.lines[0].fontSize=0,this.shapeLabel)},u=e=>{let o=this.steps.find(l=>l.scaleFactor<1/e);const i=this.shapeDot.source.width*e,r=this.shapeDot.source.height*e;return this.shapeDot.bounds=new p({x:this.canvasRect.center.x-i/2,y:this.canvasRect.center.y-r/2},{x:this.canvasRect.center.x+i/2,y:this.canvasRect.center.y+r/2}),this.shapeDot.hidden=!!o,this.shapeDot};t.ptScaleHandlers.push({fn:m}),t.ptScaleHandlers.push({fn:u}),f(()=>c.mapSettings,({roll:e})=>{_(e)&&t.rollHandlers?.push({fn:o=>{const i=this.shapeLabel.bounds.rotation;if(this.labelIsVertical)B(o,i)&&(this.shapeLabel.bounds.rotation=-i);else{const r=V(o,i);if(r!==void 0){const{size:l}=this.canvasRect;this.shapeLabel=M(this.shapeLabel,r),l.x!==l.y&&!this.shapeLabel.hidden&&(this.canvasRect=H(this.canvasRect,r),this.setFactors(this.text),m(t.scale),u(t.scale))}}return[this.shapeLabel,this.shapeDot]}})})}getShape(){return[this.shapeLabel,this.shapeDot]}setFactors(t){this.steps=N(devicePixelRatio).getStepsForRect(t,this.canvasRect.size.x,this.canvasRect.size.y)}setText(){const t=this.booth.title||this.booth.name,s=`Clicks: ${S.getTotalClicksByBooth(this.booth)}`;this.text=c.heatmap?`${t} - ${s}`:t}}
1
+ import{SpecialBooth as R}from"../../../../store/BoothStore";import x from"../../../../tools/settings";import{heatmapStore as L,uiState as l,boothStore as D,layersStore as F}from"../../../../store";import y from"./TextFitter";import{Rect as p}from"./Rect";import{getFont as v}from"./canvases";import{BoothLabelDrawer as T,getFontUrlByWeight as w,getMinZoomFactorForDot as z,isDirectionsMode as P}from"./config-booth-labels";import{reaction as b}from"mobx";import{updateRenderer as k,createTextDef as C,updateTextDefRotation as I,getRotation as M,shouldFlip as B,updateRectRotation as W,getRollValue as H}from"./engine-core";import{FONT_WEIGHT_PRIMARY_BOOTH as V,FONT_WEIGHT_PRIMARY_SPECIAL as _}from"../../../../constants";const d=new Map;function N(i){let t=d.get(i);if(!t){const s=[18,16,14,12,10,7].map(c=>c*i),o=14*i;t=new y(v,s,o),d.set(i,t),setTimeout(()=>d.delete(i),5e3)}return t}export default function O(i,t){if(!(!(t instanceof R)||t.noLabels))return new A(i,t)}class A extends T{steps;labelIsVertical;text;constructor(t,s){super(t,s);const o=s.borderWidth/2||D.borderWidth/2,c=this.booth.rect,g=Number(getComputedStyle(document.body).getPropertyValue(_))||Number(getComputedStyle(document.body).getPropertyValue(V))||500,S=w(g,this.renderer.fontUrls),f=c.withPadding(c.w*.05+o,c.h*.05+o);this.setText(),this.canvasRect=p.fromCoreRect(f,s.rotate),this.setFactors(this.text),this.labelIsVertical=Math.abs(Math.abs(s.rotate)-Math.PI/2)<.01,this.fontSizes=[this.steps,[]],this.minZoomDotVisible=z(this.steps.map(e=>e.scaleFactor)),this.shapeLabel=C([{text:this.text,color:s.labelColor||x.boothLabelColor,fontUrl:S,fontSize:0}],p.fromCoreRect(f,s.rotate),[o,o],{horizontal:"center",text:"center",vertical:"center"}),this.getShapeDot(),b(()=>[this.booth.skipDim,l.selectedRoute,F.layersLoaded],()=>{const e=P();this.shapeLabel.dim=e||this.booth.skipDim?!1:void 0,this.shapeDot.dim=e||this.booth.skipDim?!1:void 0,k(t,this.shapeLabel,this.shapeDot)});const u=e=>{let a=this.steps.find(h=>h.scaleFactor<1/e);return a?(this.shapeLabel.lines[0].fontSize=a.value/devicePixelRatio*e,this.shapeLabel.lines[0].text=a.lines.join(`
2
+ `),this.shapeLabel.padding=[this.paddingScaled[0]*e+this.padding,this.paddingScaled[1]*e+this.padding],this.shapeLabel):(this.shapeLabel.lines[0].fontSize=0,this.shapeLabel)},m=e=>{let a=this.steps.find(r=>r.scaleFactor<1/e);const h=this.shapeDot.source.width*e,n=this.shapeDot.source.height*e;return this.shapeDot.bounds=new p({x:this.canvasRect.center.x-h/2,y:this.canvasRect.center.y-n/2},{x:this.canvasRect.center.x+h/2,y:this.canvasRect.center.y+n/2}),this.shapeDot.hidden=!!a,this.shapeDot};t.ptScaleHandlers.push({fn:u}),t.ptScaleHandlers.push({fn:m}),b(()=>l.mapSettings,({roll:e})=>{H(e)&&t.rollHandlers?.push({fn:a=>{const h=this.shapeLabel.bounds.rotation;if(this.labelIsVertical)B(a,h)&&(this.shapeLabel.bounds.rotation=-h);else{const n=M(a,h);if(n!==void 0){const{size:r}=this.canvasRect;this.shapeLabel=I(this.shapeLabel,n),r.x!==r.y&&!this.shapeLabel.hidden&&(this.canvasRect=W(this.canvasRect,n),this.setFactors(this.text),u(t.scale),m(t.scale))}}return[this.shapeLabel,this.shapeDot]}})})}getShape(){return[this.shapeLabel,this.shapeDot]}setFactors(t){this.steps=N(devicePixelRatio).getStepsForRect(t,this.canvasRect.size.x,this.canvasRect.size.y)}setText(){const t=this.booth.title||this.booth.name,o=`Clicks: ${L.getTotalClicksByBooth(this.booth)}`;this.text=l.heatmap?`${t} - ${o}`:t}}
@@ -30,7 +30,7 @@ export declare class BoothLabelDrawer extends BoothDrawerBaseWithoutPainter {
30
30
  protected prefixes: Prefix[];
31
31
  protected fontUrls: [string, string];
32
32
  constructor(renderer: MapRenderer, booth: Booth);
33
- getShape(): (TextDef | ImageDef)[];
33
+ getShape(): (ImageDef | TextDef)[];
34
34
  getShapeDot(): void;
35
35
  private createLines;
36
36
  private calculateFontSizeFactors;
@@ -1 +1 @@
1
- import{layersStore as w,uiState as m}from"../../../../store";import{RegularBooth as B,SpecialBooth as I}from"../../../../store/BoothStore";import x from"../../../../tools/settings";import V from"../../../../utils/is-mobile";import W from"../../../../utils/is-webview";import{Rect as E}from"./Rect";import d from"../../../../data";import{BoothDrawerBaseWithoutPainter as U}from"./BoothDrawerBase";import{getFont as _}from"./canvases";import{isArabicText as Z}from"../../../../utils/rtl";import{t as L}from"../../../../utils/i18n";import{reaction as M}from"mobx";import{createTextDef as X,createTextDefLines as G,updateLinesScale as Y,updateTextDefRotation as k,updateRenderer as $,getRotation as q,createShapeDot as j,DEFAULT_FONT_LIGHT_URL as J,DEFAULT_FONT_URL as C,getRollValue as K,updateRectRotation as Q}from"./engine-core";import{FONT_WEIGHT_PRIMARY_BOOTH as ee,FONT_WEIGHT_PRIMARY_EXHIBITOR as te,FONT_WEIGHT_SECONDARY_BOOTH as ie,FONT_WEIGHT_SECONDARY_EXHIBITOR as se}from"../../../../constants";let z=x.boothLabelColor;x.EXPO==="tqs2021"&&(z="#000");const b=V||W,D=r=>r.replace(" ","").substring(0,4).replace(/[0-9]/g,"3").replace(/[A-Z]/gi,"A"),H=document.createElement("canvas").getContext("2d");export default function oe(r,e){if(!(!(e instanceof B)||e.noLabels))return new BoothLabelDrawer(r,e)}export function getMinZoomFactorForDot(r){return Array.isArray(r)&&r.length>0?Math.max(...r.map(e=>e)):typeof r=="number"?r:-0}export const isDirectionsMode=()=>!!(m.selectedRoute?.from&&m.selectedRoute?.to);export function getFontUrlByWeight(r,e=[],t="normal"){return[...e,{weight:500,url:C,style:"normal"},{weight:300,url:J,style:"normal"}].find(h=>+h.weight===r&&h.style===t)?.url||C}const R="Details";export class BoothLabelDrawer extends U{renderer;canvasRect;paddingScaled;padding;minZoomDotVisible;maxZoomDotVisible;exh;shapeLabel;shapeDot;fontSizes;lines;topLeftAlignment;centerAlignment;prefixes;fontUrls;constructor(e,t){if(super(t),this.renderer=e,this.canvasRect=E.fromCoreRect(t.rect,t.rotate),this.paddingScaled=[4,4],this.padding=(t.borderWidth||x.boothBorderWidth)/2,this.topLeftAlignment={horizontal:m.rtl?"right":"left",vertical:"top"},this.centerAlignment={horizontal:"center",vertical:"center"},this.prefixes=b?[{fontSize:7,name:"XS",short:!0},{fontSize:10,name:"S",short:!0},{fontSize:16,name:R,short:!1}]:[{fontSize:7,name:"XS",short:!0},{fontSize:10,name:"S",short:!0},{fontSize:12,name:"M",short:!0},{fontSize:14,name:"L",short:!0},{fontSize:18,name:R,short:!1}],t instanceof I)return;this.exh=d.hideExhibitors?[]:d.onlyFeaturedExhibitors?t.exhibitors.filter(i=>i.featured):t.exhibitors,b&&this.optimizationLevel()>=3&&(this.prefixes=this.prefixes.filter(i=>i.name!=="S")),this.createLines(),this.calculateFontSizeFactors(),this.shapeLabel=X(G(this.lines,this.booth.labelColor||z,0,this.fontUrls),E.fromCoreRect(this.booth.rect,this.booth.rotate),[...this.paddingScaled],{horizontal:"left",vertical:"top"}),this.getShapeDot();const h=i=>{const o=this.lines[1]??[],s=this.fontSizes[1]??[];if(x.EXPO!=="wineparis2026"){const c=this.exh.length?this.topLeftAlignment:o.length?i<s[s.length-1].scaleFactor?this.topLeftAlignment:this.centerAlignment:this.topLeftAlignment;this.shapeLabel.alignment=c}if(!Y(this.shapeLabel.lines,i,this.fontSizes,this.booth.name))return;const a=this.paddingScaled[0]*i+this.padding,l=this.paddingScaled[1]*i+this.padding;return this.shapeLabel.padding[0]=a,this.shapeLabel.padding[1]=l,this.shapeLabel},n=i=>{const o=i>=this.minZoomDotVisible&&i<=this.maxZoomDotVisible,s=this.shapeDot.source.width*i,a=this.shapeDot.source.height*i;if(!(!o&&this.shapeDot.hidden))return this.shapeDot.bounds.size={x:s,y:a},this.shapeDot.hidden=!o,this.shapeDot};M(()=>[this.booth.skipDim,m.selectedRoute,w.layersLoaded],()=>{if(!w.layersLoaded)return;const i=isDirectionsMode();this.shapeLabel.dim=i||this.booth.skipDim?!1:void 0,this.shapeDot.dim=i||this.booth.skipDim?!1:void 0,$(e,this.shapeLabel,this.shapeDot)}),M(()=>m.mapSettings,({roll:i})=>{K(i)&&e.rollHandlers?.push({fn:o=>{const s=q(o,this.shapeLabel.bounds.rotation),{size:a}=this.canvasRect;return s!==void 0&&(this.shapeLabel=k(this.shapeLabel,s),!this.shapeLabel.hidden&&!this.exh.length&&a.x!==a.y&&(this.canvasRect=Q(this.canvasRect,s),this.calculateFontSizeFactors(),h(e.scale),n(e.scale))),[this.shapeLabel,this.shapeDot]}})}),e.ptScaleHandlers.push({fn:h}),e.ptScaleHandlers.push({fn:n})}getShape(){return[this.shapeLabel,this.shapeDot]}getShapeDot(){this.shapeDot=j(this.canvasRect,this.booth.labelColor||z),this.shapeDot.hidden=!0,this.maxZoomDotVisible=Math.min(this.canvasRect.size.x/this.shapeDot.source.width,this.canvasRect.size.y/this.shapeDot.source.height)}createLines(){const e=this.booth,t=[],h=[],n=b&&this.optimizationLevel()>=3?1:3;if(this.exh.length){const i=e.exhibitors.filter(s=>s.order===0),o=e.exhibitors.filter(s=>s.order);if(i.length>0)t.push(...i.map(s=>s.name));else if(d.onlyFeaturedExhibitors)t.push(...e.exhibitors.filter(s=>s.featured).map(s=>s.name));else if(o.length>0){t.push(...o.map(a=>a.name));const s=e.exhibitors.filter(a=>a.order===void 0);s.length>0&&t.push(L("and {{moreCount}} more",{moreCount:s.length}))}else e.exhibitors.length>n?t.push(`${e.exhibitors.length} ${d.exhibitorTermPlural}`):t.push(...e.exhibitors.map(s=>s.name));h.push(e.title||e.name)}else{const i=!!e.exhibitors.length;t.push(e.title||e.name),e.onHold?h.push(L("On Hold")):e.reserved?h.push(L("Reserved")):i||h.push(...e.exhibitors.map(o=>o.name).sort((o,s)=>o>s?1:-1)),e.size&&h.push(e.size.indexOf("/")>-1?e.size.substring(0,e.size.indexOf("/")).trim():e.size),e.price&&e.price!=="0"&&!m.previewMode&&h.push(e.price)}m.rtl&&t.forEach((i,o)=>{(i.endsWith(".")||i.endsWith("!")||i.endsWith("?"))&&(t[o]=t[o]+"\u200F"),Z(i)&&(t[o]=t[o]+" ")}),this.lines=[t,h]}calculateFontSizeFactors(){let[e,t]=this.lines;const h=this.canvasRect,n=[],i=[],o=this.prefixes.slice(0,this.exh.length?this.prefixes.length:this.prefixes.length-1);let s=500,a=300;this.exh.length?(s=Number(getComputedStyle(document.body).getPropertyValue(te))||s,a=Number(getComputedStyle(document.body).getPropertyValue(se))||a):(s=Number(getComputedStyle(document.body).getPropertyValue(ee))||s,a=Number(getComputedStyle(document.body).getPropertyValue(ie))||a);for(const{fontSize:l,short:c}of o){const u=l*devicePixelRatio,v=.9*l*devicePixelRatio,f=_(u,s),T=_(v,a),y=d.hideExhibitorBoothNumber||c;let F,A,S,g;if(this.exh.length)c?t=[]:t=this.lines[1],S=Math.max(...e.map(p=>this.measureText(p,f).width),...t.map(p=>this.measureText(p,T).width)),F=Math.max(...e.map(p=>this.exh.length?this.measureText(D(p),f).width:this.measureText(D(p),f).width+3+3),...t.map(p=>this.measureText(D(p),T).width)),g=u*e.length+v*t.length+devicePixelRatio*(e.length+t.length)+3,A=y?g/e.length:null;else{const p=e[0].replace(/[0-9]/g,"3").replace(/[A-Z]/g,"A");S=this.measureText(p,f).width+3+3,g=u+4}const N=h.size.x/(F||S),P=h.size.y/(A||g),O=Math.min(N,P);n.push({scaleFactor:O,value:l}),!y&&i.push({scaleFactor:O,value:.9*l})}if(!this.exh.length){const l=n[n.length-1],c=this.prefixes.find(u=>u.name===R);n.push({scaleFactor:l.scaleFactor/1.8,value:c.fontSize}),i.push({scaleFactor:l.scaleFactor/1.8,value:c.fontSize*(b?1:.9)})}this.fontUrls=[getFontUrlByWeight(s,this.renderer.fontUrls),getFontUrlByWeight(a,this.renderer.fontUrls)],this.minZoomDotVisible=getMinZoomFactorForDot(n.map(l=>l.scaleFactor)),this.fontSizes=[n,i]}calcArea(e,t){return Math.floor(Math.max(0,e)*Math.max(0,t)/1e3)}optimizationLevel(){return Math.min(d.viewOptimizationLevel?d.viewOptimizationLevel:Math.floor(this.calcArea(this.canvasRect.size.x,this.canvasRect.size.y)/5e3),3)}measureText(e,t){return H.font=t,H.measureText(e)}}
1
+ import{layersStore as O,uiState as m}from"../../../../store";import{RegularBooth as P,SpecialBooth as I}from"../../../../store/BoothStore";import x from"../../../../tools/settings";import V from"../../../../utils/is-mobile";import U from"../../../../utils/is-webview";import{Rect as E}from"./Rect";import u from"../../../../data";import{BoothDrawerBaseWithoutPainter as Z}from"./BoothDrawerBase";import{getFont as M}from"./canvases";import{isArabicText as X}from"../../../../utils/rtl";import{t as L}from"../../../../utils/i18n";import{reaction as B}from"mobx";import{createTextDef as G,createTextDefLines as Y,updateLinesScale as k,updateTextDefRotation as $,updateRenderer as q,getRotation as j,createShapeDot as J,DEFAULT_FONT_LIGHT_URL as K,DEFAULT_FONT_URL as _,getRollValue as Q,updateRectRotation as ee}from"./engine-core";import{FONT_WEIGHT_PRIMARY_BOOTH as te,FONT_WEIGHT_PRIMARY_EXHIBITOR as ie,FONT_WEIGHT_SECONDARY_BOOTH as se,FONT_WEIGHT_SECONDARY_EXHIBITOR as oe}from"../../../../constants";let D=x.boothLabelColor;x.EXPO==="tqs2021"&&(D="#000");const b=V||U,z=h=>h.replace(" ","").substring(0,4).replace(/[0-9]/g,"3").replace(/[A-Z]/gi,"A"),H=document.createElement("canvas").getContext("2d");export default function ne(h,e){if(!(!(e instanceof P)||e.noLabels))return new BoothLabelDrawer(h,e)}export function getMinZoomFactorForDot(h){return Array.isArray(h)&&h.length>0?Math.max(...h.map(e=>e)):typeof h=="number"?h:-0}export const isDirectionsMode=()=>!!(m.selectedRoute?.from&&m.selectedRoute?.to);export function getFontUrlByWeight(h,e=[],t="normal"){return[...e,{weight:500,url:_,style:"normal"},{weight:300,url:K,style:"normal"}].find(i=>+i.weight===h&&i.style===t)?.url||_}const v="Details";export class BoothLabelDrawer extends Z{renderer;canvasRect;paddingScaled;padding;minZoomDotVisible;maxZoomDotVisible;exh;shapeLabel;shapeDot;fontSizes;lines;topLeftAlignment;centerAlignment;prefixes;fontUrls;constructor(e,t){if(super(t),this.renderer=e,this.canvasRect=E.fromCoreRect(t.rect,t.rotate),this.paddingScaled=[4,4],this.padding=(t.borderWidth||x.boothBorderWidth)/2,this.topLeftAlignment={horizontal:m.rtl?"right":"left",vertical:"top"},this.centerAlignment={horizontal:"center",vertical:"center"},this.prefixes=b?[{fontSize:7,name:"XS",short:!0},{fontSize:10,name:"S",short:!0},{fontSize:16,name:v,short:!1}]:[{fontSize:7,name:"XS",short:!0},{fontSize:10,name:"S",short:!0},{fontSize:12,name:"M",short:!0},{fontSize:14,name:"L",short:!0},{fontSize:18,name:v,short:!1}],t instanceof I)return;this.exh=u.hideExhibitors?[]:u.onlyFeaturedExhibitors?t.exhibitors.filter(i=>i.featured):t.exhibitors,b&&this.optimizationLevel()>=3&&(this.prefixes=this.prefixes.filter(i=>i.name!=="S")),this.createLines(),this.calculateFontSizeFactors(),this.shapeLabel=G(Y(this.lines,this.booth.labelColor||D,0,this.fontUrls),E.fromCoreRect(this.booth.rect,this.booth.rotate),[...this.paddingScaled],{horizontal:"left",vertical:"top"}),this.getShapeDot();const a=i=>{const o=this.lines[1]??[],s=this.fontSizes[1]??[];if(x.EXPO!=="wineparis2026"){const d=this.exh.length?this.topLeftAlignment:o.length?i<s[s.length-1].scaleFactor?this.topLeftAlignment:this.centerAlignment:this.topLeftAlignment;this.shapeLabel.alignment=d}if(!k(this.shapeLabel.lines,i,this.fontSizes,this.booth.name))return;const l=this.paddingScaled[0]*i+this.padding,p=this.paddingScaled[1]*i+this.padding;return this.shapeLabel.padding[0]=l,this.shapeLabel.padding[1]=p,this.shapeLabel},r=i=>{const o=i>=this.minZoomDotVisible&&i<=this.maxZoomDotVisible,s=this.shapeDot.source.width*i,n=this.shapeDot.source.height*i;if(!(!o&&this.shapeDot.hidden))return this.shapeDot.bounds.size={x:s,y:n},this.shapeDot.hidden=!o,this.shapeDot};B(()=>[this.booth.skipDim,m.selectedRoute,O.layersLoaded],()=>{if(!O.layersLoaded)return;const i=isDirectionsMode();this.shapeLabel.dim=i||this.booth.skipDim?!1:void 0,this.shapeDot.dim=i||this.booth.skipDim?!1:void 0,q(e,this.shapeLabel,this.shapeDot)}),B(()=>m.mapSettings,({roll:i})=>{Q(i)&&e.rollHandlers?.push({fn:o=>{const s=j(o,this.shapeLabel.bounds.rotation),{size:n}=this.canvasRect;return s!==void 0&&(this.shapeLabel=$(this.shapeLabel,s),!this.shapeLabel.hidden&&!this.exh.length&&n.x!==n.y&&(this.canvasRect=ee(this.canvasRect,s),this.calculateFontSizeFactors(),a(e.scale),r(e.scale))),[this.shapeLabel,this.shapeDot]}})}),e.ptScaleHandlers.push({fn:a}),e.ptScaleHandlers.push({fn:r})}getShape(){return[this.shapeLabel,this.shapeDot]}getShapeDot(){this.shapeDot=J(this.canvasRect,this.booth.labelColor||D),this.shapeDot.hidden=!0,this.maxZoomDotVisible=Math.min(this.canvasRect.size.x/this.shapeDot.source.width,this.canvasRect.size.y/this.shapeDot.source.height)}createLines(){const e=this.booth,t=[],a=[],r=b&&this.optimizationLevel()>=3?1:3;if(this.exh.length){const i=e.exhibitors.filter(s=>s.order===0),o=e.exhibitors.filter(s=>s.order);if(i.length>0)t.push(...i.map(s=>s.name));else if(u.onlyFeaturedExhibitors)t.push(...e.exhibitors.filter(s=>s.featured).map(s=>s.name));else if(o.length>0){t.push(...o.map(n=>n.name));const s=e.exhibitors.filter(n=>n.order===void 0);s.length>0&&t.push(L("and {{moreCount}} more",{moreCount:s.length}))}else e.exhibitors.length>r?t.push(`${e.exhibitors.length} ${u.exhibitorTermPlural}`):t.push(...e.exhibitors.map(s=>s.name));a.push(e.title||e.name)}else{const i=!!e.exhibitors.length;t.push(e.title||e.name),e.onHold?a.push(L("On Hold")):e.reserved?a.push(L("Reserved")):i||a.push(...e.exhibitors.map(o=>o.name).sort((o,s)=>o>s?1:-1)),e.size&&a.push(e.size.indexOf("/")>-1?e.size.substring(0,e.size.indexOf("/")).trim():e.size),e.price&&e.price!=="0"&&!m.previewMode&&a.push(e.price)}m.rtl&&t.forEach((i,o)=>{(i.endsWith(".")||i.endsWith("!")||i.endsWith("?"))&&(t[o]=t[o]+"\u200F"),X(i)&&(t[o]=t[o]+" ")}),this.lines=[t,a]}calculateFontSizeFactors(){let[e,t]=this.lines;const a=this.canvasRect,r=[],i=[],o=this.prefixes.slice(0,this.exh.length?this.prefixes.length:this.prefixes.length-1);let s=500,n=300;this.exh.length?(s=Number(getComputedStyle(document.body).getPropertyValue(ie))||s,n=Number(getComputedStyle(document.body).getPropertyValue(oe))||n):(s=Number(getComputedStyle(document.body).getPropertyValue(te))||s,n=Number(getComputedStyle(document.body).getPropertyValue(se))||n);for(const{fontSize:l,short:p}of o){const d=l*devicePixelRatio,R=.9*l*devicePixelRatio,f=M(d,s),y=M(R,n),F=u.hideExhibitorBoothNumber||p;let T,A,S,g;if(this.exh.length)p?t=[]:t=this.lines[1],S=Math.max(...e.map(c=>this.measureText(c,f).width),...t.map(c=>this.measureText(c,y).width)),T=Math.max(...e.map(c=>this.exh.length?this.measureText(z(c),f).width:this.measureText(z(c),f).width+3+3),...t.map(c=>this.measureText(z(c),y).width)),g=d*e.length+R*t.length+devicePixelRatio*(e.length+t.length)+3,A=F?g/e.length:null;else{const c=e[0].replace(/[0-9]/g,"3").replace(/[A-Z]/g,"A"),N=4;S=this.measureText(c,f).width+3+3,g=d+N}const W=a.size.x/(T||S),C=a.size.y/(A||g),w=Math.min(W,C);r.push({scaleFactor:w,value:l}),!F&&i.push({scaleFactor:w,value:.9*l})}if(!this.exh.length){const l=r[r.length-1],p=this.prefixes.find(d=>d.name===v);r.push({scaleFactor:l.scaleFactor/1.8,value:p.fontSize}),i.push({scaleFactor:l.scaleFactor/1.8,value:p.fontSize*(b?1:.9)})}this.fontUrls=[getFontUrlByWeight(s,this.renderer.fontUrls),getFontUrlByWeight(n,this.renderer.fontUrls)],this.minZoomDotVisible=getMinZoomFactorForDot(r.map(l=>l.scaleFactor)),this.fontSizes=[r,i]}calcArea(e,t){return Math.floor(Math.max(0,e)*Math.max(0,t)/1e3)}optimizationLevel(){return Math.min(u.viewOptimizationLevel?u.viewOptimizationLevel:Math.floor(this.calcArea(this.canvasRect.size.x,this.canvasRect.size.y)/5e3),3)}measureText(e,t){return H.font=t,H.measureText(e)}}
@@ -1 +1 @@
1
- import p,{layersStore as c}from"../../../../store";import{LayersMode as f}from"../../../../store/LayerStore";import{BoothDrawerBaseWithoutPainter as d}from"./BoothDrawerBase";import{getTrianglesFromFpPaths as u}from"../../../../data/svg";import{reaction as E}from"mobx";import{Rect as g}from"./Rect";import{createImageDef as b,updateRenderer as y}from"./engine-core";const l=document.createElement("canvas"),o=l.getContext("2d");export function canvasFromPath(n,s=.5,t){var e=[Number.MAX_VALUE,Number.MAX_VALUE,Number.MIN_VALUE,Number.MIN_VALUE];n.forEach(m=>{m.triangles=u(m.index,t),m.triangles.forEach(a=>{a.forEach(r=>{r[0]<e[0]?e[0]=r[0]:r[0]>e[2]&&(e[2]=r[0]),r[1]<e[1]?e[1]=r[1]:r[1]>e[3]&&(e[3]=r[1])})})});const i=e[0],h=e[1];return o.scale(s,s),n.forEach(m=>{o.beginPath(),o.fillStyle=m.color,m.triangles.forEach(a=>{o.moveTo(a[0][0]-i,a[0][1]-h),o.lineTo(a[1][0]-i,a[1][1]-h),o.lineTo(a[2][0]-i,a[2][1]-h),o.lineTo(a[0][0]-i,a[0][1]-h)}),o.fill()}),l}export default function L(n,s){return new N(n,s)}class N extends d{shape;constructor(s,t){super(t);const e=g.fromCoreRect(t.rect,t.rotate),i=canvasFromPath(t.paths,.5,p.layerStore.mode!==f.Default?t.layer.name:"");this.shape=b(i,e,{hidden:!0,dim:!0}),E(()=>[this.booth.skipDim,c.layersLoaded],()=>{c.layersLoaded&&(this.shape.dim=this.booth.skipDim?!1:void 0,y(s,this.shape))})}getShape(){return[this.shape]}}
1
+ import d,{layersStore as f}from"../../../../store";import{LayersMode as h}from"../../../../store/LayerStore";import{BoothDrawerBaseWithoutPainter as u}from"./BoothDrawerBase";import{getTrianglesFromFpPaths as g}from"../../../../data/svg";import{reaction as p}from"mobx";import{Rect as E}from"./Rect";import{createImageDef as y,updateRenderer as x}from"./engine-core";const l=document.createElement("canvas"),a=l.getContext("2d");export function canvasFromPath(m,s=.5,t){var e=[Number.MAX_VALUE,Number.MAX_VALUE,Number.MIN_VALUE,Number.MIN_VALUE];m.forEach(c=>{c.triangles=g(c.index,t),c.triangles.forEach(r=>{r.forEach(o=>{o[0]<e[0]?e[0]=o[0]:o[0]>e[2]&&(e[2]=o[0]),o[1]<e[1]?e[1]=o[1]:o[1]>e[3]&&(e[3]=o[1])})})});const n=e[0],i=e[1];return a.scale(s,s),m.forEach(c=>{a.beginPath(),a.fillStyle=c.color,c.triangles.forEach(r=>{a.moveTo(r[0][0]-n,r[0][1]-i),a.lineTo(r[1][0]-n,r[1][1]-i),a.lineTo(r[2][0]-n,r[2][1]-i),a.lineTo(r[0][0]-n,r[0][1]-i)}),a.fill()}),l}export default function L(m,s){return new N(m,s)}class N extends u{shape;constructor(s,t){super(t);const e=E.fromCoreRect(t.rect,t.rotate),n=canvasFromPath(t.paths,.5,d.layerStore.mode!==h.Default?t.layer.name:"");this.shape=y(n,e,{hidden:!0,dim:!0}),p(()=>[this.booth.skipDim,f.layersLoaded],()=>{f.layersLoaded&&(this.shape.dim=this.booth.skipDim?!1:void 0,x(s,this.shape))})}getShape(){return[this.shape]}}
@@ -1 +1 @@
1
- import W from"./config-booth-bg";import{Rect as u}from"./Rect";import _ from"./config-booth-labels";import{SEPARATOR as r}from"../../../../constants";import v from"./config-booth-labels-special";import F from"./config-booth-border";import K from"./config-booth-bookmark";import P from"../../../../tools/settings";import x,{boothStore as U,uiState as Z}from"../../../../store";import j from"./config-booth-scaled";import{loadImagesInBatchesById as q}from"../../../../utils/loadImagesInBatches";import{createBoothImg as z,getImageLayerName as G,mapBoothsLogos as J}from"./loadBoothsImages";import{degToRad as M}from"three/src/math/MathUtils";import{createImageDef as Q}from"./engine-core";export const BOOTHS_CHUNK_SIZE=350;export default function V(a,g,L){return(c=>{const o=g,$=[],l=[],p=[],b=[],y=[],f=G(o);for(const e of c){const m=W(a,e)?.getShape();m&&$.push(...m);const s=_(a,e)?.getShape();s&&l.push(...s);const i=v(a,e)?.getShape();if(i&&p.push(...i),!P.borderless){const t=F(a,e)?.getShape();t&&b.push(t)}const h=K(a,e)?.getShape();h&&y.push(h)}const k=l.filter(e=>e.lines),w=p.filter(e=>e.lines),H=l.filter(e=>e.source),O=p.filter(e=>e.source);if(!Z.hideLogoInBooth){const e=J(c);a.layerImagesHandlers.push({fn:async()=>{const m=await q(e,BOOTHS_CHUNK_SIZE),s=[];for(const[i,h]of m){const t=x.boothStore.boothById.get(i);if(!t)continue;const{bounds:{x:B,y:I,height:T,angle:A,width:C},htmlImage:D}=z(t,h),R=Q(D,new u({x:B,y:I},{x:B+C,y:I+T},M(A))),E=u.fromCoreRect(t.rect,t.rotate),N=u.inflateRect(E,t.borderWidth||U.borderWidth);t.shapes.push(R),s.push({shape:R,parentRect:N})}return{name:f,children:s}},name:f})}let d=[];c.length&&(d=[{name:`${o}${r}boothBackground`,children:$,interactive:!0},{name:`${o}${r}labels`,children:k},{name:`${o}${r}specialLabels`,children:w},{name:`${o}${r}bots`,children:H},{name:`${o}${r}specialDots`,children:O},{name:f,children:[]},{name:`${o}${r}boothsBookmark`,children:y},{name:`${o}${r}boothBorder`,children:b}]);const{defaultFrom:n}=x.routeStore,S=(g+":").split(":")[0];if(n?.layer===null||n?.layer?.name===S||n?.layer?.childLayers.find(e=>e.name===S)){const e=j(a,n);e&&d.push({name:`${o}${r}yahBooth`,children:e.getShape()})}return{name:o,children:d}})(L)}
1
+ import E from"./config-booth-bg";import{Rect as d}from"./Rect";import U from"./config-booth-labels";import{SEPARATOR as s}from"../../../../constants";import W from"./config-booth-labels-special";import v from"./config-booth-border";import F from"./config-booth-bookmark";import K from"../../../../tools/settings";import k,{boothStore as P,uiState as Z}from"../../../../store";import j from"./config-booth-scaled";import{loadImagesInBatchesById as q}from"../../../../utils/loadImagesInBatches";import{createBoothImg as z,getImageLayerName as G,mapBoothsLogos as J}from"./loadBoothsImages";import{degToRad as M}from"three/src/math/MathUtils";import{createImageDef as Q}from"./engine-core";export const BOOTHS_CHUNK_SIZE=350;export default function V(a,b,R){return(l=>{const t=b,B=[],m=[],f=[],u=[],y=[],p=G(t);for(const o of l){const i=E(a,o)?.getShape();i&&B.push(...i);const n=U(a,o)?.getShape();n&&m.push(...n);const c=W(a,o)?.getShape();if(c&&f.push(...c),!K.borderless){const e=v(a,o)?.getShape();e&&u.push(e)}const h=F(a,o)?.getShape();h&&y.push(h)}const D=m.filter(o=>o.lines),x=f.filter(o=>o.lines),_=m.filter(o=>o.source),w=f.filter(o=>o.source);if(!Z.hideLogoInBooth){const o=J(l);a.layerImagesHandlers.push({fn:async()=>{const i=await q(o,BOOTHS_CHUNK_SIZE),n=[];for(const[c,h]of i){const e=k.boothStore.boothById.get(c);if(!e)continue;const{bounds:{x:$,y:I,height:H,angle:N,width:O},htmlImage:T}=z(e,h),L=Q(T,new d({x:$,y:I},{x:$+O,y:I+H},M(N))),A=d.fromCoreRect(e.rect,e.rotate),C=d.inflateRect(A,e.borderWidth||P.borderWidth);e.shapes.push(L),n.push({shape:L,parentRect:C})}return{name:p,children:n}},name:p})}let g=[];l.length&&(g=[{name:`${t}${s}boothBackground`,children:B,interactive:!0},{name:`${t}${s}labels`,children:D},{name:`${t}${s}specialLabels`,children:x},{name:`${t}${s}bots`,children:_},{name:`${t}${s}specialDots`,children:w},{name:p,children:[]},{name:`${t}${s}boothsBookmark`,children:y},{name:`${t}${s}boothBorder`,children:u}]);const{defaultFrom:r}=k.routeStore,S=(b+":").split(":")[0];if(r?.layer===null||r?.layer?.name===S||r?.layer?.childLayers.find(o=>o.name===S)){const o=j(a,r);o&&g.push({name:`${t}${s}yahBooth`,children:o.getShape()})}return{name:t,children:g}})(R)}
@@ -1 +1 @@
1
- import m,{boothStore as x}from"../../../../store";import N from"../../../../store/init/init-booths";import{LayersMode as O}from"../../../../store/LayerStore";import{loadJs as T}from"../../../../tools/loaders";import H,{BOOTHS_CHUNK_SIZE as M}from"./config-booths";import{chunkArray as v}from"../../../../utils";import{BOOTHS_PAINTER_MARKER as D,SEPARATOR as l}from"../../../../constants";import{Rect as C}from"@expofp/renderer";import G,{BG_LAYER_NAME as $,FG_LAYER_NAME as w}from"./config-bg";import{getChildLayers as K}from"../../../../store/init/init-layers";import{createImageDef as U,createLayerDef as Y}from"./engine-core";import{getImageLayerName as j,getLayerIcons as k}from"./loadBoothsImages";import{getRenderer as F}from"./config-all";import{loadIcons as J}from"../../../../utils/imageloader";import{degToRad as Z}from"three/src/math/MathUtils";function q(o){return o.childLayers.length?o.childLayers:K(o,o.basePriority,15).layers}function _(o,r,h){return new Promise(async c=>{let t=[];const s=N(m,r),n=await G(r),i=[],f=v(s,M);x.booths.filter(e=>e.rect&&(!e.layer||e.layer===r||e.layer.childLayers.includes(r))&&e.exhibitors.find(a=>!!a.logoInBooth&&!!a.logo)&&!m.uiState.hideLogoInBooth).forEach(e=>e.noLabels=!0),s.length&&f.forEach((e,a)=>{i.push(H(o,`${r.name}${l}${D}${l}${a}`,e))}),r.loaded=!0;const p=n.children.find(e=>e.name===$),g=n.children.find(e=>e.name===w),d=j(r.name),y=k(r);y.length&&o.layerImagesHandlers.push({fn:async()=>{const e=await J(y),a=[];for(const E of e.filter(Boolean)){const{bounds:{x:u,y:L,height:I,angle:R,width:b},htmlImage:A}=E,S=new C({x:u,y:L},{x:u+b,y:L+I},Z(R)),B=U(A,S);a.push({shape:B})}return{name:d,children:a}},name:d}),p&&t.push({...p,name:`${n.name}${l}${$}`}),i.length&&t.push(...i),g&&t.push({...g,name:`${n.name}${l}${w}`}),y.length&&t.push({name:d,children:[]});const P=r.childLayers.sort((e,a)=>e.basePriority-a.basePriority).map(async e=>_(o,e,!0));Promise.all(P).then(e=>{const a=e.flat();a.length&&t.push(...a),c(Y(r.name,t,{hidden:!h}))})})}export default async function z(o,r=F()){return o.configured?Promise.resolve({name:o.name,children:o.children}):new Promise(async(h,c)=>{if(m.layerStore.mode!==O.Default&&!window[`__fpPaths${o.name}`]&&!o.rootParent)try{await T(`${window.__dataUrlBase}fp.svg.${o.name}.js`)}catch{return c()}const t=q(o);t.length&&(o.childLayers=t);const{layers:s}=m.layerStore;m.layerStore.layers=[...s,...t.filter(i=>!s.some(f=>f.name===i.name))];const n=await _(r,o,o.visible);h(n)})}
1
+ import m,{boothStore as N}from"../../../../store";import C from"../../../../store/init/init-booths";import{LayersMode as O}from"../../../../store/LayerStore";import{loadJs as T}from"../../../../tools/loaders";import x,{BOOTHS_CHUNK_SIZE as H}from"./config-booths";import{chunkArray as M}from"../../../../utils";import{BOOTHS_PAINTER_MARKER as v,SEPARATOR as c}from"../../../../constants";import{Rect as D}from"@expofp/renderer";import k,{BG_LAYER_NAME as $,FG_LAYER_NAME as w}from"./config-bg";import{getChildLayers as G}from"../../../../store/init/init-layers";import{createImageDef as K,createLayerDef as U}from"./engine-core";import{getImageLayerName as Y,getLayerIcons as j}from"./loadBoothsImages";import{getRenderer as F}from"./config-all";import{loadIcons as J}from"../../../../utils/imageloader";import{degToRad as Z}from"three/src/math/MathUtils";function q(e){return e.childLayers.length?e.childLayers:G(e,e.basePriority,15).layers}function B(e,t,h){return new Promise(async f=>{let n=[];const a=C(m,t),s=await k(t),i=[],d=M(a,H);N.booths.filter(o=>o.rect&&(!o.layer||o.layer===t||o.layer.childLayers.includes(t))&&o.exhibitors.find(r=>!!r.logoInBooth&&!!r.logo)&&!m.uiState.hideLogoInBooth).forEach(o=>o.noLabels=!0),a.length&&d.forEach((o,r)=>{i.push(x(e,`${t.name}${c}${v}${c}${r}`,o))}),t.loaded=!0;const u=s.children.find(o=>o.name===$),y=s.children.find(o=>o.name===w),l=Y(t.name),g=j(t);g.length&&e.layerImagesHandlers.push({fn:async()=>{const o=await J(g),r=[];for(const _ of o.filter(Boolean)){const{bounds:{x:p,y:L,height:I,angle:b,width:E},htmlImage:R}=_,A=new D({x:p,y:L},{x:p+E,y:L+I},Z(b)),S=K(R,A);r.push({shape:S})}return{name:l,children:r}},name:l}),u&&n.push({...u,name:`${s.name}${c}${$}`}),i.length&&n.push(...i),y&&n.push({...y,name:`${s.name}${c}${w}`}),g.length&&n.push({name:l,children:[]});const P=t.childLayers.sort((o,r)=>o.basePriority-r.basePriority).map(async o=>B(e,o,!0));Promise.all(P).then(o=>{const r=o.flat();r.length&&n.push(...r),f(U(t.name,n,{hidden:!h}))})})}export default async function z(e,t=F()){return e.configured?Promise.resolve({name:e.name,children:e.children}):new Promise(async(h,f)=>{if(m.layerStore.mode!==O.Default&&!window[`__fpPaths${e.name}`]&&!e.rootParent)try{await T(`${window.__dataUrlBase}fp.svg.${e.name}.js`)}catch{return f()}const n=q(e);n.length&&(e.childLayers=n);const{layers:a}=m.layerStore;m.layerStore.layers=[...a,...n.filter(i=>!a.some(d=>d.name===i.name))];const s=await B(t,e,e.visible);h(s)})}
@@ -1 +1 @@
1
- import h,{layersStore as M}from"../../../../store";import{reaction as $}from"mobx";import{createImageCanvas as I}from"./canvases";import{createImageDef as L,updateRenderer as x,getBounds as E}from"./engine-core";import{toRadians as Y}from"../../../../utils/toRadians";const P="_selected";export const MARKER_LAYER_NAME="markers";export function configMarkers(o,k){const m=[],i=new Map,s=new Map;let n=[];const p=k.rootLayer.children.find(e=>e.name===MARKER_LAYER_NAME);async function f(e){const r=[];e.forEach(c=>{const{name:l,content:t,width:a,height:d,scale:u}=c;if(i.has(l))return;const g=new Image,H=new Promise((w,y)=>{g.onload=()=>{i.set(l,{img:g,width:a,height:d,scale:u}),w()},g.onerror=v=>{y(v)}});r.push(H),g.src=t,g.crossOrigin="anonymous"}),await Promise.all(r)}const D=e=>`marker-ptScaleHandlers-${e.id}`,R=e=>`marker-rollHandlers-${e.id}`,z=(e,r)=>{o.ptScaleHandlers.push({fn:c=>{const{center:l,rotation:t}=e.bounds,{width:a,height:d}=e.source;return e.bounds=E(l.x,l.y,a,d,c,t),e},name:r})},A=(e,r)=>{o.rollHandlers.push({fn:c=>(e.bounds.rotation=c,e),name:r})};function C(){const e=h.routeStore.markersData.markers;if(!e.length)return;n=[];const r=h.renderer?.controls.getCameraState(),c=r?.ptScale||1,l=Y(r?.roll)||0;e.forEach(t=>{const a=i.get(t.icon);if(!a)return;const d=a.scale||window.devicePixelRatio,u=t.icon;if(!s.has(u)){const b=I(a.img,a.width,a.height,d);s.set(u,b)}const g=s.get(u),H=i.get(t.selectedIcon),w=t.selectedIcon;if(!s.has(w)){const b=I(a.img,H.width,H.height,d);s.set(w,b)}const y=s.get(w),v=M.findLayer(t.z)?.visible??!0,F=E(t.x,t.y,g.width,g.height,c,l),K=E(t.x,t.y,y.width,y.height,c,l);let S;switch(t.position){case"lefttop":S=[0,0];break;case"centertop":S=[.5,0];break;case"centerbottom":S=[.5,1];break;default:S=[.5,.5]}const N={...L(g,F,{hidden:!v,origin:S}),id:t.id,scale:d},O={...L(y,K,{hidden:!(v&&t.active),origin:S}),id:`${t.id}${P}`,scale:d};n.push(N,O)}),p.children=n,n.forEach(t=>{const a=D(t),d=R(t);o.ptScaleHandlers=o.ptScaleHandlers.filter(u=>u.name!==a),o.rollHandlers=o.rollHandlers.filter(u=>u.name!==d),z(t,a),A(t,d)})}function _(){n.forEach(e=>{o.ptScaleHandlers=o.ptScaleHandlers.filter(r=>r.name!==D(e)),o.rollHandlers=o.rollHandlers.filter(r=>r.name!==R(e))}),p.children=[],n=[]}function B(){const e=h.routeStore.markersData.markers;e.length&&e.forEach(r=>{const c=n.find(a=>a.id===r.id),l=n.find(a=>a.id===`${r.id}${P}`);if(!c)return;const t=M.findLayer(r.z)?.visible??!0;r.active?(c.hidden=!0,l.hidden=!(t&&r.active)):(c.hidden=!t,l.hidden=!0)})}return m.push($(()=>[h.routeStore.selectedMarkers,h.layerStore.visible],()=>{if(!h.routeStore.markersData.markers.length){_(),x(o,p);return}B(),x(o,...n)})),m.push($(()=>h.routeStore.markersData.markers,()=>{f(h.routeStore.markersData.icons).then(()=>{C(),x(o,p)})})),function(){m.forEach(e=>e()),m.length=0}}export function getMarkerFromClick(o,k,m){for(const i of h.routeStore.markersData.markers){const s=h.routeStore.markersData.icons.find(f=>f.name===i.icon);if(!s)continue;const n=s.width*m*devicePixelRatio,p=s.height*m*devicePixelRatio;if(T(o,k,i.x,i.y,n,p)){const f=h.layerStore.findLayer(i.z);if(!f||f&&f.visible)return i}}return null}function T(o,k,m,i,s,n){const p=o>=m-s&&o<=m+s,f=k>=i-n&&k<=i+n;return p&&f}
1
+ import u,{layersStore as R}from"../../../../store";import{reaction as C}from"mobx";import{createImageCanvas as x}from"./canvases";import{createImageDef as L,updateRenderer as H,getBounds as b}from"./engine-core";import{toRadians as T}from"../../../../utils/toRadians";const P="_selected";export const MARKER_LAYER_NAME="markers";export function configMarkers(o,k){const h=[],r=new Map,c=new Map;let s=[];const g=k.rootLayer.children.find(e=>e.name===MARKER_LAYER_NAME);async function m(e){const n=[];e.forEach(i=>{const{name:l,content:t,width:a,height:d,scale:f}=i;if(r.has(l))return;const p=new Image,M=new Promise((D,v)=>{p.onload=()=>{r.set(l,{img:p,width:a,height:d,scale:f}),D()},p.onerror=w=>{v(w)}});n.push(M),p.src=t,p.crossOrigin="anonymous"}),await Promise.all(n)}const E=e=>`marker-ptScaleHandlers-${e.id}`,I=e=>`marker-rollHandlers-${e.id}`,$=(e,n)=>{o.ptScaleHandlers.push({fn:i=>{const{center:l,rotation:t}=e.bounds,{width:a,height:d}=e.source;return e.bounds=b(l.x,l.y,a,d,i,t),e},name:n})},N=(e,n)=>{o.rollHandlers.push({fn:i=>(e.bounds.rotation=i,e),name:n})};function _(){const e=u.routeStore.markersData.markers;if(!e.length)return;s=[];const n=u.renderer?.controls.getCameraState(),i=n?.ptScale||1,l=T(n?.roll)||0;e.forEach(t=>{const a=r.get(t.icon);if(!a)return;const d=a.scale||window.devicePixelRatio,f=t.icon;if(!c.has(f)){const y=x(a.img,a.width,a.height,d);c.set(f,y)}const p=c.get(f),M=r.get(t.selectedIcon),D=t.selectedIcon;if(!c.has(D)){const y=x(a.img,M.width,M.height,d);c.set(D,y)}const v=c.get(D),w=R.findLayer(t.z)?.visible??!0,B=b(t.x,t.y,p.width,p.height,i,l),F=b(t.x,t.y,v.width,v.height,i,l);let S;switch(t.position){case"lefttop":S=[0,0];break;case"centertop":S=[.5,0];break;case"centerbottom":S=[.5,1];break;default:S=[.5,.5]}const K={...L(p,B,{hidden:!w,origin:S}),id:t.id,scale:d},O={...L(v,F,{hidden:!(w&&t.active),origin:S}),id:`${t.id}${P}`,scale:d};s.push(K,O)}),g.children=s,s.forEach(t=>{const a=E(t),d=I(t);o.ptScaleHandlers=o.ptScaleHandlers.filter(f=>f.name!==a),o.rollHandlers=o.rollHandlers.filter(f=>f.name!==d),$(t,a),N(t,d)})}function z(){s.forEach(e=>{o.ptScaleHandlers=o.ptScaleHandlers.filter(n=>n.name!==E(e)),o.rollHandlers=o.rollHandlers.filter(n=>n.name!==I(e))}),g.children=[],s=[]}function A(){const e=u.routeStore.markersData.markers;e.length&&e.forEach(n=>{const i=s.find(a=>a.id===n.id),l=s.find(a=>a.id===`${n.id}${P}`);if(!i)return;const t=R.findLayer(n.z)?.visible??!0;n.active?(i.hidden=!0,l.hidden=!(t&&n.active)):(i.hidden=!t,l.hidden=!0)})}return h.push(C(()=>[u.routeStore.selectedMarkers,u.layerStore.visible],()=>{if(!u.routeStore.markersData.markers.length){z(),H(o,g);return}A(),H(o,...s)})),h.push(C(()=>u.routeStore.markersData.markers,()=>{m(u.routeStore.markersData.icons).then(()=>{_(),H(o,g)})})),function(){h.forEach(n=>n()),h.length=0}}export function getMarkerFromClick(o,k,h){for(const r of u.routeStore.markersData.markers){const c=u.routeStore.markersData.icons.find(m=>m.name===r.icon);if(!c)continue;const s=c.width*h*devicePixelRatio,g=c.height*h*devicePixelRatio;if(Y(o,k,r.x,r.y,s,g)){const m=u.layerStore.findLayer(r.z);if(!m||m&&m.visible)return r}}return null}function Y(o,k,h,r,c,s){const g=o>=h-c&&o<=h+c,m=k>=r-s&&k<=r+s;return g&&m}
@@ -1 +1 @@
1
- import ue from"color";import{observable as me,reaction as re}from"mobx";import{lineLength as Ee}from"simple-geometry";import Oe from"../../../../core/Rect";import a,{layersStore as Pe,uiState as g}from"../../../../store";import{LayersMode as ve}from"../../../../store/LayerStore";import{getGraphLines as ze,getRouteLength as ge,RoutePoint as he}from"../../../../utils/wayfinding";import{strEqual as O}from"../../../../utils/strEqual";import{createArrowCurrentCanvas as _e,createCurrentCanvas as xe,createImageCanvas as V,createTargetCanvas as We,createYahCanvas as qe}from"./canvases";import{toRadians as Me}from"../../../../utils/toRadians";import{areLayersEnabled as ke}from"../../../../utils/areLayersEnabled";import{createImageDef as Z,createLineDef as Re,updateRenderer as ee,createCircleCanvas as Ue,getBounds as b,getRotation as Xe}from"./engine-core";import{animateLineSegments as $e}from"./engine-core/animation";import{splitRouteByPoint as Ge,snapPositionToRoute as Ke,getThresholdSafe as je,getThresholdFromMetersToSvg as Je,SNAP_THRESHOLD_METERS as Qe}from"./route-snapping";import{fpGeo as Ae}from"../../../Mapbox/utils/fpGeo";const _=devicePixelRatio;let H=[],ie=null,F=[],pe=ue("#00A2FF"),Ve=ue("#FF9F06"),Te="#A4CCE2",Ze="#0794EA";const ae=34;let $,G,K,j,te,Se,Ne,Ce,ce,k,A,z,W,J,be=[];function et(){H=[];const e=a.routeStore.currentRouteLayer?.name;ie=ot();const r=ie&&(ke()?O(e,ie.destination?.layer):!0);if(ie){const d=ie?.routePoint;d&&O(e,d.layer)&&(H=rt(d,H))}let o=[],i=[];for(let d=0;d<F.length;d++){let x=F[d],y=a.layerStore.mode==ve.Default?!0:a.layerStore.layers.find(n=>n.name==e&&e===x.p0.layer)?.visible||!1;!x.virtual&&y&&o.push(x),(x.virtual||!y||d===F.length-1)&&o.length&&(i=o.map(({p0:n,p1:u})=>(H.push({x:n.x,y:n.y},{x:u.x,y:u.y}),{p0:n,p1:u})))}H.length||(A.hidden=!0,k.hidden=!0);let l=1e6,c=1e6,m=0,f=0;H.forEach(d=>{d.x<l&&(l=d.x),d.y<c&&(c=d.y),d.x>m&&(m=d.x),d.y>f&&(f=d.y)});const p=Oe.fromX1y1x2y2(l,c,m,f);return{rect:H.length&&(p.w||p.h)?p.withPadding(p.w,p.h):null,lines:i,addTrailPoints:r}}export const WF_TRAIL_LAYER_NAME="wf-trail-points",WF_POINTS_LAYER_NAME="wf-points",WF_CURRENT_POSITION_NAME="wf-current-position",WF_LINES_LAYER_NAME="wf-lines",WF_LINES_ANIMATED_LAYER_NAME="wf-lines-animated";export default function tt(e,r){let o=null;const i=[];let l=null,c=me.box([]),m=me.box([],{deep:!1}),f=me.box([],{deep:!1});const p=r.rootLayer.children,d=p.find(t=>t.name===WF_POINTS_LAYER_NAME),x=p.find(t=>t.name===WF_CURRENT_POSITION_NAME),y=p.find(t=>t.name===WF_LINES_LAYER_NAME),n=p.find(t=>t.name===WF_TRAIL_LAYER_NAME),u=p.find(t=>t.name===WF_LINES_ANIMATED_LAYER_NAME),R=je(Ae?.properties?.config?.snapThreshold)||Qe,E=Je({thresholdInMeters:R,gpsConfig:Ae?.properties?.config});let M=[];const I=a.fp.icons.get("destination");I?(I.id="destination",G=V(I,ae,ae,_)):G=We(_,Ve.hex()),A=Z(G,b(0,0,G.width,G.height),{hidden:!0});const S=a.fp.icons.get("departure");S?(S.id="departure",$=V(S,ae,ae,_)):$=xe(_,pe.hex()),k=Z($,b(0,0,$.width,$.height),{hidden:!0}),K=xe(_,pe.hex()),K.id="current-location",z=Z(K,b(0,0,K.width,K.height),{hidden:!0,origin:[.5,.5]});const w=a.fp.icons.get("transition");w?(w.id="transition",Se=V(w,34,34,_)):Se=xe(_,pe.hex());const Y=a.fp.icons.get("transition_up");Y&&(Y.id="transition_up",Ne=V(Y,56,34,_));const T=a.fp.icons.get("transition_down");T&&(T.id="transition_down",Ce=V(T,56,34,_));const D=a.fp.icons.get("direction");D?(D.id="direction",j=V(D,ae,ae,_)):j=_e(_,pe.hex()),W=Z(j,b(0,0,j.width,j.height),{hidden:!0});const U=a.fp.icons.get("yah");U?te=V(U,fe(64,32),fe(90,32),_):te=qe(_,"#ff4343"),te.id="current-location-2",J=Z(te,b(0,0,te.width,te.height),{hidden:!0,origin:[.5,1]}),ce=Ue(4,ue("#b5b7bc").hex());function X(t=null){const h=a.layerStore.visible.map(s=>s.name);if(H=[],c.set([]),t||(F=[]),h.length&&g.selectedRoute?.from?.rect&&g.selectedRoute?.to?.rect){let s=g.selectedRoute.from,L=g.selectedRoute.to;if(!F.length&&!t&&(F=ze(s,L,a.routeStore.onlyAccessible,g.selectedRoute.waypoints)),!F.length){if(a.routeStore.updateRoute(F),a.routeStore.updateRouteDistance(0),s.name!==L.name)throw new Error(`Route not found. From: ${s.name} to: ${L.name}`);return}const{rect:N,lines:P,addTrailPoints:v}=et();P.length&&(nt(e.scale),it(e.scale,m),Fe(e,n,!v)),M=P,ye(),N&&(g.moveToRect=N)}else k.hidden=!0,A.hidden=!0;a.routeStore.updateRoute(F.filter(s=>!s.virtual)),c.get()||(k.hidden=!0,A.hidden=!0)}function B(){const t=a.routeStore.currentPosition,h=t?.angle?Me(t.angle):null,s=a.routeStore.currentRouteLayer?.name,L=F.filter(C=>a.layerStore.mode==ve.Default?!0:a.layerStore.layers.find(Be=>Be.name==s&&s===C.p0.layer)?.visible).filter(C=>!C.virtual);if(g.kioskData&&g.selectedRoute?.from){const C=a.routeStore.currentRouteLayer;k.hidden=g.selectedRoute?.from?.entity?.type==="route-cut-in"&&C?.name===g.selectedRoute?.from?.layer?.name,A.hidden=g.selectedRoute?.to?.entity?.type==="route-cut-in"&&C?.name===g.selectedRoute?.to?.layer?.name}if(t){const C=Pe.findLayer(t.z)?.visible??!0;a.routeStore.iconType===0||g.selectedRoute?.from&&g.selectedRoute?.to?(J.hidden=!0,z.hidden=!C,z.dim=!C,z.bounds=b(t.x,t.y,K.width,K.height,e.scale),h!=null?(z.hidden=!0,W.hidden=!C,W.dim=!C,W.bounds=b(t.x,t.y,j.width,j.height,e.scale,h)):W.hidden=!0):(z.hidden=!0,W.hidden=!0,J.dim=!C,J.hidden=!C,J.bounds=b(t.x,t.y,te.width,te.height,e.scale))}else z.hidden=!0,J.hidden=!0,W.hidden=!0,Q(),ye();if(!t||!H.length){ee(e,W,z,J);return}const N=g.selectedRoute?.to,P=g.selectedRoute?.from,v=new he(P?.layer?.name,k.bounds.center.x,k.bounds.center.y),ne=new he(N?.layer?.name,A.bounds.center.x,A.bounds.center.y),le=Ke(t,L,{snapThreshold:E,fromPoint:v,toPoint:ne,fromRect:P?.rect,toRect:N?.rect}),oe=le.snapped?le.snappedPoint:t;ye(le),W.bounds=b(oe.x,oe.y,j.width,j.height,e.scale,h),z.bounds=b(oe.x,oe.y,K.width,K.height,e.scale,h),ee(e,W,z,J)}function se(){const t=[W,z,J];x.children=t,t.forEach(h=>de(h)),ee(e,x)}function q(t=!1){const h=[k,A,...m.get(),...f.get()];t&&(De(!0),n.children=[],h.forEach(s=>{s.source.id.includes("kiosk")||(s.hidden=!0)})),d.children=h,ee(e,d,n)}function Q(t,h){const s=F.filter(ne=>!ne.virtual),L=ge(s);if(!t?.snapped){a.routeStore.updateRouteDistance(L);return}const N=g.selectedRoute?.to,P=ge(h);let v;if(t.snappedPoint?.layer===N?.layer?.name||N?.layer?.name===a.routeStore.currentRouteLayer?.name)v=P;else if(t.snappedPoint?.layer!==N?.layer?.name&&t.snappedPoint?.layer===a.routeStore.currentRouteLayer?.name){const ne=s.filter(oe=>oe.p0.layer!==t?.snappedPoint?.layer&&oe.p1.layer!==t?.snappedPoint?.layer),le=ge(ne);v=P+le}v&&a.routeStore.updateRouteDistance(v)}function ye(t){const h=g.selectedRoute?.from,s=g.selectedRoute?.to;if(!h||!s)return;const L=st(F,M,new he(h?.layer?.name,h?.rect.cx,h?.rect.cy),new he(s?.layer?.name,s?.rect.cx,s?.rect.cy));if(!t?.snapped){const v=L.map(ne=>Re(ne,Te));a.routeStore.currentPosition&&a.routeStore.currentRouteLayer&&a.routeStore.currentPosition?.z?.toString()===a.routeStore.currentRouteLayer?.name.toString()&&Q(),Le([],v);return}const{passed:N,remaining:P}=Ge(L,t.snappedPoint);P.length&&(P[0]={...P[0],p0:t.snappedPoint}),Q(t,P),Le(N.map(v=>Re(v,"#B5B7BC")),P.map(v=>Re(v,Te)))}const de=(t,h)=>{e.ptScaleHandlers.push({fn:s=>(t.hidden||(t.bounds=b(t.bounds.center.x,t.bounds.center.y,t.source.width,t.source.height,s,t.bounds.rotation)),t),name:h})},we=(t,h)=>{e.rollHandlers.push({fn:s=>{const L=Xe(s,t.bounds.rotation);return L!==void 0&&(t.bounds.rotation=t.bounds.rotation+L),t},name:h})};function De(t){o&&(o(),o=null),u.children=[],t&&(y.children=[]),ee(e,u,y)}function Le(t=[],h=[]){o&&(o(),o=null),y.children=[...t,...h];const s=h.map(L=>({...L,color:Ze}));o=$e(s,(L,N,P)=>{if(P)u.children=[];else{const v=s.slice(0,N);u.children=[...v,L]}ee(e,u)},()=>e.scale),ee(e,y)}i.push(re(()=>[a.layerStore.layersLoaded],()=>{X(),B(),q()}));const He=re(()=>[a.routeStore.currentRouteLayer,g.getRouteNextFloor],()=>{a.layerStore.layersLoaded&&(l!==null&&clearTimeout(l),l=setTimeout(()=>{X(a.routeStore.currentRouteLayer),B(),q(),l=null},0))});i.push(()=>{l!==null&&(clearTimeout(l),l=null),He()}),i.push(re(()=>[g.selectedRoute,a.routeStore.onlyAccessible],()=>{X(),B(),q(!g.selectedRoute)})),i.push(re(()=>a.routeStore.currentPosition,()=>{B(),q()})),i.push(re(()=>m.get(),t=>{const h="transitionPoints";e.ptScaleHandlers=e.ptScaleHandlers.filter(s=>s.name!==h),t.length&&t.forEach(s=>{de(s,h),we(s,h)})})),i.push(re(()=>[f.get()],()=>{const t=f.get(),h="kioskArrows";e.ptScaleHandlers=e.ptScaleHandlers.filter(s=>s.name!==h),t.length&&t.forEach(s=>de(s,h))})),i.push(re(()=>[g.kioskData,Pe.floors.find(t=>t.active),g.selectedRoute],([t,h])=>{f.set([]);const s=ke()?t?.z===h?.name:!0;t&&s&&at(t,{skipdim:!0,visible:!0,pixelRatio:_},e.scale,f),q()})),[k,A].forEach(t=>{de(t),we(t)}),q(),B(),se();function Ye(){o&&(o(),o=null),i.forEach(t=>t()),i.length=0}return Ye}function nt(e){const r=a.routeStore.currentRouteLayer?.name,o=H;let i=g.selectedRoute?.from,l=g.selectedRoute?.to;const c=g.selectedRoute?.waypoints;if(i?.entity.type==="route-cut-in"&&(i=null),l?.entity.type==="route-cut-in"&&(l=null),!o.length)return;const m=[{key:"sourceLocation",rect:i?.rect,index:void 0},{key:"destinationLocation",rect:l?.rect,index:void 0}];c&&m.push(...c?.map((y,n)=>({key:`waypoint-${y.externalId}`,index:n,rect:y.rect})));const f=r?O(r,i?.layer?.name):!0,p=r?O(r,l?.layer?.name):!0;let d=!1,x=!1;o.forEach(({x:y,y:n})=>{for(const{key:u,rect:R,index:E}of m)if(R?.containsPoint(y,n)){u==="sourceLocation"&&(k.bounds=b(y,n,$.width,$.height,e),k.hidden=!f,k.dim=!f,d=f),u==="destinationLocation"&&(A.bounds=b(y,n,G.width,G.height,e),A.hidden=!p,A.dim=!p,x=p);break}}),d||(k.bounds=b(o[o.length-1].x,o[o.length-1].y,$.width,$.height,e),k.hidden=!1,k.dim=!1),x||(A.bounds=b(o[0].x,o[0].y,G.width,G.height,e),A.hidden=!p,A.dim=!p)}function ot(){const{from:e,to:r}=a.uiState.selectedRoute||{},o="route-cut-in";return e&&e?.entity.type===o||r&&r?.entity.type===o?a.routeStore.defaultFrom:null}function rt(e,r){if(!e||!r.length)return r;const o=r.reduce((i,l,c)=>Ee(e,l)<Ee(e,r[i])?c:i,0);return o<=r.length/2?r.slice(o):r.slice(0,o)}function it(e,r){const o=a.routeStore.currentRouteLayer?.name,i=g.getRouteNextFloor,l=a.layerStore.floors.map(n=>n.name),c=(n,u)=>n.findIndex(R=>O(R,u)),m=c(l,o),f=c(l,i),p=f!==-1,d=F.filter(n=>o?n.virtual&&(O(n.p0.layer,o)||O(n.p1.layer,o))&&(O(n.p0.layer,i)||O(n.p1.layer,i)):n.virtual).flatMap(n=>[n.p0,n.p1]),x=[];let y;d.forEach(n=>{if(i&&!O(n.layer,i)&&(p&&f>m&&a.fp.icons.get("transition_up")?y=Ce:p&&f<m&&a.fp.icons.get("transition_down")?y=Ne:y=Se),y){const u=O(o,n.layer),R=b(n.x,n.y,y.width,y.height,e),E=Z(y,R,{hidden:!u,dim:!1});x.push(E)}}),r.set(x)}function at(e,r,o=1,i){if(!e)return;const l=a.fp.icons.get("kiosk");l.id="kiosk";let c;if(l){const f=e?.iconSizePercent?e.iconSizePercent/100:1,p=55;c=V(l,fe(199*f,p),fe(152*f,p),_)}else c=_e(_,ue("#ee4422").hex());const m=Z(c,b(e.x,e.y,c.width,c.height,o,Me(e.heading||0)),{hidden:!r.visible,dim:!r.skipdim});i.set([...i.get(),m])}function fe(e,r){return e*(1-r/100)}function Fe(e,r,o=!1){e.ptScaleHandlers=e.ptScaleHandlers.filter(E=>E.name!==r.name);let i=H.length-1;if(g.selectedRoute?.to?.entity.type==="route-cut-in"&&(i=0),o){be=[],r.children=[],ee(e,r);return}const l=e.scale,c=H[i],m=ie?.destination;if(!c||!m)return;const f=ce.width,p=splitPolyLine([{p0:c,p1:m}],f*2*l);if(p.length<2)return;const d=m.x-c.x,x=m.y-c.y,y=Math.hypot(d,x),n={x:(c.x+m.x)/2,y:(c.y+m.y)/2-y*.2},u=[c,n,m],R=p.map((E,M,I)=>{const S=(M+1)/(I.length+1),w=Ie(u,S);return Z(ce,b(w.x,w.y,ce.width,ce.height,l),{hidden:!1,dim:!1})})||[];return r.children=R,e.ptScaleHandlers.push({fn:E=>{e.scale=E;const M=Fe(e,r)||[];return r.children=M,be=M,r},name:r.name}),be=R,R}function Ie(e,r){if(e.length===1)return e[0];const o=[];for(let i=0;i<e.length-1;i++){const l=(1-r)*e[i].x+r*e[i+1].x,c=(1-r)*e[i].y+r*e[i+1].y;o.push({x:l,y:c})}return Ie(o,r)}export function splitPolyLine(e,r){if(e.length===0)return[];const o=[];let i=0;for(let f=0;f<e.length;f++){const p=e[f],d=p.p0,x=p.p1,y=x.x-d.x,n=x.y-d.y,u=Math.sqrt(y*y+n*n);if(u===0)continue;const R=y/u,E=n/u;let M=0;for(;i+M*r<=u;){const w=i+M*r,Y=d.x+R*w,T=d.y+E*w;o.push({x:Y,y:T}),M++}const I=i+(M-1)*r;let S=u-I;if(S=Math.max(S,0),f<e.length-1){const w=e[f+1],Y=w.p0,T=w.p1,D=T.x-Y.x,U=T.y-Y.y,X=Math.sqrt(D*D+U*U);if(X===0)i=0;else{const B=D/X,se=U/X,q=R*B+E*se,Q=S*q;i=r-Q}}else i=r-S;i=Math.max(i,0)}const l=e[0].p0;(o.length===0||!o[0]||o[0].x!==l.x||o[0].y!==l.y)&&o.unshift(l);const c=e[e.length-1].p1,m=o[o.length-1];return(o.length===0||!m||m.x!==c.x||m.y!==c.y)&&o.push(c),o}function st(e,r,o,i){if(!r.length)return r;const l=new Array(e.length);let c=0;for(let n=0;n<e.length;n++){const u=e[n],R=Math.hypot(u.p1.x-u.p0.x,u.p1.y-u.p0.y);l[n]=R,c+=R}const m=n=>n?String(n):null;function f(n){let u=0,R=1/0,E=1/0;const M=m(n.layer);for(let I=0;I<e.length;I++){const S=e[I],w=l[I],Y=m(S.p0.layer);if(!(M===null||Y===null||Y===M)){u+=w;continue}const T=S.p1.x-S.p0.x,D=S.p1.y-S.p0.y,U=T*T+D*D;if(U===0){u+=w;continue}const X=((n.x-S.p0.x)*T+(n.y-S.p0.y)*D)/U,B=Math.max(0,Math.min(1,X)),se=S.p0.x+T*B,q=S.p0.y+D*B,Q=Math.hypot(n.x-se,n.y-q);Q<R&&(R=Q,E=u+w*B),u+=w}return{found:E!==1/0,fromStart:E,total:c}}const p=f(o),d=p.found?p:f(i);if(!d.found)return r;const x=d.fromStart,y=d.total-d.fromStart;return(p.found?y<x:x<y)?r.slice().reverse().map(n=>({...n,p0:n.p1,p1:n.p0})):r}
1
+ import ft from"color";import{observable as pt,reaction as rt}from"mobx";import{lineLength as bt}from"simple-geometry";import Ot from"../../../../core/Rect";import r,{layersStore as vt,uiState as g}from"../../../../store";import{LayersMode as Ct}from"../../../../store/LayerStore";import{getGraphLines as kt,getRouteLength as gt,RoutePoint as ht}from"../../../../utils/wayfinding";import{strEqual as O}from"../../../../utils/strEqual";import{createArrowCurrentCanvas as It,createCurrentCanvas as xt,createImageCanvas as V,createTargetCanvas as Wt,createYahCanvas as qt}from"./canvases";import{toRadians as Et}from"../../../../utils/toRadians";import{areLayersEnabled as Tt}from"../../../../utils/areLayersEnabled";import{createImageDef as Z,createLineDef as Rt,updateRenderer as tt,createCircleCanvas as Ut,getBounds as w,getRotation as Xt}from"./engine-core";import{animateLineSegments as $t}from"./engine-core/animation";import{splitRouteByPoint as Gt,snapPositionToRoute as Kt,getThresholdSafe as jt,getThresholdFromMetersToSvg as Jt,SNAP_THRESHOLD_METERS as Qt}from"./route-snapping";import{fpGeo as At}from"../../../Mapbox/utils/fpGeo";const C=devicePixelRatio;let z=[],st=null,F=[],yt=ft("#00A2FF"),Vt=ft("#FF9F06"),_t="#A4CCE2",Zt="#0794EA";const at=34;let $,G,K,j,et,Lt,Dt,Mt,dt,T,A,k,W,J,St=[];function te(){z=[];const t=r.routeStore.currentRouteLayer?.name;st=oe();const o=st&&(Tt()?O(t,st.destination?.layer):!0);if(st){const d=st?.routePoint;d&&O(t,d.layer)&&(z=ie(d,z))}let n=[],i=[];for(let d=0;d<F.length;d++){let L=F[d],m=r.layerStore.mode==Ct.Default?!0:r.layerStore.layers.find(a=>a.name==t&&t===L.p0.layer)?.visible||!1;!L.virtual&&m&&n.push(L),(L.virtual||!m||d===F.length-1)&&n.length&&(i=n.map(({p0:a,p1:s})=>(z.push({x:a.x,y:a.y},{x:s.x,y:s.y}),{p0:a,p1:s})))}z.length||(A.hidden=!0,T.hidden=!0);let l=1e6,u=1e6,p=0,y=0;z.forEach(d=>{d.x<l&&(l=d.x),d.y<u&&(u=d.y),d.x>p&&(p=d.x),d.y>y&&(y=d.y)});const h=Ot.fromX1y1x2y2(l,u,p,y);return{rect:z.length&&(h.w||h.h)?h.withPadding(h.w,h.h):null,lines:i,addTrailPoints:o}}export const WF_TRAIL_LAYER_NAME="wf-trail-points",WF_POINTS_LAYER_NAME="wf-points",WF_CURRENT_POSITION_NAME="wf-current-position",WF_LINES_LAYER_NAME="wf-lines",WF_LINES_ANIMATED_LAYER_NAME="wf-lines-animated";export default function ee(t,o){let n=null;const i=[];let l=null,u=pt.box([]),p=pt.box([],{deep:!1}),y=pt.box([],{deep:!1});const h=o.rootLayer.children,d=h.find(e=>e.name===WF_POINTS_LAYER_NAME),L=h.find(e=>e.name===WF_CURRENT_POSITION_NAME),m=h.find(e=>e.name===WF_LINES_LAYER_NAME),a=h.find(e=>e.name===WF_TRAIL_LAYER_NAME),s=h.find(e=>e.name===WF_LINES_ANIMATED_LAYER_NAME),x=jt(At?.properties?.config?.snapThreshold)||Qt,S=Jt({thresholdInMeters:x,gpsConfig:At?.properties?.config});let P=[];const q=r.fp.icons.get("destination");q?(q.id="destination",G=V(q,at,at,C)):G=Wt(C,Vt.hex()),A=Z(G,w(0,0,G.width,G.height),{hidden:!0});const I=r.fp.icons.get("departure");I?(I.id="departure",$=V(I,at,at,C)):$=xt(C,yt.hex()),T=Z($,w(0,0,$.width,$.height),{hidden:!0}),K=xt(C,yt.hex()),K.id="current-location",k=Z(K,w(0,0,K.width,K.height),{hidden:!0,origin:[.5,.5]});const R=r.fp.icons.get("transition");R?(R.id="transition",Lt=V(R,34,34,C)):Lt=xt(C,yt.hex());const D=r.fp.icons.get("transition_up");D&&(D.id="transition_up",Dt=V(D,56,34,C));const Y=r.fp.icons.get("transition_down");Y&&(Y.id="transition_down",Mt=V(Y,56,34,C));const Q=r.fp.icons.get("direction");Q?(Q.id="direction",j=V(Q,at,at,C)):j=It(C,yt.hex()),W=Z(j,w(0,0,j.width,j.height),{hidden:!0});const B=r.fp.icons.get("yah");B?et=V(B,mt(64,32),mt(90,32),C):et=qt(C,"#ff4343"),et.id="current-location-2",J=Z(et,w(0,0,et.width,et.height),{hidden:!0,origin:[.5,1]}),dt=Ut(4,ft("#b5b7bc").hex());function N(e=null){const f=r.layerStore.visible.map(c=>c.name);if(z=[],u.set([]),e||(F=[]),f.length&&g.selectedRoute?.from?.rect&&g.selectedRoute?.to?.rect){let c=g.selectedRoute.from,_=g.selectedRoute.to;if(!F.length&&!e&&(F=kt(c,_,r.routeStore.onlyAccessible,g.selectedRoute.waypoints)),!F.length){if(r.routeStore.updateRoute(F),r.routeStore.updateRouteDistance(0),c.name!==_.name)throw new Error(`Route not found. From: ${c.name} to: ${_.name}`);return}const{rect:E,lines:b,addTrailPoints:v}=te();b.length&&(ne(t.scale),re(t.scale,p),Ft(t,a,!v)),P=b,lt(),E&&(g.moveToRect=E)}else T.hidden=!0,A.hidden=!0;r.routeStore.updateRoute(F.filter(c=>!c.virtual)),u.get()||(T.hidden=!0,A.hidden=!0)}function U(){const e=r.routeStore.currentPosition,f=e?.angle?Et(e.angle):null,c=r.routeStore.currentRouteLayer?.name,_=F.filter(M=>r.layerStore.mode==Ct.Default?!0:r.layerStore.layers.find(Bt=>Bt.name==c&&c===M.p0.layer)?.visible).filter(M=>!M.virtual);if(g.kioskData&&g.selectedRoute?.from){const M=r.routeStore.currentRouteLayer;T.hidden=g.selectedRoute?.from?.entity?.type==="route-cut-in"&&M?.name===g.selectedRoute?.from?.layer?.name,A.hidden=g.selectedRoute?.to?.entity?.type==="route-cut-in"&&M?.name===g.selectedRoute?.to?.layer?.name}if(e){const M=vt.findLayer(e.z)?.visible??!0;r.routeStore.iconType===0||g.selectedRoute?.from&&g.selectedRoute?.to?(J.hidden=!0,k.hidden=!M,k.dim=!M,k.bounds=w(e.x,e.y,K.width,K.height,t.scale),f!=null?(k.hidden=!0,W.hidden=!M,W.dim=!M,W.bounds=w(e.x,e.y,j.width,j.height,t.scale,f)):W.hidden=!0):(k.hidden=!0,W.hidden=!0,J.dim=!M,J.hidden=!M,J.bounds=w(e.x,e.y,et.width,et.height,t.scale))}else k.hidden=!0,J.hidden=!0,W.hidden=!0,nt(),lt();if(!e||!z.length){tt(t,W,k,J);return}const E=g.selectedRoute?.to,b=g.selectedRoute?.from,v=new ht(b?.layer?.name,T.bounds.center.x,T.bounds.center.y),X=new ht(E?.layer?.name,A.bounds.center.x,A.bounds.center.y),ut=Kt(e,_,{snapThreshold:S,fromPoint:v,toPoint:X,fromRect:b?.rect,toRect:E?.rect}),it=ut.snapped?ut.snappedPoint:e;lt(ut),W.bounds=w(it.x,it.y,j.width,j.height,t.scale,f),k.bounds=w(it.x,it.y,K.width,K.height,t.scale,f),tt(t,W,k,J)}function ct(){const e=[W,k,J];L.children=e,e.forEach(f=>ot(f)),tt(t,L)}function H(e=!1){const f=[T,A,...p.get(),...y.get()];e&&(Ht(!0),a.children=[],f.forEach(c=>{c.source.id.includes("kiosk")||(c.hidden=!0)})),d.children=f,tt(t,d,a)}function nt(e,f){const c=F.filter(X=>!X.virtual),_=gt(c);if(!e?.snapped){r.routeStore.updateRouteDistance(_);return}const E=g.selectedRoute?.to,b=gt(f);let v;if(e.snappedPoint?.layer===E?.layer?.name||E?.layer?.name===r.routeStore.currentRouteLayer?.name)v=b;else if(e.snappedPoint?.layer!==E?.layer?.name&&e.snappedPoint?.layer===r.routeStore.currentRouteLayer?.name){const X=c.filter(it=>it.p0.layer!==e?.snappedPoint?.layer&&it.p1.layer!==e?.snappedPoint?.layer),ut=gt(X);v=b+ut}v&&r.routeStore.updateRouteDistance(v)}function lt(e){const f=g.selectedRoute?.from,c=g.selectedRoute?.to;if(!f||!c)return;const _=ae(F,P,new ht(f?.layer?.name,f?.rect.cx,f?.rect.cy),new ht(c?.layer?.name,c?.rect.cx,c?.rect.cy));if(!e?.snapped){const v=_.map(X=>Rt(X,_t));r.routeStore.currentPosition&&r.routeStore.currentRouteLayer&&r.routeStore.currentPosition?.z?.toString()===r.routeStore.currentRouteLayer?.name.toString()&&nt(),Pt([],v);return}const{passed:E,remaining:b}=Gt(_,e.snappedPoint);b.length&&(b[0]={...b[0],p0:e.snappedPoint}),nt(e,b),Pt(E.map(v=>Rt(v,"#B5B7BC")),b.map(v=>Rt(v,_t)))}const ot=(e,f)=>{t.ptScaleHandlers.push({fn:c=>(e.hidden||(e.bounds=w(e.bounds.center.x,e.bounds.center.y,e.source.width,e.source.height,c,e.bounds.rotation)),e),name:f})},wt=(e,f)=>{t.rollHandlers.push({fn:c=>{const _=Xt(c,e.bounds.rotation);return _!==void 0&&(e.bounds.rotation=e.bounds.rotation+_),e},name:f})};function Ht(e){n&&(n(),n=null),s.children=[],e&&(m.children=[]),tt(t,s,m)}function Pt(e=[],f=[]){n&&(n(),n=null),m.children=[...e,...f];const c=f.map(E=>({...E,color:Zt}));n=$t(c,(E,b,v)=>{if(v)s.children=[];else{const X=c.slice(0,b);s.children=[...X,E]}tt(t,s)},()=>t.scale),tt(t,m)}i.push(rt(()=>[r.layerStore.layersLoaded],()=>{N(),U(),H()}));const zt=rt(()=>[r.routeStore.currentRouteLayer,g.getRouteNextFloor],()=>{r.layerStore.layersLoaded&&(l!==null&&clearTimeout(l),l=setTimeout(()=>{N(r.routeStore.currentRouteLayer),U(),H(),l=null},0))});i.push(()=>{l!==null&&(clearTimeout(l),l=null),zt()}),i.push(rt(()=>[g.selectedRoute,r.routeStore.onlyAccessible],()=>{N(),U(),H(!g.selectedRoute)})),i.push(rt(()=>r.routeStore.currentPosition,()=>{U(),H()})),i.push(rt(()=>p.get(),e=>{const f="transitionPoints";t.ptScaleHandlers=t.ptScaleHandlers.filter(c=>c.name!==f),e.length&&e.forEach(c=>{ot(c,f),wt(c,f)})})),i.push(rt(()=>[y.get()],()=>{const e=y.get(),f="kioskArrows";t.ptScaleHandlers=t.ptScaleHandlers.filter(c=>c.name!==f),e.length&&e.forEach(c=>ot(c,f))})),i.push(rt(()=>[g.kioskData,vt.floors.find(e=>e.active),g.selectedRoute],([e,f])=>{y.set([]);const c=Tt()?e?.z===f?.name:!0;e&&c&&se(e,{skipdim:!0,visible:!0,pixelRatio:C},t.scale,y),H()})),[T,A].forEach(e=>{ot(e),wt(e)}),H(),U(),ct();function Yt(){n&&(n(),n=null),i.forEach(e=>e()),i.length=0}return Yt}function ne(t){const o=r.routeStore.currentRouteLayer?.name,n=z;let i=g.selectedRoute?.from,l=g.selectedRoute?.to;const u=g.selectedRoute?.waypoints;if(i?.entity.type==="route-cut-in"&&(i=null),l?.entity.type==="route-cut-in"&&(l=null),!n.length)return;const p=[{key:"sourceLocation",rect:i?.rect,index:void 0},{key:"destinationLocation",rect:l?.rect,index:void 0}];u&&p.push(...u?.map((m,a)=>({key:`waypoint-${m.externalId}`,index:a,rect:m.rect})));const y=o?O(o,i?.layer?.name):!0,h=o?O(o,l?.layer?.name):!0;let d=!1,L=!1;n.forEach(({x:m,y:a})=>{for(const{key:s,rect:x,index:S}of p)if(x?.containsPoint(m,a)){s==="sourceLocation"&&(T.bounds=w(m,a,$.width,$.height,t),T.hidden=!y,T.dim=!y,d=y),s==="destinationLocation"&&(A.bounds=w(m,a,G.width,G.height,t),A.hidden=!h,A.dim=!h,L=h);break}}),d||(T.bounds=w(n[n.length-1].x,n[n.length-1].y,$.width,$.height,t),T.hidden=!1,T.dim=!1),L||(A.bounds=w(n[0].x,n[0].y,G.width,G.height,t),A.hidden=!h,A.dim=!h)}function oe(){const{from:t,to:o}=r.uiState.selectedRoute||{},n="route-cut-in";return t&&t?.entity.type===n||o&&o?.entity.type===n?r.routeStore.defaultFrom:null}function ie(t,o){if(!t||!o.length)return o;const n=o.reduce((i,l,u)=>bt(t,l)<bt(t,o[i])?u:i,0);return n<=o.length/2?o.slice(n):o.slice(0,n)}function re(t,o){const n=r.routeStore.currentRouteLayer?.name,i=g.getRouteNextFloor,l=r.layerStore.floors.map(a=>a.name),u=(a,s)=>a.findIndex(x=>O(x,s)),p=u(l,n),y=u(l,i),h=y!==-1,d=F.filter(a=>n?a.virtual&&(O(a.p0.layer,n)||O(a.p1.layer,n))&&(O(a.p0.layer,i)||O(a.p1.layer,i)):a.virtual).flatMap(a=>[a.p0,a.p1]),L=[];let m;d.forEach(a=>{if(i&&!O(a.layer,i)&&(h&&y>p&&r.fp.icons.get("transition_up")?m=Mt:h&&y<p&&r.fp.icons.get("transition_down")?m=Dt:m=Lt),m){const s=O(n,a.layer),x=w(a.x,a.y,m.width,m.height,t),S=Z(m,x,{hidden:!s,dim:!1});L.push(S)}}),o.set(L)}function se(t,o,n=1,i){if(!t)return;const l=r.fp.icons.get("kiosk");l.id="kiosk";let u;if(l){const y=t?.iconSizePercent?t.iconSizePercent/100:1,h=55;u=V(l,mt(199*y,h),mt(152*y,h),C)}else u=It(C,ft("#ee4422").hex());const p=Z(u,w(t.x,t.y,u.width,u.height,n,Et(t.heading||0)),{hidden:!o.visible,dim:!o.skipdim});i.set([...i.get(),p])}function mt(t,o){return t*(1-o/100)}function Ft(t,o,n=!1){t.ptScaleHandlers=t.ptScaleHandlers.filter(S=>S.name!==o.name);let i=z.length-1;if(g.selectedRoute?.to?.entity.type==="route-cut-in"&&(i=0),n){St=[],o.children=[],tt(t,o);return}const l=t.scale,u=z[i],p=st?.destination;if(!u||!p)return;const y=dt.width,h=splitPolyLine([{p0:u,p1:p}],y*2*l);if(h.length<2)return;const d=p.x-u.x,L=p.y-u.y,m=Math.hypot(d,L),a={x:(u.x+p.x)/2,y:(u.y+p.y)/2-m*.2},s=[u,a,p],x=h.map((S,P,q)=>{const I=(P+1)/(q.length+1),R=Nt(s,I);return Z(dt,w(R.x,R.y,dt.width,dt.height,l),{hidden:!1,dim:!1})})||[];return o.children=x,t.ptScaleHandlers.push({fn:S=>{t.scale=S;const P=Ft(t,o)||[];return o.children=P,St=P,o},name:o.name}),St=x,x}function Nt(t,o){if(t.length===1)return t[0];const n=[];for(let i=0;i<t.length-1;i++){const l=(1-o)*t[i].x+o*t[i+1].x,u=(1-o)*t[i].y+o*t[i+1].y;n.push({x:l,y:u})}return Nt(n,o)}export function splitPolyLine(t,o){if(t.length===0)return[];const n=[];let i=0;for(let y=0;y<t.length;y++){const h=t[y],d=h.p0,L=h.p1,m=L.x-d.x,a=L.y-d.y,s=Math.sqrt(m*m+a*a);if(s===0)continue;const x=m/s,S=a/s;let P=0;for(;i+P*o<=s;){const R=i+P*o,D=d.x+x*R,Y=d.y+S*R;n.push({x:D,y:Y}),P++}const q=i+(P-1)*o;let I=s-q;if(I=Math.max(I,0),y<t.length-1){const R=t[y+1],D=R.p0,Y=R.p1,Q=Y.x-D.x,B=Y.y-D.y,N=Math.sqrt(Q*Q+B*B);if(N===0)i=0;else{const U=Q/N,ct=B/N,H=x*U+S*ct,nt=I*H;i=o-nt}}else i=o-I;i=Math.max(i,0)}const l=t[0].p0;(n.length===0||!n[0]||n[0].x!==l.x||n[0].y!==l.y)&&n.unshift(l);const u=t[t.length-1].p1,p=n[n.length-1];return(n.length===0||!p||p.x!==u.x||p.y!==u.y)&&n.push(u),n}function ae(t,o,n,i){if(!o.length)return o;const l=new Array(t.length);let u=0;for(let s=0;s<t.length;s++){const x=t[s],S=Math.hypot(x.p1.x-x.p0.x,x.p1.y-x.p0.y);l[s]=S,u+=S}const p=s=>s?String(s):null;function y(s){let x=0,S=1/0,P=1/0;const q=p(s.layer);for(let I=0;I<t.length;I++){const R=t[I],D=l[I],Y=p(R.p0.layer);if(!(q===null||Y===null||Y===q)){x+=D;continue}const B=R.p1.x-R.p0.x,N=R.p1.y-R.p0.y,U=B*B+N*N;if(U===0){x+=D;continue}const ct=((s.x-R.p0.x)*B+(s.y-R.p0.y)*N)/U,H=Math.max(0,Math.min(1,ct)),nt=R.p0.x+B*H,lt=R.p0.y+N*H,ot=Math.hypot(s.x-nt,s.y-lt);ot<S&&(S=ot,P=x+D*H),x+=D}return{found:P!==1/0,fromStart:P,total:u}}const h=y(n),d=h.found?h:y(i);if(!d.found)return o;const L=d.fromStart,m=d.total-d.fromStart;return(h.found?m<L:L<m)?o.slice().reverse().map(s=>({...s,p0:s.p1,p1:s.p0})):o}
@@ -1 +1 @@
1
- import{Point as s}from"simple-geometry";import r from"../../../../store";import{getYah as h}from"../../../../utils/yah";export default function a(){let t=h();const e=window.location.search.length>1?decodeURIComponent(window.location.search.substring(1)):"";if(!t&&e.startsWith("route")){const o=e.split(":").find(n=>n.startsWith("yah_"));o&&(t=o)}const i=Array.isArray(t)||!1;return r.routeStore.defaultFrom=i?r.boothStore.getBoothAtPoint(new s(t[0],t[1])):r.boothStore.booths.find(o=>o.name===t),r.boothStore.booths.filter(o=>o.yah).forEach(o=>r.boothStore.booths.splice(r.boothStore.booths.indexOf(o),1)),()=>{}}
1
+ import{Point as n}from"simple-geometry";import r from"../../../../store";import{getYah as s}from"../../../../utils/yah";export default function a(){let t=s();const e=window.location.search.length>1?decodeURIComponent(window.location.search.substring(1)):"";if(!t&&e.startsWith("route")){const o=e.split(":").find(h=>h.startsWith("yah_"));o&&(t=o)}const i=Array.isArray(t)||!1;return r.routeStore.defaultFrom=i?r.boothStore.getBoothAtPoint(new n(t[0],t[1])):r.boothStore.booths.find(o=>o.name===t),r.boothStore.booths.filter(o=>o.yah).forEach(o=>r.boothStore.booths.splice(r.boothStore.booths.indexOf(o),1)),()=>{}}
@@ -1 +1 @@
1
- export function animateLineSegments(l,f,v){let i=0,s=0,o=null,r=null;if(!l.length)return;const m=l.map(t=>{const e=t.points[1].x-t.points[0].x,n=t.points[1].y-t.points[0].y;return Math.sqrt(e*e+n*n)}),M=m.reduce((t,e)=>t+e,0),g=Math.max(20,Math.min(M/2,300));function q(t,e){const n=t.points[0],u=t.points[1],c=u.x-n.x,a=u.y-n.y,b=Math.sqrt(c*c+a*a),d=Math.min(e/b,1);return{points:[{x:n.x,y:n.y},{x:n.x+c*d,y:n.y+a*d}],color:t.color,width:t.width}}function y(t){o||(o=t);const e=(t-o)/1e3;o=t;const n=v(),u=g*Math.sqrt(n);for(s+=u*e;s>=m[i];)s-=m[i],i++,i>=l.length&&(i=0);const c=l[i],a=q(c,s);f(a,i,!1),r=requestAnimationFrame(y)}function x(){h(),i=0,s=0,o=null,r=requestAnimationFrame(y)}function h(){r&&(cancelAnimationFrame(r),r=null,o=null)}function p(){document.visibilityState==="visible"?x():h()}return document.addEventListener("visibilitychange",p),x(),()=>{h(),document.removeEventListener("visibilitychange",p)}}
1
+ export function animateLineSegments(l,f,g){let e=0,s=0,o=null,a=null;if(!l.length)return;const d=l.map(t=>{const i=t.points[1].x-t.points[0].x,n=t.points[1].y-t.points[0].y;return Math.sqrt(i*i+n*n)}),v=d.reduce((t,i)=>t+i,0),b=Math.max(20,Math.min(v/2,300));function M(t,i){const n=t.points[0],u=t.points[1],c=u.x-n.x,r=u.y-n.y,q=Math.sqrt(c*c+r*r),x=Math.min(i/q,1);return{points:[{x:n.x,y:n.y},{x:n.x+c*x,y:n.y+r*x}],color:t.color,width:t.width}}function m(t){o||(o=t);const i=(t-o)/1e3;o=t;const n=g(),u=b*Math.sqrt(n);for(s+=u*i;s>=d[e];)s-=d[e],e++,e>=l.length&&(e=0);const c=l[e],r=M(c,s);f(r,e,!1),a=requestAnimationFrame(m)}function y(){h(),e=0,s=0,o=null,a=requestAnimationFrame(m)}function h(){a&&(cancelAnimationFrame(a),a=null,o=null)}function p(){document.visibilityState==="visible"?y():h()}return document.addEventListener("visibilitychange",p),y(),()=>{h(),document.removeEventListener("visibilitychange",p)}}
@@ -1 +1 @@
1
- import{Rect as g}from"../Rect";const r=new Map;export function createCircleCanvas(a,n){const i=n.toUpperCase();if(!r.has(i)){const t=document.createElement("canvas"),o=a*2*devicePixelRatio+2;t.width=o,t.height=o;const l=t.getContext("2d");l.fillStyle=n,l.beginPath(),l.arc(o/2,o/2,a*devicePixelRatio,0,2*Math.PI),l.fill(),r.set(i,t)}return r.get(i)}const f=new Map;export function createBookmarkCanvas(a,n){const i=a;if(f.has(i))return f.get(i);const t=a,o=t*1.4,l=Math.ceil(t*n),s=Math.ceil(o*n),c=document.createElement("canvas");c.width=l,c.height=s;const e=c.getContext("2d");return e.scale(n,n),e.fillStyle="#fdbf2b",e.strokeStyle="#fff",e.lineWidth=4/n,e.beginPath(),e.moveTo(0,0),e.lineTo(0,o),e.lineTo(t/2,o-t/2),e.lineTo(t,o),e.lineTo(t,0),e.lineTo(0,0),e.fill(),e.stroke(),f.set(i,c),c}export function getBounds(a,n,i,t,o=1,l){const s=i*o,c=t*o,e=s/2,h=c/2,d={x:a-e,y:n-h},u={x:a+e,y:n+h};return new g(d,u,l)}
1
+ import{Rect as v}from"../Rect";const h=new Map;export function createCircleCanvas(o,n){const c=n.toUpperCase();if(!h.has(c)){const e=document.createElement("canvas"),s=o*2*devicePixelRatio+1*2;e.width=s,e.height=s;const i=e.getContext("2d");i.fillStyle=n,i.beginPath(),i.arc(s/2,s/2,o*devicePixelRatio,0,2*Math.PI),i.fill(),h.set(c,e)}return h.get(c)}const r=new Map;export function createBookmarkCanvas(o,n){const c=o;if(r.has(c))return r.get(c);const e=o,a=e*1.4,s=Math.ceil(e*n),i=Math.ceil(a*n),l=document.createElement("canvas");l.width=s,l.height=i;const t=l.getContext("2d");return t.scale(n,n),t.fillStyle="#fdbf2b",t.strokeStyle="#fff",t.lineWidth=4/n,t.beginPath(),t.moveTo(0,0),t.lineTo(0,a),t.lineTo(e/2,a-e/2),t.lineTo(e,a),t.lineTo(e,0),t.lineTo(0,0),t.fill(),t.stroke(),r.set(c,l),l}export function getBounds(o,n,c,e,a=1,s){const i=c*a,l=e*a,t=i/2,d=l/2,f={x:o-t,y:n-d},g={x:o+t,y:n+d};return new v(f,g,s)}
@@ -1,3 +1,3 @@
1
- import{Polygon as f,Rect as a}from"@expofp/renderer";import{createCircleCanvas as s}from"./canvases";import{DEFAULT_FONT_LIGHT_URL as p,DEFAULT_FONT_URL as u}from"./fonts";export function rectToShapeDef(e,r){let n;return e instanceof SVGRectElement&&(n=a.fromSvg(e)),createShapeDef(n,r)}export function meshToShapeDef(e,r){if(!e)throw new Error("Create ShapeDef: mesh is not provided");const n=e.positions.map(i=>({x:i[0],y:Math.abs(i[1])})),t=e.cells,o=new f(n,t);return createShapeDef(o,r)}export function createShapeDef(e,r="#000"){if(!e||!(e instanceof f||e instanceof a))throw new Error("Invalid shape definition");return{shape:e,color:r}}export function createImageDef(e,r,n){if(!e)throw new Error("Image source is not provided");return{source:e,bounds:r,...n}}export function createTextDef(e,r,n,t,o){if(e.length===0)throw new Error("Invalid text lines");return{lines:e,bounds:r,padding:n,alignment:t,...o}}export function createTextDefLines(e,r,n,t=[void 0,void 0]){const[o,i]=e,c=[{text:o.join(`
2
- `),fontUrl:t[0]||u,color:r,fontSize:n}];return i.length&&c.push({text:i.join(`
3
- `),fontUrl:t[1]||p,color:r,fontSize:n}),c}export function createLineDef({p0:e,p1:r},n="#000",t=10){if(!(e?.x&&e.y||r?.x&&r.y))throw new Error("Line data is invalid");return{points:[{x:e.x,y:e.y},{x:r.x,y:r.y}],color:n,width:t}}export function createLayerDef(e,r,n){if(!e)throw new Error("Layer name is required");return r||(r=[]),{name:e,children:r,...n}}export function createSceneDef(e,r,n,t){let o;return r instanceof SVGRectElement?o=a.fromSvg(r):r instanceof a&&(o=r),{rootLayer:createLayerDef("root",e),background:n,viewbox:o,memoryLimit:t}}export function createShapeDot(e,r="#000",n=1.5){const t=s(n,r),o=new a({x:e.center.x-t.width/2,y:e.center.y-t.height/2},{x:e.center.x+t.width/2,y:e.center.y+t.height/2},e.rotation);return createImageDef(t,o)}
1
+ import{Polygon as c,Rect as f}from"@expofp/renderer";import{createCircleCanvas as s}from"./canvases";import{DEFAULT_FONT_LIGHT_URL as u,DEFAULT_FONT_URL as x}from"./fonts";export function rectToShapeDef(e,n){let t;return e instanceof SVGRectElement&&(t=f.fromSvg(e)),createShapeDef(t,n)}export function meshToShapeDef(e,n){if(!e)throw new Error("Create ShapeDef: mesh is not provided");const t=e.positions.map(i=>({x:i[0],y:Math.abs(i[1])})),r=e.cells,o=new c(t,r);return createShapeDef(o,n)}export function createShapeDef(e,n="#000"){if(!e||!(e instanceof c||e instanceof f))throw new Error("Invalid shape definition");return{shape:e,color:n}}export function createImageDef(e,n,t){if(!e)throw new Error("Image source is not provided");return{source:e,bounds:n,...t}}export function createTextDef(e,n,t,r,o){if(e.length===0)throw new Error("Invalid text lines");return{lines:e,bounds:n,padding:t,alignment:r,...o}}export function createTextDefLines(e,n,t,r=[void 0,void 0]){const[o,i]=e,a=[{text:o.join(`
2
+ `),fontUrl:r[0]||x,color:n,fontSize:t}];return i.length&&a.push({text:i.join(`
3
+ `),fontUrl:r[1]||u,color:n,fontSize:t}),a}export function createLineDef({p0:e,p1:n},t="#000",r=10){if(!(e?.x&&e.y||n?.x&&n.y))throw new Error("Line data is invalid");return{points:[{x:e.x,y:e.y},{x:n.x,y:n.y}],color:t,width:r}}export function createLayerDef(e,n,t){if(!e)throw new Error("Layer name is required");return n||(n=[]),{name:e,children:n,...t}}export function createSceneDef(e,n,t,r){let o;return n instanceof SVGRectElement?o=f.fromSvg(n):n instanceof f&&(o=n),{rootLayer:createLayerDef("root",e),background:t,viewbox:o,memoryLimit:r}}export function createShapeDot(e,n="#000",t=1.5){const r=s(t,n),o=new f({x:e.center.x-r.width/2,y:e.center.y-r.height/2},{x:e.center.x+r.width/2,y:e.center.y+r.height/2},e.rotation);return createImageDef(r,o)}
@@ -1 +1 @@
1
- import t from"../../../../../tools/base-runtime-url";export const DEFAULT_FONT_URL=`${t}fonts/oswald-v17-cyrillic_latin-500.woff`,DEFAULT_FONT_LIGHT_URL=`${t}fonts/oswald-v17-cyrillic_latin-300.woff`;export function loadCustomFontsUrls(){const o=window.__data;return o&&o.customCssFonts?.length?o.customCssFonts:[]}
1
+ import o from"../../../../../tools/base-runtime-url";export const DEFAULT_FONT_URL=`${o}fonts/oswald-v17-cyrillic_latin-500.woff`,DEFAULT_FONT_LIGHT_URL=`${o}fonts/oswald-v17-cyrillic_latin-300.woff`;export function loadCustomFontsUrls(){const t=window.__data;return t&&t.customCssFonts?.length?t.customCssFonts:[]}
@@ -1 +1 @@
1
- import{startRenderer as e,updateRenderer as a}from"./renderer";import{rectToShapeDef as s,meshToShapeDef as t,createLayerDef as r,createLineDef as o,createSceneDef as n,createImageDef as p,createShapeDef as f,createTextDefLines as i,createTextDef as l,createShapeDot as c}from"./defs";import{updateLinesScale as D,updateTextDefRotation as m,getRotation as d,shouldFlip as g,getAngleDiff as u,getClampedBoundsCanvas as R,flipAngle as T,updateRectRotation as L}from"./update-def";import{createCircleCanvas as S,createBookmarkCanvas as h,getBounds as x}from"./canvases";import{loadCustomFontsUrls as C,DEFAULT_FONT_URL as F,DEFAULT_FONT_LIGHT_URL as I}from"./fonts";import{isInnerInsideOuter as U,flipImageDef as _}from"./utils/rotation";import{mapRollSetting as A,getRollValue as v}from"./settings";export{e as startRenderer,a as updateRenderer};export{s as rectToShapeDef,t as meshToShapeDef,r as createLayerDef,o as createLineDef,n as createSceneDef,p as createImageDef,f as createShapeDef,l as createTextDef,i as createTextDefLines,c as createShapeDot};export{D as updateLinesScale,m as updateTextDefRotation,d as getRotation,g as shouldFlip,T as flipAngle,u as getAngleDiff,R as getClampedBoundsCanvas};export{S as createCircleCanvas,h as createBookmarkCanvas,x as getBounds};export{C as loadCustomFontsUrls,F as DEFAULT_FONT_URL,I as DEFAULT_FONT_LIGHT_URL};export{U as isInnerInsideOuter,A as mapRollSetting,v as getRollValue,L as updateRectRotation,_ as flipImageDef};
1
+ import{startRenderer as e,updateRenderer as t}from"./renderer";import{rectToShapeDef as r,meshToShapeDef as o,createLayerDef as a,createLineDef as p,createSceneDef as f,createImageDef as i,createShapeDef as m,createTextDefLines as n,createTextDef as l,createShapeDot as c}from"./defs";import{updateLinesScale as s,updateTextDefRotation as D,getRotation as d,shouldFlip as g,getAngleDiff as u,getClampedBoundsCanvas as R,flipAngle as T,updateRectRotation as x}from"./update-def";import{createCircleCanvas as L,createBookmarkCanvas as S,getBounds as h}from"./canvases";import{loadCustomFontsUrls as C,DEFAULT_FONT_URL as F,DEFAULT_FONT_LIGHT_URL as I}from"./fonts";import{isInnerInsideOuter as U,flipImageDef as _}from"./utils/rotation";import{mapRollSetting as A,getRollValue as v}from"./settings";export{e as startRenderer,t as updateRenderer};export{r as rectToShapeDef,o as meshToShapeDef,a as createLayerDef,p as createLineDef,f as createSceneDef,i as createImageDef,m as createShapeDef,l as createTextDef,n as createTextDefLines,c as createShapeDot};export{s as updateLinesScale,D as updateTextDefRotation,d as getRotation,g as shouldFlip,T as flipAngle,u as getAngleDiff,R as getClampedBoundsCanvas};export{L as createCircleCanvas,S as createBookmarkCanvas,h as getBounds};export{C as loadCustomFontsUrls,F as DEFAULT_FONT_URL,I as DEFAULT_FONT_LIGHT_URL};export{U as isInnerInsideOuter,A as mapRollSetting,v as getRollValue,x as updateRectRotation,_ as flipImageDef};
@@ -1 +1 @@
1
- import{Renderer as n}from"@expofp/renderer";export function startRenderer(e,r){if(e){if(!(e instanceof n))throw new Error("Invalid renderer definition");console.log("Create sceneDef",r),e.init(r),e.start()}}export function updateRenderer(e,...r){if(e){if(!(e instanceof n))throw new Error("Invalid renderer definition");e.update(...r)}}
1
+ import{Renderer as i}from"@expofp/renderer";export function startRenderer(t,n){if(t){if(!(t instanceof i))throw new Error("Invalid renderer definition");console.log("Create sceneDef",n),t.init(n),t.start()}}export function updateRenderer(t,...n){if(t){if(!(t instanceof i))throw new Error("Invalid renderer definition");t.update(...n)}}
@@ -1 +1 @@
1
- import{Rect as C}from"@expofp/renderer";import{getBounds as D}from"./canvases";export function updateLinesScale(t,e,n,o=""){let a=!1;return t.forEach((i,r)=>{let s=0;n[r].forEach(({value:u,scaleFactor:x})=>{e<x&&(s=u)}),i.fontSize!==s*e&&(a=!0),i.fontSize=s*e}),a}export function updateTextDefRotation(t,e){const n=t.bounds.size;return t.bounds.rotation+=e,t.bounds.size={x:n.y,y:n.x},t}export function updateRectRotation(t,e){const{size:n,center:o,rotation:a}=t;return new C({x:o.x-n.y/2,y:o.y-n.x/2},{x:o.x+n.y/2,y:o.y+n.x/2},a+e)}export function getRotation(t,e){const n=getAngleDiff(t,e);if(Math.abs(n)>Math.PI/4)return Math.sign(n)*Math.PI/2}export function shouldFlip(t,e){const n=getAngleDiff(t,e),o=Math.PI/2;return Math.abs(n)>o+.1}export function getAngleDiff(t,e,n=!1){const o=Math.PI,a=2*o;return((i,r)=>((i-r+o)%a+a)%a-o)(t,e)}export function flipAngle(t){return(t+Math.PI+Math.PI)%(2*Math.PI)-Math.PI}export function getClampedBoundsCanvas(t,e,n,o){const a=e.width,i=e.height,r=t.size,s=t.center,u=t.rotation,x=r.x/a,l=r.x-n*2,y=(r.y-n*2)*.8,g=0,m=l/a,I=y/i,P=Math.min(m,I,x);o=Math.min(Math.max(o,g),P);const z=a*o,b=i*o,c=Math.sin(u),h=Math.cos(u),f=r.x/2-n,p=-r.y/2+n,R=s.x+f*h-p*c,S=s.y+f*c+p*h,M=z/2,d=-b/2,v=M*h-d*c,w=M*c+d*h,A=R-v,B=S-w;return D(A,B,a,i,o,u)}
1
+ import{Rect as k}from"@expofp/renderer";import{getBounds as C}from"./canvases";export function updateLinesScale(t,n,o,e=""){let s=!1;return t.forEach((a,i)=>{let c=0;o[i].forEach(({value:h,scaleFactor:u})=>{n<u&&(c=h)}),a.fontSize!==c*n&&(s=!0),a.fontSize=c*n}),s}export function updateTextDefRotation(t,n){const o=t.bounds.size;return t.bounds.rotation+=n,t.bounds.size={x:o.y,y:o.x},t}export function updateRectRotation(t,n){const{size:o,center:e,rotation:s}=t;return new k({x:e.x-o.y/2,y:e.y-o.x/2},{x:e.x+o.y/2,y:e.y+o.x/2},s+n)}export function getRotation(t,n){const o=getAngleDiff(t,n);if(Math.abs(o)>Math.PI/4)return Math.sign(o)*Math.PI/2}export function shouldFlip(t,n){const o=getAngleDiff(t,n),e=Math.PI/2;return Math.abs(o)>e+.1}export function getAngleDiff(t,n,o=!1){const e=Math.PI,s=2*e;return((i,c)=>((i-c+e)%s+s)%s-e)(t,n)}export function flipAngle(t){return(t+Math.PI+Math.PI)%(2*Math.PI)-Math.PI}export function getClampedBoundsCanvas(t,n,o,e){const s=n.width,a=n.height,i=t.size,c=t.center,h=t.rotation,m=i.x/s,M=i.x-o*2,b=(i.y-o*2)*.8,g=0,y=M/s,I=b/a,P=Math.min(y,I,m);e=Math.min(Math.max(e,g),P);const S=s*e,z=a*e,r=Math.sin(h),f=Math.cos(h),x=i.x/2-o,d=-i.y/2+o,R=c.x+x*f-d*r,W=c.y+x*r+d*f,p=S/2,l=-z/2,B=p*f-l*r,H=p*r+l*f,X=R-B,Y=W-H;return C(X,Y,s,a,e,h)}
@@ -1 +1 @@
1
- import{flipAngle as y,getRotation as m,shouldFlip as c}from"../update-def";export function isInnerInsideOuter(n,o){if(!o)return!1;const a=u(n,n.rotation+Math.PI/2),e=u(o),i=Math.min(...e.map(t=>t.x)),r=Math.max(...e.map(t=>t.x)),s=Math.min(...e.map(t=>t.y)),x=Math.max(...e.map(t=>t.y));return a.every(t=>t.x>=i&&t.x<=r&&t.y>=s&&t.y<=x)}function u(n,o=n.rotation){const a=n.size.x/2,e=n.size.y/2,i=Math.sin(o),r=Math.cos(o),s=n.center.x,x=n.center.y;return[{x:-a,y:-e},{x:a,y:-e},{x:a,y:e},{x:-a,y:e}].map(t=>({x:s+t.x*r-t.y*i,y:x+t.x*i+t.y*r}))}export function flipImageDef(n,o){const a=n.bounds.rotation;return c(o,a)&&(n.bounds.rotation=y(n.bounds.rotation)),n}export function rotateImageDef(n,o){const a=m(o,n.bounds.rotation);return a!==void 0&&(n.bounds.rotation=n.bounds.rotation+a),n}
1
+ import{flipAngle as y,getRotation as d,shouldFlip as h}from"../update-def";export function isInnerInsideOuter(t,s){if(!s)return!1;const o=u(t,t.rotation+Math.PI/2),r=u(s),c=Math.min(...r.map(n=>n.x)),a=Math.max(...r.map(n=>n.x)),i=Math.min(...r.map(n=>n.y)),x=Math.max(...r.map(n=>n.y));return o.every(n=>n.x>=c&&n.x<=a&&n.y>=i&&n.y<=x)}function u(t,s=t.rotation){const o=t.size.x/2,r=t.size.y/2,c=Math.sin(s),a=Math.cos(s),i=t.center.x,x=t.center.y;return[{x:-o,y:-r},{x:o,y:-r},{x:o,y:r},{x:-o,y:r}].map(e=>({x:i+e.x*a-e.y*c,y:x+e.x*c+e.y*a}))}export function flipImageDef(t,s){const o=t.bounds.rotation;return h(s,o)&&(t.bounds.rotation=y(t.bounds.rotation)),t}export function rotateImageDef(t,s){const o=d(s,t.bounds.rotation);return o!==void 0&&(t.bounds.rotation=t.bounds.rotation+o),t}
@@ -1 +1 @@
1
- import{getLayerSvg as u}from"../../../../data/svg";import{select as w}from"d3";import{getLogoUrl as y}from"../../../../utils/getLogoUrl";import{flipImageDef as I,isInnerInsideOuter as x,updateRenderer as B}from"./engine-core";import{SEPARATOR as L}from"../../../../constants";import{rotateImageDef as b}from"./engine-core/utils/rotation";export async function loadLayersImages(o,t){const e=performance.now(),r=o.layerImagesHandlers.filter(Boolean);await Promise.all(r.map(async a=>{const n=await a.fn();if(!n)return;const{name:c,children:m}=n,l=g(t.rootLayer.children,c);if(l&&m.length){const f=[];for(const{shape:i,parentRect:d}of n.children){const p=x(i.bounds,d);l.name.includes("Pathway_")||o.rollHandlers.push(p?{fn:h=>b(i,h),name:"imageRotationHandler"}:{fn:h=>I(i,h),name:"imageFlipHandler"}),f.push(i)}l.children.push(...f),B(o,l)}}));const s=+(performance.now()-e).toFixed(2);console.log(`\u{1F4CA} Total loadBoothsImages time: ${s} ms`)}export const getImageLayerName=o=>`${o}${L}images`;export function mapBoothsLogos(o){return new Map(o.map(t=>{const e=t.rect&&t.exhibitors.find(r=>r.logoInBooth&&r.logo);return e?[t.id,{preferred:y(e.logo),fallback:e.logo}]:null}).filter(Boolean))}export function getLayerIcons(o){const t=w(u(o)).select(`[data-layer="${o.name}"]`);return(window.__fpVersion>5?t.selectAll(":scope > image, :scope > g:not([data-layer]) image").nodes():t.selectAll(":scope > g[data-is-editable='false'] image").nodes()).filter(Boolean)}export function createBoothImg(o,t){const e=o.rect,r=e.h?e.w/e.h:1,s=t.height?t.width/t.height:1;let a,n,c;const m=.9;r>s?(n=e.h*m,a=n*s):(a=e.w*m,n=a/s);const l=o.rotate||0;s>=2&&!l&&e.h>=e.w*2?(n=e.w*m,a=n*s,c=-90):c=-l*180/Math.PI,a>e.w&&(a=e.w,n=a/s),n>e.h&&(n=e.h,a=n*s);const f=e.cx-a/2,i=e.cy-n/2;return{name:o.slug,bounds:{x:f,y:i,width:a,height:n,angle:c},htmlImage:t,booth:o}}function g(o,t){for(const e of o){if(e.name===t)return e;if(e.children&&e.children.length>0){const r=g(e.children,t);if(r)return r}}return null}
1
+ import{getLayerSvg as w}from"../../../../data/svg";import{select as y}from"d3";import{getLogoUrl as x}from"../../../../utils/getLogoUrl";import{flipImageDef as I,isInnerInsideOuter as L,updateRenderer as B}from"./engine-core";import{SEPARATOR as R}from"../../../../constants";import{rotateImageDef as A}from"./engine-core/utils/rotation";export async function loadLayersImages(o,t){const e=performance.now(),a=o.layerImagesHandlers.filter(Boolean);await Promise.all(a.map(async n=>{const s=await n.fn();if(!s)return;const{name:c,children:f}=s,l=p(t.rootLayer.children,c);if(l&&f.length){const d=[];for(const{shape:m,parentRect:g}of s.children){const u=L(m.bounds,g);l.name.includes("Pathway_")||o.rollHandlers.push(u?{fn:h=>A(m,h),name:"imageRotationHandler"}:{fn:h=>I(m,h),name:"imageFlipHandler"}),d.push(m)}l.children.push(...d),B(o,l)}}));const r=+(performance.now()-e).toFixed(2);console.log(`\u{1F4CA} Total loadBoothsImages time: ${r} ms`)}export const getImageLayerName=o=>`${o}${R}images`;export function mapBoothsLogos(o){return new Map(o.map(t=>{const e=t.rect&&t.exhibitors.find(a=>a.logoInBooth&&a.logo);return e?[t.id,{preferred:x(e.logo),fallback:e.logo}]:null}).filter(Boolean))}export function getLayerIcons(o){const t=y(w(o)).select(`[data-layer="${o.name}"]`);return(window.__fpVersion>5?t.selectAll(":scope > image, :scope > g:not([data-layer]) image").nodes():t.selectAll(":scope > g[data-is-editable='false'] image").nodes()).filter(Boolean)}export function createBoothImg(o,t){const e=o.rect,a=e.h?e.w/e.h:1,i=t.height?t.width/t.height:1;let r,n,s;const c=.9;a>i?(n=e.h*c,r=n*i):(r=e.w*c,n=r/i);const f=o.rotate||0;i>=2&&!f&&e.h>=e.w*2?(n=e.w*c,r=n*i,s=-90):s=-f*180/Math.PI,r>e.w&&(r=e.w,n=r/i),n>e.h&&(n=e.h,r=n*i);const l=e.cx-r/2,d=e.cy-n/2;return{name:o.slug,bounds:{x:l,y:d,width:r,height:n,angle:s},htmlImage:t,booth:o}}function p(o,t){for(const e of o){if(e.name===t)return e;if(e.children&&e.children.length>0){const a=p(e.children,t);if(a)return a}}return null}
@@ -1 +1 @@
1
- import{RoutePoint as w}from"../../../../../utils/wayfinding";export const SNAP_THRESHOLD_METERS=7.5;function N(n,t){return n.x>=t.x1&&n.x<=t.x2&&n.y>=t.y1&&n.y<=t.y2}function E(n,t){let s=0;for(const e of n){const p=Math.hypot(e.p1.x-e.p0.x,e.p1.y-e.p0.y);if(p!==0){if(s+p>=t){const x=(t-s)/p,c=e.p0.x+(e.p1.x-e.p0.x)*x,u=e.p0.y+(e.p1.y-e.p0.y)*x;return{point:new w(e.p0.layer,c,u),line:e}}s+=p}}const l=n[n.length-1];return{point:new w(l.p0.layer,l.p1.x,l.p1.y),line:l}}export function snapPositionToRoute(n,t,s){const l=t.length;if(!l)return{snapped:!1};const{snapThreshold:e,toPoint:p,minRemainingUnits:x=.5,fromPoint:c,fromRect:u,toRect:F}=s,r=n.z!=null?String(n.z):null;let M=1/0,f=null,d=0,z=r==null;for(let i=0;i<l;i++){const y=t[i],{p0:o,p1:D}=y,P=D.x-o.x,S=D.y-o.y,L=P*P+S*S;if(L===0)continue;const T=Math.sqrt(L);if(r!=null&&String(o.layer)!==r){d+=T;continue}z=!0;const j=((n.x-o.x)*P+(n.y-o.y)*S)/L,g=Math.max(0,Math.min(1,j)),k=o.x+P*g,v=o.y+S*g,I=Math.hypot(n.x-k,n.y-v);I<M&&(M=I,f={segmentIndex:i,t:g,distanceFromPolylineStart:d+T*g}),d+=T}if(r!=null&&!z)return{snapped:!1};const a=d,H=t[0].p0,_=t[l-1].p1,O=Math.hypot(p.x-H.x,p.y-H.y),U=Math.hypot(p.x-_.x,p.y-_.y),h=O<=U,R=Math.min(x,a),q=new w((r??t[0].p0.layer).toString(),n.x,n.y);if(u&&c&&(r==null||String(c.layer)===r)&&N(q,u)){const i=a,y=h?i:a-i,o=E(t,y);return{snapped:!0,snappedPoint:o.point,snappedLine:o.line}}if(F&&(r==null||String(p.layer)===r)&&N(q,F)){const i=R,y=a-i,o=E(t,h?i:y);return{snapped:!0,snappedPoint:o.point,snappedLine:o.line}}if(!f||M>e)return{snapped:!1};let m=h?f.distanceFromPolylineStart:a-f.distanceFromPolylineStart;m<R&&(m=R);const b=a-m,A=E(t,h?m:b);return{snapped:!0,snappedPoint:A.point,snappedLine:A.line}}
1
+ import{RoutePoint as E}from"../../../../../utils/wayfinding";export const SNAP_THRESHOLD_METERS=7.5;function O(t,n){return t.x>=n.x1&&t.x<=n.x2&&t.y>=n.y1&&t.y<=n.y2}function w(t,n){let p=0;for(const e of t){const a=Math.hypot(e.p1.x-e.p0.x,e.p1.y-e.p0.y);if(a!==0){if(p+a>=n){const d=(n-p)/a,f=e.p0.x+(e.p1.x-e.p0.x)*d,x=e.p0.y+(e.p1.y-e.p0.y)*d;return{point:new E(e.p0.layer,f,x),line:e}}p+=a}}const c=t[t.length-1];return{point:new E(c.p0.layer,c.p1.x,c.p1.y),line:c}}export function snapPositionToRoute(t,n,p){const c=n.length;if(!c)return{snapped:!1};const{snapThreshold:e,toPoint:a,minRemainingUnits:d=.5,fromPoint:f,fromRect:x,toRect:A}=p,i=t.z!=null?String(t.z):null;let M=1/0,u=null,m=0,I=i==null;for(let s=0;s<c;s++){const r=n[s],{p0:o,p1:y}=r,g=y.x-o.x,P=y.y-o.y,D=g*g+P*P;if(D===0)continue;const F=Math.sqrt(D);if(i!=null&&String(o.layer)!==i){m+=F;continue}I=!0;const U=((t.x-o.x)*g+(t.y-o.y)*P)/D,R=Math.max(0,Math.min(1,U)),j=o.x+g*R,k=o.y+P*R,H=Math.hypot(t.x-j,t.y-k);H<M&&(M=H,u={segmentIndex:s,t:R,distanceFromPolylineStart:m+F*R}),m+=F}if(i!=null&&!I)return{snapped:!1};const l=m,b=n[0].p0,q=n[c-1].p1,_=Math.hypot(a.x-b.x,a.y-b.y),L=Math.hypot(a.x-q.x,a.y-q.y),S=_<=L,T=Math.min(d,l),v=new E((i??n[0].p0.layer).toString(),t.x,t.y);if(x&&f&&(i==null||String(f.layer)===i)&&O(v,x)){const s=l,r=S?s:l-s,o=w(n,r);return{snapped:!0,snappedPoint:o.point,snappedLine:o.line}}if(A&&(i==null||String(a.layer)===i)&&O(v,A)){const s=T,r=l-s,y=w(n,S?s:r);return{snapped:!0,snappedPoint:y.point,snappedLine:y.line}}if(!u||M>e)return{snapped:!1};let h=S?u.distanceFromPolylineStart:l-u.distanceFromPolylineStart;h<T&&(h=T);const N=l-h,z=w(n,S?h:N);return{snapped:!0,snappedPoint:z.point,snappedLine:z.line}}
@@ -1 +1 @@
1
- import{RoutePoint as d}from"../../../../../utils/wayfinding";export function splitRouteByPoint(i,t){let e=-1,s=0,y=1/0;for(let r=0;r<i.length;r++){const p=i[r];if(p.p0.layer!==t.layer)continue;const o=p.p1.x-p.p0.x,a=p.p1.y-p.p0.y,u=o*o+a*a;if(u===0)continue;const c=((t.x-p.p0.x)*o+(t.y-p.p0.y)*a)/u;if(c<-1e-6||c>1+1e-6)continue;const l=Math.min(1,Math.max(0,c)),m=p.p0.x+l*o,g=p.p0.y+l*a,f=(t.x-m)**2+(t.y-g)**2;f<y&&(y=f,e=r,s=l)}if(e===-1)return{passed:[],remaining:i};if(s<1e-6)return{passed:i.slice(0,e),remaining:i.slice(e)};if(s>1-1e-6)return{passed:i.slice(0,e+1),remaining:i.slice(e+1)};const n=i[e],x=new d(n.p0.layer,n.p0.x+s*(n.p1.x-n.p0.x),n.p0.y+s*(n.p1.y-n.p0.y));return{passed:[...i.slice(0,e),{...n,p1:x}],remaining:[{...n,p0:x},...i.slice(e+1)]}}
1
+ import{RoutePoint as E}from"../../../../../utils/wayfinding";export function splitRouteByPoint(t,c){let n=-1,e=0,a=1/0;for(let l=0;l<t.length;l++){const p=t[l];if(p.p0.layer!==c.layer)continue;const s=p.p1.x-p.p0.x,y=p.p1.y-p.p0.y,r=s*s+y*y;if(r===0)continue;const x=((c.x-p.p0.x)*s+(c.y-p.p0.y)*y)/r;if(x<-1e-6||x>1+1e-6)continue;const o=Math.min(1,Math.max(0,x)),m=p.p0.x+o*s,g=p.p0.y+o*y,d=(c.x-m)**2+(c.y-g)**2;d<a&&(a=d,n=l,e=o)}if(n===-1)return{passed:[],remaining:t};if(e<1e-6)return{passed:t.slice(0,n),remaining:t.slice(n)};if(e>1-1e-6)return{passed:t.slice(0,n+1),remaining:t.slice(n+1)};const i=t[n],f=new E(i.p0.layer,i.p0.x+e*(i.p1.x-i.p0.x),i.p0.y+e*(i.p1.y-i.p0.y));return{passed:[...t.slice(0,n),{...i,p1:f}],remaining:[{...i,p0:f},...t.slice(n+1)]}}
@@ -1 +1 @@
1
- import{lineLength as S}from"simple-geometry";import{distance as v}from"../../../../../utils/gps";export function distancePointToRouteOnLayer(t,l){let e=1/0;for(const o of l){if(t.layer&&(o.p0.layer!==t.layer||o.p1.layer!==t.layer))continue;const u=T(t.x,t.y,o.p0.x,o.p0.y,o.p1.x,o.p1.y);u<e&&(e=u)}return e}function T(t,l,e,o,u,f){const c=u-e,y=f-o,d=t-e,x=l-o,h=c*c+y*y;if(h===0)return Math.hypot(t-e,l-o);let n=(d*c+x*y)/h;n<0?n=0:n>1&&(n=1);const i=e+n*c,r=o+n*y;return Math.hypot(t-i,l-r)}const b=20;export function findBoothInRadius(t,l,e,o=b){if(!t||!l?.length)return null;const u=t.z?String(t.z):null,f=o*o,c=new Set;e?.forEach(n=>n?.id&&c.add(String(n.id)));function y(n){const i=n?.x1,r=n?.x2,s=n?.y1,a=n?.y2;if(i==null||r===null||r===void 0||s===null||s===void 0||a===null||a===void 0)return null;const p=Math.min(i,r),g=Math.max(i,r),m=Math.min(s,a),M=Math.max(s,a);return{x1:p,x2:g,y1:m,y2:M}}function d(n,i,r){const s=n<r.x1?r.x1-n:n>r.x2?n-r.x2:0,a=i<r.y1?r.y1-i:i>r.y2?i-r.y2:0;return s*s+a*a}let x=null,h=1/0;for(const n of l){const i=!(n.id&&c.has(String(n.id))),r=n.layer?.name??n.layer??null,s=!u||r&&String(r)===u,a=y(n.rect);if(i&&s&&a){const p=d(t.x,t.y,a);p<=f&&p<h&&(h=p,x=n)}}return x}const L=20;export const getThresholdSafe=t=>{if(typeof t=="number"&&Number.isFinite(t))return t};function R(t,l){const{p0:e,p2:o}=l,u=v(e.lat,e.lng,o.lat,o.lng),f=S(e,o);return!u||!f?0:t*(f/u)}export function getThresholdFromMetersToSvg({thresholdInMeters:t,gpsConfig:l}){let e=0;return t&&l&&(e=R(t,l)),e||(e=L),e}
1
+ import{lineLength as b}from"simple-geometry";import{distance as L}from"../../../../../utils/gps";export function distancePointToRouteOnLayer(t,r){let e=1/0;for(const o of r){if(t.layer&&(o.p0.layer!==t.layer||o.p1.layer!==t.layer))continue;const i=B(t.x,t.y,o.p0.x,o.p0.y,o.p1.x,o.p1.y);i<e&&(e=i)}return e}function B(t,r,e,o,i,d){const f=i-e,a=d-o,S=t-e,x=r-o,y=f*f+a*a;if(y===0)return Math.hypot(t-e,r-o);let n=(S*f+x*a)/y;n<0?n=0:n>1&&(n=1);const s=e+n*f,c=o+n*a;return Math.hypot(t-s,r-c)}const M=20;export function findBoothInRadius(t,r,e,o=M){if(!t||!r?.length)return null;const i=t.z?String(t.z):null,d=o*o,f=new Set;e?.forEach(n=>n?.id&&f.add(String(n.id)));function a(n){const s=n?.x1,c=n?.x2,u=n?.y1,l=n?.y2;if(s==null||c===null||c===void 0||u===null||u===void 0||l===null||l===void 0)return null;const m=Math.min(s,c),h=Math.max(s,c),g=Math.min(u,l),T=Math.max(u,l);return{x1:m,x2:h,y1:g,y2:T}}function S(n,s,c){const u=n<c.x1?c.x1-n:n>c.x2?n-c.x2:0,l=s<c.y1?c.y1-s:s>c.y2?s-c.y2:0;return u*u+l*l}let x=null,y=1/0;for(const n of r){const s=!(n.id&&f.has(String(n.id))),c=n.layer?.name??n.layer??null,u=!i||c&&String(c)===i,l=a(n.rect);if(s&&u&&!!l){const h=S(t.x,t.y,l);h<=d&&h<y&&(y=h,x=n)}}return x}const R=20;export const getThresholdSafe=t=>{if(typeof t=="number"&&Number.isFinite(t))return t};function O(t,r){const{p0:e,p2:o}=r,i=L(e.lat,e.lng,o.lat,o.lng),d=b(e,o);return!i||!d?0:t*(d/i)}export function getThresholdFromMetersToSvg({thresholdInMeters:t,gpsConfig:r}){let e=0;return t&&r&&(e=O(t,r)),e||(e=R),e}
@@ -1 +1 @@
1
- export const TRAFFIC_ROUTE_PREFIX="traffic_route",TRAFFIC_ROUTE_STOP_PREFIX="traffic_route_stop",TRAFFIC_VEHICLES="traffic_vehicles",BUILD_ROUTE_LINES="build_route_lines",BUILD_ROUTE_DOTS="build_route_dots";const i=5;export function createTrafficLayers(){const e=[];for(let t=0;t<5;t++)e.push({name:r(t),children:[]}),e.push({name:n(t),children:[],interactive:!0});return e.push({name:TRAFFIC_VEHICLES,children:[],interactive:!0}),e.push({name:BUILD_ROUTE_LINES,children:[]}),e.push({name:BUILD_ROUTE_DOTS,children:[],interactive:!0}),e}function r(e){return`${TRAFFIC_ROUTE_PREFIX}_${e+1}`}function n(e){return`${TRAFFIC_ROUTE_STOP_PREFIX}_${e+1}`}export function getRouteLayerRegex(){return new RegExp(`^${TRAFFIC_ROUTE_PREFIX}_\\d+$`)}export function getRouteStopLayerRegex(){return new RegExp(`^${TRAFFIC_ROUTE_STOP_PREFIX}_\\d+$`)}
1
+ export const TRAFFIC_ROUTE_PREFIX="traffic_route",TRAFFIC_ROUTE_STOP_PREFIX="traffic_route_stop",TRAFFIC_VEHICLES="traffic_vehicles",BUILD_ROUTE_LINES="build_route_lines",BUILD_ROUTE_DOTS="build_route_dots";const o=5;export function createTrafficLayers(){const e=[];for(let t=0;t<5;t++)e.push({name:r(t),children:[]}),e.push({name:n(t),children:[],interactive:!0});return e.push({name:TRAFFIC_VEHICLES,children:[],interactive:!0}),e.push({name:BUILD_ROUTE_LINES,children:[]}),e.push({name:BUILD_ROUTE_DOTS,children:[],interactive:!0}),e}function r(e){return`${TRAFFIC_ROUTE_PREFIX}_${e+1}`}function n(e){return`${TRAFFIC_ROUTE_STOP_PREFIX}_${e+1}`}export function getRouteLayerRegex(){return new RegExp(`^${TRAFFIC_ROUTE_PREFIX}_\\d+$`)}export function getRouteStopLayerRegex(){return new RegExp(`^${TRAFFIC_ROUTE_STOP_PREFIX}_\\d+$`)}
@@ -1,7 +1,7 @@
1
- import{useCallback as S,useEffect as H,useMemo as k,useRef as E}from"react";import{BUILD_ROUTE_DOTS as O,BUILD_ROUTE_LINES as B}from"./trafficLayers";import{createCircleCanvas as I,getBounds as C}from"../drawing/config/engine-core/canvases";import{UpdateQueue as K}from"./UpdateQueue";const P=49,D=`hsl(257, 76%, ${P}%)`,N=`hsl(339.903, 82%, ${P}%)`,J=`hsl(257, 76%, ${Math.round(P*1.82)}%)`,$=4,T=$,U="U",A="R",M="S",R="P";class q{_state=[[]];index=0;pointHashSet=new Set;locked=!1;storageKey="expofp_build_route_state";_selected=0;get points(){return this._state[this.index]}set points(t){this._state.push(t),this.setIndex(),this.save()}setIndex(){this.index=Math.max(this._state.length-1,0)}genPointHash(t){return`${t.x},${t.y}`}add(t){const d=this.genPointHash(t);this.pointHashSet.has(d)||(this.pointHashSet.add(d),this.points=[...this.points,t])}undo(){this.index&&(this._state.pop(),this.setIndex(),this.save(),this.select(this.points.length-1))}execute(t){try{if(this.locked)return;this.locked=!0,t()}finally{requestAnimationFrame(()=>{this.locked=!1})}}log(t,d=12){console.log(`%c${t}`,`color: black; font-size: ${d}px; background: LemonChiffon;`)}instruct(){this.log(`How to Build a Route:
1
+ import{useCallback as _,useEffect as $,useMemo as w,useRef as E}from"react";import{BUILD_ROUTE_DOTS as A,BUILD_ROUTE_LINES as K}from"./trafficLayers";import{createCircleCanvas as R,getBounds as C}from"../drawing/config/engine-core/canvases";import{UpdateQueue as T}from"./UpdateQueue";const O=49,D=`hsl(257, 76%, ${O}%)`,H=`hsl(339.903, 82%, ${O}%)`,Y=`hsl(257, 76%, ${Math.round(O*1.82)}%)`,I=4,B=I,b="U",N="R",M="S",U="P";class J{_state=[[]];index=0;pointHashSet=new Set;locked=!1;storageKey="expofp_build_route_state";_selected=0;get points(){return this._state[this.index]}set points(t){this._state.push(t),this.setIndex(),this.save()}setIndex(){this.index=Math.max(this._state.length-1,0)}genPointHash(t){return`${t.x},${t.y}`}add(t){const f=this.genPointHash(t);this.pointHashSet.has(f)||(this.pointHashSet.add(f),this.points=[...this.points,t])}undo(){this.index&&(this._state.pop(),this.setIndex(),this.save(),this.select(this.points.length-1))}execute(t){try{if(this.locked)return;this.locked=!0,t()}finally{requestAnimationFrame(()=>{this.locked=!1})}}log(t,f=12){console.log(`%c${t}`,`color: black; font-size: ${f}px; background: LemonChiffon;`)}instruct(){this.log(`How to Build a Route:
2
2
  Add Point: Click on the map.
3
- Apply Smoothing: Press ${A}.
3
+ Apply Smoothing: Press ${N}.
4
4
  Apply Simplification: Press ${M}.
5
- Undo: Press ${U}.
6
- Enable/Disable Preview: Press ${R}.
7
- `,16)}applyChaikinSmoothing(t,d,x){let i=[];if(x>=1&&t.length>=2){i=[t[0]];for(let h=1;h<t.length;h++){const o=t[h-1],p=t[h];for(let e=1;e<=x;e++){const n=e/(x+1);i.push({x:o.x+(p.x-o.x)*n,y:o.y+(p.y-o.y)*n})}i.push(p)}}else i=t.slice();for(let h=0;h<d&&!(i.length<2);h++){const o=[{...i[0]}];for(let p=1;p<i.length;p++){const e=i[p-1],n=i[p];o.push({x:.75*e.x+.25*n.x,y:.75*e.y+.25*n.y}),o.push({x:.25*e.x+.75*n.x,y:.25*e.y+.75*n.y})}o.push({...i[i.length-1]}),i=o}return i}applySmoothing(){this.points.length<3||(this.points=this.applyChaikinSmoothing(this.points,1,0),this.select(this.points.length-1))}save(){try{this.points.length?sessionStorage.setItem(this.storageKey,JSON.stringify(this.points)):sessionStorage.removeItem(this.storageKey)}catch(t){console.warn(t)}}restore(){try{const t=sessionStorage.getItem(this.storageKey);if(!t)return;const d=JSON.parse(t);if(!Array.isArray(d))return;d.forEach(x=>this.add(x)),this.select(this.points.length-1)}catch(t){console.warn(t)}}topologyPreservingSimplify(t,d){if(t.length<=2)return t.map(e=>({...e}));const x=(e,n,u)=>{const a=e.x,y=e.y,l=n.x,c=n.y,s=u.x,r=u.y,f=Math.abs((r-c)*a-(s-l)*y+s*c-r*l),m=Math.sqrt((r-c)**2+(s-l)**2);return f/(m||1e-10)},i=(e,n,u,a)=>{const y=(l,c,s)=>(s.y-l.y)*(c.x-l.x)-(c.y-l.y)*(s.x-l.x);return y(e,u,a)*y(n,u,a)<0&&y(u,e,n)*y(a,e,n)<0},h=new Array(t.length).fill(!1);h[0]=h[h.length-1]=!0;const o=[],p=(e,n)=>{if(n<=e+1)return;const u=t[e],a=t[n];let y=0,l=0;for(let c=e+1;c<n;c++){const s=x(t[c],u,a);s>y&&(y=s,l=c)}if(y>d){const c=t[l];let s=!0;for(let r=0;r<o.length-1;r++)if(i(o[r],o[r+1],u,c)||i(o[r],o[r+1],c,a)){s=!1;break}s&&(h[l]=!0,p(e,l),p(l,n))}};return p(0,t.length-1),t.filter((e,n)=>h[n])}applySimplification(){this.points=this.topologyPreservingSimplify(this.points,.5),this.select(this.points.length-1)}get selected(){return this._selected}select(t){this._selected=Math.max(0,Math.min(t,this.points.length-1))}}export function useBuildRoute({enabled:w,renderer:t,scene:d,initialScale:x}){const i=E(!1),h=E(),o=k(()=>I($,D),[]),p=k(()=>I($,N),[]),e=k(()=>new q,[]),n=E(new K),u=k(()=>{if(!d)return{};const s=d.rootLayer.children,r=s.find(m=>m.name===B),f=s.find(m=>m.name===O);return{linesLayer:r,pointsLayer:f}},[d]),a=S(()=>{if(!t||!u||!o||!p)return;const{linesLayer:s,pointsLayer:r}=u;if(!s||!r)return;const f=e.points,m=i.current;m?r.children.length=0:r.children=f.map(({x:g,y:b},L)=>{const _=L==e.selected?p:o;return{source:_,bounds:C(g,b,_.width,_.height,h.current)}});const v=[];for(let g=1;g<f.length;g++){const b=f[g-1],L=f[g];v.push({points:[b,L],color:m?D:J,width:T})}v.length?s.children=v:s.children.length=0,n.current.add(()=>t.update(r,s)),e.instruct(),e.log(JSON.stringify(e.points))},[t,e,u,o,p]),y=S(s=>{const r=s.key.toUpperCase();e.execute(()=>{switch(r){case U:s.preventDefault(),e.undo(),i.current=!1,a();break;case A:s.preventDefault(),e.applySmoothing(),i.current=!1,a();break;case M:s.preventDefault(),e.applySimplification(),i.current=!1,a();break;case R:s.preventDefault(),i.current=!i.current,a();break}})},[e,a]),l=S(s=>{if(!t||!u)return;const{pointsLayer:r}=u;r&&(h.current=s,e.execute(()=>{const f=r.children,m=[];for(let v=0;v<f.length;v++){const g=f[v];g.bounds=C(g.bounds.center.x,g.bounds.center.y,g.source.width,g.source.height,h.current),m.push(g)}n.current.add(()=>t.update(...m))}))},[t,u,e]),c=S(s=>{e.execute(()=>{e.add({x:s.point.x,y:s.point.y}),e.select(e.points.length-1),a()})},[e,a]);H(()=>{if(w)return h.current=x||window.devicePixelRatio,e.execute(()=>{e.restore(),a()}),t.events.addEventListener("pointer:click",c),t.events.addEventListener("viewport:ptscale",l),window.addEventListener("keyup",y),()=>{window.removeEventListener("keyup",y),t.events.removeEventListener("pointer:click",c),t.events.removeEventListener("viewport:ptscale",l),n.current.destroy()}},[w,t,x,e,a,c,l,y])}
5
+ Undo: Press ${b}.
6
+ Enable/Disable Preview: Press ${U}.
7
+ `,16)}applyChaikinSmoothing(t,f,x){let i=[];if(x>=1&&t.length>=2){i=[t[0]];for(let c=1;c<t.length;c++){const r=t[c-1],u=t[c];for(let e=1;e<=x;e++){const n=e/(x+1);i.push({x:r.x+(u.x-r.x)*n,y:r.y+(u.y-r.y)*n})}i.push(u)}}else i=t.slice();for(let c=0;c<f&&!(i.length<2);c++){const r=[{...i[0]}];for(let u=1;u<i.length;u++){const e=i[u-1],n=i[u];r.push({x:.75*e.x+.25*n.x,y:.75*e.y+.25*n.y}),r.push({x:.25*e.x+.75*n.x,y:.25*e.y+.75*n.y})}r.push({...i[i.length-1]}),i=r}return i}applySmoothing(){this.points.length<3||(this.points=this.applyChaikinSmoothing(this.points,1,0),this.select(this.points.length-1))}save(){try{this.points.length?sessionStorage.setItem(this.storageKey,JSON.stringify(this.points)):sessionStorage.removeItem(this.storageKey)}catch(t){console.warn(t)}}restore(){try{const t=sessionStorage.getItem(this.storageKey);if(!t)return;const f=JSON.parse(t);if(!Array.isArray(f))return;f.forEach(x=>this.add(x)),this.select(this.points.length-1)}catch(t){console.warn(t)}}topologyPreservingSimplify(t,f){if(t.length<=2)return t.map(e=>({...e}));const x=(e,n,p)=>{const l=e.x,y=e.y,a=n.x,h=n.y,s=p.x,o=p.y,d=Math.abs((o-h)*l-(s-a)*y+s*h-o*a),m=Math.sqrt((o-h)**2+(s-a)**2);return d/(m||1e-10)},i=(e,n,p,l)=>{const y=(a,h,s)=>(s.y-a.y)*(h.x-a.x)-(h.y-a.y)*(s.x-a.x);return y(e,p,l)*y(n,p,l)<0&&y(p,e,n)*y(l,e,n)<0},c=new Array(t.length).fill(!1);c[0]=c[c.length-1]=!0;const r=[],u=(e,n)=>{if(n<=e+1)return;const p=t[e],l=t[n];let y=0,a=0;for(let h=e+1;h<n;h++){const s=x(t[h],p,l);s>y&&(y=s,a=h)}if(y>f){const h=t[a];let s=!0;for(let o=0;o<r.length-1;o++)if(i(r[o],r[o+1],p,h)||i(r[o],r[o+1],h,l)){s=!1;break}s&&(c[a]=!0,u(e,a),u(a,n))}};return u(0,t.length-1),t.filter((e,n)=>c[n])}applySimplification(){this.points=this.topologyPreservingSimplify(this.points,.5),this.select(this.points.length-1)}get selected(){return this._selected}select(t){this._selected=Math.max(0,Math.min(t,this.points.length-1))}}export function useBuildRoute({enabled:S,renderer:t,scene:f,initialScale:x}){const i=E(!1),c=E(),r=w(()=>R(I,D),[]),u=w(()=>R(I,H),[]),e=w(()=>new J,[]),n=E(new T),p=w(()=>{if(!f)return{};const s=f.rootLayer.children,o=s.find(m=>m.name===K),d=s.find(m=>m.name===A);return{linesLayer:o,pointsLayer:d}},[f]),l=_(()=>{if(!t||!p||!r||!u)return;const{linesLayer:s,pointsLayer:o}=p;if(!s||!o)return;const d=e.points,m=i.current;m?o.children.length=0:o.children=d.map(({x:g,y:L},k)=>{const P=k==e.selected?u:r;return{source:P,bounds:C(g,L,P.width,P.height,c.current)}});const v=[];for(let g=1;g<d.length;g++){const L=d[g-1],k=d[g];v.push({points:[L,k],color:m?D:Y,width:B})}v.length?s.children=v:s.children.length=0,n.current.add(()=>t.update(o,s)),e.instruct(),e.log(JSON.stringify(e.points))},[t,e,p,r,u]),y=_(s=>{const o=s.key.toUpperCase();e.execute(()=>{switch(o){case b:s.preventDefault(),e.undo(),i.current=!1,l();break;case N:s.preventDefault(),e.applySmoothing(),i.current=!1,l();break;case M:s.preventDefault(),e.applySimplification(),i.current=!1,l();break;case U:s.preventDefault(),i.current=!i.current,l();break}})},[e,l]),a=_(s=>{if(!t||!p)return;const{pointsLayer:o}=p;o&&(c.current=s,e.execute(()=>{const d=o.children,m=[];for(let v=0;v<d.length;v++){const g=d[v];g.bounds=C(g.bounds.center.x,g.bounds.center.y,g.source.width,g.source.height,c.current),m.push(g)}n.current.add(()=>t.update(...m))}))},[t,p,e]),h=_(s=>{e.execute(()=>{e.add({x:s.point.x,y:s.point.y}),e.select(e.points.length-1),l()})},[e,l]);$(()=>{if(S)return c.current=x||window.devicePixelRatio,e.execute(()=>{e.restore(),l()}),t.events.addEventListener("pointer:click",h),t.events.addEventListener("viewport:ptscale",a),window.addEventListener("keyup",y),()=>{window.removeEventListener("keyup",y),t.events.removeEventListener("pointer:click",h),t.events.removeEventListener("viewport:ptscale",a),n.current.destroy()}},[S,t,x,e,l,h,a,y])}
@@ -1 +1 @@
1
- import{useEffect as me,useRef as M}from"react";import{getBounds as q}from"../drawing/config/engine-core";import{getRouteLayerRegex as we,getRouteStopLayerRegex as ve,TRAFFIC_VEHICLES as be}from"./trafficLayers";import{loadImage as Me}from"../../../utils/loadImage";import{createImageCanvas as Fe}from"../drawing/config/canvases";import{UpdateQueue as Se}from"./UpdateQueue";import Pe from"../../../tools/base-runtime-url";import{toRadians as Ee}from"../../../utils/toRadians";const ne=2,Ie=ne*3.5,Y=ne*12,le=Y*.7,Re=8,Te="transport_locations",Ce=150,re="#a4aab6",ue=1e3,Le=2e4,de=500;export function useManageTraffic({permission:e,renderer:r,scene:c,dataJsonUrl:o,websocketUrl:t,initialScale:i}){const n=M(window.devicePixelRatio),a=M(new Map),h=M(new Map),d=M(),b=M(),P=M(performance.now()),E=M(1),x=M(new Se),w=M(new Map),g=M(),s=M(ue),L=M(new Map),k=M();me(()=>{async function I(){try{if(!e||!r||!c)return;let f;try{f=await(await fetch(o,{method:"GET",headers:{"Content-Type":"application/json"}})).json()}catch(u){console.warn("useManageTraffic failed to get JSON",u)}if(!f||f?.disabled||f?.error)return;n.current=he(i);const K=new Map(f.routes.map(({id:u,color:p})=>[u,p])),U=c.rootLayer.children,$=new Map;K.forEach(u=>{$.set(u,Ne({radius:Ie,color:u,scale:window.devicePixelRatio}))});const W=we(),B=U.filter(u=>W.test(u.name)),X=ve(),j=U.filter(u=>X.test(u.name));f.routes.slice(0,B.length).forEach(({id:u,color:p,path:T,stops:F,hiddenPoints:y},m)=>{w.current.set(u,T);const v=B[m];if(v){const O=new Map(y?.map(l=>[oe(l),l])??[]);for(let l=1;l<T.length;l++){const Q=T[l-1],J=T[l];O.has(oe(Q))||O.has(oe(J))||v.children.push({points:[Q,J],color:p,width:ne})}v.children.length&&x.current.add(()=>r.update(v))}const _=j[m];if(_&&F?.length){const O=$.get(p);F.forEach(l=>{_.children.push({source:O,bounds:q(l.x,l.y,O.width,O.height,n.current)})}),_.children.length&&x.current.add(()=>r.update(_))}});const A=U.find(u=>u.name===be),V=new Map;g.current=u=>{try{n.current=he(u);const p=[];for(let F=0;F<j.length;F++){const y=j[F].children;for(let m=0;m<y.length;m++){const v=y[m];v.bounds=q(v.bounds.center.x,v.bounds.center.y,v.source.width,v.source.height,n.current,v.bounds.rotation),p.push(v)}}const T=[...a.current.values()];for(let F=0;F<T.length;F++){const y=T[F];y.bounds=q(y.bounds.center.x,y.bounds.center.y,y.source.width,y.source.height,n.current,y.bounds.rotation)}x.current.add(()=>r.update(...p,...T))}catch(p){console.error("ptscale",p)}},r.events.addEventListener("viewport:ptscale",g.current),K.forEach((u,p)=>{V.set(p,fe({id:p,width:Y,height:Y,color:u,scale:window.devicePixelRatio}))}),V.set(re,fe({id:"orphan",width:Y,height:Y,color:re,scale:window.devicePixelRatio}));let G=null;try{const u=await Me(`${Pe}icons/bus-white.svg`);G=Fe(u,le,le,window.devicePixelRatio)}catch(u){console.error(u)}b.current=u=>{try{const p=JSON.parse(u.data);if(p.type!==Te)return;const T=u.timeStamp||performance.now();E.current=Math.round(T-P.current),P.current=T;const F=Math.max(E.current??de,de),y=h.current,m=a.current,v=A.children,_=x.current;let O=!1;p.data.forEach(({id:l,x:Q,y:J,route_id:ae,hidden:xe})=>{if(y.has(l)&&(y.get(l)?.(),y.delete(l)),xe&&m.has(l)&&m.has(z(l))){const C=m.get(l);C.hidden=!0;const S=m.get(z(l));S.hidden=!0,_.add(()=>r.update(C,S));return}if(L.current.set(l,performance.now()),!m.has(l)){const C=V.get(ae)||V.get(re),S={id:l,source:C,bounds:q(Q,J,C.width,C.height,n.current,0)};if(m.set(l,S),G){const H=z(l),se={id:H,source:G,bounds:q(Q,J,G.width,G.height,n.current,0)};G.setAttribute("id",H),m.set(H,se),v.push(S,se)}else v.push(S);O=!0;return}const Z=m.get(l),ie=m.get(z(l)),ye=Z.bounds.center,te=Oe(ye,{x:Q,y:J},w.current.get(ae));if(te.reduce((C,S,H)=>H===0?C:C+ce(te[H-1],S),0)>=Ce||document.hidden)ge({renderer:r,updateQueue:_,vehicle:Z,vehicleFinery:ie,x:Q,y:J,scale:n.current,angle:ke(Z.bounds.center,{x:Q,y:J})});else{const C=Qe(te,F,S=>{ge({renderer:r,updateQueue:_,vehicle:Z,vehicleFinery:ie,x:S.x,y:S.y,scale:n.current,angle:S.angle})});y.set(l,C)}}),O&&_.add(()=>r.update(A))}catch(p){console.error("handleSocketMessage",p)}},R(),D(f.config?(Number(f.config.vehicle_inactive_interval)||20)*1e3:Le)}catch(f){console.warn(f)}}I();function R(){d.current?.readyState===WebSocket.OPEN||d.current?.readyState===WebSocket.CONNECTING||(d.current=new WebSocket(t),d.current.onmessage=b.current,d.current.onopen=()=>{s.current=ue},d.current.onclose=()=>{if(!navigator.onLine)return;setTimeout(R,s.current);const f=3e4;s.current=Math.min(s.current*2,f)})}function N(){R()}window.addEventListener("online",N);function D(f){clearInterval(k.current),k.current=window.setInterval(()=>{const K=performance.now(),U=[],$=[];L.current.forEach((W,B)=>{if(K-W<f)return;const X=a.current.get(B);X&&(X.hidden=!0,$.push(X),U.push(B));const j=z(B),A=a.current.get(j);A&&(A.hidden=!0,$.push(A),U.push(j))}),$.length&&x.current.add(()=>r.update(...$)),U.forEach(W=>L.current.delete(W))},f)}return()=>{g.current&&r.events.removeEventListener("viewport:ptscale",g.current),h.current.forEach(f=>f?.()),h.current.clear(),a.current.clear(),x.current.destroy(),window.removeEventListener("online",N),clearInterval(k.current)}},[e,r,c,o,t])}function he(e){return Math.min(e||window.devicePixelRatio,Re)}function ke(e,r){return Math.atan2(r.y-e.y,r.x-e.x)}function Ne({radius:e,scale:r,color:c}){const o=document.createElement("canvas"),t=o.getContext("2d");t.imageSmoothingEnabled=!1;const i=Math.ceil(e*2*r),n=i/2,a=e*.78,h=e*.33;return o.width=i,o.height=i,t.translate(n,n),t.scale(r,r),t.beginPath(),t.arc(0,0,e,0,2*Math.PI),t.fillStyle="#FFFFFF",t.fill(),t.beginPath(),t.arc(0,0,a,0,2*Math.PI),t.fillStyle=c,t.fill(),t.beginPath(),t.arc(0,0,h,0,2*Math.PI),t.fillStyle="#FFFFFF",t.fill(),o}function fe({id:e,width:r,height:c,color:o,scale:t}){const i=2*t,n=r/2*t,a=c*t,h=.6,d=.01,b=a*h,P=a,E=8*t,x=P+i+b/2+E*2,w=n*2+b+i+E*2,g=document.createElement("canvas");g.setAttribute("id",e),g.width=x,g.height=w;const s=g.getContext("2d"),L=x/2,k=w/2;s.save(),s.translate(L,k),s.rotate(-Math.PI/2),s.translate(-L,-k);const I=L,R=k-P/2+n,N=R+b;return s.shadowColor="rgba(16, 24, 40, 0.2)",s.shadowBlur=E/2,s.beginPath(),s.arc(I,R,n,Math.PI,0,!1),s.bezierCurveTo(I+n,R+a*.3,I+d*n,N,I,N),s.bezierCurveTo(I-d*n,N,I-n,R+a*.3,I-n,R),s.closePath(),s.fillStyle=o,s.fill(),s.strokeStyle="#FFFFFF",s.lineWidth=i,s.stroke(),s.restore(),g}function ce(e,r){return Math.hypot(e.x-r.x,e.y-r.y)}function z(e){return`${e}_finery`}function ge({renderer:e,updateQueue:r,vehicle:c,vehicleFinery:o,x:t,y:i,scale:n,angle:a}){if(c.bounds=q(t,i,c.source.width,c.source.height,n,a),c.hidden=!1,o){const h=e.controls.getCameraState();o.bounds=q(t,i,o.source.width,o.source.height,n,Ee(h.roll||0)),o.hidden=!1,r.add(()=>e.update(o,c))}else r.add(()=>e.update(c))}function ee(e,r,c){return{x:e.x+(r.x-e.x)*c,y:e.y+(r.y-e.y)*c}}function pe(e,r){let c=1/0,o={index:0,t:0};for(let t=0;t<r.length-1;t++){const i=r[t],n=r[t+1],a=n.x-i.x,h=n.y-i.y,d=a*a+h*h,b=d?((e.x-i.x)*a+(e.y-i.y)*h)/d:0,P=Math.max(0,Math.min(1,b)),E=ee(i,n,P),x=ce(e,E);x<c&&(c=x,o={index:t,t:P})}return o}function _e(e,r,c){const o=ce(e,r),t=Math.max(2,Math.ceil(o/c)+1),i=[];for(let n=0;n<t;n++){const a=n/(t-1),h=ee(e,r,a);i.push({x:h.x,y:h.y})}return i}function Oe(e,r,c){if(!c||!c.length)return _e(e,r,10);const o=pe(e,c),t=pe(r,c),i=[],n=a=>i.push({x:a.x,y:a.y});o.index+1<c.length?n(ee(c[o.index],c[o.index+1],o.t)):n(c[o.index]);for(let a=o.index+1;a<=t.index&&a<c.length;a++)n(c[a]);return t.index+1<c.length?n(ee(c[t.index],c[t.index+1],t.t)):n(c[t.index]),i}function Qe(e,r,c,o){if(e.length<2)return()=>{};let t=null,i;const n=[];let a=0;for(let d=0;d<e.length-1;d++){const b=Math.hypot(e[d+1].x-e[d].x,e[d+1].y-e[d].y);n.push(b),a+=b}const h=d=>{t||(t=d);const b=d-t,P=Math.min(b/r,1),E=P*a;let x=0,w=0;for(;w<n.length&&x+n[w]<E;)x+=n[w],w++;w>=n.length&&(w=n.length-1);const g=e[w],s=e[Math.min(w+1,e.length-1)],L=n[w]||0,k=L===0?0:(E-x)/L,I=g.x+(s.x-g.x)*k,R=g.y+(s.y-g.y)*k,N=s.x-g.x,D=s.y-g.y,f=N===0&&D===0?0:Math.atan2(D,N);c({x:I,y:R,angle:f}),P<1?i=requestAnimationFrame(h):o&&o()};return i=requestAnimationFrame(h),()=>{i&&cancelAnimationFrame(i)}}function oe(e){return`${e.x},${e.y}`}
1
+ import{useEffect as wt,useRef as M}from"react";import{getBounds as k}from"../drawing/config/engine-core";import{getRouteLayerRegex as xt,getRouteStopLayerRegex as Et,TRAFFIC_VEHICLES as It}from"./trafficLayers";import{loadImage as Mt}from"../../../utils/loadImage";import{createImageCanvas as vt}from"../drawing/config/canvases";import{UpdateQueue as St}from"./UpdateQueue";import Lt from"../../../tools/base-runtime-url";import{toRadians as bt}from"../../../utils/toRadians";const nt=2,Rt=nt*3.5,G=nt*12,ut=G*.7,Ft=8,At="transport_locations",Tt=150,ot="#a4aab6",lt=1e3,Pt=2e4,ht=500;export function useManageTraffic({permission:t,renderer:o,scene:c,dataJsonUrl:r,websocketUrl:e,initialScale:i}){const n=M(window.devicePixelRatio),s=M(new Map),d=M(new Map),h=M(),I=M(),L=M(performance.now()),b=M(1),y=M(new St),x=M(new Map),g=M(),a=M(lt),P=M(new Map),C=M();wt(()=>{async function R(){try{if(!t||!o||!c)return;let f;try{f=await(await fetch(r,{method:"GET",headers:{"Content-Type":"application/json"}})).json()}catch(u){console.warn("useManageTraffic failed to get JSON",u)}if(!f||f?.disabled||f?.error)return;n.current=dt(i);const Z=new Map(f.routes.map(({id:u,color:m})=>[u,m])),V=c.rootLayer.children,W=new Map;Z.forEach(u=>{W.set(u,_t({radius:Rt,color:u,scale:window.devicePixelRatio}))});const z=xt(),Y=V.filter(u=>z.test(u.name)),B=Et(),U=V.filter(u=>B.test(u.name));f.routes.slice(0,Y.length).forEach(({id:u,color:m,path:A,stops:v,hiddenPoints:p},w)=>{x.current.set(u,A);const E=Y[w];if(E){const O=new Map(p?.map(l=>[rt(l),l])??[]);for(let l=1;l<A.length;l++){const D=A[l-1],H=A[l];O.has(rt(D))||O.has(rt(H))||E.children.push({points:[D,H],color:m,width:nt})}E.children.length&&y.current.add(()=>o.update(E))}const N=U[w];if(N&&v?.length){const O=W.get(m);v.forEach(l=>{N.children.push({source:O,bounds:k(l.x,l.y,O.width,O.height,n.current)})}),N.children.length&&y.current.add(()=>o.update(N))}});const $=V.find(u=>u.name===It),J=new Map;g.current=u=>{try{n.current=dt(u);const m=[];for(let v=0;v<U.length;v++){const p=U[v].children;for(let w=0;w<p.length;w++){const E=p[w];E.bounds=k(E.bounds.center.x,E.bounds.center.y,E.source.width,E.source.height,n.current,E.bounds.rotation),m.push(E)}}const A=[...s.current.values()];for(let v=0;v<A.length;v++){const p=A[v];p.bounds=k(p.bounds.center.x,p.bounds.center.y,p.source.width,p.source.height,n.current,p.bounds.rotation)}y.current.add(()=>o.update(...m,...A))}catch(m){console.error("ptscale",m)}},o.events.addEventListener("viewport:ptscale",g.current),Z.forEach((u,m)=>{J.set(m,ft({id:m,width:G,height:G,color:u,scale:window.devicePixelRatio}))}),J.set(ot,ft({id:"orphan",width:G,height:G,color:ot,scale:window.devicePixelRatio}));let j=null;try{const u=await Mt(`${Lt}icons/bus-white.svg`);j=vt(u,ut,ut,window.devicePixelRatio)}catch(u){console.error(u)}I.current=u=>{try{const m=JSON.parse(u.data);if(m.type!==At)return;const A=u.timeStamp||performance.now();b.current=Math.round(A-L.current),L.current=A;const v=Math.max(b.current??ht,ht),p=d.current,w=s.current,E=$.children,N=y.current;let O=!1;m.data.forEach(({id:l,x:D,y:H,route_id:st,hidden:yt})=>{if(p.has(l)&&(p.get(l)?.(),p.delete(l)),yt&&w.has(l)&&w.has(Q(l))){const T=w.get(l);T.hidden=!0;const S=w.get(Q(l));S.hidden=!0,N.add(()=>o.update(T,S));return}if(P.current.set(l,performance.now()),!w.has(l)){const T=J.get(st)||J.get(ot),S={id:l,source:T,bounds:k(D,H,T.width,T.height,n.current,0)};if(w.set(l,S),j){const q=Q(l),at={id:q,source:j,bounds:k(D,H,j.width,j.height,n.current,0)};j.setAttribute("id",q),w.set(q,at),E.push(S,at)}else E.push(S);O=!0;return}const K=w.get(l),it=w.get(Q(l)),pt=K.bounds.center,et=Ot(pt,{x:D,y:H},x.current.get(st));if(et.reduce((T,S,q)=>q===0?T:T+ct(et[q-1],S),0)>=Tt||document.hidden)gt({renderer:o,updateQueue:N,vehicle:K,vehicleFinery:it,x:D,y:H,scale:n.current,angle:Ct(K.bounds.center,{x:D,y:H})});else{const T=Dt(et,v,S=>{gt({renderer:o,updateQueue:N,vehicle:K,vehicleFinery:it,x:S.x,y:S.y,scale:n.current,angle:S.angle})});p.set(l,T)}}),O&&N.add(()=>o.update($))}catch(m){console.error("handleSocketMessage",m)}},F(),X(f.config?(Number(f.config.vehicle_inactive_interval)||20)*1e3:Pt)}catch(f){console.warn(f)}}R();function F(){h.current?.readyState===WebSocket.OPEN||h.current?.readyState===WebSocket.CONNECTING||(h.current=new WebSocket(e),h.current.onmessage=I.current,h.current.onopen=()=>{a.current=lt},h.current.onclose=()=>{if(!navigator.onLine)return;setTimeout(F,a.current);const f=3e4;a.current=Math.min(a.current*2,f)})}function _(){F()}window.addEventListener("online",_);function X(f){clearInterval(C.current),C.current=window.setInterval(()=>{const Z=performance.now(),V=[],W=[];P.current.forEach((z,Y)=>{if(Z-z<f)return;const B=s.current.get(Y);B&&(B.hidden=!0,W.push(B),V.push(Y));const U=Q(Y),$=s.current.get(U);$&&($.hidden=!0,W.push($),V.push(U))}),W.length&&y.current.add(()=>o.update(...W)),V.forEach(z=>P.current.delete(z))},f)}return()=>{g.current&&o.events.removeEventListener("viewport:ptscale",g.current),d.current.forEach(f=>f?.()),d.current.clear(),s.current.clear(),y.current.destroy(),window.removeEventListener("online",_),clearInterval(C.current)}},[t,o,c,r,e])}function dt(t){return Math.min(t||window.devicePixelRatio,Ft)}function Ct(t,o){return Math.atan2(o.y-t.y,o.x-t.x)}function _t({radius:t,scale:o,color:c}){const r=document.createElement("canvas"),e=r.getContext("2d");e.imageSmoothingEnabled=!1;const i=Math.ceil(t*2*o),n=i/2,s=t*.78,d=t*.33;return r.width=i,r.height=i,e.translate(n,n),e.scale(o,o),e.beginPath(),e.arc(0,0,t,0,2*Math.PI),e.fillStyle="#FFFFFF",e.fill(),e.beginPath(),e.arc(0,0,s,0,2*Math.PI),e.fillStyle=c,e.fill(),e.beginPath(),e.arc(0,0,d,0,2*Math.PI),e.fillStyle="#FFFFFF",e.fill(),r}function ft({id:t,width:o,height:c,color:r,scale:e}){const i=2*e,n=o/2*e,s=c*e,d=.6,h=.01,I=s*d,L=s,b=8*e,y=L+i+I/2+b*2,x=n*2+I+i+b*2,g=document.createElement("canvas");g.setAttribute("id",t),g.width=y,g.height=x;const a=g.getContext("2d"),P=y/2,C=x/2;a.save(),a.translate(P,C),a.rotate(-Math.PI/2),a.translate(-P,-C);const R=P,F=C-L/2+n,_=F+I;return a.shadowColor="rgba(16, 24, 40, 0.2)",a.shadowBlur=b/2,a.beginPath(),a.arc(R,F,n,Math.PI,0,!1),a.bezierCurveTo(R+n,F+s*.3,R+h*n,_,R,_),a.bezierCurveTo(R-h*n,_,R-n,F+s*.3,R-n,F),a.closePath(),a.fillStyle=r,a.fill(),a.strokeStyle="#FFFFFF",a.lineWidth=i,a.stroke(),a.restore(),g}function ct(t,o){return Math.hypot(t.x-o.x,t.y-o.y)}function Q(t){return`${t}_finery`}function gt({renderer:t,updateQueue:o,vehicle:c,vehicleFinery:r,x:e,y:i,scale:n,angle:s}){if(c.bounds=k(e,i,c.source.width,c.source.height,n,s),c.hidden=!1,r){const d=t.controls.getCameraState();r.bounds=k(e,i,r.source.width,r.source.height,n,bt(d.roll||0)),r.hidden=!1,o.add(()=>t.update(r,c))}else o.add(()=>t.update(c))}function tt(t,o,c){return{x:t.x+(o.x-t.x)*c,y:t.y+(o.y-t.y)*c}}function mt(t,o){let c=1/0,r={index:0,t:0};for(let e=0;e<o.length-1;e++){const i=o[e],n=o[e+1],s=n.x-i.x,d=n.y-i.y,h=s*s+d*d,I=h?((t.x-i.x)*s+(t.y-i.y)*d)/h:0,L=Math.max(0,Math.min(1,I)),b=tt(i,n,L),y=ct(t,b);y<c&&(c=y,r={index:e,t:L})}return r}function Nt(t,o,c){const r=ct(t,o),e=Math.max(2,Math.ceil(r/c)+1),i=[];for(let n=0;n<e;n++){const s=n/(e-1),d=tt(t,o,s);i.push({x:d.x,y:d.y})}return i}function Ot(t,o,c){if(!c||!c.length)return Nt(t,o,10);const r=mt(t,c),e=mt(o,c),i=[],n=s=>i.push({x:s.x,y:s.y});r.index+1<c.length?n(tt(c[r.index],c[r.index+1],r.t)):n(c[r.index]);for(let s=r.index+1;s<=e.index&&s<c.length;s++)n(c[s]);return e.index+1<c.length?n(tt(c[e.index],c[e.index+1],e.t)):n(c[e.index]),i}function Dt(t,o,c,r){if(t.length<2)return()=>{};let e=null,i;const n=[];let s=0;for(let h=0;h<t.length-1;h++){const I=Math.hypot(t[h+1].x-t[h].x,t[h+1].y-t[h].y);n.push(I),s+=I}const d=h=>{e||(e=h);const I=h-e,L=Math.min(I/o,1),b=L*s;let y=0,x=0;for(;x<n.length&&y+n[x]<b;)y+=n[x],x++;x>=n.length&&(x=n.length-1);const g=t[x],a=t[Math.min(x+1,t.length-1)],P=n[x]||0,C=P===0?0:(b-y)/P,R=g.x+(a.x-g.x)*C,F=g.y+(a.y-g.y)*C,_=a.x-g.x,X=a.y-g.y,f=_===0&&X===0?0:Math.atan2(X,_);c({x:R,y:F,angle:f}),L<1?i=requestAnimationFrame(d):r&&r()};return i=requestAnimationFrame(d),()=>{i&&cancelAnimationFrame(i)}}function rt(t){return`${t.x},${t.y}`}
@@ -1 +1 @@
1
- export function getVisibleArea(t){const n=t.viewport.canvasToSvg({x:0,y:0}),a=t.viewport.canvasToSvg({x:t.canvas.clientWidth,y:0}),e=t.viewport.canvasToSvg({x:0,y:t.canvas.clientHeight}),i=t.viewport.canvasToSvg({x:t.canvas.clientWidth,y:t.canvas.clientHeight}),o=Math.min(n.x,a.x,e.x,i.x),c=Math.max(n.x,a.x,e.x,i.x),x=Math.min(n.y,a.y,e.y,i.y),v=Math.max(n.y,a.y,e.y,i.y);return{x:o,y:x,width:c-o,height:v-x,left:o,right:c,top:v,bottom:x,center:{x:(o+c)/2,y:(x+v)/2}}}export function isPointVisible(t,n){const a=getVisibleArea(t);return n.x>=a.left&&n.x<=a.right&&n.y>=a.bottom&&n.y<=a.top}
1
+ export function getVisibleArea(t){const o=t.viewport.canvasToSvg({x:0,y:0}),a=t.viewport.canvasToSvg({x:t.canvas.clientWidth,y:0}),i=t.viewport.canvasToSvg({x:0,y:t.canvas.clientHeight}),c=t.viewport.canvasToSvg({x:t.canvas.clientWidth,y:t.canvas.clientHeight}),n=Math.min(o.x,a.x,i.x,c.x),s=Math.max(o.x,a.x,i.x,c.x),x=Math.min(o.y,a.y,i.y,c.y),v=Math.max(o.y,a.y,i.y,c.y);return{x:n,y:x,width:s-n,height:v-x,left:n,right:s,top:v,bottom:x,center:{x:(n+s)/2,y:(x+v)/2}}}export function isPointVisible(t,o){const a=getVisibleArea(t);return o.x>=a.left&&o.x<=a.right&&o.y>=a.bottom&&o.y<=a.top}