I am going to build some kind of ui to manage dependencies between blocks with d3 version 4.
I need to add new element onClick - it works fine, but if container element is zoomed in/out - coordinates of click are wrong, of course.
There should be well defined approach to do that, but I cannot find example for version 4 of d3 library. Will appreciate any help.
Illustration of problem: https://bl.ocks.org/bfunc/e8c5649f1a3233b4141b36f6ffdff79c
Edited:
Solution provided by Gerardo Furtado