I define my NumberController like:
const folder = gui.addFolder("elements");
folder.add(state, 'a', 0.1).min(0).step(0.1);
Keyboard arrow-up and arrow-down work correctly. However, mouse scrolling event increases and decreases the values by 5.3 😕 the same behaviour is experienced with a dofferent controller (the sliders) where keyboards change the value by 0.015 but mouse wheel changes the value by 0.0795 (also 5.3 times larger).
I noticed these lines when searching for the problem:
|
_normalizeMouseWheel( e ) { |
|
|
|
let { deltaX, deltaY } = e; |
|
|
|
// Safari and Chrome report weird non-integral values for a notched wheel, |
|
// but still expose actual lines scrolled via wheelDelta. Notched wheels |
|
// should behave the same way as arrow keys. |
|
if ( Math.floor( e.deltaY ) !== e.deltaY && e.wheelDelta ) { |
|
deltaX = 0; |
|
deltaY = -e.wheelDelta / 120; |
|
deltaY *= this._stepExplicit ? 1 : 10; |
|
} |
|
|
|
const wheel = deltaX + -deltaY; |
|
|
|
return wheel; |
|
|
|
} |
Maybe the magic 120 is wrongly hardcoded? But I can't even grasp my head around what the value would depend on...
I use Brave Browser:
Version 1.36.83 Chromium: 98.0.4758.87 (Official Build) beta (64-bit)
I define my
NumberControllerlike:Keyboard arrow-up and arrow-down work correctly. However, mouse scrolling event increases and decreases the values by 5.3 😕 the same behaviour is experienced with a dofferent controller (the sliders) where keyboards change the value by
0.015but mouse wheel changes the value by0.0795(also 5.3 times larger).I noticed these lines when searching for the problem:
lil-gui/src/NumberController.js
Lines 416 to 433 in d3c2bfd
Maybe the magic
120is wrongly hardcoded? But I can't even grasp my head around what the value would depend on...I use Brave Browser:
Version 1.36.83 Chromium: 98.0.4758.87 (Official Build) beta (64-bit)