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

Implement user cursor and selection tracking #260

Merged
merged 2 commits into from
May 7, 2021
Merged

Conversation

jonatanklosko
Copy link
Member

Closes #59.

Clients broadcast own location (focused cell, cursor position/selection) whenever it changes and we show colorful indicators of that. Additionally the user can follow another one, so that they automatically move around together (:cat: !!).

Design

Whenever user location changes we send it to the LV and broadcast to other clients via the session topic. We then handle the locations accordingly on the client side. Note that as opposed to text deltas, we don't pass/transform the locations via the session process and that's intentional. When it comes to cursor positions we want to make sure the intermediate states when typing look fine and that eventually we show the actual position. Under low latency, transforming cursor positions has no benefits, and under high latency both approaches may show displaced cursor in intermediate states. By simply broadcasting the locations we don't overflow the session process with additional messages and also avoid a ton of complexity.

Also note that if there is just a single user we simply don't send any reports, so there are no implications whatsoever.

Demo

cursors.mp4

@jonatanklosko jonatanklosko merged commit cd80bd7 into main May 7, 2021
@jonatanklosko jonatanklosko deleted the jk-cursors branch May 7, 2021 14:41
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.

Improve collaborative features
2 participants