Make Button state composition visible in ButtonGroup and the gallery
Three small fixes around the new Button + ButtonGroup so the cursor is
always visible and the section reads as a single Button showing flag
combinations.
ButtonGroup now exposes cursorIndex + hovered(index, isHovered) so
panels can drive a single Button's hasCursor without reaching past
ButtonGroup's API. Every chip gets bordered: true so the row reads as
a real picker — distinct outlines, not just a tinted fill that vanishes
into the background.
Button's border treatment grows two paths so the cursor is always
visible regardless of other state: bordered + hot recolors the border
to the accent and thickens to the focus-ring width, and selected + hot
thickens the existing accent border to the focus-ring width (so the
cursor landing on the chosen option still reads as cursor presence,
instead of disappearing into the selected fill).
Gallery's Button section pairs each demo button with a small caption
('idle', 'active', 'icon only', 'icon + active', 'bordered +
focusable') so the row reads as one Button with its state flags side
by side rather than five unrelated buttons. The ButtonGroup section
gets the cursor wiring (cursorIndex + onHovered) plus an
onFocusedChanged auto-scroll so the cursor visual is reachable via
j/k h/l from the panel cursor model.
This commit is contained in:
+11
-1
@@ -72,13 +72,23 @@ Rectangle {
|
||||
: active ? Style.selectedFill
|
||||
: background
|
||||
|
||||
// Border color follows the same precedence as fill: focus ring wins,
|
||||
// then selected, then cursor on bordered (paints accent so the chip
|
||||
// structure clearly reads as "cursor is here"), then plain bordered
|
||||
// (foreground), then nothing.
|
||||
border.color: _showFocusRing ? Style.focusBorderColor
|
||||
: selected ? accent
|
||||
: (bordered && hot) ? Style.focusBorderColor
|
||||
: bordered ? foreground
|
||||
: Style.idleBorderColor
|
||||
|
||||
// selected+hot thickens to the focus-ring width so the cursor remains
|
||||
// visible on the chosen option (otherwise selected's accent fill+border
|
||||
// masks any hot fill). bordered+hot also thickens so the chip cursor
|
||||
// reads as a deliberate state change rather than a faint tint.
|
||||
border.width: _showFocusRing ? Style.focusBorderWidth
|
||||
: selected ? Math.max(Style.borderWidth, 2)
|
||||
: selected ? (hot ? Style.focusBorderWidth : Math.max(Style.borderWidth, 2))
|
||||
: (bordered && hot) ? Style.focusBorderWidth
|
||||
: bordered ? Style.borderWidth
|
||||
: 0
|
||||
|
||||
|
||||
Reference in New Issue
Block a user