Rich text labels

This commit is contained in:
Andreas Hocevar
2022-02-21 23:25:33 +01:00
parent 1f8338d3b8
commit 18f06b8b9a
10 changed files with 313 additions and 48 deletions

View File

@@ -1146,7 +1146,12 @@ class CanvasImmediateRenderer extends VectorContext {
? textTextBaseline
: defaultTextBaseline,
};
this.text_ = textText !== undefined ? textText : '';
this.text_ =
textText !== undefined
? Array.isArray(textText)
? textText.reduce((acc, t, i) => (acc += i % 2 ? ' ' : t), '')
: textText
: '';
this.textOffsetX_ =
textOffsetX !== undefined ? this.pixelRatio_ * textOffsetX : 0;
this.textOffsetY_ =