-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathevents.d.ts
164 lines (151 loc) · 3.69 KB
/
events.d.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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
/**
* A class that extends {@link Event | `Event`}.
*/
export interface RemoteEvent extends Event {
readonly detail: {
/**
* The unique numeric id of the connection that sent the event.
*/
readonly connectionId: number;
};
}
export interface ConnectionEvent extends RemoteEvent {
readonly type: "disconnected" | "connected";
}
/**
* Received when a user interacts with an m-interaction.
*/
export interface MMLInteractionEvent extends RemoteEvent {
readonly type: "interact";
}
/**
* Received when a user triggers a prompt with a value.
*/
export interface MMLPromptEvent extends RemoteEvent {
readonly type: "prompt";
readonly detail: {
/**
* The value of the prompt.
*/
readonly value: string;
} & RemoteEvent["detail"];
}
/**
* Received when a user clicks on a 3D object.
*/
export interface MMLClickEvent extends RemoteEvent {
readonly type: "click";
readonly detail: {
/**
* The position of the click relative to the element's origin
*/
readonly position: {
x: number;
y: number;
z: number;
};
} & RemoteEvent["detail"];
}
type PositionAndRotation = {
/**
* The position as x, y, and z coordinates.
*/
position: {
x: number;
y: number;
z: number;
};
/**
* The rotation as Euler XYZ-ordered angles in degrees.
*/
rotation: {
x: number;
y: number;
z: number;
};
};
/**
* Received when a user enters the range of an m-position-probe.
*/
export interface MMLPositionEnterEvent extends RemoteEvent {
readonly type: "positionenter";
readonly detail: {
/**
* The location of the user relative to the target element.
*/
readonly elementRelative: PositionAndRotation;
/**
* The location of the user relative to the target element.
*/
readonly documentRelative: PositionAndRotation;
} & RemoteEvent["detail"];
}
/**
* Received when a user moves after having entered the range of an m-position-probe.
*/
export interface MMLPositionMoveEvent extends RemoteEvent {
readonly type: "positionmove";
readonly detail: {
/**
* The location of the user relative to the target element.
*/
readonly elementRelative: PositionAndRotation;
/**
* The location of the user relative to the target element.
*/
readonly documentRelative: PositionAndRotation;
} & RemoteEvent["detail"];
}
/**
* Received when a user leaves the range of an m-position-probe after having entered.
*/
export interface MMLPositionLeaveEvent extends RemoteEvent {
readonly type: "positionleave";
}
/**
* Received when a user starts colliding with an element.
*/
export interface MMLCollisionStartEvent extends RemoteEvent {
readonly type: "collisionstart";
readonly detail: {
/**
* The position of the collision relative to the element's origin
*/
readonly position: {
x: number;
y: number;
z: number;
};
} & RemoteEvent["detail"];
}
/**
* Received when a user moves the collision point they are colliding at on an element.
*/
export interface MMLCollisionMoveEvent extends RemoteEvent {
readonly type: "collisionmove";
readonly detail: {
/**
* The position of the collision relative to the element's origin
*/
readonly position: {
x: number;
y: number;
z: number;
};
} & RemoteEvent["detail"];
}
/**
* Received when a user stops colliding with an element.
*/
export interface MMLCollisionEndEvent extends RemoteEvent {
readonly type: "collisionend";
}
export interface MMLChatEvent extends RemoteEvent {
readonly type: "chat";
readonly detail: {
/**
* The contents of the chat message.
*/
readonly message: string;
} & RemoteEvent["detail"];
}