jnschulze / flutter-webview-windows

A WebView2-powered Flutter WebView implementation for the Windows platform.
BSD 3-Clause "New" or "Revised" License
203 stars 120 forks source link

Webview Scroll Event #250

Open njuptzwt opened 1 year ago

njuptzwt commented 1 year ago

Webview send scroll event.

why the point must be(0,0), when I change it to last_cursorpos, it doesn't work, and this is the reason why scroll elements in pages doesn't work??

void Webview::SendScroll(double delta, bool horizontal) { // delta * 6 gives me a multiple of WHEEL_DELTA (120) constexpr auto kScrollMultiplier = 6;

auto offset = static_cast(delta * kScrollMultiplier);

  **POINT point;
  point.x = 0;
  point.y = 0;**

if (horizontal) { compositioncontroller->SendMouseInput( COREWEBVIEW2_MOUSE_EVENT_KIND_HORIZONTAL_WHEEL, virtualkeys.state(), offset, point); } else { compositioncontroller->SendMouseInput(COREWEBVIEW2_MOUSE_EVENT_KIND_WHEEL, virtualkeys.state(), offset, point); } }