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

Properties

canvas

canvas: HTMLCanvasElement

Defined in

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


ctx

ctx: CanvasRenderingContext2D

Defined in

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


elementRenderers

elementRenderers: Record<string, ElementRenderer>

Defined in

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


grid

grid: GridManager

Defined in

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


layerManager

layerManager: LayerManager

Defined in

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


provider

provider: Partial<EnvProvider>

Defined in

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


stackingCanvasUpdated

stackingCanvasUpdated: Slot<object>

Type declaration

added

added: HTMLCanvasElement[]

canvases

canvases: HTMLCanvasElement[]

removed

removed: HTMLCanvasElement[]

Defined in

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


viewport

viewport: Viewport

Defined in

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

Accessors

stackingCanvas

get stackingCanvas(): HTMLCanvasElement[]

Returns

HTMLCanvasElement[]

Defined in

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

Methods

addOverlay()

addOverlay(overlay): void

Parameters

overlay: Overlay

Returns

void

Defined in

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


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


dispose()

dispose(): void

Returns

void

Defined in

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


generateColorProperty()

generateColorProperty(color, fallback): string

Parameters

color: Color

fallback: string

Returns

string

Defined in

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


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


getColorScheme()

getColorScheme(): ColorScheme

Returns

ColorScheme

Defined in

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


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


getPropertyValue()

getPropertyValue(property): string

Parameters

property: string

Returns

string

Defined in

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


refresh()

refresh(): void

Returns

void

Defined in

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


removeOverlay()

removeOverlay(overlay): void

Parameters

overlay: Overlay

Returns

void

Defined in

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