-
Notifications
You must be signed in to change notification settings - Fork 19
Open
Labels
help wantedExtra attention is neededExtra attention is needednextIssues related to next pre-releaseIssues related to next pre-release
Description
Currently the next-branch passes a very minimal event-object around. For each canvas-event there is a single event-object that is passed to each individual handler:
const createThreeEvent = <TEvent extends MouseEvent | PointerEvent | WheelEvent>(
nativeEvent: TEvent,
): S3.Event<TEvent> => {
const event = {
...nativeEvent,
nativeEvent,
stopped: false,
stopPropagation: () => (event.stopped = true),
};
return event;
};react-three-fiber on the other hand passes an individual object for each event-handler containing the following event-data see:
{
...DomEvent // All the original event data
...Intersection // All of Three's intersection data - see note 2
intersections: Intersection[] // The first intersection of each intersected object
object: Object3D // The object that was actually hit
eventObject: Object3D // The object that registered the event
unprojectedPoint: Vector3 // Camera-unprojected point
ray: Ray // The ray that was used to strike the object
camera: Camera // The camera that was used in the raycaster
sourceEvent: DomEvent // A reference to the host event
delta: number // Distance between mouse down and mouse up event in pixels
}I didn't feel super comfortable back when I made this decision to (potentially) create so many objects on-the-fly, but maybe it's worth to follow r3f here because I assume event-handlers is where most usercode will be.
gleamish
Metadata
Metadata
Assignees
Labels
help wantedExtra attention is neededExtra attention is needednextIssues related to next pre-releaseIssues related to next pre-release