Unify action-button states across the UI
- Add UiStyles with explicit normal, hover, pressed, focus and disabled styles and apply it to every action button. - Disable timeline Previous/Next at the first/last event and keep Close always available. - Style settings reset-dialog buttons and cover the button-state audit in docs/ui-copy.md. - Add shared-state and timeline-boundary regression tests.
This commit is contained in:
1 parent
98c31fe44c
commit
9692f262f1
15 files changed
+172
-75
No files matched your search
@@ -0,0 +1,26 @@
|
||||
extends RefCounted
|
||||
## Shared UI button states: every normal/hover/pressed/focus/disabled state is
|
||||
## explicitly styled so the custom dark panels do not fall back to the engine
|
||||
## theme when a control is focused or disabled.
|
||||
|
||||
const UiStyles := preload("res://src/game/ui/ui_styles.gd")
|
||||
|
||||
func test_shared_button_states_are_complete() -> bool:
|
||||
var button := Button.new()
|
||||
UiStyles.apply_button(button, 16)
|
||||
var states := ["normal", "hover", "pressed", "focus", "disabled"]
|
||||
var missing: Array[String] = []
|
||||
for state in states:
|
||||
if not button.has_theme_stylebox_override(state):
|
||||
missing.append(state)
|
||||
var a := TestUtils.check(missing.is_empty(),
|
||||
"all five button states have explicit styles (missing: %s)" % str(missing))
|
||||
var b := TestUtils.check_eq(button.get_theme_font_size("font_size"), 16,
|
||||
"the shared style applies the requested font size")
|
||||
var disabled := button.get_theme_stylebox("disabled")
|
||||
var normal := button.get_theme_stylebox("normal")
|
||||
var c := TestUtils.check(disabled != null and normal != null
|
||||
and disabled.bg_color != normal.bg_color,
|
||||
"the disabled state is visually distinct from normal")
|
||||
button.free()
|
||||
return a and b and c
|
||||
Reference in new issue
Block a user