( ctx: CanvasRenderingContext2D, data: Record<string, number>, gc: string[], longest: number, string: string )
| 37 | * @private |
| 38 | */ |
| 39 | export function _measureText( |
| 40 | ctx: CanvasRenderingContext2D, |
| 41 | data: Record<string, number>, |
| 42 | gc: string[], |
| 43 | longest: number, |
| 44 | string: string |
| 45 | ) { |
| 46 | let textWidth = data[string]; |
| 47 | if (!textWidth) { |
| 48 | textWidth = data[string] = ctx.measureText(string).width; |
| 49 | gc.push(string); |
| 50 | } |
| 51 | if (textWidth > longest) { |
| 52 | longest = textWidth; |
| 53 | } |
| 54 | return longest; |
| 55 | } |
| 56 | |
| 57 | type Thing = string | undefined | null |
| 58 | type Things = (Thing | Thing[])[] |
no outgoing calls
no test coverage detected