chore: cleanup drawPath render function

Signed-off-by: Samuel Leihkamm <s.leihkamm@gmx.com>
This commit is contained in:
Samuel Leihkamm 2023-09-09 15:03:55 +02:00 committed by Andrew Calcutt
parent 3f2fd42381
commit d830e58235

View file

@ -446,7 +446,8 @@ const drawMarkers = async (ctx, markers, z) => {
* @param {number} z Map zoom level.
*/
const drawPath = (ctx, path, query, pathQuery, z) => {
const renderPath = (splitPaths) => {
const splitPaths = decodeURIComponent(pathQuery).split('|');
if (!path || path.length < 2) {
return null;
}
@ -468,8 +469,7 @@ const drawPath = (ctx, path, query, pathQuery, z) => {
}
// Optionally fill drawn shape with a rgba color from query
const pathHasFill =
splitPaths.filter((x) => x.startsWith('fill')).length > 0;
const pathHasFill = splitPaths.filter((x) => x.startsWith('fill')).length > 0;
if (query.fill !== undefined || pathHasFill) {
if ('fill' in query) {
ctx.fillStyle = query.fill || 'rgba(255,255,255,0.4)';
@ -540,9 +540,6 @@ const drawPath = (ctx, path, query, pathQuery, z) => {
ctx.strokeStyle = 'rgba(0,64,255,0.7)';
}
ctx.stroke();
};
renderPath(decodeURIComponent(pathQuery).split('|'));
};
const renderOverlay = async (