chore: cleanup drawPath render function
Signed-off-by: Samuel Leihkamm <s.leihkamm@gmx.com>
This commit is contained in:
parent
3f2fd42381
commit
d830e58235
1 changed files with 83 additions and 86 deletions
|
|
@ -446,7 +446,8 @@ const drawMarkers = async (ctx, markers, z) => {
|
||||||
* @param {number} z Map zoom level.
|
* @param {number} z Map zoom level.
|
||||||
*/
|
*/
|
||||||
const drawPath = (ctx, path, query, pathQuery, z) => {
|
const drawPath = (ctx, path, query, pathQuery, z) => {
|
||||||
const renderPath = (splitPaths) => {
|
const splitPaths = decodeURIComponent(pathQuery).split('|');
|
||||||
|
|
||||||
if (!path || path.length < 2) {
|
if (!path || path.length < 2) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
@ -468,8 +469,7 @@ const drawPath = (ctx, path, query, pathQuery, z) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Optionally fill drawn shape with a rgba color from query
|
// Optionally fill drawn shape with a rgba color from query
|
||||||
const pathHasFill =
|
const pathHasFill = splitPaths.filter((x) => x.startsWith('fill')).length > 0;
|
||||||
splitPaths.filter((x) => x.startsWith('fill')).length > 0;
|
|
||||||
if (query.fill !== undefined || pathHasFill) {
|
if (query.fill !== undefined || pathHasFill) {
|
||||||
if ('fill' in query) {
|
if ('fill' in query) {
|
||||||
ctx.fillStyle = query.fill || 'rgba(255,255,255,0.4)';
|
ctx.fillStyle = query.fill || 'rgba(255,255,255,0.4)';
|
||||||
|
|
@ -542,9 +542,6 @@ const drawPath = (ctx, path, query, pathQuery, z) => {
|
||||||
ctx.stroke();
|
ctx.stroke();
|
||||||
};
|
};
|
||||||
|
|
||||||
renderPath(decodeURIComponent(pathQuery).split('|'));
|
|
||||||
};
|
|
||||||
|
|
||||||
const renderOverlay = async (
|
const renderOverlay = async (
|
||||||
z,
|
z,
|
||||||
x,
|
x,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue