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

[event] add touchEvt support to localPnt, find owner svg. fixes #15 #167

Merged
merged 1 commit into from
Oct 6, 2017

Conversation

hshoff
Copy link
Member

@hshoff hshoff commented Oct 6, 2017

Fixes: #15

Adds single arity support to localPoint(event) which will find the ownerSVG and loop for the owner on nested SVG. This use case was found by @conglei when his chart has nested svg icons that had event handlers. Thanks to @conglei for pointing this out.

You can still pass in a reference to a specific svg if you want your local point relative to a specific svg element by using dual arity localPoint(svgNode, event) or localPoint(event.target.ownerSVGElement, event).

Lastly, this adds touch event support to localPoint so you don't have to use touchPoint and localPoint. touchPoint will still exist to prevent breaking changes for folks. I also added touchPoint to the exports on index so you can now do import { touchPoint } from '@vx/event' if you want to.

Updated the /areas demo to support touch events and mouse events with the new single arity usage.

future will probably need a localTouchPoints that returns an array of local event.changeTouches points since localPoint returns the the first event.eventTouches and ignores the rest.

@hshoff hshoff merged commit 74da7d8 into master Oct 6, 2017
@hshoff hshoff deleted the harry-event-141 branch October 6, 2017 21:16
@hshoff hshoff added this to the v0.0.141 milestone Oct 6, 2017
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.

1 participant