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

Add d3.pointers. #255

Merged
merged 7 commits into from
Aug 4, 2020
Prev Previous commit
Next Next commit
Update src/pointers.js
Co-authored-by: Mike Bostock <mbostock@gmail.com>
  • Loading branch information
Fil and mbostock committed Aug 3, 2020
commit bbc520a47279b1a69912a81e0362e9ffa4182041
2 changes: 1 addition & 1 deletion src/pointers.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import sourceEvent from "./sourceEvent.js";
export default function(events, node) {
if (events.target) { // i.e., instanceof Event, not TouchList or iterable
Copy link
Member Author

Choose a reason for hiding this comment

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

I think I’d prefer events instanceof Event here, but our current custom events in d3-drag etc. don’t extend Event, so that isn’t possible. It might be possible to change them to extend Event, although for all I know, that may introduce other problems.

events = sourceEvent(events);
if (!node) node = events.currentTarget;
if (node === undefined) node = events.currentTarget;
events = events.touches || [events];
Fil marked this conversation as resolved.
Show resolved Hide resolved
}
return Array.from(events, event => pointer(event, node));
Expand Down