OverlayManager
Table of contents
class OverlayManager {}Constructor
Constructs a new instance of the OverlayManager class
Parameters
| Name | Description |
|---|---|
|
Properties
editor
readonly editor: Editor;Methods
getActiveOverlayEntries( )
Reactive list of active overlay utils paired with the overlays they produced for the current editor state, in paint order (ascending zIndex). Both the hit-test and render paths read from this single cached scan instead of each re-deriving the active set. Active utils are included even when their getOverlays() returns an empty array, since render() may still draw non-interactive UI (e.g. the selection bounding box during brushing).
getActiveOverlayEntries(): TLOverlayEntry[];getCurrentOverlays( )
Reactively computed list of all currently active overlays, in paint order.
getCurrentOverlays(): TLOverlay[];getHoveredOverlay( )
getHoveredOverlay(): null | TLOverlay;getHoveredOverlayId( )
getHoveredOverlayId(): null | string;getOverlayAtPoint( )
Hit test all active overlays at a given page point. Returns the topmost overlay whose geometry contains the point, or null. Utils are walked from highest zIndex to lowest so the overlay painted on top also wins the hit test. Within a util, overlays are walked in array order: the first overlay whose geometry contains the point wins, so utils should place highest-priority overlays first in getOverlays. Interactive overlays (those with geometry) are checked; non-interactive are skipped.
Parameters
| Name | Description |
|---|---|
| Point in page coordinates |
| Hit test margin |
Returns
null | TLOverlay;getOverlayGeometry( )
Get hit-test geometry for an overlay, cached by overlay identity. Lets hit-testing on a pointermove storm skip the per-overlay geometry allocation that OverlayUtil.getGeometry would otherwise do on every call.
getOverlayGeometry(overlay: TLOverlay): Geometry2d | null;Parameters
| Name | Description |
|---|---|
|
Returns
Geometry2d | null;getOverlayUtil( )
Get an overlay util by type string, overlay instance, or by passing a util class as a generic parameter for type-safe lookup.
getOverlayUtil<T extends OverlayUtil>(
type: T extends OverlayUtil<infer O> ? O["type"] : string,
): T;Example
const util = editor.overlays.getOverlayUtil("brush");
const util = editor.overlays.getOverlayUtil<BrushOverlayUtil>("brush");
const util = editor.overlays.getOverlayUtil(myOverlay);Parameters
| Name | Description |
|---|---|
| |
Returns
T;getOverlayUtilsInZOrder( )
Returns all registered overlay utils in paint order (ascending zIndex). Utils with the same zIndex preserve their registration order.
getOverlayUtilsInZOrder(): OverlayUtil[];setHoveredOverlay( )
setHoveredOverlay(id: null | string): void;Parameters
| Name | Description |
|---|---|
| |
Returns
void;