fix wheel zoom step (#771)

This commit is contained in:
David Luzar 2020-02-16 16:23:56 +01:00 committed by GitHub
parent eee961d65f
commit 2d22ffda49
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1985,8 +1985,15 @@ export class App extends React.Component<any, AppState> {
const { deltaX, deltaY } = e; const { deltaX, deltaY } = e;
if (e[KEYS.META]) { if (e[KEYS.META]) {
const sign = Math.sign(deltaY);
const MAX_STEP = 10;
let delta = Math.abs(deltaY);
if (delta > MAX_STEP) {
delta = MAX_STEP;
}
delta *= sign;
this.setState(({ zoom }) => ({ this.setState(({ zoom }) => ({
zoom: getNormalizedZoom(zoom - deltaY / 100), zoom: getNormalizedZoom(zoom - delta / 100),
})); }));
return; return;
} }