CollaboratorCursorOverlayUtil
Deprecated:
Collaborator cursors are no longer drawn to the overlay canvas, so this util is no longer part of defaultOverlayUtils. They render as DOM elements instead, customizable through the CollaboratorCursor editor component. To keep drawing cursors to the canvas, pass this util (or a subclass of it) to overlayUtils and set components={{ CollaboratorCursor: null }} so the DOM layer doesn't draw them a second time.
Table of contents
Extends OverlayUtil<TLCollaboratorCursorOverlay>.
Overlay util for collaborator cursors (arrow + name tag + chat message).
class CollaboratorCursorOverlayUtil extends OverlayUtil<TLCollaboratorCursorOverlay> {}Constructor
Constructs a new instance of the OverlayUtil class
Parameters
| Name | Description |
|---|---|
|
Properties
type
static type: string;editor
editor: Editor;options
options: {
chatMaxWidth: number;
fontSize: number;
nameMaxWidth: number;
zIndex: number;
};Methods
configure( )
Create a new overlay util class with the given options merged in.
static configure<T extends TLOverlayUtilConstructor<any>>(
this: T,
options: T extends new (...args: any[]) => {
options: infer Options;
}
? Partial<Options>
: never,
): T;Example
const MyBrush = BrushOverlayUtil.configure({ fill: "rgba(0,0,255,0.1)" });Parameters
| Name | Description |
|---|---|
| |
| |
Returns
T;dispose( )
Clean up any resources held by this overlay util.
dispose(): void;getCursor( )
Returns the cursor type to show when hovering this overlay.
getCursor(_overlay: T): TLCursorType | undefined;Parameters
| Name | Description |
|---|---|
| |
Returns
TLCursorType | undefined;getGeometry( )
Returns hit-test geometry for an overlay instance, in page coordinates. Return null for non-interactive overlays (e.g. snap indicators, scribbles).
getGeometry(_overlay: T): Geometry2d | null;Parameters
| Name | Description |
|---|---|
| |
Returns
Geometry2d | null;getOverlays( )
getOverlays(): TLCollaboratorCursorOverlay[];isActive( )
isActive(): boolean;onPointerDown( )
Called when the user points down on this overlay, before the default routing runs. Acts as an interrupt: define it to take over the event.
Return false to continue with the default behavior (e.g. the built-in rotate/resize handle transitions or shape-handle dispatch). Return true — or nothing at all — to skip the default. In other words, once you override this method you own the event unless you explicitly opt back in by returning false.
onPointerDown?(overlay: T, info: TLPointerEventInfo): boolean | void;Parameters
| Name | Description |
|---|---|
| |
|
Returns
boolean | void;render( )
render(
ctx: CanvasRenderingContext2D,
overlays: TLCollaboratorCursorOverlay[],
): void;Parameters
| Name | Description |
|---|---|
| |
|
Returns
void;renderMinimap( )
renderMinimap(
ctx: CanvasRenderingContext2D,
overlays: TLCollaboratorCursorOverlay[],
zoom: number,
): void;Parameters
| Name | Description |
|---|---|
| |
| |
| |
Returns
void;