ixfx
    Preparing search index...

    Class CanvasRegion

    Draws on a canvas, constrained to a specific region

    Index

    Accessors

    Constructors

    Methods

    • Converts absolute to region point

      Parameters

      • pt: Point
      • source: "screen"
      • clamped: boolean

      Returns { x: number; y: number }

    • For debugging, draws an outline of the bounds

      Parameters

      • strokeStyle: string
      • lineWidth: number = 1

      Returns void

    • Draws connected points in absolute coordinates, however with 0,0 being the top-left of the region.

      Thus, this will apply the region offset before drawing.

      Parameters

      • points: Point[]

        Points to draw

      • strokeStyle: string

        Stroke style

      • lineWidth: number = 1

        Line width

      Returns void

    • Draws a line from a series of points. Assumes region-relative, % coordinates (ie 0..1 scale)

      Parameters

      • relativePoints: Point[]

        Points to connect, in region-relative coordinates

      • strokeStyle: string

        Stroke style

      • lineWidth: number = 1

        Line with

      Returns void

    • Fills text at a region-relative position

      Parameters

      • text: string
      • point: Point

        Region relative, meaning 0,0 is top-left of region

      • fillStyle: string = ...
      • font: string
      • baseline: CanvasTextBaseline = ...
      • align: CanvasTextAlign = ...

      Returns void

    • Fills text at a relative position

      Parameters

      • text: string
      • relPos: Point

        Relative, meaning 0.5,0.5 is the middle of the region

      • fillStyle: string = ...
      • font: string
      • baseline: CanvasTextBaseline = ...
      • align: CanvasTextAlign = ...

      Returns void

    • Calls the original regionCompute function passed in to the constructor to recompute the absolute region

      Returns void

    • Converts a region-relative point (0..1) to an absolute point, which uses region-relative coordinates.

      Eg if the region had an x,y of 100,100, toAbsRegion({x:0,y:0}) will return 0,0.

      Parameters

      • regionRel: Point
      • scaleBy: "both" = ...

      Returns { x: number; y: number }

    • Converts a point to a region-relative one.

      Parameters

      • pt: Point
      • source: "source" | "screen" = ...
      • kind: "independent" = ...
      • clamped: boolean = true

      Returns { x: number; y: number }

    Properties

    source: CanvasSource