@expofp/floorplan
Version:
Interactive floor plan library for expos and events
2 lines (1 loc) • 639 B
JavaScript
import{lineLength as i}from"simple-geometry";import{haversineDistance as l}from"../../../utils/haversineDistance";export const SNAP_THRESHOLD_METERS=7.5;const c=15,h=20;function u(t,r){const{p0:e,p2:n}=r,o=l(e.lat,e.lng,n.lat,n.lng),s=i(e,n);return!o||!s?0:t*(s/o)}export const getThresholdSafe=t=>{if(typeof t=="number"&&Number.isFinite(t))return t};export function getThresholdFromMetersToSvg({thresholdInMeters:t,gpsConfig:r}){let e=0;return t&&r&&(e=u(t,r)),e||(e=h),e}export function resolveRerouteThresholdSvg(t){const r=getThresholdSafe(t?.rerouteThreshold)||c;return getThresholdFromMetersToSvg({thresholdInMeters:r,gpsConfig:t})}