-
Notifications
You must be signed in to change notification settings - Fork 173
/
Copy pathViroCommonProps.ts
126 lines (119 loc) · 3.34 KB
/
ViroCommonProps.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
import { ViroAnimation } from "../Animation/ViroAnimations";
import {
ViroAnchor,
ViroAnchorFoundMap,
ViroAnchorUpdatedMap,
ViroClickState,
ViroErrorEvent,
ViroPinchState,
ViroRotateState,
} from "../Types/ViroEvents";
import {
ViroPhysicsBody,
Viro3DPoint,
ViroRotation,
ViroScale,
ViroSource,
} from "../Types/ViroUtils";
import { NativeSyntheticEvent, ViewProps } from "react-native";
export type ViroCommonProps = ViewProps & {
target?: string;
pauseUpdates?: boolean;
renderingOrder?: number;
visible?: boolean;
opacity?: number;
ignoreEventHandling?: boolean;
dragType?:
| "FixedDistance"
| "FixedDistanceOrigin"
| "FixedToWorld"
| "FixedToPlane";
dragPlane?: {
planePoint: Viro3DPoint;
planeNormal: Viro3DPoint;
maxDistance: number;
};
onHover?: (
isHovering: boolean,
position: Viro3DPoint,
source: ViroSource
) => void;
onClick?: (position: Viro3DPoint, source: ViroSource) => void;
onClickState?: (
clickState: ViroClickState,
position: Viro3DPoint,
source: ViroSource
) => void;
onTouch?: (
touchState: any,
touchPos: Viro3DPoint,
source: ViroSource
) => void;
onScroll?: (scrollPos: Viro3DPoint, source: ViroSource) => void;
onSwipe?: (swipeState: any, source: ViroSource) => void;
onDrag?: (dragToPos: Viro3DPoint, source: ViroSource) => void;
onPinch?: (
pinchState: ViroPinchState,
scaleFactor: number,
source: ViroSource
) => void;
onRotate?: (
rotateState: ViroRotateState,
rotationFactor: number,
source: ViroSource
) => void;
onFuse?:
| { callback: (source: any) => void; timeToFuse?: number }
| ((source: any) => void);
onCollision?: (
viroTag: string,
collidedPoint: Viro3DPoint,
collidedNormal: Viro3DPoint
) => void;
viroTag?: string;
onAnchorFound?: (anchorFoundMap: ViroAnchorFoundMap) => void;
onAnchorUpdated?: (anchorUpdatedMap: ViroAnchorUpdatedMap) => void;
onAnchorRemoved?: ((event?: ViroAnchor) => void) | (() => void);
onError?: (event: NativeSyntheticEvent<ViroErrorEvent>) => void;
};
export type ViroObjectProps = {
position?: Viro3DPoint;
scale?: ViroScale;
rotation?: ViroRotation;
scalePivot?: Viro3DPoint;
rotationPivot?: Viro3DPoint;
renderingOrder?: number;
visible?: boolean;
opacity?: number;
width?: number;
height?: number;
length?: number;
materials?: ViroSource[] | string | string[];
animation?: ViroAnimation;
transformBehaviors?: string | string[];
lightReceivingBitMask?: number;
shadowCastingBitMask?: number;
onTransformUpdate?: (position: Viro3DPoint) => void;
/**
* Enables high accuracy event collision checks for this object.
* This can be useful for complex 3D objects where the default
* checking method of bounding boxes do not provide adequate
* collision detection coverage.
*
* NOTE: Enabling high accuracy event collision checks has a high
* performance cost and should be used sparingly / only when
* necessary.
*
* Flag is set to false by default.
*/
highAccuracyEvents?: boolean;
/**
* DEPRECATION WARNING - highAccuracyGaze has been deprecated, please use highAccuracyEvents instead
* @deprecated
*/
highAccuracyGaze?: boolean;
physicsBody?: ViroPhysicsBody;
onCollision?: () => void;
onAnimationStartViro?: () => void;
onAnimationFinishViro?: () => void;
};