show keybindings in info panel

This commit is contained in:
Dustin Carlino 2020-01-09 15:43:35 -06:00
parent 0a5d945f20
commit de21ee0727

View File

@ -4,8 +4,8 @@ use crate::helpers::{rotating_color, ID};
use crate::ui::UI;
use abstutil::prettyprint_usize;
use ezgui::{
hotkey, Color, Composite, EventCtx, GfxCtx, Key, Line, ManagedWidget, Outcome, Plot, Series,
Text,
hotkey, Button, Color, Composite, EventCtx, GfxCtx, Key, Line, ManagedWidget, Outcome, Plot,
Series, Text,
};
use geom::{Duration, Statistic, Time};
use map_model::{IntersectionID, RoadID};
@ -28,11 +28,17 @@ impl InfoPanel {
])];
for (key, label) in ui.per_obj.consume() {
col.push(crate::managed::Composite::text_button(
ctx,
&label,
let mut txt = Text::new();
txt.append(Line(key.describe()).fg(ezgui::HOTKEY_COLOR));
txt.append(Line(format!(" - {}", label)));
col.push(ManagedWidget::btn(Button::text(
txt,
Color::grey(0.5),
Color::ORANGE,
hotkey(key),
));
&label,
ctx,
)));
}
col.push(ManagedWidget::draw_text(ctx, info_for(id.clone(), ui)));