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

✨ (slope) improve hover interaction #3270

Merged
merged 1 commit into from
Mar 11, 2024
Merged

Conversation

sophiamersmann
Copy link
Member

@sophiamersmann sophiamersmann commented Feb 29, 2024

Improves hover interaction on slope charts.

Summary

  • Improves the "algorithm" to figure out which slope is currently closest to the mouse (see below for an explanation)
  • Adds support for clicking anywhere inside the Grapher frame to dismiss the current selection
  • Uses the "default" cursor for value and entity labels since they're clickable (default is the text selection cursor)
How do we figure out which slope is currently closest to the mouse?

Before After
Screenshot 2024-03-07 at 10 27 26 Screenshot 2024-03-07 at 10 27 34
We used to measure the distance to the orange line that is defined by the start and end point of a slope but extends to both sides. Now we measure the distance to the line segment that is the slope or, if the mouse is outside of the chart area, we measure the distance to a label that is represented by a straight line

Caveats

  • If a Grapher chart has entities selected by default, then clicking anywhere inside the Grapher frame will dismiss the default selection (Example)
    • I do believe that if it's possible to select entities by clicking on slopes or clicking the legend, then it should also be possible to dismiss a selection by clicking into dead space (it's almost expected behaviour, I think?)
    • But dismissing a default selection before a user has even interacted with a chart is not ideal
    • We have very few slope charts though that allow entity selection and have a set of entities selected by default
    • All in all, I think it's still net positive but can be convinced otherwise

Videos

Before/After

before.mov
after.mov

Context

Part of a larger body of work. See stack 👇🏻

SVG tester

All slope charts are updated because of the cursor change.

@sophiamersmann sophiamersmann force-pushed the slope-hover-interaction branch 2 times, most recently from 68b333a to 28e2a26 Compare March 1, 2024 09:53
@sophiamersmann sophiamersmann force-pushed the slope-entity-selection branch from 1929d3a to c371dac Compare March 1, 2024 09:54
@sophiamersmann sophiamersmann force-pushed the slope-hover-interaction branch from 28e2a26 to 453c38c Compare March 1, 2024 09:54
@sophiamersmann sophiamersmann force-pushed the slope-entity-selection branch from c371dac to 7883eec Compare March 1, 2024 10:14
@sophiamersmann sophiamersmann force-pushed the slope-hover-interaction branch from 453c38c to 79f7bf7 Compare March 1, 2024 10:14
@sophiamersmann sophiamersmann force-pushed the slope-hover-interaction branch from 79f7bf7 to 1b74736 Compare March 5, 2024 11:25
@sophiamersmann sophiamersmann changed the base branch from slope-entity-selection to master March 5, 2024 11:25
@sophiamersmann sophiamersmann force-pushed the slope-hover-interaction branch from 1b74736 to 0c94b50 Compare March 5, 2024 13:28
@sophiamersmann sophiamersmann force-pushed the slope-hover-interaction branch from 0c94b50 to ff9abda Compare March 6, 2024 14:25
@sophiamersmann sophiamersmann force-pushed the slope-hover-interaction branch 2 times, most recently from e14309a to 1dcd907 Compare March 7, 2024 09:15
@sophiamersmann sophiamersmann marked this pull request as ready for review March 7, 2024 09:47
@sophiamersmann sophiamersmann force-pushed the slope-hover-interaction branch from 1dcd907 to 8d58cce Compare March 7, 2024 09:56
Copy link
Member

@marcelgerber marcelgerber left a comment

Choose a reason for hiding this comment

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

Nice work! I left two comments, but otherwise this is great and a definite improvement. 🙌🏻

@sophiamersmann sophiamersmann force-pushed the slope-hover-interaction branch from 5242128 to 9cc854d Compare March 8, 2024 13:52
Copy link
Member

@marcelgerber marcelgerber left a comment

Choose a reason for hiding this comment

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

Nice!

@sophiamersmann sophiamersmann merged commit 317b4ee into master Mar 11, 2024
24 of 27 checks passed
@sophiamersmann sophiamersmann deleted the slope-hover-interaction branch March 11, 2024 12:46
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.

2 participants