mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-12-29 17:34:58 +03:00
add padding to OSD
This commit is contained in:
parent
a88a836752
commit
f28961e9c4
@ -232,7 +232,7 @@ impl Canvas {
|
||||
VerticalAlignment::Center => (self.window_height - dims.height) / 2.0,
|
||||
VerticalAlignment::Bottom => self.window_height - dims.height,
|
||||
// TODO Hack
|
||||
VerticalAlignment::BottomAboveOSD => self.window_height - dims.height - 40.0,
|
||||
VerticalAlignment::BottomAboveOSD => self.window_height - dims.height - 60.0,
|
||||
VerticalAlignment::Percent(pct) => pct * self.window_height,
|
||||
VerticalAlignment::Above(y) => y - dims.height,
|
||||
VerticalAlignment::Below(y) => y,
|
||||
|
@ -250,7 +250,7 @@ impl Tab {
|
||||
|
||||
let mut c = WrappedComposite::new(
|
||||
Composite::new(ManagedWidget::col(col).evenly_spaced())
|
||||
.exact_size_percent(90, 90)
|
||||
.exact_size_percent(90, 85)
|
||||
.build(ctx),
|
||||
)
|
||||
.cb("back", Box::new(|_, _| Some(Transition::Pop)));
|
||||
|
@ -252,23 +252,27 @@ impl CommonState {
|
||||
// First the constant background
|
||||
let mut batch = GeomBatch::from(vec![(
|
||||
crate::colors::PANEL_BG,
|
||||
Polygon::rectangle(g.canvas.window_width, g.default_line_height()),
|
||||
Polygon::rectangle(g.canvas.window_width, 1.5 * g.default_line_height()),
|
||||
)]);
|
||||
batch.add_translated(osd.render_g(g), 0.0, 0.0);
|
||||
batch.add_translated(osd.render_g(g), 10.0, 0.25 * g.default_line_height());
|
||||
|
||||
if ui.opts.dev && !g.is_screencap() {
|
||||
let mut txt = Text::from(Line("DEV"));
|
||||
txt.highlight_last_line(Color::RED);
|
||||
let dev_batch = txt.render_g(g);
|
||||
let dims = dev_batch.get_dims();
|
||||
batch.add_translated(dev_batch, g.canvas.window_width - dims.width, 0.0);
|
||||
batch.add_translated(
|
||||
dev_batch,
|
||||
g.canvas.window_width - dims.width - 10.0,
|
||||
0.25 * g.default_line_height(),
|
||||
);
|
||||
}
|
||||
let draw = g.upload(batch);
|
||||
let top_left = ScreenPt::new(0.0, g.canvas.window_height - g.default_line_height());
|
||||
let top_left = ScreenPt::new(0.0, g.canvas.window_height - 1.5 * g.default_line_height());
|
||||
g.redraw_at(top_left, &draw);
|
||||
g.canvas.mark_covered_area(ScreenRectangle::top_left(
|
||||
top_left,
|
||||
ScreenDims::new(g.canvas.window_width, g.default_line_height()),
|
||||
ScreenDims::new(g.canvas.window_width, 1.5 * g.default_line_height()),
|
||||
));
|
||||
}
|
||||
|
||||
|
@ -332,6 +332,6 @@ fn make_diagram(i: IntersectionID, selected: usize, ui: &UI, ctx: &mut EventCtx)
|
||||
|
||||
Composite::new(ManagedWidget::col(col).bg(colors::PANEL_BG))
|
||||
.aligned(HorizontalAlignment::Left, VerticalAlignment::Top)
|
||||
.max_size_percent(30, 90)
|
||||
.max_size_percent(30, 85)
|
||||
.build(ctx)
|
||||
}
|
||||
|
@ -602,7 +602,7 @@ fn make_diagram(i: IntersectionID, selected: usize, ui: &UI, ctx: &mut EventCtx)
|
||||
|
||||
Composite::new(ManagedWidget::col(col).bg(colors::PANEL_BG))
|
||||
.aligned(HorizontalAlignment::Left, VerticalAlignment::Top)
|
||||
.max_size_percent(30, 90)
|
||||
.max_size_percent(30, 85)
|
||||
.build(ctx)
|
||||
}
|
||||
|
||||
|
@ -129,7 +129,7 @@ pub fn main_menu(ctx: &mut EventCtx, ui: &UI) -> Box<dyn State> {
|
||||
|
||||
let mut c = WrappedComposite::new(
|
||||
Composite::new(ManagedWidget::col(col).evenly_spaced())
|
||||
.exact_size_percent(90, 90)
|
||||
.exact_size_percent(90, 85)
|
||||
.build(ctx),
|
||||
)
|
||||
.cb(
|
||||
@ -258,7 +258,7 @@ fn about(ctx: &mut EventCtx) -> Box<dyn State> {
|
||||
ManagedGUIState::fullscreen(
|
||||
WrappedComposite::new(
|
||||
Composite::new(ManagedWidget::col(col))
|
||||
.exact_size_percent(90, 90)
|
||||
.exact_size_percent(90, 85)
|
||||
.build(ctx),
|
||||
)
|
||||
.cb("back", Box::new(|_, _| Some(Transition::Pop))),
|
||||
@ -326,7 +326,7 @@ fn proposals_picker(ctx: &mut EventCtx) -> Box<dyn State> {
|
||||
])
|
||||
.evenly_spaced(),
|
||||
)
|
||||
.exact_size_percent(90, 90)
|
||||
.exact_size_percent(90, 85)
|
||||
.build(ctx),
|
||||
)
|
||||
.cb("back", Box::new(|_, _| Some(Transition::Pop)));
|
||||
|
@ -71,7 +71,7 @@ pub fn make(ctx: &mut EventCtx, ui: &UI, tab: Tab) -> Box<dyn State> {
|
||||
]))
|
||||
// TODO Want to use exact, but then scrolling breaks. exact_size_percent will fix the
|
||||
// jumpiness though.
|
||||
.max_size_percent(90, 90)
|
||||
.max_size_percent(90, 80)
|
||||
.build(ctx),
|
||||
)
|
||||
.cb("back", Box::new(|_, _| Some(Transition::Pop)));
|
||||
|
Loading…
Reference in New Issue
Block a user