Skip to content

Commit cd60d58

Browse files
authored
Merge pull request Gnathonic#245 from Gnathonic/fix/wheel-zoom-tuning
fix: Tune wheel zoom speed and Firefox normalization
2 parents b262a31 + e763a12 commit cd60d58

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/lib/panzoom/util.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export function initPanzoom(node: HTMLElement) {
6363
if (shouldZoom) {
6464
// Normalize wheel delta to pixels across browsers (based on Facebook's normalize-wheel)
6565
// https://github.com/basilfx/normalize-wheel
66-
const LINE_HEIGHT = 40; // Approximate pixels per line
66+
const LINE_HEIGHT = 25; // Tuned to match Chrome's zoom steps
6767
const PAGE_HEIGHT = 800; // Approximate pixels per page
6868
let pixelDelta: number;
6969
if (e.deltaMode === 1) {
@@ -79,7 +79,7 @@ export function initPanzoom(node: HTMLElement) {
7979

8080
// Calculate zoom multiplier (based on anvaka/panzoom approach)
8181
// speed * delta / 128, capped at 0.25 (25% max per event)
82-
const zoomSpeed = 0.065;
82+
const zoomSpeed = 0.2;
8383
const sign = Math.sign(pixelDelta);
8484
const deltaAdjustedSpeed = Math.min(0.25, Math.abs((zoomSpeed * pixelDelta) / 128));
8585
let scaleMultiplier = 1 - sign * deltaAdjustedSpeed;

0 commit comments

Comments
 (0)