Skip to content

BlockSuite API Documentation / @blocksuite/blocks / CanvasRenderer

Class: CanvasRenderer

Constructors

new CanvasRenderer()

new CanvasRenderer(options): CanvasRenderer

Parameters

options

RendererOptions

Returns

CanvasRenderer

Defined in

packages/affine/block-surface/dist/renderer/canvas-renderer.d.ts:43

Properties

canvas

canvas: HTMLCanvasElement

Defined in

packages/affine/block-surface/dist/renderer/canvas-renderer.d.ts:30


ctx

ctx: CanvasRenderingContext2D

Defined in

packages/affine/block-surface/dist/renderer/canvas-renderer.d.ts:31


elementRenderers

elementRenderers: Record<string, ElementRenderer>

Defined in

packages/affine/block-surface/dist/renderer/canvas-renderer.d.ts:32


grid

grid: GridManager

Defined in

packages/affine/block-surface/dist/renderer/canvas-renderer.d.ts:33


layerManager

layerManager: LayerManager

Defined in

packages/affine/block-surface/dist/renderer/canvas-renderer.d.ts:34


provider

provider: Partial<EnvProvider>

Defined in

packages/affine/block-surface/dist/renderer/canvas-renderer.d.ts:35


stackingCanvasUpdated

stackingCanvasUpdated: Slot<{ added: HTMLCanvasElement[]; canvases: HTMLCanvasElement[]; removed: HTMLCanvasElement[]; }>

Defined in

packages/affine/block-surface/dist/renderer/canvas-renderer.d.ts:36


viewport

viewport: Viewport

Defined in

packages/affine/block-surface/dist/renderer/canvas-renderer.d.ts:41

Accessors

stackingCanvas

Get Signature

get stackingCanvas(): HTMLCanvasElement[]

Returns

HTMLCanvasElement[]

Defined in

packages/affine/block-surface/dist/renderer/canvas-renderer.d.ts:42

Methods

addOverlay()

addOverlay(overlay): void

Parameters

overlay

Overlay

Returns

void

Defined in

packages/affine/block-surface/dist/renderer/canvas-renderer.d.ts:57


attach()

attach(container): void

Used to attach main canvas, main canvas will always exist

Parameters

container

HTMLElement

Returns

void

Defined in

packages/affine/block-surface/dist/renderer/canvas-renderer.d.ts:62


dispose()

dispose(): void

Returns

void

Defined in

packages/affine/block-surface/dist/renderer/canvas-renderer.d.ts:63


generateColorProperty()

generateColorProperty(color, fallback): string

Parameters

color

Color

fallback

string

Returns

string

Defined in

packages/affine/block-surface/dist/renderer/canvas-renderer.d.ts:64


getCanvasByBound()

getCanvasByBound(bound?, surfaceElements?, canvas?, clearBeforeDrawing?, withZoom?): HTMLCanvasElement

Parameters

bound?

IBound

surfaceElements?

SurfaceElementModel<BaseElementProps>[]

canvas?

HTMLCanvasElement

clearBeforeDrawing?

boolean

withZoom?

boolean

Returns

HTMLCanvasElement

Defined in

packages/affine/block-surface/dist/renderer/canvas-renderer.d.ts:65


getColorScheme()

getColorScheme(): ColorScheme

Returns

ColorScheme

Defined in

packages/affine/block-surface/dist/renderer/canvas-renderer.d.ts:66


getColorValue()

getColorValue(color, fallback?, real?): string

Parameters

color

Color

fallback?

string

real?

boolean

Returns

string

Defined in

packages/affine/block-surface/dist/renderer/canvas-renderer.d.ts:67


getPropertyValue()

getPropertyValue(property): string

Parameters

property

string

Returns

string

Defined in

packages/affine/block-surface/dist/renderer/canvas-renderer.d.ts:68


refresh()

refresh(): void

Returns

void

Defined in

packages/affine/block-surface/dist/renderer/canvas-renderer.d.ts:69


removeOverlay()

removeOverlay(overlay): void

Parameters

overlay

Overlay

Returns

void

Defined in

packages/affine/block-surface/dist/renderer/canvas-renderer.d.ts:70