@playcanvas/react
Version:
A React renderer for PlayCanvas – build interactive 3D applications using React's declarative paradigm.
44 lines (43 loc) • 1.26 kB
TypeScript
import { CameraComponent, GraphNode } from "playcanvas";
/**
* A gizmo component that allows you to manipulate the nodes in the scene.
* @param props - The props for the gizmo.
* @param props.camera - The camera component to use for the gizmo.
* @param props.nodes - The nodes to attach the gizmo to.
* @param props.mode - The mode of the gizmo.
* @param props.onCommit - The function to call when the gizmo is committed.
* @returns A gizmo component.
*
* @example
* ```tsx
* <Gizmo camera={camera} nodes={nodes} mode="rotate" onCommit={onCommit} />
* ```
*/
export declare function Gizmo({ camera, nodes, mode, onCommit }: Props): null;
type Mode = "rotate" | "scale" | "translate";
type EntityProps = {
id: string;
name: string;
position: [number, number, number];
rotation: [number, number, number];
scale: [number, number, number];
};
type Props = {
/**
* The camera component to use for the gizmo.
*/
camera: CameraComponent;
/**
* The nodes to attach the gizmo to.
*/
nodes: GraphNode[];
/**
* The mode of the gizmo.
*/
mode: Mode;
/**
* The function to call when the gizmo is committed.
*/
onCommit: (props: EntityProps[]) => void;
};
export {};