Example of zoom and drag in d3 v4.
This example has a modified drag function so that when you zoom in, you're still able to drag the circles to the correct mouse location. Here's an example of the drag problem.
It's not an easy way to do this task. Read this for an easier and better way, as well as an explanation of this code.
https://d3js.org/d3.v4.min.js