Class Strokes
ControlSize step.
A quantity belongs here if it expresses a weight, a rasterization correction
derived from a weight, a device fact, or a human motor constant. It belongs in
SizeTokens instead if it expresses an extent or an optical gap.
The separation is structural, not editorial: these are public static final
float and SizeTokens has no row for any of them, so there is nowhere to put
the five columns a scaled value would need. No member of this class may be indexed
by a ControlSize.
Trap when migrating a literal. The four text-cluster components draw one
rounded rect whose stroke width is the expression BORDER + (FOCUS_RING -
BORDER) * focus, so the border thickens continuously as the focus transition runs.
Writing focus > 0 ? FOCUS_RING : BORDER instead deletes that animation.
A test that records stroke widths over these components must paint at a settled
transition (focus exactly 0, then exactly 1) or it records frame-dependent
fractional widths.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final floatAntialiasing fringe allowance for a text clip.static final floatIcon line weight: the glyph grows, the pen does not.static final floatEvery border and hairline separator.static final floatThe text caret.static final floatThe check-mark pen.static final floatSlack so a 1 pt caret clears a hard-edged clip.static final floatCaret damage margin: antialiasing plus hairline snap.static final floatHand jitter: a motor constant.static final floatA 2 pt stroke centred 2 pt out leaves exactly 1 pt clear.static final floatFocus gap for the indicator-scale toggles, which are in declared lockstep and must not differ here.static final floatSlider's focus gap.static final floattabHoverInset > FOCUS_GAP_TABmust hold at every step.static final floatVisible-focus indicator weight.static final floatThe declared paint reach of a ring drawn at −2 with a 2 pt centred stroke: the ring spans −3…−1.static final floatThe thin focus weight, for indicator-scale controls.static final floatAlias: the same weight, read as a separator rather than an outline.static final floatHalf ofBORDER.static final floatIcon glyphs have no ascender/descender slack and must be drawn slightly larger than the text box to read at the same weight.static final floatIME preedit underline, resting weight.static final floatIME preedit underline for the converting block.static final floatCheckbox box, RadioButton ring and Slider knob outline: 1.5 pt at every step.static final floatThe ±1 pt overshoot that makes a caret bracket its glyphs and a selection band clear the tallest ascender.static final floatMenu tick.static final floatThe popup's scroll-hint band.static final floatWCAG 2.2 SC 2.5.8 (AA): the accessibility floor does not scale.static final floatVisibility floor so a zero-width selection on an empty line still shows (Math.max(2, x1 - x0)).static final floatThe colour picker's cursor ring, drawn twice one point apart in black and white so it stays legible on whatever colour it lands on.static final floatRow clip inset whose value is the border width.static final floatThe gap that stops two highlighted rows fusing.static final floatScrollbar chrome breathing room, and what keepsthickness() = WIDE + 4trivial.static final floatSpinner hover fill inset.static final floatExactly twiceBORDER: it exists to hide the seam between two columns' borders.static final floatThe tab strip's sliding indicator.static final floatA wheel detent is a device unit: the same physical flick must move the same physical distance in a dense list and a roomy one. -
Method Summary
-
Field Details
-
BORDER
public static final float BORDEREvery border and hairline separator. A toolbar and the buttons inside it share one border weight, and scaling either one breaks that read.- See Also:
-
HAIRLINE
public static final float HAIRLINEAlias: the same weight, read as a separator rather than an outline.- See Also:
-
HALF_PIXEL_INSET
public static final float HALF_PIXEL_INSETHalf ofBORDER. Lands a 1 pt stroke on a whole device pixel instead of straddling two and going grey:drawRoundRect(0.5f, 0.5f, w - 1, h - 1, …). A function of the stroke, not of the size: at XLARGE it is still 0.5.- See Also:
-
FOCUS_RING
public static final float FOCUS_RINGVisible-focus indicator weight. WCAG-style focus indicators are specified in absolute thickness, and a form mixing size steps must afford focus uniformly.- See Also:
-
FOCUS_RING_THIN
public static final float FOCUS_RING_THINThe thin focus weight, for indicator-scale controls. Two named weights, not an accident.- See Also:
-
FOCUS_GAP_BUTTON
public static final float FOCUS_GAP_BUTTONA 2 pt stroke centred 2 pt out leaves exactly 1 pt clear.- See Also:
-
FOCUS_GAP_INDICATOR
public static final float FOCUS_GAP_INDICATORFocus gap for the indicator-scale toggles, which are in declared lockstep and must not differ here. A gap must be at least as wide as the thinner stroke it separates: between anINDICATOR_BORDERand aFOCUS_RING_THIN, both 1.5, a 1 pt gap reads as a seam rather than as clearance.- See Also:
-
FOCUS_GAP_SLIDER
public static final float FOCUS_GAP_SLIDERSlider's focus gap. Accepted consequence: Slider's height derives from2 × (knobHover + gap + BORDER), so pinning the gap makes the small steps proportionally taller than the knob ramp predicts. The ring needs absolute room.- See Also:
-
FOCUS_GAP_TAB
public static final float FOCUS_GAP_TABtabHoverInset > FOCUS_GAP_TABmust hold at every step.- See Also:
-
FOCUS_RING_OUTSET
public static final float FOCUS_RING_OUTSETThe declared paint reach of a ring drawn at −2 with a 2 pt centred stroke: the ring spans −3…−1. Locked because the ring is. Consumed bypaintOutset()overrides, whose whole purpose is to change which pixels are repainted.- See Also:
-
INDICATOR_BORDER
public static final float INDICATOR_BORDERCheckbox box, RadioButton ring and Slider knob outline: 1.5 pt at every step.- See Also:
-
CHECK_MARK
public static final float CHECK_MARKThe check-mark pen. The mark's extent scales with the indicator; the pen does not. At XSMALL the mark still keeps 1.83 pt of clearance from the box border's inner ink edge (1.75 at MEDIUM), so one pen is optically sound at every step.- See Also:
-
MENU_CHECK_PEN
public static final float MENU_CHECK_PENMenu tick. Heavier thanARROW_PENby convention: a tick is not an arrow.- See Also:
-
ARROW_PEN
public static final float ARROW_PENIcon line weight: the glyph grows, the pen does not. Sound only because every locked-pen glyph is floored at its MEDIUM extent for XSMALL and SMALL, which keepspen ÷ glyphMinExtent ≤ 0.45at all five steps.- See Also:
-
PICKER_CURSOR
public static final float PICKER_CURSORThe colour picker's cursor ring, drawn twice one point apart in black and white so it stays legible on whatever colour it lands on. NotFOCUS_RING: it happens to be the same weight today, and it means something else: a retune of the focus ring must not silently move a marker that is not one.- See Also:
-
TAB_INDICATOR
public static final float TAB_INDICATORThe tab strip's sliding indicator. Locked rather than tabled: 2.5 pt reads correctly across the strip's 2.1× range, and locking keeps the indicator insideheight()for free (y = height() − thickness), so nopaintOutsetquestion arises. Bottom-anchored, so the centred-stroke parity rule does not apply.- See Also:
-
CARET
public static final float CARETThe text caret.- See Also:
-
INK_BLEED
public static final float INK_BLEEDThe ±1 pt overshoot that makes a caret bracket its glyphs and a selection band clear the tallest ascender. An optical correction (themetrics.height()term it is added to already scales) and only meaningful from the ink box.- See Also:
-
AA_BLEED
public static final float AA_BLEEDAntialiasing fringe allowance for a text clip. An absolute device effect: scaling it would let 2 pt of the leading pad be overwritten at XLARGE.- See Also:
-
DAMAGE_MARGIN
public static final float DAMAGE_MARGINCaret damage margin: antialiasing plus hairline snap. Growing it at large steps inflates per-blink damage and defeats partial rendering.- See Also:
-
CLIP_CLEARANCE
public static final float CLIP_CLEARANCESlack so a 1 pt caret clears a hard-edged clip. TextField's two uses of this must stay identical or the caret oscillates per keystroke.- See Also:
-
MIN_SELECTION_SLIVER
public static final float MIN_SELECTION_SLIVERVisibility floor so a zero-width selection on an empty line still shows (Math.max(2, x1 - x0)). The minimum that survives antialiasing at any size.- See Also:
-
IME_UNDERLINE
public static final float IME_UNDERLINEIME preedit underline, resting weight. Platform IMEs draw a hairline regardless of text size.- See Also:
-
IME_UNDERLINE_ACTIVE
public static final float IME_UNDERLINE_ACTIVEIME preedit underline for the converting block. The 1-vs-2 contrast carries the meaning; a scaled 0.5-vs-1 pair at XSMALL would erase it.- See Also:
-
ROW_CLIP
public static final float ROW_CLIPRow clip inset whose value is the border width.- See Also:
-
ROW_GUTTER
public static final float ROW_GUTTERThe gap that stops two highlighted rows fusing. Scaled to 3 pt at XLARGE it would read as a deliberate stripe.- See Also:
-
SUBMENU_OVERLAP
public static final float SUBMENU_OVERLAPExactly twiceBORDER: it exists to hide the seam between two columns' borders. 4 pt at XLARGE looks glued; 1 pt at XSMALL reveals a gap.- See Also:
-
SPINNER_HOVER_INSET
public static final float SPINNER_HOVER_INSETSpinner hover fill inset. Its value is the divider width, which the fill must not cover.- See Also:
-
SCROLLBAR_MARGIN
public static final float SCROLLBAR_MARGINScrollbar chrome breathing room, and what keepsthickness() = WIDE + 4trivial.ScrollBarreads it for both its track geometry and its drag arithmetic, which is what keeps the two in lockstep: a bar that painted with one margin and dragged with another would put the thumb a pixel away from the pointer.- See Also:
-
MENU_SCROLL_HINT_H
public static final float MENU_SCROLL_HINT_HThe popup's scroll-hint band. A control that intercepts clicks before item activation; below ~10 pt the scroll/activate boundary is unaimable.- See Also:
-
WHEEL_STEP
public static final float WHEEL_STEPA wheel detent is a device unit: the same physical flick must move the same physical distance in a dense list and a roomy one. Accepted consequence: a notch covers ~1.7 menu rows at MEDIUM and ~2.0 at XSMALL.- See Also:
-
MIN_HIT_TARGET
public static final float MIN_HIT_TARGETWCAG 2.2 SC 2.5.8 (AA): the accessibility floor does not scale.The height ramp pays this floor in paint (XSMALL is 24), so no control needs a pointer target wider than its painted box: there is no hit outset and no two-pass hit test, only a
Math.maxclamp at the few sites where an axis can fall short. A clamp that can never bind is a defect rather than defensive coding: it claims an axis can fall below the floor when it cannot, and the next reader has to re-derive the ramp to find out.- See Also:
-
DRAG_SLOP
public static final float DRAG_SLOPHand jitter: a motor constant. Growing it at XLARGE would make small deliberate drags read as clicks.- See Also:
-
ICON_OPTICAL_BUMP
public static final float ICON_OPTICAL_BUMPIcon glyphs have no ascender/descender slack and must be drawn slightly larger than the text box to read at the same weight. A constant correction, not a proportion.- See Also:
-