[Fix] Wheel bug (#2657)

This PR fixes a bug in the wheel event that added the container offset
to the pointer location.

![Kapture 2024-01-26 at 13 54
20](https://github.com/tldraw/tldraw/assets/23072548/20cdc0ed-4a43-4b11-9261-9e6aecfd3292)

### Change Type

- [x] `patch` — Bug fix

### Test Plan

1. start dragging
2. use the mousewheel / trackpad to move the camera

### Release Notes

- Fixed a bug with the mouse wheel effecting the pointer location when
the editor was not full screen
pull/2559/head^2
Steve Ruiz 2024-01-26 14:00:10 +00:00 zatwierdzone przez GitHub
rodzic 0d2fa6ae24
commit 6960acc559
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: B5690EEEBB952194
1 zmienionych plików z 1 dodań i 6 usunięć

Wyświetl plik

@ -116,16 +116,11 @@ export function useGestureEvents(ref: React.RefObject<HTMLDivElement>) {
if (delta.x === 0 && delta.y === 0) return
const container = editor.getContainer().getBoundingClientRect()
const info: TLWheelEventInfo = {
type: 'wheel',
name: 'wheel',
delta,
point: new Vec(event.clientX, event.clientY).sub({
x: container.left,
y: container.top,
}),
point: new Vec(event.clientX, event.clientY),
shiftKey: event.shiftKey,
altKey: event.altKey,
ctrlKey: event.metaKey || event.ctrlKey,