mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-11-28 20:29:04 +03:00
elide scrollbar if it's not needed
This commit is contained in:
parent
852ee69430
commit
27912bdaf0
@ -557,17 +557,21 @@ impl Composite {
|
||||
top_level,
|
||||
CompositePosition::Aligned(HorizontalAlignment::Left, VerticalAlignment::Top),
|
||||
);
|
||||
|
||||
// If the panel fits without a scrollbar, don't add one.
|
||||
c.recompute_layout(ctx);
|
||||
if c.top_level.rect.height() > ctx.canvas.window_height {
|
||||
c.scrollable = true;
|
||||
// TODO Height of our panel
|
||||
c.sliders.insert(
|
||||
"scrollbar".to_string(),
|
||||
Slider::vertical(ctx, ctx.canvas.window_height - 100.0),
|
||||
Slider::vertical(ctx, ctx.canvas.window_height),
|
||||
);
|
||||
c.top_level = ManagedWidget::row(vec![c.top_level, ManagedWidget::slider("scrollbar")]);
|
||||
for (name, menu) in menus {
|
||||
c.menus.insert(name.to_string(), menu);
|
||||
}
|
||||
c.recompute_layout(ctx);
|
||||
}
|
||||
c
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user