Whole document tree
    

Whole document tree

Organization of items

8.2. Organization of items

Items in the canvas are organized in a tree hierarchy. Items can be groups (nodes in the tree), or terminal items (leaves in the tree). Groups can contain any number of children, which can be terminal items or other groups. Thus, items can be nested to an arbitrary depth inside a canvas.

A canvas has a single root group. For simple drawings, it is likely that you will want to put all your items directly inside this group. For more complex drawings, it may be convenient to use a hierarchical structure of nested canvas groups.

For example, consider a circuit editor. You could define groups that contain the items that are necessary to draw a certain type of logic gate. Then you could define groups for different components. A group representing an adder would contain several logic gates and some wires. You would then group some adders with other components to form a more complex circuit. This makes it convenient to handle whole hierarchies as single entities, for when you want to move all the items that define a chain of adders, for example.