Skip to content

BlockSuite API Documentation / @blocksuite/affine-block-surface / CanvasRenderer

Class: CanvasRenderer

Constructors

new CanvasRenderer()

new CanvasRenderer(options): CanvasRenderer

Parameters

options

RendererOptions

Returns

CanvasRenderer

Defined in

packages/affine/block-surface/src/renderer/canvas-renderer.ts:77

Properties

canvas

canvas: HTMLCanvasElement

Defined in

packages/affine/block-surface/src/renderer/canvas-renderer.ts:53


ctx

ctx: CanvasRenderingContext2D

Defined in

packages/affine/block-surface/src/renderer/canvas-renderer.ts:55


elementRenderers

elementRenderers: Record<string, ElementRenderer>

Defined in

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


grid

grid: GridManager

Defined in

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


layerManager

layerManager: LayerManager

Defined in

packages/affine/block-surface/src/renderer/canvas-renderer.ts:61


provider

provider: Partial<EnvProvider>

Defined in

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


stackingCanvasUpdated

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

Defined in

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


viewport

viewport: Viewport

Defined in

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

Accessors

stackingCanvas

Get Signature

get stackingCanvas(): HTMLCanvasElement[]

Returns

HTMLCanvasElement[]

Defined in

packages/affine/block-surface/src/renderer/canvas-renderer.ts:73

Methods

addOverlay()

addOverlay(overlay): void

Parameters

overlay

Overlay

Returns

void

Defined in

packages/affine/block-surface/src/renderer/canvas-renderer.ts:324


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/src/renderer/canvas-renderer.ts:334


dispose()

dispose(): void

Returns

void

Defined in

packages/affine/block-surface/src/renderer/canvas-renderer.ts:342


generateColorProperty()

generateColorProperty(color, fallback): string

Parameters

color

Color

fallback

string

Returns

string

Defined in

packages/affine/block-surface/src/renderer/canvas-renderer.ts:346


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/src/renderer/canvas-renderer.ts:353


getColorScheme()

getColorScheme(): ColorScheme

Returns

ColorScheme

Defined in

packages/affine/block-surface/src/renderer/canvas-renderer.ts:383


getColorValue()

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

Parameters

color

Color

fallback?

string

real?

boolean

Returns

string

Defined in

packages/affine/block-surface/src/renderer/canvas-renderer.ts:387


getPropertyValue()

getPropertyValue(property): string

Parameters

property

string

Returns

string

Defined in

packages/affine/block-surface/src/renderer/canvas-renderer.ts:393


refresh()

refresh(): void

Returns

void

Defined in

packages/affine/block-surface/src/renderer/canvas-renderer.ts:397


removeOverlay()

removeOverlay(overlay): void

Parameters

overlay

Overlay

Returns

void

Defined in

packages/affine/block-surface/src/renderer/canvas-renderer.ts:406