separators in meters [rebuild]

This commit is contained in:
Dustin Carlino 2020-02-19 13:44:09 -08:00
parent fe068da3f4
commit e79790249e
2 changed files with 29 additions and 7 deletions

View File

@ -21,8 +21,8 @@ impl Histogram {
let mut batch = GeomBatch::new();
let mut rect_labels = Vec::new();
let width = 0.25 * ctx.canvas.window_width;
let height = 0.25 * ctx.canvas.window_height;
let width = 0.20 * ctx.canvas.window_width;
let height = 0.15 * ctx.canvas.window_height;
let num_buckets = 10;
let (min_x, max_x, bars) = bucketize(unsorted_dts, num_buckets);
@ -88,7 +88,7 @@ impl Histogram {
}
let x_axis = ManagedWidget::row(row);
let num_y_labels = 5;
let num_y_labels = 3;
let mut col = Vec::new();
for i in 0..num_y_labels {
let percent_y = (i as f64) / ((num_y_labels - 1) as f64);

View File

@ -17,12 +17,12 @@ use crate::render::DrawOptions;
pub use crate::sandbox::gameplay::TutorialState;
use crate::ui::{ShowEverything, UI};
use ezgui::{
hotkey, lctrl, Choice, Composite, EventCtx, EventLoopMode, GfxCtx, HorizontalAlignment, Key,
Line, ManagedWidget, Outcome, Text, VerticalAlignment, Wizard,
hotkey, lctrl, Choice, Color, Composite, EventCtx, EventLoopMode, GeomBatch, GfxCtx,
HorizontalAlignment, Key, Line, ManagedWidget, Outcome, Text, VerticalAlignment, Wizard,
};
pub use gameplay::spawner::spawn_agents_around;
pub use gameplay::GameplayMode;
use geom::{Duration, Statistic, Time};
use geom::{Duration, Polygon, Statistic, Time};
use map_model::MapEdits;
use sim::TripMode;
pub use speed::{SpeedControls, TimePanel};
@ -405,7 +405,16 @@ impl AgentMeter {
),
])
.centered(),
// TODO Separator
// Separator
ManagedWidget::draw_batch(
ctx,
GeomBatch::from(vec![(
Color::WHITE,
Polygon::rectangle(0.2 * ctx.canvas.window_width, 2.0),
)]),
)
.margin(15)
.centered_horiz(),
{
let mut txt = Text::new();
let pct = 100.0 * (finished as f64) / ((finished + unfinished) as f64);
@ -440,6 +449,19 @@ impl AgentMeter {
// stuff loaded yet, just skip a tick.
if ui.has_prebaked().is_some() {
if let Some(ScoreCard { stat, goal }) = show_score {
// Separator
rows.push(
ManagedWidget::draw_batch(
ctx,
GeomBatch::from(vec![(
Color::WHITE,
Polygon::rectangle(0.2 * ctx.canvas.window_width, 2.0),
)]),
)
.margin(15)
.centered_horiz(),
);
let (now, _, _) = ui
.primary
.sim