@mocanvas/mocanvas · class

BaseBrushOverlayUtil

declare abstract class BaseBrushOverlayUtil<T extends TLBrushOverlay | TLZoomBrushOverlay> extends OverlayUtil<Editor, BrushOverlayUtilOptions>

The half a brush painter shares with the other one: read a rectangle off the instance record, name it, stroke it in page space.

Generic in its overlay record so the two concrete utils can each declare their own — a caller that asked editor.overlays.getOverlayUtil("zoomBrush") for its overlays gets TLZoomBrushOverlay[], not the union.


Methods · 6

protected abstract getBrushBounds(): OverlayBox | null

The brush rectangle, or null when no drag is in flight.

getDisplayValues(): BrushOverlayUtilDisplayValues

The colours to draw with, read fresh from the theme on every frame.

getGeometry(): Geometry2d | undefined

A brush is not pointable — it *is* the pointer gesture. Returning the rectangle would make the brush swallow the drag that draws it.

abstract getOverlays(): T[]
isActive(): boolean
render(ctx: CanvasRenderingContext2D): void

mocanvas is built by Symbio. Free for non-commercial, non-profit and development use; commercial use needs an agreement. Not affiliated with or endorsed by tldraw.