mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-12-24 23:15:24 +03:00
Retain tab when changing maps
This commit is contained in:
parent
5b7523b2c4
commit
deb4a202d9
@ -416,7 +416,8 @@ fn finish_app_setup(
|
||||
vec![SandboxMode::simple_new(app, mode)]
|
||||
}
|
||||
} else if setup.ungap {
|
||||
vec![ungap::ExploreMap::launch(ctx, app)]
|
||||
let layers = ungap::Layers::new(ctx, app);
|
||||
vec![ungap::ExploreMap::new_state(ctx, app, layers)]
|
||||
} else {
|
||||
// Not attempting to keep the primary and secondary simulations synchronized at the same
|
||||
// time yet. Just handle this one startup case, so we can switch maps without constantly
|
||||
|
@ -26,11 +26,6 @@ impl TakeLayers for ExploreMap {
|
||||
}
|
||||
|
||||
impl ExploreMap {
|
||||
pub fn launch(ctx: &mut EventCtx, app: &mut App) -> Box<dyn State<App>> {
|
||||
let layers = Layers::new(ctx, app);
|
||||
ExploreMap::new_state(ctx, app, layers)
|
||||
}
|
||||
|
||||
pub fn new_state(ctx: &mut EventCtx, app: &mut App, layers: Layers) -> Box<dyn State<App>> {
|
||||
app.opts.show_building_driveways = false;
|
||||
|
||||
|
@ -84,12 +84,18 @@ impl Tab {
|
||||
Transition::Push(CityPicker::new_state(
|
||||
ctx,
|
||||
app,
|
||||
Box::new(|ctx, app| {
|
||||
Box::new(move |ctx, app| {
|
||||
// Since we're totally changing maps, don't reuse the Layers
|
||||
let layers = Layers::new(ctx, app);
|
||||
Transition::Multi(vec![
|
||||
Transition::Pop,
|
||||
// Since we're totally changing maps, don't reuse the Layers
|
||||
// TODO Keep current tab...
|
||||
Transition::Replace(ExploreMap::launch(ctx, app)),
|
||||
Transition::Replace(match self {
|
||||
Tab::Explore => ExploreMap::new_state(ctx, app, layers),
|
||||
Tab::Create => {
|
||||
quick_sketch::QuickSketch::new_state(ctx, app, layers)
|
||||
}
|
||||
Tab::Route => route::RoutePlanner::new_state(ctx, app, layers),
|
||||
}),
|
||||
])
|
||||
}),
|
||||
))
|
||||
|
Loading…
Reference in New Issue
Block a user