-
Notifications
You must be signed in to change notification settings - Fork 524
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
Feature request: defaultBrushArea="move" #1435
Feature request: defaultBrushArea="move" #1435
Conversation
const parentSVG = restProps.parentSVG || Selection.getParentSVG(evt); | ||
const pannedBox = this.panBox( | ||
{ | ||
...restProps, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can avoid a second call to this.getDomainBox
, and avoid needing to destructure / remove props from restProps
like so:
const pannedBox = this.panBox(
{
...targetProps,
...brushBox,
brushDomain: cachedDomain,
startX: (brushBox.x1 + brushBox.x2) / 2,
startY: (brushBox.y1 + brushBox.y2) / 2
},
Selection.getSVGEventCoordinates(evt, parentSVG)
);
@@ -20,7 +20,7 @@ export const brushContainerMixin = (base) => | |||
y: PropTypes.array | |||
}), | |||
brushStyle: PropTypes.object, | |||
defaultBrushArea: PropTypes.oneOf(["all", "disable", "none"]), | |||
defaultBrushArea: PropTypes.oneOf(["all", "disable", "none", "move"]), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This addition is making me want to rename this prop 😅
I'm going to avoid the breaking change for now so I can get this feature in without a major version bump. For the future, I think this should be something more like brushClearing: PropTypes.oneOf(["selectAll", "disable", "selectNone", "move"])
Open to suggestions on what would be clearest. What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I had basically the same thought. Maybe something like outsideClickBehavior
@Hypnosphi thanks for this feature! I will merge this after the slight changes to |
Thanks! I'm going to get this merged and released as a patch today. I'll add changing that prop name to my todo list for the next major verison bump. |
I find it quite convenient to move the selected area without changing the zoom by just clicking at the desired location, like with scrollbars