Mastering Diagram Layout and Arrangement (Day 6)
A diagram consists of nodes and connectors. Some nodes, called containers, may have other nested nodes. If you move a container, its nested content will move together with it. Elements may be grouped into groups. The elements of a group move always together. If you select an element included in a group, the entire group will be selected.
Using Software Ideas Modeler's diagram editor you can handle various aspect of the diagram layout very easily. Our tutorial shows you how to work with:
- grouping and ungrouping
- grips and snap lines
- alignment & distribution
- size, moving, rotation
- auto layouts
- auto size
Usually, each element has its own space within a diagram, but sometimes it is desired that elements share the same area and overlap each other. In such cases, you have to take the z-order into account. The z-order says which element is on top of the other. By default, the recently added elements are placed on top of the older elements but it may be changed. The z-order of elements in a diagram may be changed using the z-order actions:
- Bring to Front – places the selected element (or elements) on top of all others
- Send to Back – places the selected element (or elements) on bottom of all others
- Back One – places the selected element (or elements) back by one position in the z-order
- Forward One – places the selected element (or elements) forward by one position in the z-order
The actions are available in the ribbon tab Home / Order and also on the tab Design / Order, in the classic menu, you may find them in Arrange / Order.
The faster way how to control the z-order is using the shortcut keys:
- Bring to Front – Ctrl + Shift + PageUp
- Send to Back – Ctrl + Shift + PageDown
- Forward One – Ctrl + PageUp
- Back One – Ctrl + PageDown
If you want to operate with a set of elements always together (in terms of moving, styling, selecting) you should create a group.
To create a group, select multiple elements in a diagram and use Group action – available in the context menu, in the ribbon Home/Order/Group or Design/Order/Group or in the classic menu Arrange/Group. The default shortcut keys for grouping are Ctrl+G.
If the group is not desired anymore, you may cancel it using Ungroup action. You may find it in the same places as the Group action - in the context menu, in the ribbon Home/Order/Group or Design/Order/Group or in the classic menu Arrange/Group. The default shortcut keys for grouping are Ctrl+Shift+G.
Grid is a great feature which turns the diagram editor canvas into a squared paper and it will also make the element to snap to these squares. The elements snap to the grid only when you move them or resize them. The newly created elements snap to the grid automatically when the grid is turned on. Turning the grid on does not affect the position of existing elements.
The grid allows you to create diagrams that are better aligned and it makes them look better.
You may turn the grid on using shortcut keys ALT+G. The setting is also available on the ribbon tab View in the Auto Guides group. In the classic menu, it is in View menu.
Snap lines are a more advanced version of the grid. It allows you to draw aligned diagrams but instead of the fixed grid, it uses dynamic snap lines which helps you to align an element to other elements in a diagram. The snap lines are displayed when you move the element near the position where the elements could be aligned. An element may be aligned to a border of another element or to a center of another element.
The snap lines may also help you to maintain the desired distance between elements or use the same width or height for unaligned elements.
The individual kinds of guides and snap lines may be turned on and off separately, so you may use only the ones you need or turn off the one that influences your diagramming in an unwanted way.
Alignment & Distribution
The diagram editor allows you to align the element to left / right / horizontal center / top / bottom / vertical center. It works so that you select a group of elements you want to align and choose the desired alignment clicking on the designated button in the ribbon (Design tab / Alignment group).
The program finds the boundaries of the group of selected elements and aligns the elements to them so the elements stay within these boundaries. Another layout feature is distribution. It allows you to reposition the selected elements. It also takes the boundaries of the selected group as a reference point. The distribution algorithm splits the area of the current selection to as many same-sized cells as there are selected elements. Then it aligns the individual elements to these cells in one of these ways:
To use the Distribution feature, select a group of elements and choose the desired distribute layout clicking on the designated button in the ribbon (Design tab / Distribute group / Distribute button).
The similar layout feature to the Distribution is the Same Space. It also repositions elements but instead of a regular placement of elements, it uses regular spaces between elements. If all elements have the same size the result of Distribution and Same Space features will be the same.
The Same Space actions are available in the ribbon on the Design tab in the Distribute group. These actions are available:
- Horizontal Same Space – repositions the elements horizontally so the horizontal spaces between the borders of two neighboring elements are always the same.
- Vertical Same Space – repositions the elements vertically so the vertical spaces between the borders of two neighboring elements are always the same.
If you want to change the size of multiple selected elements without changing their central position, you may use actions from the Size group. Using them, you may inflate or deflate the elements, make them wider or narrower, higher or lower. The size is increased and decreased by 10-pixel steps. There is also a dialog that allows you to choose any other exact numbers.
The shortcut keys are Ctrl+Plus for inflating the elements and Ctrl+Minus for deflating them.
In case you want to set the size by another existing element, you may use these actions:
- Make Same Width
- Make Same Height
- Make Same Size
The actions set width, height or both dimensions of size by a focused element (the one with dashed selection rectangle) to all other selected elements.
The diagram elements may be moved using the drag&drop method. The features like grid and snap lines help you to be more precise but it may be not enough in some scenarios. You may want to move elements by exact steps. It is possible with the Move actions. They are available in the ribbon tab Design in the Move group. There are 4 basic options:
- Move Left – moves the element by 20 pixels to the left
- Move Right – moves the element by 20 pixels to the right
- Move Up – moves the element by 20 pixels up
- Move Down – moves the element by 20 pixels down
Another handy option for how to move elements is to use the keyboard. Arrow keys moves the selected element(s) by 10 pixels left/right/up/down. You may move the elements by an exact number of pixels using the Custom Move dialog. It will show when you click on the little button with an arrow placed in the right bottom corner of the Move ribbon group.
The elements in the diagram support rotation. You may rotate an element or a group of elements using a Rotation grip. If you want to rotate it by the exact angle, you may use the Rotate button in the ribbon Design/Rotation group. The group also contains the Reset Rotation button which will set the rotation of selected elements to the default position.
Software Ideas Modeler offers complex layout algorithms that help you to tide up diagrams or their parts quickly. The auto-layout may be applied using the designated ribbon button from the Auto Layout group on the Design tab.
These auto layouts are available:
- Force Directed
- Around Center
If you want to set the automatic size for an element, double click on its right bottom sizing grip. The size of the element will be adjusted to be as small as possible to show all displayed element information. Auto size is accessible using the shortcut keys ALT+A too. The button for the auto-size is accessible from the ribbon – Design tab/Auto Layout group.