Skip to content

Commit

Permalink
fix: 🐛 inaccurate calculation in target scale (#367)
Browse files Browse the repository at this point in the history
  • Loading branch information
imtrent authored Apr 11, 2023
1 parent 72fd37e commit e8117f6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/core/handlers/handlers.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const handleCalculateButtonZoom = (
throw new Error("Wrapper is not mounted");
}

const targetScale = scale * Math.exp(delta * step);
const targetScale = scale + delta * step;

const newScale = checkZoomBounds(
roundNumber(targetScale, 3),
Expand Down
2 changes: 1 addition & 1 deletion src/core/wheel/wheel.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export const handleCalculateWheelZoom = (
throw new Error("Wrapper is not mounted");
}

const targetScale = scale + delta * (scale - scale * step) * step;
const targetScale = scale + delta * step;

if (getTarget) return targetScale;
const paddingEnabled = disable ? false : !disabled;
Expand Down

0 comments on commit e8117f6

Please sign in to comment.