Skip to content

Commit 8d64714

Browse files
committed
add scroll/dolly notes
1 parent 4c79aac commit 8d64714

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/moto/orbit.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -462,16 +462,18 @@ class Orbit extends EventDispatcher {
462462
slider(null);
463463

464464
// Normalize delta across browsers
465+
// Goal: scroll up = negative delta = zoom in, scroll down = positive delta = zoom out
465466
let delta = 0;
466467
if (event.wheelDelta !== undefined) {
467-
// Chrome/Safari use wheelDelta (positive = scroll up, zoom out)
468+
// Chrome/Safari wheelDelta: scroll up = +120, scroll down = -120
469+
// Negate to match deltaY convention
468470
delta = -event.wheelDelta;
469471
} else if (event.detail !== undefined) {
470-
// Old Firefox DOMMouseScroll uses detail
472+
// Old Firefox DOMMouseScroll detail: scroll up = -3, scroll down = +3
471473
delta = event.detail * 40; // Normalize to pixel values
472474
} else if (event.deltaY !== undefined) {
473-
// Modern browsers (including Firefox) use deltaY
474-
// Firefox can send deltas in different units (pixels, lines, pages)
475+
// Modern browsers deltaY: scroll up = negative, scroll down = positive
476+
// Already matches our convention
475477
delta = event.deltaY;
476478
// Firefox's deltaMode indicates the unit of deltaY
477479
// DOM_DELTA_PIXEL (0x00) - pixels

0 commit comments

Comments
 (0)