Commit 3e45abd
fix(examples/pysdl2): scale mouse wheel by deviceScaleFactor for HiDPI
Switch from flat addition to multiplication for scroll deltas so that
scroll speed is correct on HiDPI displays:
- Use event.wheel.preciseX/Y (SDL >= 2.0.18) for smooth-scroll precision;
integer x/y truncates sub-pixel Wayland events to 0 causing phantom
40-px scrolls per sub-pixel event with the old adder approach
- Multiply delta by scrollEnhance * deviceScaleFactor — at 2× scaling
each notch sends 80 physical pixels matching native browser behaviour;
at 1× the factor is 1.0 so nothing changes
- y=0 events now correctly send 0px instead of ±scrollEnhance
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>1 parent 2aff2c9 commit 3e45abd
1 file changed
Lines changed: 18 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
156 | 156 | | |
157 | 157 | | |
158 | 158 | | |
159 | | - | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
160 | 163 | | |
161 | 164 | | |
162 | 165 | | |
| |||
370 | 373 | | |
371 | 374 | | |
372 | 375 | | |
373 | | - | |
374 | | - | |
375 | | - | |
376 | | - | |
377 | | - | |
378 | | - | |
379 | | - | |
380 | | - | |
381 | | - | |
382 | | - | |
383 | | - | |
384 | | - | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
385 | 390 | | |
386 | 391 | | |
387 | 392 | | |
| |||
0 commit comments