1

How to normalize mouse wheel speed across browsers, in Dart?

There is a similar discussion for Javascript: Normalizing mousewheel speed across browsers

Assuming that Dart should provide uniform wheel readings automatically, I filled this ticket:

https://code.google.com/p/dart/issues/detail?id=18256

Meanwhile I am using this work-around:

int normalizeWheel(int dy) {
  if (dy.abs() < 100) {
    // Firefox: Nx3
    return dy * 100 ~/ 3;
  }
  if (dy % 120 == 0) {
    // IE: Nx120
    return dy * 100 ~/ 120;
  }
  if (dy % 100 == 0) {
    // Chrome, Opera: Nx100
    return dy;
  }
  return dy; // unknown browser
}

Please point out the Dart way to handle differences on mouse wheel speed across browsers.

Community
  • 1
  • 1
Everton
  • 12,589
  • 9
  • 47
  • 59

1 Answers1

1

You can do the same thing in Dart to "correct" this as in JavaScript; however it's very unlikely Dart will ever natively normalise these for you. Browsers have different behaviour and the user will be used to how their browser behaves; it does not make sense for them to see different scroll behaviour on different websites just because some use Dart.

Danny Tuppeny
  • 40,147
  • 24
  • 151
  • 275