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

Properties

canvas

canvas: HTMLCanvasElement

Defined in

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


ctx

ctx: CanvasRenderingContext2D

Defined in

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


elementRenderers

elementRenderers: Record<string, ElementRenderer>

Defined in

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


grid

grid: GridManager

Defined in

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


layerManager

layerManager: LayerManager

Defined in

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


provider

provider: Partial<EnvProvider>

Defined in

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


stackingCanvasUpdated

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

Defined in

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


viewport

viewport: Viewport

Defined in

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

Accessors

stackingCanvas

Get Signature

get stackingCanvas(): HTMLCanvasElement[]

Returns

HTMLCanvasElement[]

Defined in

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

Methods

addOverlay()

addOverlay(overlay): void

Parameters

overlay

Overlay

Returns

void

Defined in

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


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


dispose()

dispose(): void

Returns

void

Defined in

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


generateColorProperty()

generateColorProperty(color, fallback): string

Parameters

color

Color

fallback

string

Returns

string

Defined in

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


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


getColorScheme()

getColorScheme(): ColorScheme

Returns

ColorScheme

Defined in

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


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


getPropertyValue()

getPropertyValue(property): string

Parameters

property

string

Returns

string

Defined in

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


refresh()

refresh(): void

Returns

void

Defined in

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


removeOverlay()

removeOverlay(overlay): void

Parameters

overlay

Overlay

Returns

void

Defined in

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