Make the viewport label size one setting

Scene labels used `small` (11 px), the Texture tab used `body` (13 px). Both now
read `Theme.viewportLabelSize` through two tokens that differ only in colour.

Dropping the per-frame `label.style.fill` assignment matters: textStyle() returns
shared cached instances, so with both views on one token it would have recoloured
the scene labels too.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
rootandClaude Opus 5 committed 2026-09-08 16:59:17 +02:00
1 parent 0b34bdd990
commit 6bedc948be
3 files changed
+19 -4

No files matched your search

+17 -1
View File
@@ -6,6 +6,7 @@ export const Theme = {
monoFont: '"JetBrains Mono", Consolas, "Courier New", monospace',
fontSize: 13,
smallFontSize: 11,
viewportLabelSize: 10,
rowHeight: 26,
controlHeight: 24,
padding: 8,
@@ -62,7 +63,16 @@ export const Theme = {
const styleCache = new Map<string, TextStyle>();
export type TextStyleToken = 'body' | 'bodyBold' | 'muted' | 'small' | 'title' | 'mono' | 'accent';
export type TextStyleToken =
| 'body'
| 'bodyBold'
| 'muted'
| 'small'
| 'title'
| 'mono'
| 'accent'
| 'viewportLabel'
| 'viewportLabelMuted';
/** Shared TextStyle instances so Pixi can cache glyph measurements per token. */
export function textStyle(token: TextStyleToken = 'body'): TextStyle {
@@ -97,6 +107,12 @@ export function textStyle(token: TextStyleToken = 'body'): TextStyle {
case 'accent':
style = new TextStyle({ ...base, fill: Theme.colors.accentText, fontWeight: '600' });
break;
case 'viewportLabel':
style = new TextStyle({ ...base, fontSize: Theme.viewportLabelSize });
break;
case 'viewportLabelMuted':
style = new TextStyle({ ...base, fontSize: Theme.viewportLabelSize, fill: Theme.colors.textMuted });
break;
}
styleCache.set(token, style);
return style;