fix(engine): force full board repaint when the decor-view poller fires (#130)
Test / test (pull_request) Successful in 12m14s
Test / test (pull_request) Successful in 12m14s
The #152 poller fixes resolution + layout on a missed fold/unfold, but a transient clip could survive if card sprites held stale visuals after geometry converged. Emit StateChangedEvent alongside the synthetic WindowResized so card_plugin re-renders every sprite from scratch — silent self-heal, no player-facing prompt. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -82,7 +82,8 @@ impl Plugin for SafeAreaInsetsPlugin {
|
|||||||
);
|
);
|
||||||
|
|
||||||
#[cfg(target_os = "android")]
|
#[cfg(target_os = "android")]
|
||||||
app.init_resource::<android::SafeAreaPollTries>()
|
app.add_message::<crate::events::StateChangedEvent>()
|
||||||
|
.init_resource::<android::SafeAreaPollTries>()
|
||||||
.add_systems(Update, android::refresh_insets)
|
.add_systems(Update, android::refresh_insets)
|
||||||
.add_systems(Update, android::rearm_on_resumed)
|
.add_systems(Update, android::rearm_on_resumed)
|
||||||
.add_systems(Update, android::refresh_surface_size);
|
.add_systems(Update, android::refresh_surface_size);
|
||||||
@@ -330,11 +331,16 @@ mod android {
|
|||||||
/// `on_window_resized` in `table_plugin` recomputes the board layout,
|
/// `on_window_resized` in `table_plugin` recomputes the board layout,
|
||||||
/// 3. re-arms the inset poller, because a screen change almost always
|
/// 3. re-arms the inset poller, because a screen change almost always
|
||||||
/// moves the system bars too — covering the "re-poll never fires"
|
/// moves the system bars too — covering the "re-poll never fires"
|
||||||
/// hole left open in #116.
|
/// hole left open in #116,
|
||||||
|
/// 4. emits `StateChangedEvent` so `card_plugin`'s sync pipeline
|
||||||
|
/// re-renders every card sprite from scratch — belt-and-braces for
|
||||||
|
/// the transient tableau clip of #130, where geometry converged but
|
||||||
|
/// stale card visuals survived the relayout.
|
||||||
pub(super) fn refresh_surface_size(
|
pub(super) fn refresh_surface_size(
|
||||||
mut frame: Local<u32>,
|
mut frame: Local<u32>,
|
||||||
mut windows: Query<(Entity, &mut Window)>,
|
mut windows: Query<(Entity, &mut Window)>,
|
||||||
mut resize_events: MessageWriter<WindowResized>,
|
mut resize_events: MessageWriter<WindowResized>,
|
||||||
|
mut state_events: MessageWriter<crate::events::StateChangedEvent>,
|
||||||
mut poll: ResMut<SafeAreaPollTries>,
|
mut poll: ResMut<SafeAreaPollTries>,
|
||||||
) {
|
) {
|
||||||
const POLL_INTERVAL_FRAMES: u32 = 30; // ~0.5 s @ 60 fps
|
const POLL_INTERVAL_FRAMES: u32 = 30; // ~0.5 s @ 60 fps
|
||||||
@@ -381,6 +387,7 @@ mod android {
|
|||||||
width: decor_w as f32 / scale,
|
width: decor_w as f32 / scale,
|
||||||
height: decor_h as f32 / scale,
|
height: decor_h as f32 / scale,
|
||||||
});
|
});
|
||||||
|
state_events.write(crate::events::StateChangedEvent);
|
||||||
poll.0 = 0;
|
poll.0 = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user