You can find the promised example here - hopefully it will be of some use to you .
My translation and scaling gizmos are a bit different from yours, in that they are more like those in 3dsmax. I also managed to get rotation working as expected when dragging outside of the gizmo. Feel free to adapt the code to make it work with yours also.
Enjoy !