I just open sourced a huge project of mine (https://bisonkick.com
) that has all of that stuff you'd need in there. Including the line connection you wanted as well as aligning objects to each other and aligning to the stage and tons of other stuff that took a lot of math and a long time to figure out. The code you need would be in there for sure. I also rewrote parts of Objecthandles itself to do stuff like grid snapping and yada yada yada. It uses RobotLegs to do the MVC stuff.
If it helps you... then great.