I need to listen to mousedown events (not a full click) on the y-axis and perhaps the main plot area, but my events only trigger on the margins. How can I do this without killing the default Plotly interactions? In particular, can I detect mousedown on the y-axis but still keep the possibility of zooming by dragging the y-axis?
I should point to this related post, but it just confused me even more. (It made me think that mouseup needed to be put on document, but it works on the plot margins for me.)
Oooo, that is very close to a solution for me! It works for the main plot area, but for some reason it doesn’t work for the y-axis (which is where I need it). It’s strange because they seem to be nearly identical sibling elements of the drag layer, so I can’t see why one would work but not the other. Maybe another event on the y-axis is stopping event propagation? Or is there another reason?
What? I don’t get it … Your suggestion works, but I don’t understand why. Or rather, I don’t understand why your previous suggestion which put the listener on the .drag class didn’t also work on the y-axis. The y-axis also has class .drag (just like all nodes listed in that figure), so why do you need to write a more specific selector that targets .nsdrag?
Oh so that’s it, d3.select() works like querySelector()! It looked so much like jquery-style chaining that I implicitly assumed that it matched all nodes and not just the first matching node. Thank you again for your help and patience!