d3 / d3-drag

Drag and drop SVG, HTML or Canvas using mouse or touch input.

Home Page:https://d3js.org/d3-drag

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Expose d3.dragDisable(window).

mbostock opened this issue · comments

Anything that wants to use the common gesture mousedown, mousemove+, mouseup will need to use the same trick employed by the drag behavior (not prevent default on mousedown, then suppress dragstart and selectstart or set user-select: none). That includes d3-zoom and d3-brush. So rather than duplicate that hack three times, we should expose it in this module.

Since this hack is only intended to be employed from mousedown to mouseup, we probably don’t need to do reference counting to handle multiple calls to dragDisable. It seems cleaner to have the window passed in rather than relying on d3.event.view, though.