Skip to content

Commit 2f1444e

Browse files
authored
Merge pull request #236 from eposha/fix/zoom-precision
fix: increase zoom precision from 0.01 to 0.001
2 parents 9e21875 + aa0c4cf commit 2f1444e

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

.changeset/rotten-rocks-kneel.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@embedpdf/plugin-zoom': patch
3+
---
4+
5+
Increase zoom precision from two decimals to three (changed rounding from `/100` to `/1000`) to improve smoother zoom granularity and reduce jumpy transitions.

packages/plugin-zoom/src/lib/zoom-plugin.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ export class ZoomPlugin extends BasePlugin<
198198
return;
199199
}
200200
const exactZoom = clamp(base + delta, this.minZoom, this.maxZoom);
201-
const newZoom = Math.floor(exactZoom * 100) / 100;
201+
const newZoom = Math.floor(exactZoom * 1000) / 1000;
202202

203203
/* ------------------------------------------------------------------ */
204204
/* step 2 – figure out the viewport point we should keep under focus */

0 commit comments

Comments
 (0)