(legendItem, boxWidth, labelFont, ctx)
| 559 | } |
| 560 | |
| 561 | function calculateItemWidth(legendItem, boxWidth, labelFont, ctx) { |
| 562 | const legendItemText = legendItem.text; |
| 563 | const textWidth = legendItemText && typeof legendItemText !== 'string' |
| 564 | ? legendItemText.reduce((width, line) => Math.max(width, ctx.measureText(line).width), 0) |
| 565 | : ctx.measureText(legendItemText).width; |
| 566 | return boxWidth + (labelFont.size / 2) + textWidth; |
| 567 | } |
| 568 | |
| 569 | function calculateItemHeight(_itemHeight, legendItem, fontLineHeight) { |
| 570 | let itemHeight = _itemHeight; |