From 3f5325f59ba7f8552d093fdafd9674b713f3cad9 Mon Sep 17 00:00:00 2001 From: Akshay Nair Date: Sun, 20 Apr 2025 22:57:32 +0530 Subject: Add scrolling controls --- src/WindowActionRouter.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/WindowActionRouter.cpp') diff --git a/src/WindowActionRouter.cpp b/src/WindowActionRouter.cpp index 2eabc94..721a3e7 100644 --- a/src/WindowActionRouter.cpp +++ b/src/WindowActionRouter.cpp @@ -77,6 +77,21 @@ void WindowActionRouter::initialize(Configuration *config) { WITH_WEBVIEW_WINDOW(webview_id, window, { win_match.second->mediator()->open_devtools(webview_id); }) }); + + // Scroll + connect(&runtime, &LuaRuntime::webview_scroll_requested, this, + [this](WebViewId webview_id, int deltax, int deltay) { + WITH_WEBVIEW_WINDOW(webview_id, window, + { window->mediator()->scroll(webview_id, deltax, deltay); }); + }); + connect(&runtime, &LuaRuntime::webview_scroll_top_requested, this, [this](WebViewId webview_id) { + WITH_WEBVIEW_WINDOW(webview_id, window, { window->mediator()->scroll_to_top(webview_id); }); + }); + connect(&runtime, &LuaRuntime::webview_scroll_bottom_requested, this, + [this](WebViewId webview_id) { + WITH_WEBVIEW_WINDOW(webview_id, window, + { window->mediator()->scroll_to_bottom(webview_id); }); + }); } void WindowActionRouter::find_current_search_text(WebViewId webview_id, bool forward) { -- cgit v1.3.1