Double click to remove brush
jay2452 opened this issue · 1 comments
jay2452 commented
Is there any way to disable single click to remove brush selection. Instead, the brush selection should be removed by double click event listener only.
mbostock commented
Sure, here’s a way:
https://observablehq.com/@d3/double-click-brush-clear
Note that the brush isn’t cleared on click; it’s cleared on mousedown when you click outside of the brush selection. This needs to be the case so that any subsequent movement creates a new brush selection anchored at the mousedown location. If you waited to clear the brush until the mouse moved, the usability in the case of dragging a selection would be worse. Hence, in the above solution I require the Command key to drag a new brush.