(x: number, textWidth: number, boxWidth: number, fontSize: number, textAlign: TextAlign, right: number)
| 127 | const itemsEqual = (a: LegendItem | null, b: LegendItem | null) => a !== null && b !== null && a.datasetIndex === b.datasetIndex && a.index === b.index; |
| 128 | |
| 129 | function getAlignedHitBox(x: number, textWidth: number, boxWidth: number, fontSize: number, textAlign: TextAlign, right: number) { |
| 130 | const textX = _textX(textAlign, x + boxWidth + fontSize / 2, right, false); |
| 131 | const textLeft = textX - (textAlign === 'center' ? textWidth / 2 : textAlign === 'right' ? textWidth : 0); |
| 132 | const left = Math.min(x, textLeft); |
| 133 | // Cover both the symbol and the aligned text in LTR coordinates. |
| 134 | return {left, width: Math.max(x + boxWidth, textLeft + textWidth) - left}; |
| 135 | } |
| 136 | |
| 137 | /** |
| 138 | * The text alignment of an item: its own, or else the labels' one, which is |
no test coverage detected