Skip to content

Commit

Permalink
fix #324: forwarding wheel event
Browse files Browse the repository at this point in the history
  • Loading branch information
bbohlender committed Aug 8, 2024
1 parent 328c422 commit 3e0db38
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
22 changes: 18 additions & 4 deletions packages/pointer-events/src/event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,8 @@ export class PointerEvent<E extends NativeEvent = globalThis.PointerEvent>
public readonly type: keyof PointerEventsMap,
public readonly bubbles: boolean,
public readonly nativeEvent: E,
private pointer: Pointer,
private readonly intersection: Intersection,
protected pointer: Pointer,
protected readonly intersection: Intersection,
public readonly currentObject: Object3D = intersection.object,
public readonly object: Object3D = currentObject,
) {}
Expand Down Expand Up @@ -169,8 +169,22 @@ export class WheelEvent extends PointerEvent<NativeWheelEvent> {
return this.nativeEvent.deltaZ
}

constructor(nativeEvent: NativeWheelEvent, pointer: Pointer, intersection: Intersection) {
super('wheel', true, nativeEvent, pointer, intersection)
constructor(
nativeEvent: NativeWheelEvent,
pointer: Pointer,
intersection: Intersection,
currentObject?: Object3D,
object?: Object3D,
) {
super('wheel', true, nativeEvent, pointer, intersection, currentObject, object)
}

/**
* for internal use
*/
retarget(currentObject: Object3D) {
const { type, bubbles, nativeEvent, pointer, intersection, target } = this
return new WheelEvent(nativeEvent, pointer, intersection, currentObject, target)
}
}

Expand Down
2 changes: 1 addition & 1 deletion packages/pointer-events/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ export {
type NativeWheelEvent,
type PointerEventsHandlers,
type PointerEventsMap,
type WheelEvent,
type NativeEvent,
WheelEvent,
PointerEvent,
} from './event.js'
export * from './intersections/index.js'
Expand Down

0 comments on commit 3e0db38

Please sign in to comment.