-
Notifications
You must be signed in to change notification settings - Fork 721
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
add touch events for brush component #864
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -122,6 +122,8 @@ export default class BrushSelection extends React.Component< | |
onMouseUp={dragEnd} | ||
onMouseMove={dragMove} | ||
onMouseLeave={dragEnd} | ||
onTouchMove={dragMove} | ||
onTouchEnd={dragEnd} | ||
style={DRAGGING_OVERLAY_STYLES} | ||
/> | ||
)} | ||
|
@@ -146,6 +148,15 @@ export default class BrushSelection extends React.Component< | |
onClick={event => { | ||
if (onClick) onClick(event); | ||
}} | ||
onTouchStart={disableDraggingSelection ? undefined : dragStart} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same comment on remove these additions and updating the above |
||
onTouchMove={event => { | ||
dragMove(event); | ||
if (onMouseMove) onMouseMove(event); | ||
}} | ||
onTouchEnd={event => { | ||
dragEnd(event); | ||
if (onMouseUp) onMouseUp(event); | ||
}} | ||
style={{ | ||
pointerEvents: brush.isBrushing || brush.activeHandle ? 'none' : 'all', | ||
cursor: disableDraggingSelection ? undefined : 'move', | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -120,6 +120,8 @@ export default class Drag extends React.Component<DragProps, DragState> { | |
height={height} | ||
onMouseMove={this.handleDragMove} | ||
onMouseUp={this.handleDragEnd} | ||
onTouchMove={this.handleDragMove} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since this change |
||
onTouchEnd={this.handleDragEnd} | ||
fill="transparent" | ||
/> | ||
)} | ||
|
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.
on thought I have here for DRY-ness is to update all of these to
PointerEvent
handlers, which are a combination ofMouseEvent
s +TouchEvent
s introduced in[email protected]
. soonMouseDown => onPointerDown
,onMouseLeave => onPointerLeave
,onMouseMove => onPointerMove
. I think thatMouseHandlerEvent
will also need to be updated to supportReact.PointerEvent
.To avoid breaking changes we could could keep the props as
onMouseXXX
, but could consider also addingonPointerXXX
handlers to match, and then deprecateonMouseXXX
in a future2.0
release. This would also require that we bump thereact
peerDependency
in@visx/brush
to^16.4.0
, which is theoretically breaking but I just checked@visx/drag
(which brush relies on) and it already requires^16.8.0
so I think technically@visx/brush
should already actually be^16.8.0
.cc @hshoff