← Back to Docs
  • index.html
  • Clayground
  • Clayground.Canvas
  • Poly
  • Clayground 2025.2
  • Poly QML Type

    A polygon or polyline shape defined by vertices in world units. More...

    Import Statement: import Clayground.Canvas

    Detailed Description

    Poly renders a shape from an array of vertex points in world coordinates. It can display as a closed polygon (with fill) or an open polyline.

    Example usage:

    import Clayground.Canvas as Canv
    
    Canv.Poly {
        canvas: myCanvas
        vertices: [
            {x: 0, y: 0},
            {x: 2, y: 0},
            {x: 1, y: 2}
        ]
        fillColor: "green"
        strokeColor: "darkgreen"
    }

    Properties

    The parent canvas for coordinate transformation. Required.

    Array of vertex points {x, y} in world units.

    Width of the outline stroke in pixels.

    Color of the outline stroke.

    Fill color. Use "transparent" for polyline (no fill).

    Style of the stroke (solid, dash, etc.).

    Custom dash pattern as an array of dash/gap lengths.

    Whether the shape is closed. True when fillColor is not transparent.

    Methods

    Refreshes the shape visualization after vertex changes.