fix: windows zoom (#190)

Co-authored-by: JimmFly <yangjinfei001@gmail.com>
This commit is contained in:
JimmFly 2022-08-11 15:48:51 +08:00 committed by GitHub
parent 7c15f704e0
commit b4724f3ae0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4075,7 +4075,12 @@ export class TldrawApp extends StateManager<TDSnapshot> {
onZoom: TLWheelEventHandler = (info, e) => {
if (this.state.appState.status !== TDStatus.Idle) return;
const delta = info.delta[2] / 50;
// Normalize zoom scroll
// Fix https://github.com/toeverything/AFFiNE/issues/135
const delta =
Math.abs(info.delta[2]) > 10
? 0.2 * Math.sign(info.delta[2])
: info.delta[2] / 50;
this.zoomBy(delta, info.point);
this.onPointerMove(info, e as unknown as React.PointerEvent);
};