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

fix(vx-brush): Fix initialBrushPosition #667

Merged
merged 7 commits into from
May 2, 2020

Conversation

williaster
Copy link
Collaborator

🐛 Bug Fix

This fixes some problems with the implementation of initialBrushPosition from #618

  • the type BrushStartEnd expected both x and y of start/end to be defined, which doesn't work if you have a vertical- or horizontal-only brush. Fixed to handle partials.
  • the initial brush worked if you dragged in a new position, or extended a side, but not if you dragged the initial brush window. to fix this I updated some of the initial state.start/end logic which is used by BrushSelection upon moving a selection.

Before
broken-brush-move

After
fixed-brush-move

Also updates the demo to include an initialBrushPosition which should be useful for peeps
image

🏠 Internal

Jest was failing locally to collect coverage due to a missing react component function name. I added one to fix locally, and see if it fixes anything on CI.

@hshoff @kristw
cc @maryschmidt

@@ -185,36 +177,33 @@ export default class BaseBrush extends React.Component<BaseBrushProps, BaseBrush
};

handleDragEnd = () => {
const { isBrushing } = this.state;
if (isBrushing) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

noting to document:
by the time this function is called state has been updated isBrushing usually has been updated to false and so this feature didn't work as intended.

@williaster
Copy link
Collaborator Author

CI passed even tho it's not posting here

@williaster williaster merged commit 8e35362 into master May 2, 2020
@williaster williaster deleted the chris--initialbrushposition-fix branch May 2, 2020 18:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants