Skip to content

When scrubbing time, intelligently round to a nice value#11658

Merged
emilk merged 11 commits intomainfrom
emilk/smart-aim-timeline
Oct 27, 2025
Merged

When scrubbing time, intelligently round to a nice value#11658
emilk merged 11 commits intomainfrom
emilk/smart-aim-timeline

Conversation

@emilk
Copy link
Member

@emilk emilk commented Oct 25, 2025

Related

What

When dragging the time cursor ("time scrubbing") we would previously pick arbitrarily precise time points, regardless of zoom level. Now, we snap to the "simplest" value that is within a pixel from the mouse cursor. The simplest value is defined as the one with the most trailing zeroes (e.g. prefer 23.500000 over 23.484793).

Before

Even though we zoomed out to where we are viewing full hours, when we try to pick a time we select with microsecond precision:

dumb-aim

After

Notice how we start by picking whole multiples of 10s, but as we zoom in we pick multiples of 0.5s, and then 5ms, 10us, etc.

smart-aim

Note that we only ever omit zeroes in the display, so this is a real difference in how values are picked, NOT how they are displayed!

Future work

  • Coarser snapping when a modifier key is pressed
  • Set the time display precision based on zoom level

@emilk emilk added enhancement New feature or request ui concerns graphical user interface include in changelog labels Oct 25, 2025
@github-actions
Copy link

github-actions bot commented Oct 25, 2025

Web viewer failed to build.

| Result | Commit | Link | Manifest |
| ------ | ------- | ----- |
| ❌ | | https://rerun.io/viewer/pr/11658 | +nightly +main |

View image diff on kitdiff.

Note: This comment is updated whenever you push a commit.

@emilk emilk marked this pull request as ready for review October 25, 2025 08:28
@Wumpf Wumpf requested review from Wumpf and gavrelina October 27, 2025 10:13
@Wumpf
Copy link
Member

Wumpf commented Oct 27, 2025

I like those round numbers, but what I find super irritating is that I can't click on the time of an event anymore (edit: could I ever though? 🤔 ) even if the hover tooltip pretend that I do. Can we snap to exact times if something was hovered?

Demonstrated here:

Screen.Recording.2025-10-27.at.11.23.49.mov

Copy link
Member

@Wumpf Wumpf left a comment

Choose a reason for hiding this comment

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

liking the code improvements and mechanics of this, but request-changes on grounds of ⬆️ unless Katya or some product person thinks that's not a problem :)

@emilk
Copy link
Member Author

emilk commented Oct 27, 2025

I find super irritating is that I can't click on the time of an event anymore (edit: could I ever though?)

No, you couldn't ever. Try it on rerun.io/viewer - it's the same behavior there. I'll add it to the parent issue, but it is completely orthogonal to this PR.

@emilk emilk requested a review from Wumpf October 27, 2025 16:22
Copy link
Member

@Wumpf Wumpf left a comment

Choose a reason for hiding this comment

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

confirmed, tried it and even the error margin of clicking there feels 100% the same (even though in theory there's some subtle snapping going on, it's visible if one looks ultra closely).
In that case I have nothing to complain about (except for previous very minor comments)! 🚢

@emilk emilk merged commit 118994b into main Oct 27, 2025
32 of 34 checks passed
@emilk emilk deleted the emilk/smart-aim-timeline branch October 27, 2025 17:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request include in changelog ui concerns graphical user interface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants