* The text alignment of an item: its own, or else the labels' one, which is * written back to the item because users read `legendItems[i].textAlign`.
(item: LegendItem | undefined, labelAlign: TextAlign)
| 139 | * written back to the item because users read `legendItems[i].textAlign`. |
| 140 | */ |
| 141 | function applyItemTextAlign(item: LegendItem | undefined, labelAlign: TextAlign): TextAlign { |
| 142 | // The labels are built again after fit(), so there can be fewer items than hit boxes. |
| 143 | if (!item) { |
| 144 | return labelAlign; |
| 145 | } |
| 146 | return item.textAlign || (item.textAlign = labelAlign); |
| 147 | } |
| 148 | |
| 149 | /** |
| 150 | * What `adjustHitBoxes()` reads once to place every item. |