mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-04-14 16:40:58 -04:00
fix wheel zoom step (#771)
This commit is contained in:
parent
eee961d65f
commit
2d22ffda49
1 changed files with 8 additions and 1 deletions
|
@ -1985,8 +1985,15 @@ export class App extends React.Component<any, AppState> {
|
|||
const { deltaX, deltaY } = e;
|
||||
|
||||
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 }) => ({
|
||||
zoom: getNormalizedZoom(zoom - deltaY / 100),
|
||||
zoom: getNormalizedZoom(zoom - delta / 100),
|
||||
}));
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue