Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | 42x 39x 39x 39x 39x 39x 39x 39x 39x 31x 3x 3x 2x 2x 3x 3x 2x 2x 1x 1x 1x 1x 2x 2x 1x 1x 16x 31x 31x | /** Debug labels are immutable strings, retained only for the lifetime of their drawing owner. */
type LabelValue = string | number;
type DrawLabelKind =
| 'note'
| 'note-fallback'
| 'mine'
| 'mine-fallback'
| 'ln-body'
| 'ln-body-fallback'
| 'ln-end'
| 'ln-start'
| 'invisible-note'
| 'invisible-note-fallback'
| 'bomb'
| 'measure-line'
| 'image'
| 'number'
| 'judgeline'
| 'text'
| 'bargraph'
| 'slider'
| 'nowcombo';
const labels = new WeakMap<object, Map<DrawLabelKind, Map<LabelValue, Map<LabelValue | undefined, string>>>>();
/** Reuses the exact diagnostic label without sharing any mutable render state. No formatted cache key is needed. */
export function drawLabel(owner: object, kind: DrawLabelKind, first: LabelValue, second?: LabelValue): string {
let kinds = labels.get(owner);
if (!kinds) labels.set(owner, (kinds = new Map()));
let values = kinds.get(kind);
if (!values) kinds.set(kind, (values = new Map()));
let pairs = values.get(first);
if (!pairs) values.set(first, (pairs = new Map()));
let label = pairs.get(second);
if (label !== undefined) return label;
switch (kind) {
case 'invisible-note':
case 'invisible-note-fallback':
case 'bomb':
label = `${kind}[ch=${first}]`;
break;
case 'measure-line':
label = `measure-line[idx=${first},beat=${second}]`;
break;
case 'image':
label = `image[${first}]`;
break;
case 'number':
label = `number[num=${first},cell=${second}]`;
break;
case 'judgeline':
label = `judgeline[idx=${first}]`;
break;
case 'text':
label = `text[st=${first}]`;
break;
case 'bargraph':
case 'slider':
label = `${kind}[type=${first}]`;
break;
case 'nowcombo':
label = `nowcombo[digit=${first}]`;
break;
default:
label = `${kind}[lane=${first},ch=${second}]`;
}
pairs.set(second, label);
return label;
}
|