@mocanvas/mocanvas · class

SelectionForegroundOverlayUtil

declare class SelectionForegroundOverlayUtil extends OverlayUtil<Editor, SelectionForegroundOverlayUtilOptions>

Paints, and hit-tests, the selection box and its handles.


Methods · 6

getCursor(overlay: TLOverlay): string | undefined
getDisplayValues(): SelectionForegroundOverlayUtilDisplayValues

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

getGeometry(overlay: TLOverlay): Geometry2d | undefined

A square hit region round a handle, in **page** units — the space OverlayManager.getOverlayAtPoint tests in. The handle positions are viewport pixels, so they are converted here rather than at the source, which the SVG layer and the tools both want in viewport space.

The box outline itself has no geometry: a click on it is a click on the selection, and the select tool already owns that.

getOverlays(): TLSelectionForegroundOverlay[]

One record for the box, then one per handle.

The box comes first so that painting in order puts the handles on top of it, and hit testing in reverse lets a handle win over the box it sits on.

isActive(): boolean
render(ctx: CanvasRenderingContext2D): void

Everything here is painted in **screen** space, without the camera.

The handles are a fixed size in CSS pixels and the box is drawn round the selection's screen-space corners, so installing the camera would only mean dividing every number back out by the zoom again.


Properties · 3

static options: SelectionForegroundOverlayUtilOptions
static type: string
static zIndex: number

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.