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

Simplify and document usage of useInteraction and useModifierKeyPressed #1477

Merged
merged 2 commits into from
Aug 21, 2023

Conversation

axelboc
Copy link
Contributor

@axelboc axelboc commented Aug 18, 2023

Following #1475, I'm documenting the newly exported useInteraction and useModifierKeyPressed hooks.

I'm also taking the opportunity to do a bit of a refactoring now, to avoid a breaking change down the line:

  • InteractionEntry (the second parameter of useInteraction) becomes InteractionConfig
  • We no longer need to cast the modifierKey prop to an array before calling useInteraction and useMdifierKeyPressed (thus removing the need for getModifierKeyArray)
  • I'm introducing an Interaction class internally to encapsulate the casting of the modiferKeys and buttons arrays and the logic of whether an interaction "matches" a mouse event.

@axelboc axelboc requested a review from loichuder August 18, 2023 09:43
Copy link
Member

@loichuder loichuder left a comment

Choose a reason for hiding this comment

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

Nice !

packages/lib/src/interactions/interaction.ts Show resolved Hide resolved
@axelboc axelboc merged commit 8fcf777 into main Aug 21, 2023
8 checks passed
@axelboc axelboc deleted the doc-interactions branch August 21, 2023 13:22
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