the vital swap control

This commit is contained in:
Dustin Carlino 2019-04-28 13:32:49 -07:00
parent 58b3d6d201
commit 4a3e8177c4
2 changed files with 7 additions and 0 deletions

View File

@ -57,6 +57,7 @@ impl ABTestMode {
let mut txt = Text::new(); let mut txt = Text::new();
txt.add_styled_line("A/B Test Mode".to_string(), None, Some(Color::BLUE), None); txt.add_styled_line("A/B Test Mode".to_string(), None, Some(Color::BLUE), None);
txt.add_line(state.ui.state.primary.map.get_edits().edits_name.clone());
txt.add_line(state.ui.state.primary.sim.summary()); txt.add_line(state.ui.state.primary.sim.summary());
if let State::Running { ref speed, .. } = mode.state { if let State::Running { ref speed, .. } = mode.state {
txt.add_line(format!( txt.add_line(format!(
@ -98,6 +99,11 @@ impl ABTestMode {
if ctx.input.modal_action("speed up sim") { if ctx.input.modal_action("speed up sim") {
mode.desired_speed += ADJUST_SPEED; mode.desired_speed += ADJUST_SPEED;
} }
if ctx.input.modal_action("swap") {
let secondary = mode.secondary.take().unwrap();
let primary = std::mem::replace(&mut state.ui.state.primary, secondary);
mode.secondary = Some(primary);
}
match mode.state { match mode.state {
State::Paused => { State::Paused => {

View File

@ -150,6 +150,7 @@ impl GUI for UI {
(Key::RightBracket, "speed up sim"), (Key::RightBracket, "speed up sim"),
(Key::Space, "run/pause sim"), (Key::Space, "run/pause sim"),
(Key::M, "run one step of sim"), (Key::M, "run one step of sim"),
(Key::S, "swap"),
], ],
), ),
ModalMenu::new( ModalMenu::new(