refactored log

This commit is contained in:
2026-06-11 21:55:53 -05:00
parent 1debfaf5f5
commit 970733d8ac
4 changed files with 139 additions and 92 deletions
+5 -10
View File
@@ -1,16 +1,13 @@
use std::time::Duration;
use kiln_core::game::GameState;
use crate::log::LogState;
use crate::scroll_overlay::{ScrollAnimState, ScrollOverlayState};
/// View-only UI state for the log panel and scroll overlay. This is presentation
/// state, so it lives in the front-end rather than on the engine's [`GameState`].
pub(crate) struct Ui {
/// Whether the bottom log panel is open.
pub(crate) log_open: bool,
/// Height (in terminal rows, borders included) of the log panel when open.
pub(crate) log_height: u16,
/// Vertical scroll offset of the log panel, in lines from the top (newest).
pub(crate) scroll: u16,
/// State for the log panel (open/closed, height, scroll position).
pub(crate) log: LogState,
/// Scroll position, bounds, and animation state for an active scroll overlay.
pub(crate) overlay: ScrollOverlayState,
}
@@ -18,9 +15,7 @@ pub(crate) struct Ui {
impl Default for Ui {
fn default() -> Self {
Self {
log_open: false,
log_height: 10,
scroll: 0,
log: LogState::new(),
overlay: ScrollOverlayState::default(),
}
}
@@ -63,4 +58,4 @@ impl Ui {
self.overlay.pending_choice = choice;
self.overlay.anim = Some(ScrollAnimState::Closing(progress));
}
}
}