From c5cf78b709297c529ad27e718af20311527411ac Mon Sep 17 00:00:00 2001 From: Nick Hemsley Date: Wed, 12 Apr 2023 15:36:42 +1000 Subject: [PATCH] fix some code nits --- crates/re_ui/src/command.rs | 6 +++--- crates/re_viewer/src/app.rs | 13 ++++++++----- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/crates/re_ui/src/command.rs b/crates/re_ui/src/command.rs index 483e9ebd862e..55f1aa2a430a 100644 --- a/crates/re_ui/src/command.rs +++ b/crates/re_ui/src/command.rs @@ -43,9 +43,9 @@ pub enum Command { // Playback: PlaybackTogglePlayPause, - PlaybackRestart, PlaybackStepBack, PlaybackStepForward, + PlaybackRestart, } impl Command { @@ -117,7 +117,6 @@ impl Command { Command::PlaybackTogglePlayPause => { ("Toggle play/pause", "Either play or pause the time") } - Command::PlaybackRestart => ("Restart", "Restart from beginning of timeline"), Command::PlaybackStepBack => ( "Step time back", "Move the time marker back to the previous point in time with any data", @@ -126,6 +125,7 @@ impl Command { "Step time forward", "Move the time marker to the next point in time with any data", ), + Command::PlaybackRestart => ("Restart", "Restart from beginning of timeline"), } } @@ -183,9 +183,9 @@ impl Command { Command::ToggleCommandPalette => Some(cmd(Key::P)), Command::PlaybackTogglePlayPause => Some(key(Key::Space)), - Command::PlaybackRestart => Some(cmd(Key::ArrowLeft)), Command::PlaybackStepBack => Some(key(Key::ArrowLeft)), Command::PlaybackStepForward => Some(key(Key::ArrowRight)), + Command::PlaybackRestart => Some(cmd(Key::ArrowLeft)), } } diff --git a/crates/re_viewer/src/app.rs b/crates/re_viewer/src/app.rs index e0c908da9ddb..3775748331bc 100644 --- a/crates/re_viewer/src/app.rs +++ b/crates/re_viewer/src/app.rs @@ -34,9 +34,9 @@ const WATERMARK: bool = false; // Nice for recording media material #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] enum TimeControlCommand { TogglePlayPause, - Restart, StepBack, StepForward, + Restart, } // ---------------------------------------------------------------------------- @@ -337,7 +337,9 @@ impl App { Command::PlaybackStepForward => { self.run_time_control_command(TimeControlCommand::StepForward); } - Command::PlaybackRestart => self.run_time_control_command(TimeControlCommand::Restart), + Command::PlaybackRestart => { + self.run_time_control_command(TimeControlCommand::Restart); + } } } @@ -353,15 +355,16 @@ impl App { TimeControlCommand::TogglePlayPause => { time_ctrl.toggle_play_pause(times_per_timeline); } - TimeControlCommand::Restart => { - time_ctrl.restart(times_per_timeline); - } + TimeControlCommand::StepBack => { time_ctrl.step_time_back(times_per_timeline); } TimeControlCommand::StepForward => { time_ctrl.step_time_fwd(times_per_timeline); } + TimeControlCommand::Restart => { + time_ctrl.restart(times_per_timeline); + } } }