私はそれをかなり大まかに動作させました:http://jsfiddle.net/UT69H/18/
本当にぎくしゃくしていますが、パスと一緒に回転します。マウスがボックス自体の外に移動しても突然停止しないように、mousemove ハンドラーを body 要素に移動したことに注意してください。
bod.on "mousemove", () ->
if mousedown
pos = getPosHandle { x: d3.mouse(h[0][0])[0], y: d3.mouse(h[0][0])[1] }
pos1 = getPosHandle { x: d3.mouse(h[0][0])[0], y: d3.mouse(h[0][0])[1] - 1 }
pos2 = getPosHandle { x: d3.mouse(h[0][0])[0], y: d3.mouse(h[0][0])[1] + 1 }
ang = Math.round(Math.atan2(pos2.y - pos1.y, pos2.x - pos1.x) * 180 / Math.PI) - 90
h.attr "transform", "rotate(#{ang} #{pos.x} #{pos.y})"
h.attr "x", (pos.x - h.attr("width") / 2)
h.attr "y", (pos.y - h.attr("height") / 2)
これは少し良いです: http://jsfiddle.net/UT69H/19/
bod.on "mousemove", () ->
if mousedown
pos = getPosHandle { x: d3.mouse(bod[0][0])[0], y: d3.mouse(bod[0][0])[1] }
pos1 = getPosHandle { x: d3.mouse(bod[0][0])[0], y: d3.mouse(bod[0][0])[1] - 1 }
pos2 = getPosHandle { x: d3.mouse(bod[0][0])[0], y: d3.mouse(bod[0][0])[1] + 1 }
ang = Math.round(Math.atan2(pos2.y - pos1.y, pos2.x - pos1.x) * 180 / Math.PI) - 90
h.attr "transform", "rotate(#{ang} #{pos.x} #{pos.y})"
h.attr "x", (pos.x - h.attr("width") / 2)
h.attr "y", (pos.y - h.attr("height") / 2)
テストポイントをさらに離すことでジッターを減らすことができます: http://jsfiddle.net/UT69H/21/
bod.on "mousemove", () ->
if mousedown
pos = getPosHandle { x: d3.mouse(bod[0][0])[0], y: d3.mouse(bod[0][0])[1] }
pos1 = getPosHandle { x: d3.mouse(bod[0][0])[0], y: d3.mouse(bod[0][0])[1] - 4 }
pos2 = getPosHandle { x: d3.mouse(bod[0][0])[0], y: d3.mouse(bod[0][0])[1] + 4 }
ang = Math.round(Math.atan2(pos2.y - pos1.y, pos2.x - pos1.x) * 180 / Math.PI) - 90
h.attr "transform", "rotate(#{ang} #{pos.x} #{pos.y})"
h.attr "x", (pos.x - h.attr("width") / 2)
h.attr "y", (pos.y - h.attr("height") / 2)