The list below describes recent changes and additions to SwiftDiagram:

New in version 1.5

Alignment grid

The alignment grid help users place the diagram items more precisely. To activate the grid, set the alignToGrid property to true. If the grid is active while an item is being created or modified, the item’s control-points are aligned to the nearest grid points. The distance between adjacent grid points is set via the gridSizeX and gridSizeY properties. The grid can be either visible or invisible, depending on whether the showGrid value is true or false. If visible, the grid is painted as a matrix of points or as series of crossing lines, as specified by the gridStyle property. gridColor defines the color with which the alignment points or lines are painted.

Miscellaneous

  • The MoveNodes behavior allows grabbing nodes to drag them without using adjustment handles.
  • resizeToFitText(...) method added to ShapeNode makes nodes large enough to fit their text.
  • the measureString(...) method added to Diagram lets you determine size of strings when rendered with specified font attributes.

New in version 1.4

Undo / redo support

If the undoEnabled property is set to true, the Diagram control tracks changes done to its items and allows undoing and redoing them later by calling the undo and redo methods respectively. Multiple changes could be recorded as a single undoable operation by enclosing them between startCompositeOperation and commitCompositeOperation calls. It is also possible to create custom undoable operations by deriving from the Command class and calling executeCommand with the custom command as argument.

Miscellaneous