Fix zoom callback on camera controls (#3924)

This commit is contained in:
Jonathan Tran
2024-09-19 17:26:27 -04:00
committed by GitHub
parent dabf256e2b
commit d8236dd8da
3 changed files with 39 additions and 15 deletions

View File

@ -6,7 +6,7 @@ const META =
PLATFORM === 'macos' ? 'Cmd' : PLATFORM === 'windows' ? 'Win' : 'Super'
const ALT = PLATFORM === 'macos' ? 'Option' : 'Alt'
const noModifiersPressed = (e: React.MouseEvent) =>
const noModifiersPressed = (e: MouseEvent) =>
!e.ctrlKey && !e.shiftKey && !e.altKey && !e.metaKey
export type CameraSystem =
@ -53,14 +53,14 @@ export function mouseControlsToCameraSystem(
interface MouseGuardHandler {
description: string
callback: (e: React.MouseEvent) => boolean
callback: (e: MouseEvent) => boolean
lenientDragStartButton?: number
}
interface MouseGuardZoomHandler {
description: string
dragCallback: (e: React.MouseEvent) => boolean
scrollCallback: (e: React.MouseEvent) => boolean
dragCallback: (e: MouseEvent) => boolean
scrollCallback: (e: WheelEvent) => boolean
lenientDragStartButton?: number
}
@ -70,7 +70,7 @@ export interface MouseGuard {
rotate: MouseGuardHandler
}
export const btnName = (e: React.MouseEvent) => ({
export const btnName = (e: MouseEvent) => ({
middle: !!(e.buttons & 4) || e.button === 1,
right: !!(e.buttons & 2) || e.button === 2,
left: !!(e.buttons & 1) || e.button === 0,