So I was dragging along and d3.pointer was working for me on desktop Chrome and Safari, but on mobile Safari, clientX and clientY were coming through undefined, leading d3.pointer(event, this) to return [NaN, NaN]. But it works with the old d3.mouse(this) approach, where mouse.js has:
var event = sourceEvent();
if (event.changedTouches) event = event.changedTouches[0];
So I was dragging along and d3.pointer was working for me on desktop Chrome and Safari, but on mobile Safari,
clientX
andclientY
were coming throughundefined
, leadingd3.pointer(event, this)
to return[NaN, NaN]
. But it works with the oldd3.mouse(this)
approach, where mouse.js has:But now in pointer.js, it's just:
My example works if I add back the check for changedTouches. But maybe there was a good reason for getting rid of it, I don't know.
Examples: