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:44

Properties

canvas

canvas: HTMLCanvasElement

Defined in

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


ctx

ctx: CanvasRenderingContext2D

Defined in

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


elementRenderers

elementRenderers: Record<string, ElementRenderer>

Defined in

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


grid

grid: GridManager

Defined in

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


layerManager

layerManager: LayerManager

Defined in

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


provider

provider: Partial<EnvProvider>

Defined in

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


stackingCanvasUpdated

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

Defined in

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


viewport

viewport: Viewport

Defined in

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

Accessors

stackingCanvas

Get Signature

get stackingCanvas(): HTMLCanvasElement[]

Returns

HTMLCanvasElement[]

Defined in

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

Methods

addOverlay()

addOverlay(overlay): void

Parameters

overlay

Overlay

Returns

void

Defined in

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


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:64


dispose()

dispose(): void

Returns

void

Defined in

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


generateColorProperty()

generateColorProperty(color, fallback): string

Parameters

color

Color

fallback

string

Returns

string

Defined in

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


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:67


getColorScheme()

getColorScheme(): ColorScheme

Returns

ColorScheme

Defined in

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


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:69


getPropertyValue()

getPropertyValue(property): string

Parameters

property

string

Returns

string

Defined in

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


refresh()

refresh(): void

Returns

void

Defined in

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


removeOverlay()

removeOverlay(overlay): void

Parameters

overlay

Overlay

Returns

void

Defined in

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