* Widen and move the hit box of a vertical legend item so that it covers the * symbol and the aligned text, then mirror it for right-to-left. * @param placement - what every item shares * @param hitbox - the item's hit box * @param textAlign - the alignment of the item's text * @param x - the l
({layout: {font, boxWidth}, rtlHelper}: ItemPlacement, hitbox: LegendHitBox, textAlign: TextAlign, x: number, right: number)
| 195 | * @param right - the right end of the item's text area, before mirroring |
| 196 | */ |
| 197 | function coverAlignedText({layout: {font, boxWidth}, rtlHelper}: ItemPlacement, hitbox: LegendHitBox, textAlign: TextAlign, x: number, right: number) { |
| 198 | const aligned = getAlignedHitBox(x, hitbox._text.width, boxWidth, font.size, textAlign, right); |
| 199 | hitbox.width = aligned.width; |
| 200 | hitbox.left = rtlHelper.leftForLtr(rtlHelper.x(aligned.left), hitbox.width); |
| 201 | } |
| 202 | export class Legend extends Element<AnyObject, LegendOpts> implements LayoutItem { |
| 203 | |
| 204 | _added: boolean; |
no test coverage detected