Focused text fields show their outline on every edge (#202)
The focus outline of a text field was only visible at its corners. The mask that clips the text covered the whole field, border included, so the 1 px stroke was cut away along every straight edge. Only the rounded corners bent inwards far enough to survive. With the larger radius the new theme tried, this became obvious. - TextField puts text, selection and caret into their own container. Only that container is masked. Background and outline are not. - NumberField and the rename field in lists inherit the fix. - The theme radius goes back to 2 px. - New debug hook __gm.focusedRect() returns where the focused widget sits, so a check can read its border. Tests: - ./check.sh: 141 files, 2080 tests, exit 0 - GM_STEPS=2: ALL PASSED, 24 checks (one new) - The new check in 2c reads the middle of all four edges of the focused name field. All four must be the focus blue. - Counter-check with the old full-field mask: the check fails, all four edges read #24272e. - Editor check total is now 1286 (1285 + 1), computed, not measured. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
940a78e8ee
commit
0d207769b9
5 files changed
+29
-12
No files matched your search
@@ -1,4 +1,4 @@
|
||||
import { CanvasTextMetrics, type FederatedPointerEvent, Graphics, Text } from 'pixi.js';
|
||||
import { CanvasTextMetrics, Container, type FederatedPointerEvent, Graphics, Text } from 'pixi.js';
|
||||
import { pressCount } from '../clicks';
|
||||
import { drawControlBox } from '../draw';
|
||||
import type { TextEditTarget } from '../KeyboardBridge';
|
||||
@@ -66,15 +66,12 @@ export class TextField extends Widget implements TextEditTarget {
|
||||
this.minWidth = options.width ?? 80;
|
||||
this.textNode = new Text({ text: value, style: textStyle(options.style ?? 'body') });
|
||||
this.placeholderNode = new Text({ text: this.placeholder, style: textStyle('muted') });
|
||||
this.addChild(
|
||||
this.bg,
|
||||
this.selectionShape,
|
||||
this.placeholderNode,
|
||||
this.textNode,
|
||||
this.caret,
|
||||
this.clipShape,
|
||||
);
|
||||
this.mask = this.clipShape;
|
||||
// Only the contents are clipped: a mask on the whole field cut its border away along the
|
||||
// straight edges and left it showing at the rounded corners alone.
|
||||
const content = new Container();
|
||||
content.addChild(this.selectionShape, this.placeholderNode, this.textNode, this.caret);
|
||||
content.mask = this.clipShape;
|
||||
this.addChild(this.bg, content, this.clipShape);
|
||||
|
||||
this.trackHover();
|
||||
this.on('pointerdown', (e: FederatedPointerEvent) => this.handlePointerDown(e));
|
||||
|
||||
Reference in new issue
Block a user