Items Placement and Z-order
Measure Unit
The measureUnit
property, set to an instance of MeasureUnit
class, specifies the unit of measure for all location and size-related values assigned to SwiftDiagram properties or passed as arguments to its methods.
Location and Size of Nodes
Call the setBounds
method to change the location and size of a node. The method takes a Rect
instance as argument. Call getBounds
to find the current location and size of a node, returned as a Rect
object.
Links Control Points
Links must have two or more control points, depending on their shape
property. You can get access to the control points via link’s controlPoints
collection. You must call updateFromPoints
after programmatically moving control points of a link; that’s needed in order to repaint the link and update its internal state variables, such as arrowhead angles.
Link Dynamics
Links also provide an autoRoute
property that enables or disables automatic routing for a link. Routed links avoid nodes by finding the shortest path between their origin and destination that does not cross any other nodes.
Interactive Moving or Resizing
End-users of your application can move or resize the diagram elements. They do this by selecting an item and dragging any of its adjustment handles, a point inside its interior, any of its sides or a selection frame. The handlesStyle
property of nodes controls how interaction can be performed. Additionally it defines the representation of selected items on screen.
Controlling Z-order
The Z-order defines how items are ordered along the Z-axis, so that one item appears in front of or behind another one. Diagram items are sorted by the value of their zIndex
property, and rendered on screen in ascending order. You can change the Z index of a DiagramItem
by setting its zIndex
property.