Skip to content

Commit

Permalink
Reduce scroll multiplier (#314)
Browse files Browse the repository at this point in the history
  • Loading branch information
jnschulze authored Oct 8, 2024
1 parent c172880 commit 8554bb4
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions windows/webview.cc
Original file line number Diff line number Diff line change
Expand Up @@ -631,8 +631,18 @@ void Webview::SetPointerButtonState(WebviewPointerButton button, bool is_down) {
}

void Webview::SendScroll(double delta, bool horizontal) {
// delta * 6 gives me a multiple of WHEEL_DELTA (120)
constexpr auto kScrollMultiplier = 6;
// clang-format off
//
// TODO:
// Using a fixed value here is certainly wrong. Flutter's calculation in flutter_window.cc
// needs to be inverted to get back the "native" value. See
// - https://github.com/flutter/engine/blob/82c1dfcf588c2669ca391134910d634ca31fddf1/shell/platform/windows/flutter_window.cc#L416-L426
// Related:
// - https://source.chromium.org/chromium/chromium/src/+/main:ui/events/blink/web_input_event_builders_win.cc
// - https://github.com/flutter/flutter/issues/107248
//
// clang-format on
constexpr auto kScrollMultiplier = 1.5;

auto offset = static_cast<short>(delta * kScrollMultiplier);

Expand Down

0 comments on commit 8554bb4

Please sign in to comment.