Documentation
    Preparing search index...

    Hierarchy

    • default
      • PenShape
    Index

    Constructors

    • Returns PenShape

    Properties

    _bounds: BoundingBox
    _paint: Paint
    fillColor: Color
    height: number
    id: string
    locked: boolean
    opacity: number
    points: Point[]

    Raw input points

    renderPoints: Point[]

    Simplified / smoothed points used for rendering

    rotation: number
    scaleX: number
    scaleY: number
    strokeColor: Color
    strokeWidth: number
    visible: boolean
    width: number
    x: number
    y: number
    BOUNDS_AFFECTING_PROPS: Set<string>

    Accessors

    • get boundsAffectingProps(): Set<string>

      Returns Set<string>

    • get paint(): Paint

      Returns Paint

    • get shapeType(): string

      The shape type identifier for JSON serialization

      Returns string

    Methods

    • Parameters

      Returns void

    • Raw bounding box of the stored points (no translation / scaling applied).

      Returns { maxX: number; maxY: number; minX: number; minY: number }

    • Returns void

    • Parameters

      Returns void

    • Parameters

      • forFill: boolean

      Returns void

    • For PenShape, "resize" means adjusting scaleX/scaleY (plus x/y offset) so that the rendered bounds match the requested rectangle. The input coordinates come from getBounds() which includes strokeWidth/2 padding, so we strip that padding before computing scale to avoid a "jump" on first move.

      Parameters

      • newX: number
      • newY: number
      • newW: number
      • newH: number

      Returns void

    • Parameters

      • x: number
      • y: number

      Returns void

    • Draw the shape on the given canvas

      Parameters

      Returns void

    • Draw selection overlay: bounding box + handles, rotated with the shape.

      Parameters

      • canvas: Canvas

        the canvas to draw on (already inside the shape's canvas transform)

      • OptionalhandleSize: number

        handle square size in dp at 1× zoom

      • OptionaldisplayScale: number

        the effective display scale (canvasScale × matrix scale). Sizes are divided by this value so that handles appear constant-size on screen regardless of zoom.

      Returns void

    • Parameters

      Returns void

    • Restore shape-specific data from JSON

      Parameters

      • data: any

      Returns void

    • Return the untransformed bounding box (in local coordinates offset by x,y)

      Returns BoundingBox

    • Get the 8 resize handles + 1 rotation handle in canvas (world) coordinates, accounting for rotation

      Parameters

      • displayScale: number

      Returns HandlePoint[]

    • Get bounding box in canvas space (accounting for position, scale and rotation is simplified as AABB)

      Parameters

      • displayScale: number

      Returns BoundingBox

    • Hit-test a point (in canvas coordinates) against the shape

      Parameters

      • px: number
      • py: number

      Returns boolean

    • Parameters

      • propertyName: string
      • value: any
      • OptionaloldValue: any

      Returns void

    • Returns ShapeJSON

    • Shape-specific extra JSON data

      Returns Record<string, any>

    • Rotate a point around a center by angleDegrees, returning the new world position

      Parameters

      • px: number
      • py: number
      • cx: number
      • cy: number
      • angleDegrees: number

      Returns { x: number; y: number }