@expofp/floorplan 3.2.5 → 3.2.7
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.
- package/dist/browser/{CookieConsent-Dg2oD8sN.js → CookieConsent-C0WrwOQU.js} +2995 -2564
- package/dist/browser/{Debug-CbQznba_.js → Debug-7KOvbcgu.js} +9 -9
- package/dist/browser/{Demo-BdNX6_TP.js → Demo-BTrpOaT8.js} +12 -12
- package/dist/browser/{Free-BwoR5utw.js → Free-1JPcV1Tq.js} +14 -14
- package/dist/browser/{Gallery-CXfebPUO.js → Gallery-PP-H3fui.js} +9 -9
- package/dist/browser/{GpsLoader-Br89Qdn5.js → GpsLoader-pif05qaO.js} +33 -33
- package/dist/browser/{KioskStore-B2-ZAICw.js → KioskStore-BmqfGXEW.js} +17 -17
- package/dist/browser/Mapbox-BEO3oA1E.js +120 -0
- package/dist/browser/{SetKioskMode-CeBuv4Qc.js → SetKioskMode-BjyRxPem.js} +17 -17
- package/dist/browser/ShowKiosk-DrNFPO0o.js +26 -0
- package/dist/browser/{ThreeComponent-yHjpVIkt.js → ThreeComponent-CkTRDPj-.js} +244 -244
- package/dist/browser/{TouchHand-BEAsV_dg.js → TouchHand-BX9ElW6V.js} +4 -4
- package/dist/browser/{ViewerMenuPanel-Db8sxCQM.js → ViewerMenuPanel-BpxIaNdU.js} +15 -15
- package/dist/browser/{add-debug-secret-listener-BLEkj_Uk.js → add-debug-secret-listener-BV3Vlx9C.js} +1 -1
- package/dist/browser/{boolean-editor-COimNwU3.js → boolean-editor-DfkvcIH0.js} +10 -10
- package/dist/browser/bootIntercom-XKKrQyNd.js +37 -0
- package/dist/browser/{box-BQZT5OqH.js → box-Cy-U95_G.js} +5 -5
- package/dist/browser/{browser-8dPZoUbt.js → browser-oUjLaYcl.js} +2 -2
- package/dist/browser/bundle.json +53 -53
- package/dist/browser/{classnames-BCwn2LMt.js → classnames-DpaK9tQ8.js} +2 -2
- package/dist/browser/{client-Db8--ZUb.js → client-smunwL9U.js} +4 -4
- package/dist/browser/{data-DmyuOKjY.js → data-BVaCNE1I.js} +56 -56
- package/dist/browser/{debug-overlay-B4Z5LEoG.js → debug-overlay-CYWt6Xv8.js} +11 -11
- package/dist/browser/{debug-ui-CvJwtvIB.js → debug-ui-D63K4FZz.js} +6 -6
- package/dist/browser/{dist-C97JwCm0.js → dist-BU_A8R-K.js} +6 -6
- package/dist/browser/{dist-BG3wb6v1.js → dist-XBFUxmAT.js} +3 -3
- package/dist/browser/{dist-Dci3wfOd.js → dist-irw0I8ne.js} +5 -5
- package/dist/browser/{efp-debug-init-p9zcimBs.js → efp-debug-init-CPGmIrNj.js} +2 -2
- package/dist/browser/{enum-editor-o306HPmN.js → enum-editor-B_JVlLVN.js} +11 -11
- package/dist/browser/{exports-CStWW5-w.js → exports-C5NN5UxX.js} +1 -1
- package/dist/browser/{favicon-BA1CtVMn.js → favicon-B0nAd4Pr.js} +1 -1
- package/dist/browser/{fetch-retry.umd-Baj5gCtY.js → fetch-retry.umd-DBq0GieJ.js} +2 -2
- package/dist/browser/{flex-Bk7NLAwd.js → flex-DOhgUp1k.js} +6 -6
- package/dist/browser/{flex.props-DYJg7oQW.js → flex.props-D8JHoC5B.js} +2 -2
- package/dist/browser/{floorplan.loader-DSLFX3Z1.js → floorplan.loader-Cme4mipd.js} +9 -9
- package/dist/browser/{floorplan.ready-D1C9tWKU.js → floorplan.ready-C25lQjgP.js} +215 -254
- package/dist/browser/{fuse-DHUSTGYM.js → fuse-D1o3bI0m.js} +2 -2
- package/dist/browser/index.js +12 -12
- package/dist/browser/{is-debug-Hdaykk22.js → is-debug-D9BzIDdu.js} +3 -3
- package/dist/browser/{jsx-runtime-BudMXsuy.js → jsx-runtime-C0zFKVvF.js} +2 -2
- package/dist/browser/{lib-Dl-Q0kBv.js → lib-D2sBqUIY.js} +4 -4
- package/dist/browser/{main-C74Uu09R.js → main-GLYY8zv3.js} +1 -1
- package/dist/browser/{mobx-CqnQOCE3.js → mobx-D5pYBM85.js} +4 -4
- package/dist/browser/{particles.min-By5wV8f0.js → particles.min-egXyIDIV.js} +2 -2
- package/dist/browser/{prop-types-PFP3f1FZ.js → prop-types-xhHzBbvi.js} +2 -2
- package/dist/browser/{react-COj6SqvB.js → react-CanbjT5I.js} +2 -2
- package/dist/browser/{react-dom-BdCxtmki.js → react-dom-wNBYs_H5.js} +3 -3
- package/dist/browser/{reset-all-settings-BQEz2q9w.js → reset-all-settings-5oUUws5J.js} +7 -7
- package/dist/browser/{rolldown-runtime-msuxsciZ.js → rolldown-runtime-BKpHzyBK.js} +1 -1
- package/dist/browser/{settings-C0lWPVRL.js → settings-D5qqIejY.js} +2 -2
- package/dist/browser/{settings-item-Y4RmHiJ4.js → settings-item-Blm7DAEt.js} +6 -6
- package/dist/browser/{store-5PES-APA.js → store-CM7rJpRZ.js} +1151 -916
- package/dist/browser/{string-editor-CDEAe6WK.js → string-editor-CLdOCbq2.js} +8 -8
- package/dist/browser/{theme-yitmRjt6.js → theme-App4ywLP.js} +8 -8
- package/dist/browser/{ui--XBIRzrF.js → ui-BN6m_5pK.js} +8 -8
- package/dist/esm/RouteCutIn.js +1 -1
- package/dist/esm/components/IntercomLauncher.d.ts +5 -0
- package/dist/esm/components/IntercomLauncher.js +1 -0
- package/dist/esm/components/Layout.js +1 -1
- package/dist/esm/components/Map/Map.js +1 -1
- package/dist/esm/components/Map/drawing/config/config-all.js +1 -1
- package/dist/esm/components/gps/useUserLocationAndHeading.js +1 -1
- package/dist/esm/components/gps/utils.js +1 -1
- package/dist/esm/floorplan.ready.js +1 -1
- package/dist/esm/intercom/bootIntercom.js +1 -19
- package/dist/esm/store/IntercomStore.d.ts +7 -0
- package/dist/esm/store/IntercomStore.js +1 -0
- package/dist/esm/store/RootStore.d.ts +2 -0
- package/dist/esm/store/RootStore.js +1 -1
- package/dist/esm/store/RouteStore.d.ts +1 -1
- package/dist/esm/store/RouteStore.js +1 -1
- package/dist/esm/store/index.d.ts +1 -0
- package/dist/esm/store/index.js +1 -1
- package/dist/esm/utils/gps.d.ts +0 -1
- package/dist/esm/utils/gps.js +1 -1
- package/dist/esm/utils/haversineDistance.d.ts +7 -0
- package/dist/esm/utils/haversineDistance.js +1 -0
- package/dist/esm/wayfinding/adapters/boothToEndpoint.d.ts +13 -0
- package/dist/esm/wayfinding/adapters/boothToEndpoint.js +1 -0
- package/dist/esm/wayfinding/adapters/boothToWaypoint.d.ts +1 -1
- package/dist/esm/wayfinding/adapters/canvasIconProvider.d.ts +20 -0
- package/dist/esm/wayfinding/adapters/canvasIconProvider.js +1 -0
- package/dist/esm/wayfinding/adapters/floorContext.d.ts +10 -0
- package/dist/esm/wayfinding/adapters/floorContext.js +1 -0
- package/dist/esm/wayfinding/adapters/graphDataSource.d.ts +1 -1
- package/dist/esm/wayfinding/adapters/iconProvider.d.ts +15 -0
- package/dist/esm/wayfinding/adapters/index.d.ts +9 -0
- package/dist/esm/wayfinding/adapters/index.js +1 -0
- package/dist/esm/wayfinding/adapters/kioskCanvas.d.ts +7 -0
- package/dist/esm/wayfinding/adapters/kioskCanvas.js +1 -0
- package/dist/esm/wayfinding/adapters/positionInput.d.ts +11 -0
- package/dist/esm/wayfinding/adapters/positionInput.js +1 -0
- package/dist/esm/wayfinding/bindMobxReactions.d.ts +27 -0
- package/dist/esm/wayfinding/bindMobxReactions.js +1 -0
- package/dist/esm/wayfinding/{__tests__ → core/__tests__}/helpers.d.ts +0 -5
- package/dist/esm/wayfinding/core/__tests__/helpers.js +1 -0
- package/dist/esm/wayfinding/core/createWayfindingEngine.d.ts +16 -0
- package/dist/esm/wayfinding/core/createWayfindingEngine.js +1 -0
- package/dist/esm/wayfinding/{graph → core/graph}/graphCache.d.ts +2 -1
- package/dist/esm/wayfinding/core/index.d.ts +16 -0
- package/dist/esm/wayfinding/core/index.js +1 -0
- package/dist/esm/wayfinding/core/position/distanceToRoute.d.ts +3 -0
- package/dist/esm/wayfinding/core/position/distanceToRoute.js +1 -0
- package/dist/esm/wayfinding/core/position/gpsThreshold.d.ts +22 -0
- package/dist/esm/wayfinding/core/position/gpsThreshold.js +1 -0
- package/dist/esm/wayfinding/core/position/shouldReroute.d.ts +3 -0
- package/dist/esm/wayfinding/core/position/shouldReroute.js +1 -0
- package/dist/esm/wayfinding/core/position/snapToRoute.d.ts +4 -0
- package/dist/esm/wayfinding/core/position/snapToRoute.js +1 -0
- package/dist/esm/{components/Map/drawing/config/route-snapping → wayfinding/core/position}/splitRouteByPoint.d.ts +1 -1
- package/dist/esm/wayfinding/core/position/splitRouteByPoint.js +1 -0
- package/dist/esm/wayfinding/core/rendering/computeTrailPoints.d.ts +19 -0
- package/dist/esm/wayfinding/core/rendering/computeTrailPoints.js +1 -0
- package/dist/esm/wayfinding/{rendering → core/rendering}/computeTransitionPoints.d.ts +2 -2
- package/dist/esm/wayfinding/core/rendering/getVisibleRouteLines.d.ts +11 -0
- package/dist/esm/wayfinding/core/rendering/getVisibleRouteLines.js +1 -0
- package/dist/esm/wayfinding/core/rendering/normalizeRouteDirection.d.ts +20 -0
- package/dist/esm/wayfinding/core/rendering/normalizeRouteDirection.js +1 -0
- package/dist/esm/wayfinding/core/rendering/routeGeometry.d.ts +15 -0
- package/dist/esm/wayfinding/core/rendering/routeGeometry.js +1 -0
- package/dist/esm/wayfinding/core/routing/optimizeWaypointOrder.d.ts +19 -0
- package/dist/esm/wayfinding/core/routing/optimizeWaypointOrder.js +1 -0
- package/dist/esm/wayfinding/core/routing/resolveWaypointCandidates.d.ts +7 -0
- package/dist/esm/wayfinding/core/routing/resolveWaypointCandidates.js +1 -0
- package/dist/esm/wayfinding/{types.d.ts → core/types.d.ts} +37 -0
- package/dist/esm/wayfinding/createWayfinding.d.ts +3 -0
- package/dist/esm/wayfinding/createWayfinding.js +1 -0
- package/dist/esm/wayfinding/handlers/kioskHandler.d.ts +25 -0
- package/dist/esm/wayfinding/handlers/kioskHandler.js +1 -0
- package/dist/esm/wayfinding/handlers/yahHandler.d.ts +23 -0
- package/dist/esm/wayfinding/handlers/yahHandler.js +1 -0
- package/dist/esm/wayfinding/layers.d.ts +14 -0
- package/dist/esm/wayfinding/layers.js +1 -0
- package/dist/esm/wayfinding/renderer/createWayfindingRenderer.d.ts +14 -0
- package/dist/esm/wayfinding/renderer/createWayfindingRenderer.js +1 -0
- package/dist/esm/wayfinding/renderer/iconManager.d.ts +31 -0
- package/dist/esm/wayfinding/renderer/iconManager.js +1 -0
- package/dist/esm/wayfinding/renderer/index.d.ts +3 -0
- package/dist/esm/wayfinding/renderer/index.js +1 -0
- package/dist/esm/wayfinding/renderer/layerManager.d.ts +27 -0
- package/dist/esm/wayfinding/renderer/layerManager.js +1 -0
- package/dist/esm/wayfinding/renderer/routeLineManager.d.ts +42 -0
- package/dist/esm/wayfinding/renderer/routeLineManager.js +1 -0
- package/dist/esm/wayfinding/renderer/trailManager.d.ts +27 -0
- package/dist/esm/wayfinding/renderer/trailManager.js +1 -0
- package/dist/esm/wayfinding/renderer/types.d.ts +162 -0
- package/dist/esm/wayfinding/runtime/createWayfindingRuntime.d.ts +3 -0
- package/dist/esm/wayfinding/runtime/createWayfindingRuntime.js +1 -0
- package/dist/esm/wayfinding/runtime/endpointView.d.ts +16 -0
- package/dist/esm/wayfinding/runtime/endpointView.js +1 -0
- package/dist/esm/wayfinding/runtime/getRouteLines.d.ts +13 -0
- package/dist/esm/wayfinding/runtime/getRouteLines.js +1 -0
- package/dist/esm/wayfinding/runtime/positionTrailView.d.ts +57 -0
- package/dist/esm/wayfinding/runtime/positionTrailView.js +1 -0
- package/dist/esm/wayfinding/runtime/positionView.d.ts +23 -0
- package/dist/esm/wayfinding/runtime/positionView.js +1 -0
- package/dist/esm/wayfinding/runtime/routeLinesView.d.ts +18 -0
- package/dist/esm/wayfinding/runtime/routeLinesView.js +1 -0
- package/dist/esm/wayfinding/runtime/routeRenderData.d.ts +29 -0
- package/dist/esm/wayfinding/runtime/routeRenderData.js +1 -0
- package/dist/esm/wayfinding/runtime/routeUpdate.d.ts +14 -0
- package/dist/esm/wayfinding/runtime/routeUpdate.js +1 -0
- package/dist/esm/wayfinding/runtime/trailView.d.ts +21 -0
- package/dist/esm/wayfinding/runtime/trailView.js +1 -0
- package/dist/esm/wayfinding/runtime/transitionView.d.ts +18 -0
- package/dist/esm/wayfinding/runtime/transitionView.js +1 -0
- package/dist/esm/wayfinding/runtime/types.d.ts +72 -0
- package/dist/esm/wayfinding/runtime/types.js +1 -0
- package/dist/esm/wayfinding/utils/findBoothInRadius.d.ts +4 -0
- package/dist/esm/wayfinding/utils/findBoothInRadius.js +1 -0
- package/package.json +3 -3
- package/dist/browser/Mapbox-B5PiDpk1.js +0 -120
- package/dist/browser/ShowKiosk-CfxC8v7B.js +0 -26
- package/dist/browser/bootIntercom-DjZFUOTC.js +0 -40
- package/dist/esm/components/Map/drawing/config/config-wf.d.ts +0 -8
- package/dist/esm/components/Map/drawing/config/config-wf.js +0 -1
- package/dist/esm/components/Map/drawing/config/route-snapping/index.d.ts +0 -5
- package/dist/esm/components/Map/drawing/config/route-snapping/index.js +0 -1
- package/dist/esm/components/Map/drawing/config/route-snapping/snapPositionToRoute.d.ts +0 -21
- package/dist/esm/components/Map/drawing/config/route-snapping/snapPositionToRoute.js +0 -1
- package/dist/esm/components/Map/drawing/config/route-snapping/splitRouteByPoint.js +0 -1
- package/dist/esm/components/Map/drawing/config/route-snapping/types.d.ts +0 -18
- package/dist/esm/components/Map/drawing/config/route-snapping/utils.d.ts +0 -29
- package/dist/esm/components/Map/drawing/config/route-snapping/utils.js +0 -1
- package/dist/esm/utils/buildOptimizedRoute.d.ts +0 -11
- package/dist/esm/utils/buildOptimizedRoute.js +0 -1
- package/dist/esm/wayfinding/_PLAN-public-api.d.ts +0 -220
- package/dist/esm/wayfinding/__integration__/legacy/legacyWayfinding.d.ts +0 -27
- package/dist/esm/wayfinding/__integration__/legacy/legacyWayfinding.js +0 -1
- package/dist/esm/wayfinding/__tests__/helpers.js +0 -1
- package/dist/esm/wayfinding/index.d.ts +0 -18
- package/dist/esm/wayfinding/index.js +0 -1
- package/dist/esm/wayfinding/rendering/normalizeRouteDirection.d.ts +0 -19
- package/dist/esm/wayfinding/rendering/normalizeRouteDirection.js +0 -1
- package/dist/esm/wayfinding/rendering/routeGeometry.d.ts +0 -16
- package/dist/esm/wayfinding/rendering/routeGeometry.js +0 -1
- package/dist/esm/wayfinding/routing/getGraphLines.d.ts +0 -14
- package/dist/esm/wayfinding/routing/getGraphLines.js +0 -1
- /package/dist/esm/{components/Map/drawing/config/route-snapping/types.js → wayfinding/adapters/iconProvider.js} +0 -0
- /package/dist/esm/wayfinding/{graph → core/graph}/buildGraph.d.ts +0 -0
- /package/dist/esm/wayfinding/{graph → core/graph}/buildGraph.js +0 -0
- /package/dist/esm/wayfinding/{graph → core/graph}/buildNGraph.d.ts +0 -0
- /package/dist/esm/wayfinding/{graph → core/graph}/buildNGraph.js +0 -0
- /package/dist/esm/wayfinding/{graph → core/graph}/constants.d.ts +0 -0
- /package/dist/esm/wayfinding/{graph → core/graph}/constants.js +0 -0
- /package/dist/esm/wayfinding/{graph → core/graph}/findShortestPath.d.ts +0 -0
- /package/dist/esm/wayfinding/{graph → core/graph}/findShortestPath.js +0 -0
- /package/dist/esm/wayfinding/{graph → core/graph}/graphCache.js +0 -0
- /package/dist/esm/wayfinding/{graph → core/graph}/graphHelpers.d.ts +0 -0
- /package/dist/esm/wayfinding/{graph → core/graph}/graphHelpers.js +0 -0
- /package/dist/esm/wayfinding/{graph → core/graph}/linkCost.d.ts +0 -0
- /package/dist/esm/wayfinding/{graph → core/graph}/linkCost.js +0 -0
- /package/dist/esm/wayfinding/{graph → core/graph}/pathfinder/aStarPathFinder.d.ts +0 -0
- /package/dist/esm/wayfinding/{graph → core/graph}/pathfinder/aStarPathFinder.js +0 -0
- /package/dist/esm/wayfinding/{graph → core/graph}/pathfinder/parseNodeId.d.ts +0 -0
- /package/dist/esm/wayfinding/{graph → core/graph}/pathfinder/parseNodeId.js +0 -0
- /package/dist/esm/wayfinding/{rendering → core/rendering}/computeTransitionPoints.js +0 -0
- /package/dist/esm/wayfinding/{routing → core/routing}/buildMultiPointRoute.d.ts +0 -0
- /package/dist/esm/wayfinding/{routing → core/routing}/buildMultiPointRoute.js +0 -0
- /package/dist/esm/wayfinding/{routing → core/routing}/buildRoute.d.ts +0 -0
- /package/dist/esm/wayfinding/{routing → core/routing}/buildRoute.js +0 -0
- /package/dist/esm/wayfinding/{routing → core/routing}/findNearestGraphPoint.d.ts +0 -0
- /package/dist/esm/wayfinding/{routing → core/routing}/findNearestGraphPoint.js +0 -0
- /package/dist/esm/wayfinding/{routing → core/routing}/getRouteLength.d.ts +0 -0
- /package/dist/esm/wayfinding/{routing → core/routing}/getRouteLength.js +0 -0
- /package/dist/esm/wayfinding/{routing → core/routing}/routeResult.d.ts +0 -0
- /package/dist/esm/wayfinding/{routing → core/routing}/routeResult.js +0 -0
- /package/dist/esm/wayfinding/{types.js → core/types.js} +0 -0
- /package/dist/esm/wayfinding/{_PLAN-public-api.js → renderer/types.js} +0 -0
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import type { BoundingBox, RouteEndpoint, RouteLine, TransitionPointDef, WayfindingEngine } from "../core";
|
|
2
|
+
import type { WayfindingRenderer } from "../renderer";
|
|
3
|
+
import type { IconProvider } from "../adapters";
|
|
4
|
+
/** User position + optional heading, without efp store coupling. */
|
|
5
|
+
export interface PositionInput {
|
|
6
|
+
readonly x: number;
|
|
7
|
+
readonly y: number;
|
|
8
|
+
readonly layer: string;
|
|
9
|
+
/** Heading in degrees. Absent → no rotation (dot variant). */
|
|
10
|
+
readonly angle?: number;
|
|
11
|
+
}
|
|
12
|
+
export interface LayerNames {
|
|
13
|
+
readonly points: string;
|
|
14
|
+
readonly trail: string;
|
|
15
|
+
readonly lines: string;
|
|
16
|
+
readonly linesAnimated: string;
|
|
17
|
+
}
|
|
18
|
+
export interface SetRouteInput {
|
|
19
|
+
readonly from: RouteEndpoint;
|
|
20
|
+
readonly to: RouteEndpoint;
|
|
21
|
+
readonly waypoints?: ReadonlyArray<RouteEndpoint>;
|
|
22
|
+
readonly accessible: boolean;
|
|
23
|
+
}
|
|
24
|
+
export interface WayfindingRuntime {
|
|
25
|
+
/**
|
|
26
|
+
* Build (or update) the active route. Places endpoint/transition/trail icons
|
|
27
|
+
* and fires `onRouteUpdate` + `onRouteDistance` callbacks.
|
|
28
|
+
*/
|
|
29
|
+
setRoute(input: SetRouteInput): void;
|
|
30
|
+
/**
|
|
31
|
+
* Notify the runtime that the user position changed. `null` hides the position icon and clears
|
|
32
|
+
* the off-route trail. Dot vs arrow variant is derived from `position.angle` internally.
|
|
33
|
+
*/
|
|
34
|
+
onPositionChanged(position: PositionInput | null): void;
|
|
35
|
+
/** Notify the runtime that the active floor changed; re-renders visible route content. */
|
|
36
|
+
onFloorChanged(): void;
|
|
37
|
+
clearRoute(): void;
|
|
38
|
+
destroy(): void;
|
|
39
|
+
}
|
|
40
|
+
export interface WayfindingRuntimeConfig {
|
|
41
|
+
readonly engine: WayfindingEngine;
|
|
42
|
+
readonly renderer: WayfindingRenderer;
|
|
43
|
+
readonly iconProvider: IconProvider;
|
|
44
|
+
readonly floorContext: FloorContext;
|
|
45
|
+
readonly layers: LayerNames;
|
|
46
|
+
readonly snapThreshold: number;
|
|
47
|
+
readonly onTransitionClick: (point: TransitionPointDef) => void;
|
|
48
|
+
/** Fired when the route itself changes. `bounds` is the bbox of visible route points (null when empty). */
|
|
49
|
+
readonly onRouteUpdate: (lines: RouteLine[], bounds: BoundingBox | null) => void;
|
|
50
|
+
/** Fired when distance changes — on route change and on position snap updates. */
|
|
51
|
+
readonly onRouteDistance: (distance: number) => void;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Abstracts floor-state queries for the runtime.
|
|
55
|
+
*
|
|
56
|
+
* Views ask these predicates instead of reading any store directly;
|
|
57
|
+
* an adapter (see `adapters/floorContext.ts`) supplies the implementation
|
|
58
|
+
* that bridges to a concrete store (e.g., efp `LayerStore` + `RouteStore`).
|
|
59
|
+
*
|
|
60
|
+
* - {@link showAllFloors} — true when the map is rendering all floors simultaneously (no floor scoping/single-floor).
|
|
61
|
+
* - {@link getActiveFloor} — name of the active route floor, or `""` when unresolvable;
|
|
62
|
+
* callers must check `!showAllFloors()` first.
|
|
63
|
+
* - {@link isLayerVisible} — per-layer visibility for endpoint dim/hide and cross-floor trail gating.
|
|
64
|
+
* - {@link getFloorOrder} — stable floor-name order used by transition placement.
|
|
65
|
+
*/
|
|
66
|
+
export interface FloorContext {
|
|
67
|
+
showAllFloors(): boolean;
|
|
68
|
+
getActiveFloor(): string;
|
|
69
|
+
isLayerVisible(layer: string): boolean;
|
|
70
|
+
getFloorOrder(): string[];
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Booth } from "../../store/BoothStore";
|
|
2
|
+
import type { CurrentPosition } from "../../store/RouteStore";
|
|
3
|
+
export declare function findBoothInRadius(position: CurrentPosition | null, booths: Booth[], excludeBooths?: Booth[], radius?: number): Booth | null;
|
|
4
|
+
//# sourceMappingURL=findBoothInRadius.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const s=20;function f(n,i,t){const u=n<t.x1?t.x1-n:n>t.x2?n-t.x2:0,d=i<t.y1?t.y1-i:i>t.y2?i-t.y2:0;return u*u+d*d}export function findBoothInRadius(n,i,t=[],u=20){if(!n||!i.length)return null;const d=n.z!=null?String(n.z):null,o=u*u,r=new Set(t.filter(e=>e?.id).map(e=>String(e.id)));let a=null,c=1/0;for(const e of i){if(!e.rect||e.id&&r.has(String(e.id))||d&&e.layer?.name!==d)continue;const l=f(n.x,n.y,e.rect);l<=o&&l<c&&(c=l,a=e)}return a}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@expofp/floorplan",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.7",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/expofp/efp-app.git",
|
|
@@ -76,8 +76,8 @@
|
|
|
76
76
|
"twgl.js": "^4.14.0",
|
|
77
77
|
"uuid": "^9.0.1",
|
|
78
78
|
"zod": "4.3.5",
|
|
79
|
-
"@expofp/
|
|
80
|
-
"@expofp/
|
|
79
|
+
"@expofp/debug": "3.2.7",
|
|
80
|
+
"@expofp/resolve": "3.2.7"
|
|
81
81
|
},
|
|
82
82
|
"devDependencies": {
|
|
83
83
|
"@babel/plugin-proposal-decorators": "^7.29.0",
|
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
(function() {
|
|
2
|
-
try {
|
|
3
|
-
var e = typeof window < "u" ? window : typeof global < "u" ? global : typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : {};
|
|
4
|
-
e.SENTRY_RELEASE = { id: "3.2.5" };
|
|
5
|
-
var t = new e.Error().stack;
|
|
6
|
-
t && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[t] = "3afeb677-874c-4941-a4de-1974025ce13e", e._sentryDebugIdIdentifier = "sentry-dbid-3afeb677-874c-4941-a4de-1974025ce13e");
|
|
7
|
-
} catch {}
|
|
8
|
-
})();
|
|
9
|
-
import { r as e } from "./rolldown-runtime-msuxsciZ.js";
|
|
10
|
-
import { t } from "./react-COj6SqvB.js";
|
|
11
|
-
import { t as n } from "./jsx-runtime-BudMXsuy.js";
|
|
12
|
-
import { t as r } from "./classnames-BCwn2LMt.js";
|
|
13
|
-
import { Gn as i, Jn as a, Qn as o, Zn as s, a as c, o as l, t as u } from "./store-5PES-APA.js";
|
|
14
|
-
import { r as d } from "./mobx-CqnQOCE3.js";
|
|
15
|
-
import { _ as f, a as p, c as m, d as h, f as g, h as _, i as v, l as y, m as b, o as x, p as S, r as C, s as w, u as T } from "./data-DmyuOKjY.js";
|
|
16
|
-
//#region src/components/Mapbox/Mapbox.tsx
|
|
17
|
-
var E = /* @__PURE__ */ e(r(), 1), D = /* @__PURE__ */ e(f(), 1), O = /* @__PURE__ */ e(t(), 1), k = n();
|
|
18
|
-
function A() {
|
|
19
|
-
let e = (0, O.useRef)(null), t = (0, O.useRef)(null), n = null, r = [], f = s(() => ({
|
|
20
|
-
get initselected() {
|
|
21
|
-
return ![...l.selectedBooths].filter((e) => e.rect);
|
|
22
|
-
},
|
|
23
|
-
get actualCurrentPosition() {
|
|
24
|
-
let e = c.routeStore.currentPosition;
|
|
25
|
-
return !(e != null && e.z) || c.layerStore.visible.indexOf(c.layerStore.findLayer(e.z)) > -1 ? e : null;
|
|
26
|
-
},
|
|
27
|
-
get style() {
|
|
28
|
-
return { left: 0 };
|
|
29
|
-
}
|
|
30
|
-
}));
|
|
31
|
-
return (0, O.useEffect)(() => {
|
|
32
|
-
if (!t.current) {
|
|
33
|
-
var { cx: n, cy: o } = x.viewbox;
|
|
34
|
-
t.current = new D.default.Map({
|
|
35
|
-
container: e.current,
|
|
36
|
-
style: `mapbox://styles/mapbox/${x.style}`,
|
|
37
|
-
center: [n, o],
|
|
38
|
-
zoom: 15.5,
|
|
39
|
-
bearing: x.initBearing - 30,
|
|
40
|
-
pitch: x.initPitch + 30,
|
|
41
|
-
maxPitch: 70,
|
|
42
|
-
bearingSnap: 0,
|
|
43
|
-
accessToken: x.token
|
|
44
|
-
}), T(t.current), t.current.on("load", async () => {
|
|
45
|
-
var e;
|
|
46
|
-
setTimeout(() => p(f.initselected ? a.fromMultiple([...l.selectedBooths].filter((e) => e.rect).map((e) => e.rect)) : i, 15, 4e3), 1500), t.current.setLight({
|
|
47
|
-
anchor: "viewport",
|
|
48
|
-
color: "white",
|
|
49
|
-
intensity: 0
|
|
50
|
-
});
|
|
51
|
-
let n = await C(c.boothStore.booths);
|
|
52
|
-
m(c.boothStore.booths, n), h("yah", (e = c.routeStore.defaultFrom) != null && e.rect ? {
|
|
53
|
-
x: c.routeStore.defaultFrom.rect.cx,
|
|
54
|
-
y: c.routeStore.defaultFrom.rect.cy
|
|
55
|
-
} : null), h("cp", f.actualCurrentPosition), r = y(c.layerStore.layers);
|
|
56
|
-
let o = r.filter((e) => e.indexOf("--") === -1);
|
|
57
|
-
b(c.routeStore), w(), t.current.on("mouseenter", o, () => t.current.getCanvas().style.cursor = "pointer"), t.current.on("mouseleave", o, () => t.current.getCanvas().style.cursor = ""), t.current.on("click", (e) => {
|
|
58
|
-
let n = [[e.point.x - 5, e.point.y - 5], [e.point.x + 5, e.point.y + 5]], i = t.current.queryRenderedFeatures(n, { layers: r })[0], a = c.boothStore.booths.find((e) => {
|
|
59
|
-
var t;
|
|
60
|
-
return e.name === (i == null || (t = i.properties) == null ? void 0 : t.id);
|
|
61
|
-
});
|
|
62
|
-
c.clickBooth(a);
|
|
63
|
-
});
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
}), d(() => l.zoomBy, () => {
|
|
67
|
-
if (!l.zoomBy || !c.mapboxStore.showMapbox) return;
|
|
68
|
-
let e = l.zoomBy;
|
|
69
|
-
l.zoomBy = null, t.current.flyTo({
|
|
70
|
-
zoom: t.current.getZoom() + (e > 1 ? .5 : -.5),
|
|
71
|
-
animate: !0,
|
|
72
|
-
duration: 500,
|
|
73
|
-
essential: !0
|
|
74
|
-
});
|
|
75
|
-
}), d(() => [
|
|
76
|
-
c.layerStore.loaded,
|
|
77
|
-
c.layerStore.visible,
|
|
78
|
-
l.selectedRoute
|
|
79
|
-
], () => {
|
|
80
|
-
var e, n;
|
|
81
|
-
r.forEach((e) => {
|
|
82
|
-
let n = e.split("--")[0], r = c.layerStore.layers.find((e) => e.name === n);
|
|
83
|
-
(r.visible || t.current.getLayoutProperty(e, "visibility") !== "none") && t.current.setLayoutProperty(e, "visibility", r.visible ? "visible" : "none");
|
|
84
|
-
}), _([...l.selectedBooths], c.boothStore.booths), h("yah", (e = c.routeStore.defaultFrom) != null && e.rect && !((n = c.routeStore.defaultFrom) == null || (n = n.layer) == null) && n.visible ? {
|
|
85
|
-
x: c.routeStore.defaultFrom.rect.cx,
|
|
86
|
-
y: c.routeStore.defaultFrom.rect.cy
|
|
87
|
-
} : null), h("cp", f.actualCurrentPosition);
|
|
88
|
-
}), d(() => l.hoveredBooths, () => {
|
|
89
|
-
n && (clearTimeout(n), n = null), n = setTimeout(() => {
|
|
90
|
-
n = null, S([...l.hoveredBooths].filter((e) => {
|
|
91
|
-
var t, n;
|
|
92
|
-
return (t = (n = e.layer) == null ? void 0 : n.visible) == null ? !0 : t;
|
|
93
|
-
}), c.boothStore.booths);
|
|
94
|
-
}, 50);
|
|
95
|
-
}), d(() => [l.selectedBooths, l.listBooths], () => {
|
|
96
|
-
var e = [];
|
|
97
|
-
l.selectedBooths.size ? e = [...l.selectedBooths] : l.listBooths.size && (l.activeListIndex === 0 || l.list.type === "bookmarks" || l.list.type === "category") && (e = [...l.listBooths]), _(e, c.boothStore.booths);
|
|
98
|
-
}), d(() => c.mapboxStore.showMapbox, () => {
|
|
99
|
-
g(c.mapboxStore.showMapbox);
|
|
100
|
-
}), d(() => l.moveToBooths, () => {
|
|
101
|
-
if (!l.moveToBooths || !c.mapboxStore.showMapbox) return;
|
|
102
|
-
let e = l.moveToBooths.filter((e) => e.rect).map((e) => e.rect), t = a.fromMultiple(e);
|
|
103
|
-
e.length && p(t), l.moveToBooths = null;
|
|
104
|
-
}), d(() => l.moveToRect, () => {
|
|
105
|
-
!l.moveToRect || !c.mapboxStore.showMapbox || (p(l.moveToRect, 15), l.moveToRect = null);
|
|
106
|
-
}), d(() => l.moveToLocation, () => {
|
|
107
|
-
!l.moveToLocation || !c.mapboxStore.showMapbox || v();
|
|
108
|
-
}), d(() => l.centerMap, () => {
|
|
109
|
-
!l.centerMap || !c.mapboxStore.showMapbox || (p(a.fromMultiple(u.booths.map((e) => e.rect)), 15), l.centerMap = !1);
|
|
110
|
-
}), d(() => c.routeStore.routeLines, () => b(c.routeStore)), d(() => f.actualCurrentPosition, () => h("cp", f.actualCurrentPosition)), o(() => /* @__PURE__ */ (0, k.jsx)("div", {
|
|
111
|
-
style: f.style,
|
|
112
|
-
className: (0, E.default)("map-container", { hidden: !c.mapboxStore.showMapbox }),
|
|
113
|
-
children: /* @__PURE__ */ (0, k.jsx)("div", {
|
|
114
|
-
ref: e,
|
|
115
|
-
className: (0, E.default)("map-wrapper", "mapboxgl-map")
|
|
116
|
-
})
|
|
117
|
-
}));
|
|
118
|
-
}
|
|
119
|
-
//#endregion
|
|
120
|
-
export { A as default };
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
(function() {
|
|
2
|
-
try {
|
|
3
|
-
var e = typeof window < "u" ? window : typeof global < "u" ? global : typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : {};
|
|
4
|
-
e.SENTRY_RELEASE = { id: "3.2.5" };
|
|
5
|
-
var t = new e.Error().stack;
|
|
6
|
-
t && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[t] = "fbcf2d22-2146-4e45-93a8-c0b71d1a5eb0", e._sentryDebugIdIdentifier = "sentry-dbid-fbcf2d22-2146-4e45-93a8-c0b71d1a5eb0");
|
|
7
|
-
} catch {}
|
|
8
|
-
})();
|
|
9
|
-
import "./rolldown-runtime-msuxsciZ.js";
|
|
10
|
-
import { t as e } from "./react-COj6SqvB.js";
|
|
11
|
-
import { t } from "./jsx-runtime-BudMXsuy.js";
|
|
12
|
-
import "./is-debug-Hdaykk22.js";
|
|
13
|
-
import { C as n, Xn as r, a as i, w as a } from "./store-5PES-APA.js";
|
|
14
|
-
import { n as o } from "./mobx-CqnQOCE3.js";
|
|
15
|
-
import { t as s } from "./TouchHand-BEAsV_dg.js";
|
|
16
|
-
import { t as c } from "./KioskStore-B2-ZAICw.js";
|
|
17
|
-
e();
|
|
18
|
-
var l = t(), u = r(() => (o(() => {
|
|
19
|
-
if (localStorage.getItem("kiosk") === "0") return;
|
|
20
|
-
let e = c.restoreData();
|
|
21
|
-
if (e) return n(e, !0), a(e), i.setResetCameraFn(() => c.resetCamera()), () => {
|
|
22
|
-
i.uiState.setKioskData(null), i.uiState.resetMapSettings(), c.resetCamera();
|
|
23
|
-
};
|
|
24
|
-
}), i.uiState.kiosk && i.uiState.inIdle ? /* @__PURE__ */ (0, l.jsx)(s, {}) : null));
|
|
25
|
-
//#endregion
|
|
26
|
-
export { u as default };
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
//#region src/intercom/bootIntercom.ts
|
|
2
|
-
(function() {
|
|
3
|
-
try {
|
|
4
|
-
var e = typeof window < "u" ? window : typeof global < "u" ? global : typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : {};
|
|
5
|
-
e.SENTRY_RELEASE = { id: "3.2.5" };
|
|
6
|
-
var t = new e.Error().stack;
|
|
7
|
-
t && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[t] = "06e888c6-8445-4eae-b329-7fd09afcdde9", e._sentryDebugIdIdentifier = "sentry-dbid-06e888c6-8445-4eae-b329-7fd09afcdde9");
|
|
8
|
-
} catch {}
|
|
9
|
-
})();
|
|
10
|
-
var e = "k5f7wyx2", t = !1;
|
|
11
|
-
function n() {
|
|
12
|
-
if (document.getElementById("efp-intercom-position")) return;
|
|
13
|
-
let e = document.createElement("style");
|
|
14
|
-
e.id = "efp-intercom-position", e.textContent = "\n .intercom-namespace,\n .intercom-lightweight-app,\n .intercom-app,\n [class*=\"intercom-with-namespace-\"]:not(.intercom-messenger-frame) {\n z-index: 20 !important;\n }\n .intercom-lightweight-app-launcher,\n .intercom-app > [class*=\"intercom-with-namespace-\"]:not(.intercom-messenger-frame) {\n right: 10px !important;\n bottom: 50px !important;\n }\n @media (max-width: 767px) {\n .intercom-lightweight-app-launcher,\n .intercom-app > [class*=\"intercom-with-namespace-\"]:not(.intercom-messenger-frame) {\n bottom: 80px !important;\n }\n }\n ", document.head.appendChild(e);
|
|
15
|
-
}
|
|
16
|
-
function r(r) {
|
|
17
|
-
if (t) return;
|
|
18
|
-
t = !0;
|
|
19
|
-
let { subDomain: i, subscriptionStatus: a } = r, o = window;
|
|
20
|
-
o.intercomSettings = {
|
|
21
|
-
api_base: "https://api-iam.intercom.io",
|
|
22
|
-
app_id: e,
|
|
23
|
-
alignment: "right",
|
|
24
|
-
expofp_subdomain: i,
|
|
25
|
-
expofp_subscription_status: a
|
|
26
|
-
}, n();
|
|
27
|
-
let s = function() {
|
|
28
|
-
s.c(arguments);
|
|
29
|
-
};
|
|
30
|
-
s.q = [], s.c = function(e) {
|
|
31
|
-
s.q.push(e);
|
|
32
|
-
}, o.Intercom = s;
|
|
33
|
-
let c = () => {
|
|
34
|
-
let t = document.createElement("script");
|
|
35
|
-
t.type = "text/javascript", t.async = !0, t.src = `https://widget.intercom.io/widget/${e}`, document.head.appendChild(t);
|
|
36
|
-
};
|
|
37
|
-
document.readyState === "complete" ? c() : window.addEventListener("load", c, !1);
|
|
38
|
-
}
|
|
39
|
-
//#endregion
|
|
40
|
-
export { r as bootIntercom };
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { RendererService } from "../../../../renderer";
|
|
2
|
-
export declare const WF_TRAIL_LAYER_NAME = "wf-trail-points";
|
|
3
|
-
export declare const WF_POINTS_LAYER_NAME = "wf-points";
|
|
4
|
-
export declare const WF_CURRENT_POSITION_NAME = "wf-current-position";
|
|
5
|
-
export declare const WF_LINES_LAYER_NAME = "wf-lines";
|
|
6
|
-
export declare const WF_LINES_ANIMATED_LAYER_NAME = "wf-lines-animated";
|
|
7
|
-
export default function configWf(rendererService: RendererService): () => void;
|
|
8
|
-
//# sourceMappingURL=config-wf.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import ne from"color";import{observable as he,reaction as q}from"mobx";import{lineLength as Se}from"simple-geometry";import We from"../../../../core/Rect";import o,{layersStore as Ae,uiState as c}from"../../../../store";import{LayersMode as _e}from"../../../../store/LayerStore";import{boothToWaypoint as me,getGraphLines as Ye,graphDataSource as Ue,computeTransitionPoints as Ge,normalizeRouteDirection as qe,bezierCurve as Ke,splitPolyLine as Ve}from"../../../../wayfinding";import{decreaseByPercentage as oe}from"../../../../utils/math";import{strEqual as ie}from"../../../../utils/strEqual";import{createArrowCurrentCanvas as De,createCurrentCanvas as re,createImageCanvas as k,createTargetCanvas as Xe,createYahCanvas as je}from"./canvases";import{toRadians as Ie}from"../../../../utils/math";import{areLayersEnabled as ve}from"../../../../utils/areLayersEnabled";import{createImageDef as H,createLineDef as ye,createCircleCanvas as Je,getBounds as R,getRotation as Qe}from"../../../../renderer";import{animateLineSegments as Ze}from"../../../../renderer/engine-core/animation";import{splitRouteByPoint as et,snapPositionToRoute as tt,getThresholdSafe as nt,getThresholdFromMetersToSvg as ot,SNAP_THRESHOLD_METERS as it}from"./route-snapping";import{fpGeo as Ne}from"../../../../data/fpGeo";import{getRouteLength as pe}from"../../../../wayfinding";import{pickDefaultScene as Fe}from"../../../../renderer/engine-core/defs";const L=devicePixelRatio;let I=[],X=null,T=[],Q=ne("#00A2FF"),rt=ne("#FF9F06"),ke="#A4CCE2",at="#0794EA";const W=34;let z,B,M,$,Y,ge,Re,Le,xe,Z,C,E,N,F,O,we=[];function st(){I=[];const t=o.routeStore.currentRouteLayer?.name;X=ct();const r=X&&(ve()?ie(t,X.destination?.layer):!0);if(X){const l=X?.routePoint;l&&ie(t,l.layer)&&(I=dt(l,I))}let a=[],f=[];for(let l=0;l<T.length;l++){let _=T[l],x=o.layerStore.mode==_e.Default?!0:o.layerStore.layers.find(m=>m.name==t&&t===_.p0.layer)?.visible||!1;!_.virtual&&x&&a.push(_),(_.virtual||!x||l===T.length-1)&&a.length&&(f=a.map(({p0:m,p1:w})=>(I.push({x:m.x,y:m.y},{x:w.x,y:w.y}),{p0:m,p1:w})))}I.length||(E.hidden=!0,C.hidden=!0);let y=1e6,s=1e6,p=0,u=0;I.forEach(l=>{l.x<y&&(y=l.x),l.y<s&&(s=l.y),l.x>p&&(p=l.x),l.y>u&&(u=l.y)});const d=We.fromX1y1x2y2(y,s,p,u);return{rect:I.length&&(d.w||d.h)?d.withPadding(d.w,d.h):null,lines:f,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 ut(t){let r=null;const a=[];let f=null,y=he.box([]),s=he.box([],{deep:!1}),p=[],u=he.box([],{deep:!1});const d=t.scene.rootLayer.children,l=d.find(e=>e.name===WF_POINTS_LAYER_NAME),_=d.find(e=>e.name===WF_CURRENT_POSITION_NAME),x=d.find(e=>e.name===WF_LINES_LAYER_NAME),m=d.find(e=>e.name===WF_TRAIL_LAYER_NAME),w=d.find(e=>e.name===WF_LINES_ANIMATED_LAYER_NAME),U=nt(Ne?.properties?.config?.snapThreshold)||it,ae=ot({thresholdInMeters:U,gpsConfig:Ne?.properties?.config});let ee=[];const j=o.fp.icons.get("destination");j?(j.id="destination",B=k(j,W,W,L)):B=Xe(L,rt.hex()),E=H(B,R(0,0,B.width,B.height),{hidden:!0});const G=o.fp.icons.get("departure");G?(G.id="departure",z=k(G,W,W,L)):z=re(L,Q.hex()),C=H(z,R(0,0,z.width,z.height),{hidden:!0}),M=re(L,Q.hex()),M.id="current-location",N=H(M,R(0,0,M.width,M.height),{hidden:!0,origin:[.5,.5]});const K=o.fp.icons.get("transition");K?(K.id="transition",ge=k(K,34,34,L)):ge=re(L,Q.hex());const se=o.fp.icons.get("transition_up");se&&(se.id="transition_up",Re=k(se,56,34,L));const ue=o.fp.icons.get("transition_down");ue&&(ue.id="transition_down",Le=k(ue,56,34,L)),G?xe=k(G,W,W,L):xe=re(L,Q.hex());const le=o.fp.icons.get("direction");le?(le.id="direction",$=k(le,W,W,L)):$=De(L,Q.hex()),F=H($,R(0,0,$.width,$.height),{hidden:!0});const Pe=o.fp.icons.get("yah");Pe?Y=k(Pe,oe(64,32),oe(90,32),L):Y=je(L,"#ff4343"),Y.id="current-location-2",O=H(Y,R(0,0,Y.width,Y.height),{hidden:!0,origin:[.5,1]}),Z=Je(4,ne("#b5b7bc").hex());function ce(e=null){const n=o.layerStore.visible.map(i=>i.name);if(I=[],y.set([]),e||(T=[]),n.length&&c.selectedRoute?.from?.rect&&c.selectedRoute?.to?.rect){let i=c.selectedRoute.from,h=c.selectedRoute.to;if(!T.length&&!e&&(T=Ye(Ue,me(i),me(h),o.routeStore.onlyAccessible,c.selectedRoute.waypoints?.map(me))),!T.length){if(o.routeStore.updateRoute(T),o.routeStore.updateRouteDistance(0),i.name!==h.name)throw new Error(`Route not found. From: ${i.name} to: ${h.name}`);return}const{rect:g,lines:D,addTrailPoints:b}=st();D.length?(lt(t.scale),ft(t.scale,s,p),ze(t,m,!b),t.ptScaleRegistry.unregisterByName(m.name),b&&t.onPtScale(m.name,()=>{const P=ze(t,m)||[];return m.children=P,we=P,m})):t.ptScaleRegistry.unregisterByName(m.name),ee=D,fe(),g&&(c.moveToRect=g)}else C.hidden=!0,E.hidden=!0;o.routeStore.updateRoute(T.filter(i=>!i.virtual)),y.get()||(C.hidden=!0,E.hidden=!0)}function J(){const e=o.routeStore.currentPosition,n=e?.angle?Ie(e.angle):null,i=o.routeStore.currentRouteLayer?.name,h=T.filter(A=>o.layerStore.mode==_e.Default?!0:o.layerStore.layers.find(He=>He.name==i&&i===A.p0.layer)?.visible).filter(A=>!A.virtual);if(c.kioskData&&c.selectedRoute?.from){const A=o.routeStore.currentRouteLayer;C.hidden=c.selectedRoute?.from?.entity?.type==="route-cut-in"&&A?.name===c.selectedRoute?.from?.layer?.name,E.hidden=c.selectedRoute?.to?.entity?.type==="route-cut-in"&&A?.name===c.selectedRoute?.to?.layer?.name}if(e){const A=Ae.findLayer(e.z)?.visible??!0;o.routeStore.iconType===0||c.selectedRoute?.from&&c.selectedRoute?.to?(O.hidden=!0,N.hidden=!A,N.dim=!A,N.bounds=R(e.x,e.y,M.width,M.height,t.scale),n!=null?(N.hidden=!0,F.hidden=!A,F.dim=!A,F.bounds=R(e.x,e.y,$.width,$.height,t.scale,n)):F.hidden=!0):(N.hidden=!0,F.hidden=!0,O.dim=!A,O.hidden=!A,O.bounds=R(e.x,e.y,Y.width,Y.height,t.scale))}else N.hidden=!0,O.hidden=!0,F.hidden=!0,de(),fe();if(!e||!I.length){t.update(F,N,O);return}const g=c.selectedRoute?.to,D=c.selectedRoute?.from,b={layer:D?.layer?.name,x:C.bounds.center.x,y:C.bounds.center.y},P={layer:g?.layer?.name,x:E.bounds.center.x,y:E.bounds.center.y},S=tt(e,h,{snapThreshold:ae,fromPoint:b,toPoint:P,fromRect:D?.rect,toRect:g?.rect}),v=S.snapped?S.snappedPoint:e;fe(S,!0),F.bounds=R(v.x,v.y,$.width,$.height,t.scale,n),N.bounds=R(v.x,v.y,M.width,M.height,t.scale,n),t.update(F,N,O)}function Be(){const e=[{point:F,name:"wf-current-arrow"},{point:N,name:"wf-current-location"},{point:O,name:"wf-current-location-2"}];_.children=e.map(({point:n})=>n),e.forEach(({point:n,name:i})=>te(n,i)),t.update(_)}function V(e=!1){const n=[C,E,...s.get(),...u.get()];e&&(Me(!0),m.children=[],n.forEach(i=>{i.source.id.includes("kiosk")||(i.hidden=!0)})),l.children=n,t.update(l,m)}function de(e,n){const i=T.filter(P=>!P.virtual),h=pe(i);if(!e?.snapped){o.routeStore.updateRouteDistance(h);return}const g=c.selectedRoute?.to,D=pe(n);let b;if(e.snappedPoint?.layer===g?.layer?.name||g?.layer?.name===o.routeStore.currentRouteLayer?.name)b=D;else if(e.snappedPoint?.layer!==g?.layer?.name&&e.snappedPoint?.layer===o.routeStore.currentRouteLayer?.name){const P=i.filter(v=>v.p0.layer!==e?.snappedPoint?.layer&&v.p1.layer!==e?.snappedPoint?.layer),S=pe(P);b=D+S}b&&o.routeStore.updateRouteDistance(b)}function fe(e,n=!1){const i=c.selectedRoute?.from,h=c.selectedRoute?.to;if(!i||!h)return;const g=T[0]?.p0.layer,D=qe(T,ee,{layer:i.layer?.name??g,x:i.rect.cx,y:i.rect.cy},{layer:h.layer?.name??g,x:h.rect.cx,y:h.rect.cy});if(!e?.snapped){const S=D.map(v=>ye(v,ke));o.routeStore.currentPosition&&o.routeStore.currentRouteLayer&&o.routeStore.currentPosition?.z?.toString()===o.routeStore.currentRouteLayer?.name.toString()&&de(),Ce([],S,n);return}const{passed:b,remaining:P}=et(D,e.snappedPoint);P.length&&(P[0]={...P[0],p0:e.snappedPoint}),de(e,P),Ce(b.map(S=>ye(S,"#B5B7BC")),P.map(S=>ye(S,ke)),n)}const te=(e,n)=>t.onPtScale(n,i=>(e.hidden||(e.bounds=R(e.bounds.center.x,e.bounds.center.y,e.source.width,e.source.height,i,e.bounds.rotation)),e)),be=(e,n)=>t.onRoll(n,i=>{const h=Qe(i,e.bounds.rotation);return h!==void 0&&(e.bounds.rotation=e.bounds.rotation+h),e});function Me(e){r&&(r.stop(),r=null),w.children=[],e&&(x.children=[]),t.update(w,x)}function Ce(e=[],n=[],i=!1){let h=0;if(r&&(i&&(h=r.getProgress()),r.stop(),r=null),x.children=[...e,...n],!n.length){w.children=[],t.update(w,x);return}const g=n.map(b=>({...b,color:at}));r=Ze(g,(b,P,S)=>{if(S)w.children=[];else{const v=g.slice(0,P);w.children=[...v,b]}t.update(w)},()=>t.scale,h)??null,t.update(x)}a.push(q(()=>[o.layerStore.layersLoaded],()=>{ce(),J(),V()}));const $e=q(()=>[o.routeStore.currentRouteLayer,c.getRouteNextFloor],()=>{o.layerStore.layersLoaded&&(f!==null&&clearTimeout(f),f=setTimeout(()=>{ce(o.routeStore.currentRouteLayer),J(),V(),f=null},0))});a.push(()=>{f!==null&&(clearTimeout(f),f=null),$e()}),a.push(q(()=>[c.selectedRoute,o.routeStore.onlyAccessible],()=>{ce(),J(),V(!c.selectedRoute)})),a.push(q(()=>o.routeStore.currentPosition,()=>{J(),V()})),a.push(q(()=>s.get(),e=>{const n="transitionPoints";t.ptScaleRegistry.unregisterByPrefix(n),t.rollRegistry.unregisterByPrefix(n),e.length&&e.forEach((i,h)=>{const g=`${n}-${h}`;te(i,g),be(i,g)})})),a.push(q(()=>[u.get()],()=>{const e=u.get(),n="kioskArrows";t.ptScaleRegistry.unregisterByPrefix(n),e.length&&e.forEach((i,h)=>te(i,`${n}-${h}`))})),a.push(q(()=>[c.kioskData,Ae.floors.find(e=>e.active),c.selectedRoute],([e,n])=>{u.set([]);const i=ve()?e?.z===n?.name:!0;e&&i&&ht(e,{skipdim:!0,visible:!0,pixelRatio:L},t.scale,u),V()}));function Ee({data:e}){const{defs:n}=Fe(e),i=p.find(h=>n.includes(h.imageDef));i&&o.layerStore.updateVisibility(i.targetLayer,!0)}t.renderer.events.addEventListener("pointer:click",Ee),a.push(()=>t.renderer.events.removeEventListener("pointer:click",Ee));function Te({data:e}){const{defs:n}=Fe(e),i=p.some(h=>n.includes(h.imageDef));t.renderer.canvas.style.cursor=i?"pointer":""}t.renderer.events.addEventListener("pointer:move",Te),a.push(()=>t.renderer.events.removeEventListener("pointer:move",Te)),[{point:C,name:"wf-source"},{point:E,name:"wf-destination"}].forEach(({point:e,name:n})=>{te(e,n),be(e,n)}),V(),J(),Be();function Oe(){r&&(r.stop(),r=null),a.forEach(e=>e()),a.length=0}return Oe}function lt(t){const r=o.routeStore.currentRouteLayer?.name,a=I;let f=c.selectedRoute?.from,y=c.selectedRoute?.to;const s=c.selectedRoute?.waypoints;if(f?.entity.type==="route-cut-in"&&(f=null),y?.entity.type==="route-cut-in"&&(y=null),!a.length)return;const p=[{key:"sourceLocation",rect:f?.rect,index:void 0},{key:"destinationLocation",rect:y?.rect,index:void 0}];s&&p.push(...s?.map((x,m)=>({key:`waypoint-${x.externalId}`,index:m,rect:x.rect})));const u=r?ie(r,f?.layer?.name):!0,d=r?ie(r,y?.layer?.name):!0;let l=!1,_=!1;a.forEach(({x,y:m})=>{for(const{key:w,rect:U,index:ae}of p)if(U?.containsPoint(x,m)){w==="sourceLocation"&&(C.bounds=R(x,m,z.width,z.height,t),C.hidden=!u,C.dim=!u,l=u),w==="destinationLocation"&&(E.bounds=R(x,m,B.width,B.height,t),E.hidden=!d,E.dim=!d,_=d);break}}),l||(C.bounds=R(a[a.length-1].x,a[a.length-1].y,z.width,z.height,t),C.hidden=!1,C.dim=!1),_||(E.bounds=R(a[0].x,a[0].y,B.width,B.height,t),E.hidden=!d,E.dim=!d)}function ct(){const{from:t,to:r}=o.uiState.selectedRoute||{},a="route-cut-in";return t&&t?.entity.type===a||r&&r?.entity.type===a?o.routeStore.defaultFrom:null}function dt(t,r){if(!t||!r.length)return r;const a=r.reduce((f,y,s)=>Se(t,y)<Se(t,r[f])?s:f,0);return a<=r.length/2?r.slice(a):r.slice(0,a)}function ft(t,r,a){const f=o.routeStore.currentRouteLayer?.name,y=o.layerStore.floors.map(u=>u.name).reverse(),s=Ge({routeLines:T,currentLayerName:f,floorOrder:y});a.length=0;const p=s.map(u=>{const d=u.role==="entry"?xe:u.direction==="up"&&Re?Re:u.direction==="down"&&Le?Le:ge,l=H(d,R(u.x,u.y,d.width,d.height,t),{hidden:!1,dim:!1});return u.role==="exit"&&a.push({imageDef:l,targetLayer:u.targetLayer}),l});r.set(p)}function ht(t,r,a=1,f){if(!t)return;const y=o.fp.icons.get("kiosk");y.id="kiosk";let s;if(y){const u=t?.iconSizePercent?t.iconSizePercent/100:1,d=55;s=k(y,oe(199*u,d),oe(152*u,d),L)}else s=De(L,ne("#ee4422").hex());const p=H(s,R(t.x,t.y,s.width,s.height,a,Ie(t.heading||0)),{hidden:!r.visible,dim:!r.skipdim});f.set([...f.get(),p])}function ze(t,r,a=!1){let f=I.length-1;if(c.selectedRoute?.to?.entity.type==="route-cut-in"&&(f=0),a){we=[],r.children=[],t.update(r);return}const y=t.scale,s=I[f],p=X?.destination;if(!s||!p)return;const u=Z.width,d=Ve([{p0:s,p1:p}],u*2*y);if(d.length<2)return;const l=p.x-s.x,_=p.y-s.y,x=Math.hypot(l,_),m={x:(s.x+p.x)/2,y:(s.y+p.y)/2-x*.2},w=[s,m,p],U=d.map((ae,ee,j)=>{const G=(ee+1)/(j.length+1),K=Ke(w,G);return H(Z,R(K.x,K.y,Z.width,Z.height,y),{hidden:!1,dim:!1})})||[];return r.children=U,we=U,U}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export type { SplitRouteResult, RouteSnapResult } from "./types";
|
|
2
|
-
export { splitRouteByPoint } from "./splitRouteByPoint";
|
|
3
|
-
export { snapPositionToRoute, SNAP_THRESHOLD_METERS } from "./snapPositionToRoute";
|
|
4
|
-
export { distancePointToRouteOnLayer, getThresholdFromMetersToSvg, findBoothInRadius, getThresholdSafe } from "./utils";
|
|
5
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export{splitRouteByPoint}from"./splitRouteByPoint";export{snapPositionToRoute,SNAP_THRESHOLD_METERS}from"./snapPositionToRoute";export{distancePointToRouteOnLayer,getThresholdFromMetersToSvg,findBoothInRadius,getThresholdSafe}from"./utils";
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { RouteLine, RoutePoint } from "../../../../../wayfinding/types";
|
|
2
|
-
import { CurrentPosition } from "../../../../../store/RouteStore";
|
|
3
|
-
import type { RouteSnapResult } from "./types";
|
|
4
|
-
type Rect = {
|
|
5
|
-
x1: number;
|
|
6
|
-
x2: number;
|
|
7
|
-
y1: number;
|
|
8
|
-
y2: number;
|
|
9
|
-
};
|
|
10
|
-
export declare const SNAP_THRESHOLD_METERS = 7.5;
|
|
11
|
-
export type SnapToRouteConfig = {
|
|
12
|
-
snapThreshold: number;
|
|
13
|
-
minRemainingUnits?: number;
|
|
14
|
-
toPoint: RoutePoint;
|
|
15
|
-
toRect?: Rect;
|
|
16
|
-
fromPoint?: RoutePoint;
|
|
17
|
-
fromRect?: Rect;
|
|
18
|
-
};
|
|
19
|
-
export declare function snapPositionToRoute(position: CurrentPosition, routeLines: RouteLine[], config: SnapToRouteConfig): RouteSnapResult;
|
|
20
|
-
export {};
|
|
21
|
-
//# sourceMappingURL=snapPositionToRoute.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
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 E(t,n){let r=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(r+a>=n){const d=(n-r)/a,x=e.p0.x+(e.p1.x-e.p0.x)*d,f=e.p0.y+(e.p1.y-e.p0.y)*d;return{point:{layer:e.p0.layer,x,y:f},line:e}}r+=a}}const l=t[t.length-1];return{point:{layer:l.p0.layer,x:l.p1.x,y:l.p1.y},line:l}}export function snapPositionToRoute(t,n,r){const l=n.length;if(!l)return{snapped:!1};const{snapThreshold:e,toPoint:a,minRemainingUnits:d=.5,fromPoint:x,fromRect:f,toRect:A}=r,i=t.z!=null?String(t.z):null;let M=1/0,u=null,S=0,I=i==null;for(let s=0;s<l;s++){const p=n[s],{p0:o,p1:y}=p,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){S+=F;continue}I=!0;const N=((t.x-o.x)*g+(t.y-o.y)*P)/D,R=Math.max(0,Math.min(1,N)),U=o.x+g*R,j=o.y+P*R,H=Math.hypot(t.x-U,t.y-j);H<M&&(M=H,u={segmentIndex:s,t:R,distanceFromPolylineStart:S+F*R}),S+=F}if(i!=null&&!I)return{snapped:!1};const c=S,b=n[0].p0,q=n[l-1].p1,_=Math.hypot(a.x-b.x,a.y-b.y),w=Math.hypot(a.x-q.x,a.y-q.y),m=_<=w,T=Math.min(d,c),v={layer:(i??n[0].p0.layer).toString(),x:t.x,y:t.y};if(f&&x&&(i==null||String(x.layer)===i)&&O(v,f)){const s=c,p=m?s:c-s,o=E(n,p);return{snapped:!0,snappedPoint:o.point,snappedLine:o.line}}if(A&&(i==null||String(a.layer)===i)&&O(v,A)){const s=T,p=c-s,y=E(n,m?s:p);return{snapped:!0,snappedPoint:y.point,snappedLine:y.line}}if(!u||M>e)return{snapped:!1};let h=m?u.distanceFromPolylineStart:c-u.distanceFromPolylineStart;h<T&&(h=T);const L=c-h,z=E(n,m?h:L);return{snapped:!0,snappedPoint:z.point,snappedLine:z.line}}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export function splitRouteByPoint(t,i){let n=-1,e=0,f=1/0;for(let l=0;l<t.length;l++){const c=t[l];if(c.p0.layer!==i.layer)continue;const s=c.p1.x-c.p0.x,y=c.p1.y-c.p0.y,r=s*s+y*y;if(r===0)continue;const x=((i.x-c.p0.x)*s+(i.y-c.p0.y)*y)/r;if(x<-1e-6||x>1+1e-6)continue;const a=Math.min(1,Math.max(0,x)),m=c.p0.x+a*s,g=c.p0.y+a*y,o=(i.x-m)**2+(i.y-g)**2;o<f&&(f=o,n=l,e=a)}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 p=t[n],d={layer:p.p0.layer,x:p.p0.x+e*(p.p1.x-p.p0.x),y:p.p0.y+e*(p.p1.y-p.p0.y)};return{passed:[...t.slice(0,n),{...p,p1:d}],remaining:[{...p,p0:d},...t.slice(n+1)]}}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { RouteLine, RoutePoint } from "../../../../../wayfinding/types";
|
|
2
|
-
export type RouteSnapResult = {
|
|
3
|
-
snapped: false;
|
|
4
|
-
} | {
|
|
5
|
-
snapped: true;
|
|
6
|
-
snappedPoint: RoutePoint;
|
|
7
|
-
snappedLine: RouteLine;
|
|
8
|
-
};
|
|
9
|
-
export type SplitRouteResult = {
|
|
10
|
-
snapped: true;
|
|
11
|
-
passed: RouteLine[];
|
|
12
|
-
remaining: RouteLine[];
|
|
13
|
-
splitPoint: RoutePoint;
|
|
14
|
-
} | {
|
|
15
|
-
snapped: false;
|
|
16
|
-
remaining: RouteLine[];
|
|
17
|
-
};
|
|
18
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import type { RouteLine, RoutePoint } from "../../../../../wayfinding/types";
|
|
2
|
-
import { Booth } from "../../../../../store/BoothStore";
|
|
3
|
-
export declare function distancePointToRouteOnLayer(point: RoutePoint, lines: RouteLine[]): number;
|
|
4
|
-
export declare function findBoothInRadius<T extends Booth>(position: {
|
|
5
|
-
x: number;
|
|
6
|
-
y: number;
|
|
7
|
-
z?: string | number;
|
|
8
|
-
} | null | undefined, booths: T[] | null | undefined, excludeBooths?: T[], radius?: number): T | null;
|
|
9
|
-
type GpsProjectionConfig = {
|
|
10
|
-
p0: {
|
|
11
|
-
x: number;
|
|
12
|
-
y: number;
|
|
13
|
-
lat: number;
|
|
14
|
-
lng: number;
|
|
15
|
-
};
|
|
16
|
-
p2: {
|
|
17
|
-
x: number;
|
|
18
|
-
y: number;
|
|
19
|
-
lat: number;
|
|
20
|
-
lng: number;
|
|
21
|
-
};
|
|
22
|
-
};
|
|
23
|
-
export declare const getThresholdSafe: (value: number) => number | undefined;
|
|
24
|
-
export declare function getThresholdFromMetersToSvg({ thresholdInMeters, gpsConfig }: {
|
|
25
|
-
thresholdInMeters?: number;
|
|
26
|
-
gpsConfig?: GpsProjectionConfig;
|
|
27
|
-
}): number;
|
|
28
|
-
export {};
|
|
29
|
-
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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,11 +0,0 @@
|
|
|
1
|
-
type Point = {
|
|
2
|
-
cx: number;
|
|
3
|
-
cy: number;
|
|
4
|
-
};
|
|
5
|
-
/**
|
|
6
|
-
* Optimizes waypoint ordering to minimize total travel distance.
|
|
7
|
-
* Nearest neighbor O(n²) + 2-opt refinement O(k·n²), k ≤ 100.
|
|
8
|
-
*/
|
|
9
|
-
export declare function buildOptimizedRoute(data: [string, Point][]): string[];
|
|
10
|
-
export {};
|
|
11
|
-
//# sourceMappingURL=buildOptimizedRoute.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const d=100,x=-.01;export function buildOptimizedRoute(s){const c=new Map(s),t=Array.from(c.keys());if(t.length<=2)return t;const e=b(t,c);return e.length<4?e:u(e,c)}function b(s,c){const t=[s[0]],e=new Set(s);e.delete(s[0]);let M=s[0];for(;e.size>0;){const r=c.get(M);let n="",a=1/0;for(const o of e){const l=c.get(o),i=Math.abs(r.cx-l.cx)+Math.abs(r.cy-l.cy);i<a&&(a=i,n=o)}if(!n)break;t.push(n),e.delete(n),M=n}return t}function u(s,c){const t=[...s];let e=!0;for(let M=0;e&&M<100;M++){e=!1;t:for(let r=1;r<t.length-2;r++)for(let n=r+1;n<t.length-1;n++){const a=c.get(t[r-1]),o=c.get(t[r]),l=c.get(t[n]),i=c.get(t[n+1]);if(Math.abs(a.cx-l.cx)+Math.abs(a.cy-l.cy)+Math.abs(o.cx-i.cx)+Math.abs(o.cy-i.cy)-(Math.abs(a.cx-o.cx)+Math.abs(a.cy-o.cy))-(Math.abs(l.cx-i.cx)+Math.abs(l.cy-i.cy))<-.01){for(let f=r,h=n;f<h;f++,h--)[t[f],t[h]]=[t[h],t[f]];e=!0;break t}}}return t}
|