Selva Compute API Reference - v2.1.0
    Preparing search index...

    Interface MeasureTool

    A two-click distance measurement tool — the CAD verb users expect. Click a point, click a second, read the distance off a label on the connecting line; a third click starts a new measurement.

    Picking snaps to geometry so measurements are exact, not "wherever the ray happened to land": on a mesh hit we snap to the nearest vertex of the struck triangle if it's within MeasureOptions.snapPixels on screen, else use the raw hit point. This is a cheap local snap (three candidate vertices), no spatial index — enough for clean vertex-to-vertex measurement without the cost/complexity of full edge/midpoint snapping (a later refinement).

    The tool is dormant until MeasureTool.setEnabled(true). While enabled it intercepts clicks (the caller forwards them and swallows the event when MeasureTool.handleClick returns true) so measuring doesn't also select objects.

    interface MeasureTool {
        clear(): void;
        dispose(): void;
        handleClick(event: MouseEvent): boolean;
        handleMove(event: MouseEvent): void;
        isEnabled(): boolean;
        setEnabled(enabled: boolean): void;
    }
    Index

    Methods

    • Process pointer movement to preview the next snap point — a ghost marker tracks the cursor and jumps to the vertex a click would snap to, so users can aim before committing. No-op when the tool is disabled. The caller forwards mousemove; nothing is consumed.

      Parameters

      Returns void