fix(engine): force full board repaint when the decor-view poller fires (#130) #155
@@ -82,7 +82,8 @@ impl Plugin for SafeAreaInsetsPlugin {
|
||||
);
|
||||
|
||||
#[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::rearm_on_resumed)
|
||||
.add_systems(Update, android::refresh_surface_size);
|
||||
@@ -330,11 +331,16 @@ mod android {
|
||||
/// `on_window_resized` in `table_plugin` recomputes the board layout,
|
||||
/// 3. re-arms the inset poller, because a screen change almost always
|
||||
/// 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(
|
||||
mut frame: Local<u32>,
|
||||
mut windows: Query<(Entity, &mut Window)>,
|
||||
mut resize_events: MessageWriter<WindowResized>,
|
||||
mut state_events: MessageWriter<crate::events::StateChangedEvent>,
|
||||
mut poll: ResMut<SafeAreaPollTries>,
|
||||
) {
|
||||
const POLL_INTERVAL_FRAMES: u32 = 30; // ~0.5 s @ 60 fps
|
||||
@@ -381,6 +387,7 @@ mod android {
|
||||
width: decor_w as f32 / scale,
|
||||
height: decor_h as f32 / scale,
|
||||
});
|
||||
state_events.write(crate::events::StateChangedEvent);
|
||||
poll.0 = 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user