Skip to content

Commit 9701d12

Browse files
committed
Cache road labels in the LTN pick area screen. [rebuild] [release]
1 parent 0899081 commit 9701d12

2 files changed

Lines changed: 11 additions & 3 deletions

File tree

apps/ltn/src/app.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ pub struct PerMap {
4545
pub consultation_id: Option<String>,
4646

4747
pub draw_all_filters: Toggle3Zoomed,
48+
pub draw_major_road_labels: Option<DrawSimpleRoadLabels>,
4849
pub draw_all_road_labels: Option<DrawSimpleRoadLabels>,
4950
pub draw_poi_icons: Drawable,
5051
pub draw_bus_routes: Drawable,
@@ -80,6 +81,7 @@ impl PerMap {
8081
consultation_id: None,
8182

8283
draw_all_filters: Toggle3Zoomed::empty(ctx),
84+
draw_major_road_labels: None,
8385
draw_all_road_labels: None,
8486
draw_poi_icons,
8587
draw_bus_routes,

apps/ltn/src/pick_area.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ pub struct PickArea {
1717
bottom_panel: Panel,
1818
world: World<NeighbourhoodID>,
1919
draw_over_roads: Drawable,
20-
labels: DrawSimpleRoadLabels,
2120
draw_boundary_roads: Drawable,
2221
}
2322

@@ -51,12 +50,19 @@ impl PickArea {
5150
.layers
5251
.event(ctx, &app.cs, Mode::PickArea, Some(&bottom_panel));
5352

53+
if app.per_map.draw_major_road_labels.is_none() {
54+
app.per_map.draw_major_road_labels = Some(DrawSimpleRoadLabels::only_major_roads(
55+
ctx,
56+
app,
57+
colors::ROAD_LABEL,
58+
));
59+
}
60+
5461
Box::new(PickArea {
5562
appwide_panel,
5663
bottom_panel,
5764
world,
5865
draw_over_roads,
59-
labels: DrawSimpleRoadLabels::only_major_roads(ctx, app, colors::ROAD_LABEL),
6066
draw_boundary_roads: draw_boundary_roads(ctx, app),
6167
})
6268
}
@@ -104,7 +110,7 @@ impl State<App> for PickArea {
104110
self.bottom_panel.draw(g);
105111
app.session.layers.draw(g, app);
106112
self.draw_boundary_roads.draw(g);
107-
self.labels.draw(g);
113+
app.per_map.draw_major_road_labels.as_ref().unwrap().draw(g);
108114
app.per_map.draw_all_filters.draw(g);
109115
app.per_map.draw_poi_icons.draw(g);
110116
}

0 commit comments

Comments
 (0)