feat(engine): UI scale setting — 90/100/115/130% (Phase K)
Settings -> Accessibility gains a UI Scale row cycling four steps, applied live through bevy::ui::UiScale: every menu, modal, and HUD element scales while the table itself stays window-fit via compute_layout. New Settings::ui_scale (serde default 1.0, sanitized clamp to [0.9, 1.3]). Safe-area anchors and modal scrim padding pre-divide physical insets by the UI scale so post-multiplication lands exactly on the system bars — without this, 90% would sink the bottom action bar into the Android gesture zone. The anchor systems also re-run on UiScale changes, not just inset changes. Deferred from Phase K (noted in the doc): seeding the setting from the Android system font scale on first run (needs JNI), and the 44px touch-target audit (on-device). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -139,6 +139,10 @@ struct ReduceMotionText;
|
||||
#[derive(Component, Debug)]
|
||||
struct TouchInputModeText;
|
||||
|
||||
/// Marks the `Text` node showing the current UI scale percentage.
|
||||
#[derive(Component, Debug)]
|
||||
struct UiScaleText;
|
||||
|
||||
/// Marks the `Text` node showing the live tooltip-delay value.
|
||||
#[derive(Component, Debug)]
|
||||
struct TooltipDelayText;
|
||||
@@ -277,6 +281,10 @@ enum SettingsButton {
|
||||
/// (auto-move on tap, default) and `TapToSelect` (first tap selects
|
||||
/// a card/stack, second tap on a target pile moves it).
|
||||
ToggleTouchInputMode,
|
||||
/// Cycle [`Settings::ui_scale`] through 90 % → 100 % → 115 % →
|
||||
/// 130 % → 90 %. Applied live via `bevy::ui::UiScale`; the table
|
||||
/// stays window-fit (Phase K).
|
||||
CycleUiScale,
|
||||
/// Toggle the [`Settings::winnable_deals_only`] flag. When on, new
|
||||
/// random Classic-mode deals are filtered through
|
||||
/// [`solitaire_core::game_state::GameState::solve_fresh_deal`] until one is provably
|
||||
@@ -354,6 +362,7 @@ impl SettingsButton {
|
||||
SettingsButton::ToggleHighContrast => 61,
|
||||
SettingsButton::ToggleReduceMotion => 62,
|
||||
SettingsButton::ToggleTouchInputMode => 63,
|
||||
SettingsButton::CycleUiScale => 64,
|
||||
// Picker rows — every swatch in a row shares the row's
|
||||
// priority so entity-index tiebreaking yields left → right.
|
||||
SettingsButton::SelectCardBack(_) => 70,
|
||||
@@ -449,6 +458,11 @@ impl Plugin for SettingsPlugin {
|
||||
handle_volume_keys,
|
||||
record_window_geometry_changes,
|
||||
persist_window_geometry_after_debounce,
|
||||
// State sync, not UI — runs even under `headless()`
|
||||
// so the live `bevy::ui::UiScale` always mirrors the
|
||||
// setting; rides the mutator spine so it is ordered
|
||||
// after every settings writer this frame.
|
||||
sync_ui_scale_resource,
|
||||
)
|
||||
.chain()
|
||||
.in_set(SettingsMutation),
|
||||
@@ -492,6 +506,7 @@ impl Plugin for SettingsPlugin {
|
||||
update_high_contrast_backgrounds.run_if(resource_changed::<SettingsResource>),
|
||||
update_reduce_motion_text,
|
||||
update_touch_input_mode_text,
|
||||
update_ui_scale_text,
|
||||
update_tooltip_delay_text,
|
||||
update_time_bonus_multiplier_text,
|
||||
update_replay_move_interval_text,
|
||||
|
||||
Reference in New Issue
Block a user