app: scroll the log box and give it more height
Two hundred lines of log did not fit the card, so the text ran past the card's edge. The box is a scroll viewport now, 440 points tall, pinned to its newest line until the reader scrolls, with its own bar in the strip the padding leaves. It sits inside the settings scroller, so both bars share the screen and the log takes the wheel while the pointer is over it.
This commit is contained in:
1 parent
42ba0ce882
commit
046860ad1c
2 files changed
+28
-10
No files matched your search
@@ -183,6 +183,7 @@ pub struct App {
|
||||
pub highlights_scroll: ui::ScrollBar,
|
||||
pub events_scroll: ui::ScrollBar,
|
||||
pub recording_scroll: ui::ScrollBar,
|
||||
pub log_scroll: ui::ScrollBar,
|
||||
pub notice: Option<Notice>,
|
||||
/// ffmpeg being downloaded on the first run, and the whole percent it last reported.
|
||||
pub ffmpeg_rx: Option<Receiver<export::FetchEvent>>,
|
||||
@@ -246,6 +247,7 @@ impl App {
|
||||
highlights_scroll: ui::ScrollBar::new(),
|
||||
events_scroll: ui::ScrollBar::new(),
|
||||
recording_scroll: ui::ScrollBar::new(),
|
||||
log_scroll: ui::ScrollBar::new(),
|
||||
notice: None,
|
||||
ffmpeg_rx: None,
|
||||
ffmpeg_pct: None,
|
||||
@@ -1469,6 +1471,11 @@ pub fn view(app: &App, cx: &mut Cx<App>) -> El {
|
||||
"recording-thumb",
|
||||
"recording-scroller",
|
||||
)),
|
||||
// The Advanced tab puts the log box inside the settings scroller, so it draws a second
|
||||
// thumb, and only while that tab is up: the box leaves the window with the tab.
|
||||
Screen::Settings if app.settings_tab == SettingsTab::Advanced => window
|
||||
.child(app.scroll.thumb(p, "scroll-thumb", "scroller"))
|
||||
.child(app.log_scroll.thumb(p, "log-thumb", "log-scroller")),
|
||||
Screen::Settings => window.child(app.scroll.thumb(p, "scroll-thumb", "scroller")),
|
||||
Screen::History => window.child(app.scroll.thumb(p, "scroll-thumb", "list-scroller")),
|
||||
// A clip fills its screen with a player, not a list: the history or settings thumb would
|
||||
|
||||
+21
-10
@@ -1081,16 +1081,27 @@ fn advanced(app: &App, p: Paint, kit: &rune_kit::Kit, layer: &mut Vec<El>, conte
|
||||
p,
|
||||
Some("Log"),
|
||||
vec![
|
||||
col().key("log").padding(space::S3).h(300.0).gap(0.0).child(
|
||||
text(if app.logs.is_empty() {
|
||||
"No log loaded. Press Reload log."
|
||||
} else {
|
||||
&app.logs
|
||||
})
|
||||
.key("log-text")
|
||||
.font(type_::MONO_CAPTION)
|
||||
.color(p.muted())
|
||||
.w_full(),
|
||||
app.log_scroll.follow(
|
||||
"log-scroller",
|
||||
col()
|
||||
.key("log")
|
||||
.padding(space::S3)
|
||||
// Room for the scroll bar the box draws at the viewport's end edge.
|
||||
.pr(14.0)
|
||||
.h(440.0)
|
||||
.gap(0.0)
|
||||
.scroll(rune::ScrollSpec { stick_bottom: true })
|
||||
.child(
|
||||
text(if app.logs.is_empty() {
|
||||
"No log loaded. Press Reload log."
|
||||
} else {
|
||||
&app.logs
|
||||
})
|
||||
.key("log-text")
|
||||
.font(type_::MONO_CAPTION)
|
||||
.color(p.muted())
|
||||
.w_full(),
|
||||
),
|
||||
),
|
||||
],
|
||||
))
|
||||
|
||||
Reference in new issue
Block a user