Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jump to specific event in timeline #301

Merged
merged 6 commits into from
Jul 2, 2024
Merged

Jump to specific event in timeline #301

merged 6 commits into from
Jul 2, 2024

Conversation

Airyzz
Copy link
Contributor

@Airyzz Airyzz commented Jul 1, 2024

works by rendering entire timeline offscreen and measuring offset to desired event

Came up with a way more elegant solution: by manipulating the display indices of events in the timeline, we can force an arbitrary event to be positioned at the center of the scroll view. Because of this, we can always assume that the event will begin at scroll position 0.0 and so we can simply scroll to 0 + viewHeight/2 to end up with the event positioned in the center of the view

Super happy with this approach!

@Airyzz
Copy link
Contributor Author

Airyzz commented Jul 1, 2024

Related to #243 , but wont close it yet as it currently only works if we want to jump to an even that is already loaded in current timeline. If the event is not yet loaded, this is a separate case which needs to be handled differently

works by rendering entire timeline offscreen and measuring offset to desired event
@Airyzz Airyzz force-pushed the feat/jump-to-event branch from cb7e36e to cc0eb81 Compare July 1, 2024 07:31
@Airyzz Airyzz merged commit 4b6920d into main Jul 2, 2024
7 checks passed
@Airyzz Airyzz deleted the feat/jump-to-event branch July 6, 2024 04:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant