Fizzy / docs / ref / Shape.md
Shape
Shape is the basic building block, and comes in three flavours :
Fields
| Name | Type | Comments |
|---|---|---|
| Document | Document | |
Child.foo | Shape | Replace foo with the name of the child shape. See note below. |
| FillColor | Paint | |
| FlipX | Boolean | |
| FlipY | Boolean | |
| LineColor | Paint | An alias for StrokeColor |
| LineWidth | Dimension | |
| LocPin | Dimension2 | The position of Pin, relative to THIS shape. |
| Name | String | |
| Page | Page | |
| Parent | Page or Shape | Shapes can be children of other shapes |
| Pin | Dimension2 | The Shape's position relative to it's parent |
| Rotation | Angle | |
| Scale | Vector2 | |
| Size | Dimension | |
| StrokeColor | Paint |
Child.foo only finds immediate children (not grandchildren etc).
To search for a shape where the name is only known at run-time, use findShape( name ) (see below).
Additional fields of Shape1d and Shape2d (i.e. not ShapeText)
| Name | Type | Comments |
|---|---|---|
| CornerRadius | Dimension | Causes all joins between LineTos to be rounded. |
| StrokeCap | StrokeCap | |
| StrokeJoin | StrokeJoin |
Additional fields of Shape1d
| Name | Type | Comments |
|---|---|---|
| Start | Dimension2 | |
| End | Dimension2 | |
| StartAngle | Angle | See note below |
| EndAngle | Angle | See note below |
| Length | Dimension | |
| IsStartConnected | Boolean | Is the start point connected to another shape |
| IsEndConnected | Boolean | Is the end point connected to another shape |
StartAngle and EndAngle are relative to their parent.
When not connected to anything, these are usually
(End-Start).Angle and (Start-End).Angle.
However, when the Shape1d is connected to another shape,
then it will give the "preferred" angle of the connection.
For ConnectionPoints, this is the angle of the ConnectionPoint.
When connecting along the Geometry of another Shape,
then it is the normal at that point of the Geometry.
Additional fields of ShapeText
| Name | Type | Comments |
|---|---|---|
| Text | String | |
| FontSize | Double | |
| AlignX | Double | 0=Left 0.5=Center 1=Right |
| AlignY | Double | 0=Top 0.5=Middle 1=Bottom |
| Clip | Boolean | Is the text clipped to the shape's size? |
| MarginTop | Dimension | |
| MarginRight | Dimension | |
| MarginBottom | Dimension | |
| MarginLeft | Dimension | |
| TextSize | Dimension2 | The size of the text, not including any margins |
Methods
| Name | Parameters | Return Type | Comments |
|---|---|---|---|
| findShape | name : String | Shape | Finds an ancestor with the given name. |
| findCustomProperty | name : String | CustomProperty | Rarely used |
| findScratch | name : String | Scratch | Rarely used |
| findControlPoint | name : String | ControlPoint | Rarely used |
| localToParent | Dimension2 | Dimension2 | Converts local coordinates to those of the parent shape (or page) |
| localToPage | Dimension2 | Dimension2 | Converts local coordinates to those of the page |
| parentToLocal | Dimension2 | Dimension2 | Converts coordinates of the parent shape/page to local coordinates of this shape |
| pageToLocal | Dimension2 | Dimension2 | Converts page coordinates to local coordinates of this shape |
Additional methods of Shape1d
| Name | Parameters | Return Type | Comments |
|---|---|---|---|
| connectTo | ConnectionPoint, margin : Dimension2 | Dimension2 | Connects to a ConnectionPoint |
| connectToShape | shape :Shape, isStart : Boolean, margin : Dimension | Dimension2 | Connects to a Shape (Smart) |
| connectAlong | Geometry, along : Double, margin : Dimension | Dimension2 | Connects along the outline (Geometry of a shape |
connectTo, connectToShape and connectAlong are used on the start and end points
of a line are connected to another shape.
These methods are rarely used manually, but are created by the GUI when dragging line ends.
Additional methods of ShapeText
| Name | Parameters | Return Type | Comments |
|---|---|---|---|
| textSize | Dimension2 | The size of text, not including margins. |
Sections
Additional sections used by Shape1d and Shape2d :