mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-12-27 16:36:02 +03:00
quick hack to draw full bg for color legend
This commit is contained in:
parent
7527e61ce4
commit
147a5781ca
@ -163,6 +163,19 @@ impl ColorLegend {
|
||||
);
|
||||
|
||||
let mut batch = GeomBatch::new();
|
||||
// Hacky way to extend the text box's background a little...
|
||||
batch.push(
|
||||
Color::grey(0.2),
|
||||
Polygon::rectangle_topleft(
|
||||
Pt2D::new(
|
||||
0.0,
|
||||
g.canvas.window_height - (LINE_HEIGHT * ((self.rows.len() + 2) as f64)),
|
||||
),
|
||||
Distance::meters(50.0),
|
||||
Distance::meters(LINE_HEIGHT * ((self.rows.len() + 2) as f64)),
|
||||
),
|
||||
);
|
||||
let square_dims = 0.8 * LINE_HEIGHT;
|
||||
for (idx, (_, c)) in self.rows.iter().enumerate() {
|
||||
let offset_from_bottom = 1 + self.rows.len() - idx;
|
||||
batch.push(
|
||||
@ -170,10 +183,11 @@ impl ColorLegend {
|
||||
Polygon::rectangle_topleft(
|
||||
Pt2D::new(
|
||||
20.0,
|
||||
g.canvas.window_height - LINE_HEIGHT * (offset_from_bottom as f64),
|
||||
g.canvas.window_height - LINE_HEIGHT * (offset_from_bottom as f64)
|
||||
+ (LINE_HEIGHT - square_dims) / 2.0,
|
||||
),
|
||||
Distance::meters(10.0),
|
||||
Distance::meters(10.0),
|
||||
Distance::meters(square_dims),
|
||||
Distance::meters(square_dims),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user