The resulting code (with some minor formatting alterations) from an answer on Stack Overflow to a question about how to group two elements and drag them using d3.drag.
Kudos (and thanks) to Dragon_Slayer for the solution.
A block for the original (not working correctly) code is here.
https://d3js.org/d3.v4.min.js