I'm building an editor (similar to MS Visio) to draw a hierarchical finite state machine. Hence I need to connect rectangles (states) with lines (transitions) in my drawing area.

I will use a drag and drop approach.

Any idea on how to have an event emitted when a line is dropped (or is connected to) on a rectangle?