For example, it is possible to create a constraint that keeps several figures aligned by their x value. Simply create a class that observes the slots of these figures and then if any slot changes, modifies the other slots to match. There is not a lot to say about a viewport, except that it scrolls and zooms. Both of these are done by fooling its child. The child then paints without knowing it has been scaled.
Picking is handled the same way.
The editor has a viewport that controls scrolling and scaling of a canvas. Notice that the editor installs a callback with the CanvasViewer to capture events. The editor also has a current Tool , undo stack, and a Selection which contains a list of selected views. To grasp a figure with a tool usually means to click the mouse on the figure. Basically, the user tells the application she has the tool and has started to do something with it.