updated documentation for linecap parameter in staticmaps endpoint;

added linejoin parameter to staticmaps endpoint;
This commit is contained in:
Benedikt Brandtner 2022-10-07 13:25:27 +02:00
parent ea4c398f26
commit ec0ab3da5c
2 changed files with 8 additions and 2 deletions

View file

@ -43,7 +43,8 @@ Static images
* ``fill`` - color to use as the fill (e.g. ``red``, ``rgba(255,255,255,0.5)``, ``#0000ff``)
* ``stroke`` - color of the path stroke
* ``width`` - width of the stroke
* ``linecap`` - line cap of the path stroke
* ``linecap`` - rendering style for the start and end points of the path
* ``linejoin`` - rendering style for overlapping segments of the path with differing directions
* ``border`` - color of the optional border path stroke
* ``borderwidth`` - width of the border stroke (default 10% of width)
* ``marker`` - Marker in format ``lng,lat|iconPath|option|option|...``

View file

@ -410,9 +410,14 @@ const drawPath = async (ctx, path, query, z) => {
const borderWidth = query.borderwidth !== undefined ?
parseFloat(query.borderwidth) : lineWidth * 0.1;
// Set line start/endpoint style
// Set rendering style for the start and end points of the path
// https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/lineCap
ctx.lineCap = query.linecap || 'butt';
// Set rendering style for overlapping segments of the path with differing directions
// https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/lineJoin
ctx.lineJoin = query.linejoin || 'miter';
// In order to simulate a border we draw the path two times with the first
// beeing the wider border part.
if (query.border !== undefined && borderWidth > 0) {