I was experiencing the issue raised here and here. My d3 app works perfectly on Chrome via a touch display on Mac, but d3.drag failed when I switched to the Windows production machine running Chrome v.74. I applied the solution .touchable(navigator.maxTouchPoints)
, as suggested by the linked pages above. This allowed me to drag the element in Windows Chrome v.74 using the touch screen, but am now getting:
UncaughtTypeError: Failed to execute 'elementFromPoint' on 'Document': The provided double value is non-finite.
so my drag events aren't firing.
I am using document.elementFromPoint() to detect when the dragged element is over another element:
this.svg.dragCirclesGroup
.call(drag()
.touchable(navigator.maxTouchPoints)
.on("start", this.dragStarted)
.on("drag", this.dragged)
.on("end", this.dragEnded));
dragged() {
select(this).attr("transform","translate("+[event.x,event.y]+")")
let hitZone = select(document.elementFromPoint(event.sourceEvent.clientX, event.sourceEvent.clientY)).attr("id");
if ((hitZone == "yHitZone") || (hitZone == "xHitZone")) {
select('body').classed("plus", true);
} else {
select('body').classed("plus", false);
}
}
This is a touch-only issue, as the drag and document.elementFromPoint work perfectly when I use a mouse.