@saitonakamura/react-three-flex
Version:
`<Flex />` component for the 3D World.
29 lines (28 loc) • 1.52 kB
TypeScript
import { Box3, Object3D, Vector3 } from 'three';
import { YogaNode } from 'yoga-layout-prebuilt';
import { R3FlexProps, FlexPlane } from './props';
export declare const capitalize: (s: string) => string;
export declare const jsxPropToYogaProp: (s: string) => string;
export declare const setYogaProperties: (node: YogaNode, props: R3FlexProps, scaleFactor: number) => void;
export declare const vectorFromObject: ({ x, y, z }: {
x: number;
y: number;
z: number;
}) => Vector3;
export declare type Axis = 'x' | 'y' | 'z';
export declare const axes: Axis[];
export declare function getDepthAxis(plane: FlexPlane): "x" | "y" | "z";
export declare function getFlex2DSize(sizes: [number, number, number], plane: FlexPlane): number[];
export declare const rmUndefFromObj: (obj: Record<string, any>) => void;
/**
* Adapted code from https://github.com/mrdoob/three.js/issues/11967
* Calculates oriented bounding box size
* Essentially it negates flex root rotation to provide proper number
* E.g. if root flex group rotatet 45 degress, a cube box of size 1 will report sizes of sqrt(2)
* but it should still be 1
*
* NB: This doesn't work when object itself is rotated (well, for now)
*/
export declare const getOBBSize: (object: THREE.Object3D, bb: THREE.Box3, size: THREE.Vector3) => void;
/** @returns [mainAxisShift, crossAxisShift] */
export declare const getRootShift: (rootCenterAnchor: boolean | undefined, rootWidth: number, rootHeight: number, node: YogaNode) => number[] | readonly [number, number];