chore: simplify respondImage() args

Signed-off-by: Martin d'Allens <martin.dallens@liberty-rider.com>
This commit is contained in:
Martin d'Allens 2023-11-19 23:31:44 +01:00 committed by Andrew Calcutt
parent 3437a653b3
commit 21118f09da

View file

@ -365,9 +365,8 @@ const respondImage = (
scale, scale,
format, format,
res, res,
next, overlay = null,
opt_overlay, mode = 'tile',
opt_mode = 'tile',
) => { ) => {
if ( if (
Math.abs(lon) > 180 || Math.abs(lon) > 180 ||
@ -396,7 +395,7 @@ const respondImage = (
const tileMargin = Math.max(options.tileMargin || 0, 0); const tileMargin = Math.max(options.tileMargin || 0, 0);
let pool; let pool;
if (opt_mode === 'tile' && tileMargin === 0) { if (mode === 'tile' && tileMargin === 0) {
pool = item.map.renderers[scale]; pool = item.map.renderers[scale];
} else { } else {
pool = item.map.renderers_static[scale]; pool = item.map.renderers_static[scale];
@ -473,8 +472,8 @@ const respondImage = (
} }
const composite_array = []; const composite_array = [];
if (opt_overlay) { if (overlay) {
composite_array.push({ input: opt_overlay }); composite_array.push({ input: overlay });
} }
if (item.watermark) { if (item.watermark) {
const canvas = renderWatermark(width, height, scale, item.watermark); const canvas = renderWatermark(width, height, scale, item.watermark);
@ -482,7 +481,7 @@ const respondImage = (
composite_array.push({ input: canvas.toBuffer() }); composite_array.push({ input: canvas.toBuffer() });
} }
if (opt_mode === 'static' && item.staticAttributionText) { if (mode === 'static' && item.staticAttributionText) {
const canvas = rendeAttribution( const canvas = rendeAttribution(
width, width,
height, height,
@ -587,7 +586,6 @@ export const serve_rendered = {
scale, scale,
format, format,
res, res,
next,
); );
}, },
); );
@ -670,7 +668,6 @@ export const serve_rendered = {
scale, scale,
format, format,
res, res,
next,
overlay, overlay,
'static', 'static',
); );
@ -752,7 +749,6 @@ export const serve_rendered = {
scale, scale,
format, format,
res, res,
next,
overlay, overlay,
'static', 'static',
); );
@ -887,7 +883,6 @@ export const serve_rendered = {
scale, scale,
format, format,
res, res,
next,
overlay, overlay,
'static', 'static',
); );