Class: CrosshairManager
Defined in: CrosshairManager.ts:15
Manages a 3D crosshair (three orthogonal lines) that can be positioned at a vertex on a surface mesh. Supports selection and hover modes.
Constructors
Constructor
new CrosshairManager(requestRender): CrosshairManager;Defined in: CrosshairManager.ts:34
Parameters
requestRender
() => void
Returns
CrosshairManager
Properties
size
size: number = 1.5;Defined in: CrosshairManager.ts:20
color
color: number = 0xffcc00;Defined in: CrosshairManager.ts:21
surfaceId
surfaceId: string | null = null;Defined in: CrosshairManager.ts:22
vertexIndex
vertexIndex: number | null = null;Defined in: CrosshairManager.ts:23
visible
visible: boolean = false;Defined in: CrosshairManager.ts:24
mode
mode: CrosshairMode | null = null;Defined in: CrosshairManager.ts:25
hoverThrottleMs
hoverThrottleMs: number = 80;Defined in: CrosshairManager.ts:27
lastHoverUpdate
lastHoverUpdate: number = -Infinity;Defined in: CrosshairManager.ts:28
Methods
show()
show(
mesh,
surfaceId,
vertexIndex,
options?
): void;Defined in: CrosshairManager.ts:41
Show the crosshair at a specific vertex on a mesh.
Parameters
mesh
Mesh
surfaceId
string
vertexIndex
number
options?
Returns
void
hide()
hide(): void;Defined in: CrosshairManager.ts:83
Hide the crosshair and clear tracking state.
Returns
void
toggle()
toggle(
mesh,
surfaceId?,
vertexIndex?,
options?
): void;Defined in: CrosshairManager.ts:102
Toggle crosshair visibility. If hidden and a target is provided (or remembered from a previous show()), it will be re-shown.
Parameters
mesh
| Mesh<BufferGeometry<NormalBufferAttributes, BufferGeometryEventMap>, | Material<MaterialEventMap> | Material<MaterialEventMap>[], Object3DEventMap> | null
surfaceId?
string
vertexIndex?
number
options?
Returns
void
canHoverUpdate()
canHoverUpdate(): boolean;Defined in: CrosshairManager.ts:124
Returns true if a hover update is allowed (throttle has elapsed).
Returns
boolean
scheduleHoverUpdate()
scheduleHoverUpdate(run): void;Defined in: CrosshairManager.ts:138
Leading + trailing hover throttle. Runs run immediately when the throttle window has elapsed; otherwise remembers the latest run and invokes it once the window closes, so the final pointer position is never dropped. Pending work is discarded by cancelPendingHover and dispose.
Parameters
run
() => void
Returns
void
cancelPendingHover()
cancelPendingHover(): void;Defined in: CrosshairManager.ts:158
Drop a trailing hover update scheduled by scheduleHoverUpdate.
Returns
void
toStateJSON()
toStateJSON(): object;Defined in: CrosshairManager.ts:166
Returns
object
visible
visible: boolean;surfaceId
surfaceId: string | null;vertexIndex
vertexIndex: number | null;size
size: number;color
color: number;mode
mode: string | null;dispose()
dispose(): void;Defined in: CrosshairManager.ts:181
Dispose all GPU resources (geometries, material) and drop any pending trailing hover update.
Returns
void