Make sure older webkit/blink based browsers are able to render opacity of circles

This commit is contained in:
schlagmichdoch 2025-02-16 23:20:43 +01:00
parent ae68ede3f3
commit 8eea54f8dd
2 changed files with 17 additions and 2 deletions

View file

@ -461,7 +461,14 @@ class BackgroundCanvas {
opacity *= (8 * dw - radius) / dw
}
ctx.strokeStyle = `rgb(${baseColor} / ${opacity})`;
if (ctx.setStrokeColor) {
// older blink/webkit browsers do not understand opacity in strokeStyle. Use deprecated setStrokeColor
let baseColorRgb = baseColor.split(" ");
ctx.setStrokeColor(baseColorRgb[0], baseColorRgb[1], baseColorRgb[2], opacity);
}
else {
ctx.strokeStyle = `rgb(${baseColor} / ${opacity})`;
}
ctx.beginPath();
ctx.arc(x0, y0, radius, 0, 2 * Math.PI);
ctx.stroke();