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

Make user's cursor "tooltip-on-hover" faster and wider #259

Merged
merged 1 commit into from
Mar 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 3 additions & 2 deletions packages/collaboration/src/cursors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@
above: true,
markers(view) {
const { awareness, ytext } = view.state.facet(editorAwarenessFacet);
const ydoc = ytext.doc!;

Check warning on line 171 in packages/collaboration/src/cursors.ts

View workflow job for this annotation

GitHub Actions / Run pre-commit hook

Forbidden non-null assertion
const cursors: LayerMarker[] = [];
awareness.getStates().forEach((state: IAwarenessState, clientID) => {
if (clientID === awareness.doc.clientID) {
Expand Down Expand Up @@ -232,7 +232,7 @@
const userHover = hoverTooltip(
(view, pos) => {
const { awareness, ytext } = view.state.facet(editorAwarenessFacet);
const ydoc = ytext.doc!;

Check warning on line 235 in packages/collaboration/src/cursors.ts

View workflow job for this annotation

GitHub Actions / Run pre-commit hook

Forbidden non-null assertion

for (const [clientID, state] of awareness.getStates()) {
if (clientID === awareness.doc.clientID) {
Expand All @@ -251,7 +251,7 @@
continue;
}
// Use some margin around the cursor to display the user.
if (head.index - 1 <= pos && pos <= head.index + 1) {
if (head.index - 3 <= pos && pos <= head.index + 3) {
return {
pos: head.index,
above: true,
Expand All @@ -271,7 +271,8 @@
return null;
},
{
hideOn: (tr, tooltip) => !!tr.annotation(remoteSelectionsAnnotation)
hideOn: (tr, tooltip) => !!tr.annotation(remoteSelectionsAnnotation),
hoverTime: 0
}
);

Expand All @@ -282,7 +283,7 @@
above: false,
markers(view) {
const { awareness, ytext } = view.state.facet(editorAwarenessFacet);
const ydoc = ytext.doc!;

Check warning on line 286 in packages/collaboration/src/cursors.ts

View workflow job for this annotation

GitHub Actions / Run pre-commit hook

Forbidden non-null assertion
const cursors: LayerMarker[] = [];
awareness.getStates().forEach((state: IAwarenessState, clientID) => {
if (clientID === awareness.doc.clientID) {
Expand Down