mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-12-29 17:34:58 +03:00
Clean up some LTN code from when the concept of 3 per-neighborhood tabs was stronger. [rebuild]
This commit is contained in:
parent
36ef6d6b34
commit
25ebb627be
@ -87,32 +87,30 @@ impl Tab {
|
||||
"Adjust boundary" => Some(Transition::Replace(
|
||||
crate::select_boundary::SelectBoundary::new_state(ctx, app, id),
|
||||
)),
|
||||
"Connectivity" => Some(Tab::Connectivity.switch_to_state(ctx, app, id)),
|
||||
"Rat runs" => Some(Tab::RatRuns.switch_to_state(ctx, app, id)),
|
||||
"Connectivity" => Some(Transition::Replace(crate::connectivity::Viewer::new_state(
|
||||
ctx, app, id,
|
||||
))),
|
||||
"Rat runs" => Some(Transition::Replace(
|
||||
crate::rat_run_viewer::BrowseRatRuns::new_state(ctx, app, id, None),
|
||||
)),
|
||||
"undo" => {
|
||||
let prev = app.session.modal_filters.previous_version.take().unwrap();
|
||||
app.session.modal_filters = prev;
|
||||
after_edit(ctx, app);
|
||||
// Recreate the current state. This will reset any panel state (checkboxes and
|
||||
// dropdowns)
|
||||
Some(self.switch_to_state(ctx, app, id))
|
||||
Some(Transition::Replace(match self {
|
||||
Tab::Connectivity => crate::connectivity::Viewer::new_state(ctx, app, id),
|
||||
// TODO Preserve the current rat run
|
||||
Tab::RatRuns => {
|
||||
crate::rat_run_viewer::BrowseRatRuns::new_state(ctx, app, id, None)
|
||||
}
|
||||
}))
|
||||
}
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn switch_to_state(
|
||||
self,
|
||||
ctx: &mut EventCtx,
|
||||
app: &mut App,
|
||||
id: NeighborhoodID,
|
||||
) -> Transition {
|
||||
Transition::Replace(match self {
|
||||
Tab::Connectivity => crate::connectivity::Viewer::new_state(ctx, app, id),
|
||||
Tab::RatRuns => crate::rat_run_viewer::BrowseRatRuns::new_state(ctx, app, id, None),
|
||||
})
|
||||
}
|
||||
|
||||
fn make_buttons(self, ctx: &mut EventCtx) -> Widget {
|
||||
let mut row = Vec::new();
|
||||
for (tab, label, key) in [
|
||||
|
Loading…
Reference in New Issue
Block a user