mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-11-24 01:15:12 +03:00
Clear shortcut state when swapping neighbourhoods
This commit is contained in:
parent
83600f0e26
commit
8bc25fc136
@ -10,6 +10,7 @@ use widgetry::{
|
||||
Text, TextExt, Toggle, Widget,
|
||||
};
|
||||
|
||||
use crate::edit::EditMode;
|
||||
use crate::filters::auto::Heuristic;
|
||||
use crate::{colors, App, Neighbourhood, NeighbourhoodID, Transition};
|
||||
|
||||
@ -26,6 +27,11 @@ impl BrowseNeighbourhoods {
|
||||
pub fn new_state(ctx: &mut EventCtx, app: &mut App) -> Box<dyn State<App>> {
|
||||
map_gui::tools::update_url_map_name(app);
|
||||
|
||||
// Make sure we clear this state if we ever switch neighbourhoods
|
||||
if let EditMode::Shortcuts(ref mut maybe_focus) = app.session.edit_mode {
|
||||
*maybe_focus = None;
|
||||
}
|
||||
|
||||
let (world, draw_over_roads) =
|
||||
ctx.loading_screen("calculate neighbourhoods", |ctx, timer| {
|
||||
if &app.session.partitioning.map != app.map.get_name() {
|
||||
|
@ -12,6 +12,7 @@ use widgetry::{
|
||||
};
|
||||
|
||||
use crate::browse::draw_boundary_roads;
|
||||
use crate::edit::EditMode;
|
||||
use crate::partition::BlockID;
|
||||
use crate::{colors, App, NeighbourhoodID, Partitioning, Transition};
|
||||
|
||||
@ -35,7 +36,16 @@ pub struct SelectBoundary {
|
||||
}
|
||||
|
||||
impl SelectBoundary {
|
||||
pub fn new_state(ctx: &mut EventCtx, app: &App, id: NeighbourhoodID) -> Box<dyn State<App>> {
|
||||
pub fn new_state(
|
||||
ctx: &mut EventCtx,
|
||||
app: &mut App,
|
||||
id: NeighbourhoodID,
|
||||
) -> Box<dyn State<App>> {
|
||||
// Make sure we clear this state if we ever modify neighbourhood boundaries
|
||||
if let EditMode::Shortcuts(ref mut maybe_focus) = app.session.edit_mode {
|
||||
*maybe_focus = None;
|
||||
}
|
||||
|
||||
let top_panel = crate::components::TopPanel::panel(ctx, app);
|
||||
let left_panel = make_panel(ctx, app, id, &top_panel);
|
||||
let mut state = SelectBoundary {
|
||||
|
Loading…
Reference in New Issue
Block a user