chore: unify drawFillWithGap

This commit is contained in:
Azgaar 2024-09-02 23:05:47 +02:00
parent 6b3df6c4d8
commit 39516ce782
3 changed files with 17 additions and 101 deletions

View file

@ -84,7 +84,7 @@ function getVertexPoint(vertexId) {
function getFillPath(vertexChain) {
const points = vertexChain.map(getVertexPoint);
const firstPoint = points.shift();
return `M${firstPoint} L${points.join(" ")}`;
return `M${firstPoint} L${points.join(" ")} Z`;
}
// get single path for an non-continuous array of cells
@ -172,3 +172,10 @@ function connectVertices({startingVertex, ofSameType, addToChecked, closeRing})
if (closeRing) chain.push(startingVertex);
return chain;
}
function drawFillWithGap(elementName, fill, waterGap, color, index) {
return /* html */ `
<path d="${fill}" fill="${color}" id="${elementName}${index}" />
<path d="${waterGap}" fill="none" stroke="${color}" stroke-width="5" id="${elementName}-gap${index}" />
`;
}