mirror of
https://github.com/muerwre/orchidmap-front.git
synced 2025-05-03 15:06:41 +07:00
good markers for router
This commit is contained in:
parent
50c2ac70e3
commit
d4307ae336
2 changed files with 23 additions and 17 deletions
src/map/Router
|
@ -59,13 +59,15 @@ const RouterUnconnected: FC<Props> = memo(
|
|||
}
|
||||
|
||||
const totalDistance = parseFloat((summary.totalDistance / 1000).toFixed(1)) || 0;
|
||||
const latlng = (coordinates.length && coordinates[coordinates.length - 1]) || null;
|
||||
const latlng = waypoints[waypoints.length - 1] && (waypoints[waypoints.length - 1].latLng) || null;
|
||||
|
||||
const angle = angleBetweenPoints(
|
||||
MainMap.latLngToContainerPoint(coordinates[coordinates.length - 2]),
|
||||
MainMap.latLngToContainerPoint(coordinates[coordinates.length - 3])
|
||||
MainMap.latLngToContainerPoint(waypoints[waypoints.length - 1].latLng),
|
||||
MainMap.latLngToContainerPoint(coordinates[coordinates.length - 1]),
|
||||
);
|
||||
|
||||
console.log(angle);
|
||||
|
||||
setDist(totalDistance);
|
||||
setEnd(latlng);
|
||||
setDirection(angle > -90 && angle < 90);
|
||||
|
@ -74,8 +76,10 @@ const RouterUnconnected: FC<Props> = memo(
|
|||
);
|
||||
|
||||
useEffect(() => {
|
||||
OsrmRouter.on('waypointschanged', updateWaypoints)
|
||||
OsrmRouter
|
||||
.on('waypointschanged', updateWaypoints)
|
||||
.on('routesfound', updateDistance)
|
||||
.on('routesfound', console.log)
|
||||
.addTo(MainMap);
|
||||
|
||||
return () => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue