Why is WheelDelta = 120?

前端 未结 4 1227
無奈伤痛
無奈伤痛 2021-02-13 21:09

I\'m working with mouse events, specifically OnMouseWheel. Many code samples refer to distance the view changes (or zoom f.i. in 3D application) as Distance =

4条回答
  •  甜味超标
    2021-02-13 21:49

    As you have noticed laptop Touchpads can scroll (either two-finger or scroll zone on right hand size), in which case there can be lots of events with very small wheelDelta values (either needing integration, or perhaps timeouts to prevent too many redraws).

    Also different OS's or configurations or devices can have different meanings for scrolling - pixels, lines, or pages. e.g. DOM event.deltaMode

    Finally some devices (mice and touchpads) also allow horizontal scrolling.

    The above is more specific to browser DOM events, but the same issues may apply to Win events too.

    Edit:

    From the Firefox MDN docs there are three events you are probably interested in: WM_MOUSEWHEEL, WM_MOUSEHWHEEL, and WM_GESTURE (panning on touch devices).

    A search of the Mozilla Bugzilla database shows a variety of problems with some Symantics and ALPS touch drivers sending WM_VSCROLL instead of WM_MOUSEWHEEL (may be relevant if supporting touchpads).

    If you want horizontal mouse scrolling support, this article from a flash dev says: [mousewheel support] was added in Vista so if you are using XP or 2000 you need IntelliType Pro and/or IntelliPoint installed for WM_MOUSEHWHEEL support.

    @Krom: more speculations and loose facts but maybe useful to others :-)

提交回复
热议问题