A visual line connecting two items with automatic position tracking. More...
| Import Statement: | import Clayground.Canvas |
Connector draws a line between the centers of two items and automatically updates when either item moves. Useful for visualizing relationships or connections in diagrams and games.
Example usage:
import Clayground.Canvas as Canv Canv.Connector { from: nodeA to: nodeB color: "green" strokeWidth: 3 style: ShapePath.DashLine }
The canvas the connector belongs to (default null). When set, the connector pans and zooms with the world and its ends may be world points.
The source: an item (its center is used) or a world point {x, y}, which needs canvas to be set. Required.
The target: an item (its center is used) or a world point {x, y}, which needs canvas to be set. Required.
Where the line meets an end that is an item: "center" (default) or "edge", the edge of the item's bounding box.
Which ends carry an arrow head: "none" (default), "to", "from" or "both".
Length of an arrow head in pixels, 4 * strokeWidth + 4 by default.
Width of the connector line.
Color of the connector line.
Style of the line (solid, dash, etc.).
Custom dash pattern as an array of dash/gap lengths.
Pen used for the line and the heads: "none" (default), "chalk" or "marker", as on Poly.
How much of the connector is drawn, from 0 to 1 (default 1), in the order shaft, head at to, head at from.
Which wobble the sketch pens use (default 0).