mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-17 09:41:24 +01:00
fix: routes - don't render route with <2 points
This commit is contained in:
parent
1f280133be
commit
b54f758350
4 changed files with 16 additions and 4 deletions
|
|
@ -651,6 +651,17 @@ async function parseLoadedData(data, mapVersion) {
|
|||
p.removed = true; // remove incorrect province
|
||||
});
|
||||
|
||||
pack.routes.forEach(({i, points}) => {
|
||||
if (!points || points.length < 2) {
|
||||
ERROR &&
|
||||
console.error(
|
||||
"Data integrity check. Route",
|
||||
i,
|
||||
"has less than 2 points. Route will be ignored on layer rendering"
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
{
|
||||
const markerIds = [];
|
||||
let nextId = last(pack.markers)?.i + 1 || 0;
|
||||
|
|
|
|||
|
|
@ -1636,7 +1636,8 @@ function drawRoutes() {
|
|||
const routePaths = {};
|
||||
|
||||
for (const route of pack.routes) {
|
||||
const {i, group} = route;
|
||||
const {i, group, points} = route;
|
||||
if (!points || points.length < 2) continue;
|
||||
if (!routePaths[group]) routePaths[group] = [];
|
||||
routePaths[group].push(`<path id="route${i}" d="${Routes.getPath(route)}"/>`);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue