Type Alias CanvasHelperOpts

CanvasHelperOpts: Readonly<{
    clearOnResize: boolean;
    colourSpace: PredefinedColorSpace;
    coordinateScale: ScaleBy;
    disablePointerEvents: boolean;
    draw?: ((ctx: CanvasRenderingContext2D, size: Rect, helper: CanvasHelper) => void);
    height: number;
    onResize?: ((ctx: CanvasRenderingContext2D, size: Rect, helper: CanvasHelper) => void);
    pixelZoom: number;
    resizeLogic?: ElementResizeLogic;
    skipCss: boolean;
    width: number;
    zIndex: number;
}>

CanvasHelper options

Type declaration

  • clearOnResize: boolean

    If true (default) canvas is cleared when a resize happens

  • colourSpace: PredefinedColorSpace

    Colour space to use. Defaults to sRGB.

  • coordinateScale: ScaleBy
  • disablePointerEvents: boolean

    By default, the helper emits pointer events from the canvas. Set this to true to disable.

  • Optionaldraw?: ((ctx: CanvasRenderingContext2D, size: Rect, helper: CanvasHelper) => void)

    If specified, this function be called in an animation loop.

      • (ctx, size, helper): void
      • Parameters

        • ctx: CanvasRenderingContext2D

          Drawing context

        • size: Rect

          Viewport size

        • helper: CanvasHelper

          CanvasHelper instance

        Returns void

  • height: number

    Logical height of canvas. This is used for establishing the desired aspect ratio.

  • OptionalonResize?: ((ctx: CanvasRenderingContext2D, size: Rect, helper: CanvasHelper) => void)

    Callback when canvas is resized

      • (ctx, size, helper): void
      • Parameters

        Returns void

  • pixelZoom: number

    By default the display DPI is used for scaling. If this is set, this will override.

  • OptionalresizeLogic?: ElementResizeLogic

    Automatic canvas resizing logic.

  • skipCss: boolean

    If true, it won't add any position CSS

  • width: number

    Logical width of canvas. This is used for establishing the desired aspect ratio.

  • zIndex: number

    If set, the z-index for this canvas. By default, fullscreen canvas will be given -1