Conversation
Normalized defaultWheelDelta so that it returns the same scaling speed in Chrome/FF/Edge. IE is still slightly different.
|
My interpretation is that you are proposing two independent changes to the default wheel normalization behavior, so I’d like to disentangle these changes and discuss them separately. First, wheel vs. mousewheel. d3-zoom listens only to wheel events, which is the recommended standard: Line 73 in 6f8b119 event.wheelDeltaY is part of the deprecated mousewheel event. While Chrome and other browsers treat the deprecated mousewheel event as an alias for the wheel event and report the deprecated mousewheel properties on wheel events, we shouldn’t use deprecated fields in browsers that support recommended standards. (And even if we did want to use the deprecated wheelDeltaY, it probably doesn’t make sense to apply a multiplier derived from non-deprecated deltaMode.) Second, this changes the delta multiplier for DOM_DELTA_LINE (deltaMode = 1) from 120 to 40, and the multiplier for DOM_DELTA_PAGE (deltaMode = 2) from 120 to 800. Is that your intention, or was your primary intention just to favor the deprecated mousewheel event? If so, the new discrete multipliers seems reasonable, but I don’t have a discrete mouse to test on. |
|
Here is a list of the values of |
|
Merged as f21cdfd, then adjusted as 30d47e0 so that one “page” scroll corresponds to exactly one power-of-two zoom level, and one “line” scroll corresponds to 1/20th of a page. So, to summarize: For deltaMode = 0, the multiplier is still 0.002 (1 / 500). |
|
I see that this was solved by the new multipliers. I first thought I could just check for if (Math.abs(event.deltaY >= 102) {
// return a smaller value
}But (!) if I scroll quickly on an apple magic mouse or if I use a trackpad and scroll very fast, the delta value sometimes goes above I would be very glad for any ideas! |
Normalized defaultWheelDelta so that it returns the same scaling speed in Chrome/FF/Edge. IE is still slightly different. Works with all three
deltaModes(0=> Pixel,1=> Lines ,2=> Pages). Also usesevent.wheelDeltaYwhen possible (Chrome and Edge), because it returns the same value on both browsers, whileevent.deltaYvaries widely.Related: #100