Readability.

This commit is contained in:
zeyus 2024-11-07 16:07:13 +01:00
parent 5d1d67836c
commit a08c8616d1
Signed by untrusted user: zeyus
GPG key ID: CE89DA73E2E2C2CD

View file

@ -267,16 +267,16 @@ class ImageHitCounterRenderer extends BaseHitCounterRenderer {
* The SVG overlay.
*/
private createSvgOverlay(width: number, height: number): Buffer {
const { textPositionX, textPositionY, fontFace, fontSize, customText, secondaryText, frameColorRGB, drawFrame } = this.config;
const { textPositionX, textPositionY, fontFace, fontSize, customText, secondaryText, textColorRGB, secondaryTextColorRGB, frameColorRGB, drawFrame, borderWidth } = this.config;
const frame = drawFrame
? `<rect x="0" y="0" width="100%" height="100%" fill="none" stroke="rgb(${frameColorRGB.r},${frameColorRGB.g},${frameColorRGB.b})" stroke-width="${this.config.borderWidth}" />`
? `<rect x="0" y="0" width="100%" height="100%" fill="none" stroke="rgb(${frameColorRGB.r},${frameColorRGB.g},${frameColorRGB.b})" stroke-width="${borderWidth}" />`
: '';
const svg = `
<svg xmlns="http://www.w3.org/2000/svg" width="${width}" height="${height}">
<text y="${textPositionY}" font-family="${fontFace}" font-size="${fontSize}">
<tspan x="${textPositionX}" dy="0" fill="rgb(${this.config.textColorRGB.r},${this.config.textColorRGB.g},${this.config.textColorRGB.b})">${customText}</tspan>
<tspan x="${textPositionX}" dy="1.2em" fill="rgb(${this.config.secondaryTextColorRGB.r},${this.config.secondaryTextColorRGB.g},${this.config.secondaryTextColorRGB.b})">${secondaryText}</tspan>
<tspan x="${textPositionX}" dy="0" fill="rgb(${textColorRGB.r},${textColorRGB.g},${textColorRGB.b})">${customText}</tspan>
<tspan x="${textPositionX}" dy="1.2em" fill="rgb(${secondaryTextColorRGB.r},${secondaryTextColorRGB.g},${secondaryTextColorRGB.b})">${secondaryText}</tspan>
</text>
${frame}
</svg>`;