feat: routes - change data format, fix issues

This commit is contained in:
Azgaar 2024-08-09 15:14:22 +02:00
parent 077248e4d9
commit 19723bd513
8 changed files with 260 additions and 243 deletions

View file

@ -1643,13 +1643,11 @@ function drawRoutes() {
const routePaths = {};
const lineGen = d3.line();
let points = Routes.preparePointsArray();
for (const route of pack.routes) {
const {i, group} = route;
lineGen.curve(ROUTE_CURVES[group] || ROUTE_CURVES.default);
const routePoints = Routes.getPoints(route, points);
const path = round(lineGen(routePoints), 1);
const points = route.points.map(p => [p[0], p[1]]);
const path = round(lineGen(points), 1);
if (!routePaths[group]) routePaths[group] = [];
routePaths[group].push(`<path id="route${i}" d="${path}"/>`);
@ -1663,11 +1661,6 @@ function drawRoutes() {
TIME && console.timeEnd("drawRoutes");
}
const ROUTES_SHARP_ANGLE = 135;
const ROUTES_VERY_SHARP_ANGLE = 115;
function drawRoute() {}
function toggleMilitary() {
if (!layerIsOn("toggleMilitary")) {
turnButtonOn("toggleMilitary");