fix(android): UX-1/UX-5b/UX-7/BUG-3 — safe-area modals, glyph, help wrap, modal guard
- UX-1 (safe_area.rs): apply_safe_area_to_modal_scrims pads ModalScrim bottom by insets.bottom / scale_factor so Done buttons clear the gesture bar; fires on inset change + Added<ModalScrim> - UX-5b (home_plugin.rs): replace Geometric Shapes (U+25xx, missing from FiraMono) with card suits U+2660/2665/2666 - UX-7 (help_plugin.rs): shorten Android ≡ button description to "Open menu (Stats, Settings, Profile...)" — fits one line at 360 dp - BUG-3 (hud_plugin.rs): guard spawn_menu_popover with scrims.is_empty() so tapping ≡ while a modal is open is a no-op Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -6,6 +6,27 @@ project follows [Semantic Versioning](https://semver.org/).
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
### Fixed
|
||||
|
||||
- **BUG-3: Multi-modal stacking** (`hud_plugin.rs`). `handle_menu_button`
|
||||
now checks `scrims.is_empty()` — a `Query<(), With<ModalScrim>>` guard —
|
||||
before calling `spawn_menu_popover`. Tapping ≡ while any modal (Stats,
|
||||
Settings, Profile, Help) is open is now a no-op. Previously Stats + Profile
|
||||
could be open simultaneously.
|
||||
- **UX-7: Help text single-line overflow** (`help_plugin.rs`). The HUD menu
|
||||
button description "Menu: Stats, Settings, Profile, Achievements" wrapped to
|
||||
two lines on Android. Shortened to "Open menu (Stats, Settings, Profile...)"
|
||||
which fits on one line. Verified on device.
|
||||
- **UX-5b: Home mode glyph corruption** (`home_plugin.rs`). Mode selector icons
|
||||
were using Geometric Shapes block (U+25xx) absent from the bundled FiraMono
|
||||
font — rendered as missing-glyph rectangles on Android. Replaced with card
|
||||
suits (U+2660–2666) which FiraMono covers: ♦ Daily, ♥ Zen, ♠ Challenge.
|
||||
- **UX-1: Modal Done button in gesture zone** (`safe_area.rs`). New
|
||||
`apply_safe_area_to_modal_scrims` Bevy system pads every `ModalScrim` bottom
|
||||
by `SafeAreaInsets.bottom / scale_factor`. Modal cards are now centred over
|
||||
the safe area, not the full physical screen. The Settings / Help / Stats Done
|
||||
buttons are reachable on gesture-nav Android devices. Verified on device.
|
||||
|
||||
---
|
||||
|
||||
## [0.23.0] — 2026-05-12
|
||||
|
||||
@@ -159,7 +159,7 @@ const CONTROL_SECTIONS: &[ControlSection] = &[
|
||||
ControlRow { keys: "||", description: "Pause / resume" },
|
||||
ControlRow { keys: "?", description: "This help screen" },
|
||||
ControlRow { keys: "→", description: "Show a hint" },
|
||||
ControlRow { keys: "≡", description: "Menu: Stats, Settings, Profile, Achievements" },
|
||||
ControlRow { keys: "≡", description: "Open menu (Stats, Settings, Profile...)" },
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
@@ -150,32 +150,24 @@ impl HomeMode {
|
||||
/// readability rather than visual fidelity. Swap to `Image` nodes
|
||||
/// when art lands; the rest of the tile layout doesn't change.
|
||||
///
|
||||
/// Picks are constrained to **card suits** (U+2660-2666) and basic
|
||||
/// **Geometric Shapes** (U+25xx) — the two ranges the bundled
|
||||
/// FiraMono-Medium face actually covers. Earlier choices in
|
||||
/// Dingbats (★ ❀ ✦) and Misc Symbols (⌚) rendered as
|
||||
/// missing-glyph rectangles because FiraMono's coverage there is
|
||||
/// minimal.
|
||||
/// Picks are constrained to **card suits** (U+2660-2666), the
|
||||
/// **Arrows** block (U+2190-21FF), and ASCII — ranges confirmed
|
||||
/// present in the bundled FiraMono-Medium face. The Geometric
|
||||
/// Shapes block (U+25xx) is NOT covered by FiraMono; glyphs in
|
||||
/// that range render as missing-glyph rectangles on Android.
|
||||
fn glyph(self) -> &'static str {
|
||||
match self {
|
||||
// Black club — card suit, the obvious solitaire mark.
|
||||
// Black club — card suit; the obvious solitaire mark.
|
||||
HomeMode::Classic => "\u{2663}",
|
||||
// Black diamond — Geometric Shapes; reads as the day's gem.
|
||||
HomeMode::Daily => "\u{25C6}",
|
||||
// White circle — Geometric Shapes; reads as the Zen enso.
|
||||
HomeMode::Zen => "\u{25CB}",
|
||||
// Black up-pointing triangle — Geometric Shapes; reads as
|
||||
// a mountain / a step up in difficulty.
|
||||
HomeMode::Challenge => "\u{25B2}",
|
||||
// Rightwards arrow — Arrows block (U+2190-21FF), a core
|
||||
// range every dev-oriented monospace font (FiraMono
|
||||
// included) ships. Reads as "go / fast-forward" for the
|
||||
// timed mode. Earlier ▶ (U+25B6) did not render; FiraMono
|
||||
// ships ▲ (up triangle) but evidently not the sideways
|
||||
// siblings.
|
||||
// Black diamond suit — "gem of the day" reading.
|
||||
HomeMode::Daily => "\u{2666}",
|
||||
// Black heart suit — calm/warm; conveys the Zen mood.
|
||||
HomeMode::Zen => "\u{2665}",
|
||||
// Black spade suit — sharp/high-stakes; signals difficulty.
|
||||
HomeMode::Challenge => "\u{2660}",
|
||||
// Rightwards arrow — "go / fast-forward" for the timed mode.
|
||||
HomeMode::TimeAttack => "\u{2192}",
|
||||
// Number sign — ASCII, universally available. Reads as
|
||||
// "a specific number / seed ID".
|
||||
// Number sign — ASCII; "a specific seed ID".
|
||||
HomeMode::PlayBySeed => "#",
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,6 +40,7 @@ use crate::resources::GameStateResource;
|
||||
use crate::selection_plugin::SelectionState;
|
||||
use crate::time_attack_plugin::TimeAttackResource;
|
||||
use crate::ui_focus::{FocusGroup, Focusable};
|
||||
use crate::ui_modal::ModalScrim;
|
||||
use crate::ui_tooltip::Tooltip;
|
||||
|
||||
/// Marker on the score text node.
|
||||
@@ -1074,6 +1075,7 @@ fn handle_menu_button(
|
||||
interaction_query: Query<&Interaction, (With<MenuButton>, Changed<Interaction>)>,
|
||||
popovers: Query<Entity, With<MenuPopover>>,
|
||||
backdrops: Query<Entity, With<MenuPopoverBackdrop>>,
|
||||
scrims: Query<(), With<ModalScrim>>,
|
||||
font_res: Option<Res<FontResource>>,
|
||||
mut commands: Commands,
|
||||
) {
|
||||
@@ -1088,7 +1090,7 @@ fn handle_menu_button(
|
||||
for e in &backdrops {
|
||||
commands.entity(e).despawn();
|
||||
}
|
||||
} else {
|
||||
} else if scrims.is_empty() {
|
||||
spawn_menu_popover(&mut commands, font_res.as_deref());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
|
||||
use bevy::prelude::*;
|
||||
|
||||
use crate::ui_modal::ModalScrim;
|
||||
|
||||
/// Pixel sizes of the system-reserved regions on each edge of the
|
||||
/// surface. Zero on desktop.
|
||||
#[derive(Resource, Debug, Clone, Copy, Default, PartialEq)]
|
||||
@@ -54,7 +56,7 @@ pub struct SafeAreaInsetsPlugin;
|
||||
impl Plugin for SafeAreaInsetsPlugin {
|
||||
fn build(&self, app: &mut App) {
|
||||
app.init_resource::<SafeAreaInsets>()
|
||||
.add_systems(Update, apply_safe_area_anchors);
|
||||
.add_systems(Update, (apply_safe_area_anchors, apply_safe_area_to_modal_scrims));
|
||||
|
||||
#[cfg(target_os = "android")]
|
||||
app.add_systems(Update, android::refresh_insets);
|
||||
@@ -87,6 +89,29 @@ fn apply_safe_area_anchors(
|
||||
}
|
||||
}
|
||||
|
||||
/// Pads the bottom of every [`ModalScrim`] by the logical bottom inset so
|
||||
/// modal cards don't extend into the Android gesture-navigation zone.
|
||||
///
|
||||
/// Fires when [`SafeAreaInsets`] changes (covers the common case of insets
|
||||
/// arriving a few frames after app start) AND when a new `ModalScrim` is
|
||||
/// spawned (covers modals opened after insets have already settled).
|
||||
fn apply_safe_area_to_modal_scrims(
|
||||
insets: Res<SafeAreaInsets>,
|
||||
windows: Query<&Window>,
|
||||
mut scrims: Query<&mut Node, With<ModalScrim>>,
|
||||
new_scrims: Query<(), (With<ModalScrim>, Added<ModalScrim>)>,
|
||||
) {
|
||||
let has_new = !new_scrims.is_empty();
|
||||
if !insets.is_changed() && !has_new {
|
||||
return;
|
||||
}
|
||||
let scale = windows.iter().next().map_or(1.0, |w| w.scale_factor());
|
||||
let bottom_logical = insets.bottom / scale;
|
||||
for mut node in &mut scrims {
|
||||
node.padding.bottom = Val::Px(bottom_logical);
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(target_os = "android")]
|
||||
mod android {
|
||||
use super::SafeAreaInsets;
|
||||
|
||||
Reference in New Issue
Block a user