mirror of
https://github.com/muerwre/orchidmap-front.git
synced 2025-04-25 11:06:40 +07:00
router now properly handles poly changes
This commit is contained in:
parent
e477f50283
commit
245b559e2d
3 changed files with 40 additions and 4 deletions
|
@ -95,6 +95,32 @@ export class Router {
|
|||
};
|
||||
|
||||
startFrom = latlngs => {
|
||||
const waypoints = this.router.getWaypoints();
|
||||
|
||||
if (waypoints && waypoints.length) {
|
||||
waypoints[0] = { ...latlngs };
|
||||
this.router.setWaypoints(waypoints);
|
||||
return;
|
||||
}
|
||||
|
||||
this.router.setWaypoints([{ ...latlngs }]);
|
||||
}
|
||||
};
|
||||
|
||||
moveStart = latlng => {
|
||||
const waypoints = this.router.getWaypoints();
|
||||
const { latLng } = (waypoints[0] || {});
|
||||
|
||||
if (!latLng || !latlng) return;
|
||||
|
||||
if (
|
||||
latlng.lat.toFixed(5) === latLng.lat.toFixed(5) &&
|
||||
latlng.lng.toFixed(5) === latLng.lng.toFixed(5)
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
waypoints[0] = { ...latlng };
|
||||
|
||||
this.router.setWaypoints(waypoints);
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue