Skip to content

PointCloud.onVisualChange

Summary

PointCloud.onVisualChange registers a listener for visual-state changes and returns an unsubscribe callback.

Syntax

PointCloud.onVisualChange(listener: (kind: PointCloudVisualChangeKind) => void): () => void
const result = pointCloud.onVisualChange(listener);

Parameters

Name Type Required Description
listener (kind: PointCloudVisualChangeKind) => void Yes Callback invoked when visual-relevant state changes.

Returns

() => void - Function that unsubscribes or unregisters the listener created by this call.

Type Details

PointCloudVisualChangeKind

type PointCloudVisualChangeKind = "scale" | "colormap" | "visual";

Example

const canvas = document.querySelector("canvas");
const wgpu = await WasmGPU.create(canvas);

const pointCloud = wgpu.createPointCloud({ data: new Float32Array([0, 0, 0, 0.1, 1, 0, 0, 0.8]), scaleTransform: { mode: "linear", domainMin: 0, domainMax: 1 } });
const listener = (kind) => console.log(kind);
const result = pointCloud.onVisualChange(listener);
console.log(result);

See Also