| 110 | } |
| 111 | |
| 112 | const getBoxSize = (labelOpts: LegendLabelOptions, fontSize: number) => { |
| 113 | let {boxHeight = fontSize, boxWidth = fontSize} = labelOpts; |
| 114 | |
| 115 | if (labelOpts.usePointStyle) { |
| 116 | boxHeight = Math.min(boxHeight, fontSize); |
| 117 | boxWidth = labelOpts.pointStyleWidth || Math.min(boxWidth, fontSize); |
| 118 | } |
| 119 | |
| 120 | return { |
| 121 | boxWidth, |
| 122 | boxHeight, |
| 123 | itemHeight: Math.max(fontSize, boxHeight) |
| 124 | }; |
| 125 | }; |
| 126 | |
| 127 | const itemsEqual = (a: LegendItem | null, b: LegendItem | null) => a !== null && b !== null && a.datasetIndex === b.datasetIndex && a.index === b.index; |
| 128 | |