feat: detect coastline - fix issue with border feature

This commit is contained in:
Azgaar 2024-09-07 00:28:04 +02:00
parent 796eb4e8be
commit c76a737f94

View file

@ -183,9 +183,9 @@ window.Features = (function () {
const getType = cellId => featureIds[cellId];
const type = getType(firstCell);
const ofSameType = cellId => getType(cellId) === type;
const ofDifferentType = cellId => borderCells[cellId] || getType(cellId) !== type;
const ofDifferentType = cellId => getType(cellId) !== type;
const isOnBorder = neighbors[firstCell].some(ofDifferentType);
const isOnBorder = borderCells[firstCell] || neighbors[firstCell].some(ofDifferentType);
if (!isOnBorder) throw new Error(`Markup: firstCell ${firstCell} is not on the feature or map border`);
const startingVertex = cells.v[firstCell].find(v => vertices.c[v].some(ofDifferentType));