Skip to content

WasmGPU.createAnnotation.toolkit().selectionProbe

Summary

WasmGPU.createAnnotation.toolkit().selectionProbe returns the latest selection readout snapshot. It extends probe data with annotation linkage fields when a marker glyph instance is selected.

Syntax

WasmGPU.createAnnotation.toolkit().selectionProbe: AnnotationSelectionReadout
const probe = toolkit.selectionProbe;

Parameters

This accessor does not take parameters.

Returns

AnnotationSelectionReadout - Latest selection probe payload.

Type Details

type AnnotationSelectionReadout = {
    hit: boolean;
    kind: "mesh" | "pointcloud" | "glyphfield" | null;
    objectId: number | null;
    elementIndex: number | null;
    worldPosition: [number, number, number] | null;
    ndIndex: number[] | null;
    attributes: PickAttributes | null;
    annotationId: string | null;
    annotationKind: "marker" | "distance" | "angle" | null;
    anchorRole: "marker" | "start" | "end" | "a" | "b" | "c" | null;
};

Example

const canvas = document.querySelector("canvas");
const wgpu = await WasmGPU.create(canvas);
const scene = wgpu.createScene();
const camera = wgpu.createCamera.perspective({ fov: 55, aspect: canvas.clientWidth / canvas.clientHeight, near: 0.1, far: 1000 });
const toolkit = wgpu.createAnnotation.toolkit({ scene, camera, canvas });

await toolkit.pickAtAndCommit(140, 90);
console.log(toolkit.selectionProbe);

See Also