Skip to content

Commit

Permalink
Add keyboard shortcut for "Follow", and stop following on "Restart" (#…
Browse files Browse the repository at this point in the history
…1986)

* stop following when restarting timeline

* add PlaybackFollow command bound to cmd-right

* fix lint warning
  • Loading branch information
h3mosphere authored Apr 27, 2023
1 parent 068cdaa commit 2012617
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
3 changes: 3 additions & 0 deletions crates/re_ui/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ pub enum Command {

// Playback:
PlaybackTogglePlayPause,
PlaybackFollow,
PlaybackStepBack,
PlaybackStepForward,
PlaybackRestart,
Expand Down Expand Up @@ -117,6 +118,7 @@ impl Command {
Command::PlaybackTogglePlayPause => {
("Toggle play/pause", "Either play or pause the time")
}
Command::PlaybackFollow => ("Follow", "Follow on from end of timeline"),
Command::PlaybackStepBack => (
"Step time back",
"Move the time marker back to the previous point in time with any data",
Expand Down Expand Up @@ -183,6 +185,7 @@ impl Command {
Command::ToggleCommandPalette => Some(cmd(Key::P)),

Command::PlaybackTogglePlayPause => Some(key(Key::Space)),
Command::PlaybackFollow => Some(cmd(Key::ArrowRight)),
Command::PlaybackStepBack => Some(key(Key::ArrowLeft)),
Command::PlaybackStepForward => Some(key(Key::ArrowRight)),
Command::PlaybackRestart => Some(cmd(Key::ArrowLeft)),
Expand Down
11 changes: 8 additions & 3 deletions crates/re_viewer/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use re_smart_channel::Receiver;
use re_ui::{toasts, Command};

use crate::{
misc::{AppOptions, Caches, RecordingConfig, ViewerContext},
misc::{time_control::PlayState, AppOptions, Caches, RecordingConfig, ViewerContext},
ui::{data_ui::ComponentUiRegistry, Blueprint},
viewer_analytics::ViewerAnalytics,
};
Expand All @@ -34,6 +34,7 @@ enum TimeControlCommand {
StepBack,
StepForward,
Restart,
Follow,
}

// ----------------------------------------------------------------------------
Expand Down Expand Up @@ -329,6 +330,9 @@ impl App {
Command::PlaybackTogglePlayPause => {
self.run_time_control_command(TimeControlCommand::TogglePlayPause);
}
Command::PlaybackFollow => {
self.run_time_control_command(TimeControlCommand::Follow);
}
Command::PlaybackStepBack => {
self.run_time_control_command(TimeControlCommand::StepBack);
}
Expand All @@ -353,6 +357,9 @@ impl App {
TimeControlCommand::TogglePlayPause => {
time_ctrl.toggle_play_pause(times_per_timeline);
}
TimeControlCommand::Follow => {
time_ctrl.set_play_state(times_per_timeline, PlayState::Following);
}
TimeControlCommand::StepBack => {
time_ctrl.step_time_back(times_per_timeline);
}
Expand Down Expand Up @@ -1879,8 +1886,6 @@ fn new_recording_confg(
data_source: &'_ re_smart_channel::Source,
log_db: &'_ LogDb,
) -> RecordingConfig {
use crate::misc::time_control::PlayState;

let play_state = match data_source {
// Play files from the start by default - it feels nice and alive./
// RrdHttpStream downloads the whole file before decoding it, so we treat it the same as a file.
Expand Down
1 change: 1 addition & 0 deletions crates/re_viewer/src/misc/time_control.rs
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,7 @@ impl TimeControl {
if let Some(time_points) = times_per_timeline.get(&self.timeline) {
if let Some(state) = self.states.get_mut(&self.timeline) {
state.time = min(time_points).into();
self.following = false;
}
}
}
Expand Down

1 comment on commit 2012617

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark 'Rust Benchmark'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.25.

Benchmark suite Current: 2012617 Previous: 068cdaa Ratio
datastore/num_rows=1000/num_instances=1000/packed=false/insert/default 4065375 ns/iter (± 107090) 2511275 ns/iter (± 2964) 1.62
datastore/num_rows=1000/num_instances=1000/packed=false/range/default 3608178 ns/iter (± 56854) 2611777 ns/iter (± 3651) 1.38
datastore/num_rows=1000/num_instances=1000/gc/default 2385230 ns/iter (± 2028) 1577641 ns/iter (± 8071) 1.51
mono_points_arrow/generate_message_bundles 27449984 ns/iter (± 1019812) 20270138 ns/iter (± 558882) 1.35
mono_points_arrow_batched/generate_messages 4233731 ns/iter (± 176820) 2924963 ns/iter (± 7805) 1.45
mono_points_arrow_batched/encode_log_msg 1366429 ns/iter (± 2351) 1078336 ns/iter (± 10728) 1.27
mono_points_arrow_batched/encode_total 26096811 ns/iter (± 1246727) 20248693 ns/iter (± 54056) 1.29
mono_points_arrow_batched/decode_log_msg 782407 ns/iter (± 2467) 493140 ns/iter (± 784) 1.59
mono_points_arrow_batched/decode_total 8390886 ns/iter (± 94732) 6611599 ns/iter (± 9607) 1.27
batch_points_arrow/encode_log_msg 258224 ns/iter (± 1035) 190177 ns/iter (± 753) 1.36
batch_points_arrow/encode_total 482013 ns/iter (± 2206) 365603 ns/iter (± 3459) 1.32
arrow_mono_points/insert 2326008342 ns/iter (± 4707446) 1565459729 ns/iter (± 6056950) 1.49
arrow_mono_points/query 1218445 ns/iter (± 7089) 875653 ns/iter (± 1539) 1.39

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.