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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

new(drag): allow x,y,dx,dy overrides in useDrag + Drag #906

Merged
merged 6 commits into from Nov 5, 2020

Conversation

williaster
Copy link
Collaborator

馃殌 Enhancements

This PR builds on #902 and adds the ability to

  • set default x/y/dx/dy for useDrag + <Drag />
  • update x/y/dx/dy passed to useDrag + <Drag /> such that the internal state of the hook + component update to those values

I added tests for this + updated the /drag-i demo to demonstrate how to set an initial x/y (and verified that it works as before).

Closes #905, and I also need this for some @visx/annotations work that is in progress (validated it for that use case as well).

@hshoff @kristw cc @m0t0r

@williaster williaster added this to Reviewable in XYChart via automation Oct 30, 2020
@coveralls
Copy link

coveralls commented Oct 30, 2020

Pull Request Test Coverage Report for Build 348135996

  • 5 of 7 (71.43%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.5%) to 60.611%

Changes Missing Coverage Covered Lines Changed/Added Lines %
packages/visx-drag/src/Drag.tsx 0 1 0.0%
packages/visx-drag/src/useDrag.ts 5 6 83.33%
Totals Coverage Status
Change from base Build 348110012: 0.5%
Covered Lines: 1567
Relevant Lines: 2457

馃挍 - Coveralls

@williaster williaster added this to the 1.1.1 milestone Oct 30, 2020
Base automatically changed from chris--useDrag to master November 5, 2020 19:01
@williaster williaster merged commit 033a32c into master Nov 5, 2020
XYChart automation moved this from Reviewable to Done Nov 5, 2020
@williaster williaster deleted the chris--drag-overrides branch November 5, 2020 20:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
XYChart
  
Done
Development

Successfully merging this pull request may close these issues.

Drag: programmatically reset dragging position
5 participants