Skip to content

CanvasPainter

Overview

CanvasPainter is the abstract base class for bamboo components that use the Canvas API. Typically this would render something, but some implementations may just change the context state (such as transform or stroke).

@author Sam Reid (PhET Interactive Simulations)

Class CanvasPainter

import { CanvasPainter } from 'scenerystack/bamboo';

Constructor

new CanvasPainter( providedOptions? : CanvasPainterOptions )

Instance Methods

paintCanvas( context : CanvasRenderingContext2D )

override to paint or change the canvas context state. Only called if this.visible is true

Instance Properties

visible : boolean

if changed, you should probably invalidate the parent ChartCanvasNode

isDisposed : boolean

(protected)

Type CanvasPainterOptions

import type { CanvasPainterOptions } from 'scenerystack/bamboo';
  • visible?: boolean

Source Code

See the source for CanvasPainter.ts in the bamboo repository.