Thanks for this thread. I had an additional problem that others here might be able to relate to. I made a chart with a d3.brush that zooms in on the selected area on brushend. Then, when the user double clicks, the zoom is reset:
zoomBrush = d3.svg.brush().x(...).on('brushend', handleZoom);
zoomBrushContainer.call(zoomBrush);
...
svgElement.on('dblclick', handleUnzoom);
The problem is, my brush's container (zoomBrushContainer in the code above) traps the click event for its own uses. So the only way I could figure to solve it so far was to hide the brush on zoom and show it again on unzoom:
function handleZoom () {
...
$(zoomBrushContainer).hide();
}
function handleUnzoom () {
$(zoomBrushContainer).show();
}
So if anyone has a more elegant solution, I'd be grateful. Otherwise, hopefully this hack helps others :)