aboutsummaryrefslogtreecommitdiff
path: root/src/gui/ScrollablePage.cpp
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2024-12-14 17:53:30 +0100
committerdec05eba <dec05eba@protonmail.com>2024-12-14 17:53:30 +0100
commitfed42ee511e387bf1e30d50cf3f327130ae1d131 (patch)
treef8251b389e1cb3539571ba556ab4be81def596d5 /src/gui/ScrollablePage.cpp
parent846d3c4e813ecd981f4834ca5aca14d98f4e9fdf (diff)
Fix regression in ui event handling in scrollable page
Diffstat (limited to 'src/gui/ScrollablePage.cpp')
-rw-r--r--src/gui/ScrollablePage.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/gui/ScrollablePage.cpp b/src/gui/ScrollablePage.cpp
index 6b3116b..94da907 100644
--- a/src/gui/ScrollablePage.cpp
+++ b/src/gui/ScrollablePage.cpp
@@ -19,18 +19,20 @@ namespace gsr {
if(!visible)
return true;
- offset = position + offset + mgl::vec2f(0.0f, scroll_y);
- Widget *selected_widget = selected_child_widget;
+ offset = position + offset;
const mgl::vec2f content_size = get_inner_size();
const mgl::vec2i scissor_pos(offset.x, offset.y);
const mgl::vec2i scissor_size(content_size.x, content_size.y);
+ offset.y += scroll_y;
+ Widget *selected_widget = selected_child_widget;
+
if(event.type == mgl::Event::MouseButtonPressed || event.type == mgl::Event::MouseButtonReleased) {
- if(!mgl::IntRect(scissor_pos, scissor_pos).contains({event.mouse_button.x, event.mouse_button.y}))
+ if(!mgl::IntRect(scissor_pos, scissor_size).contains({event.mouse_button.x, event.mouse_button.y}))
return true;
} else if(event.type == mgl::Event::MouseMoved) {
- if(!mgl::IntRect(scissor_pos, scissor_pos).contains({event.mouse_move.x, event.mouse_move.y}))
+ if(!mgl::IntRect(scissor_pos, scissor_size).contains({event.mouse_move.x, event.mouse_move.y}))
return true;
}