mirror of
https://repo.dec05eba.com/gpu-screen-recorder-ui
synced 2026-05-05 06:20:44 +09:00
Fix mouse events received for scrollablepage child widgets when mouse is outside scrollablepage area
This commit is contained in:
2
TODO
2
TODO
@@ -106,3 +106,5 @@ Use global shortcuts desktop portal protocol on wayland when available.
|
||||
When support for window capture is enabled on x11 then make sure to not save the window except temporary while the program is open.
|
||||
|
||||
Support CJK.
|
||||
|
||||
Move ui hover code from ::draw to ::on_event, to properly handle widget event stack.
|
||||
@@ -20,7 +20,7 @@ namespace gsr {
|
||||
mgl_scissor prev_scissor;
|
||||
mgl_window_get_scissor(window.internal_window(), &prev_scissor);
|
||||
|
||||
mgl_scissor new_scissor = {
|
||||
const mgl_scissor new_scissor = {
|
||||
mgl_vec2i{(int)draw_pos.x, (int)draw_pos.y},
|
||||
mgl_vec2i{(int)size.x, (int)size.y}
|
||||
};
|
||||
|
||||
@@ -106,7 +106,7 @@ namespace gsr {
|
||||
mgl_window_get_scissor(window.internal_window(), &prev_scissor);
|
||||
|
||||
const mgl::vec2f inner_size = get_inner_size();
|
||||
mgl_scissor new_scissor = {
|
||||
const mgl_scissor new_scissor = {
|
||||
mgl_vec2i{(int)position.x, (int)position.y},
|
||||
mgl_vec2i{(int)inner_size.x, (int)inner_size.y}
|
||||
};
|
||||
|
||||
@@ -22,6 +22,18 @@ namespace gsr {
|
||||
offset = position + offset + mgl::vec2f(0.0f, scroll_y);
|
||||
Widget *selected_widget = selected_child_widget;
|
||||
|
||||
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);
|
||||
|
||||
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}))
|
||||
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}))
|
||||
return true;
|
||||
}
|
||||
|
||||
if(event.type == mgl::Event::MouseButtonReleased && moving_scrollbar_with_cursor) {
|
||||
moving_scrollbar_with_cursor = false;
|
||||
remove_widget_as_selected_in_parent();
|
||||
@@ -79,7 +91,7 @@ namespace gsr {
|
||||
mgl_window_get_scissor(window.internal_window(), &prev_scissor);
|
||||
|
||||
const mgl::vec2f content_size = get_inner_size();
|
||||
mgl_scissor new_scissor = {
|
||||
const mgl_scissor new_scissor = {
|
||||
mgl_vec2i{(int)offset.x, (int)offset.y},
|
||||
mgl_vec2i{(int)content_size.x, (int)content_size.y}
|
||||
};
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace gsr {
|
||||
mgl_scissor prev_scissor;
|
||||
mgl_window_get_scissor(window.internal_window(), &prev_scissor);
|
||||
|
||||
mgl_scissor new_scissor = {
|
||||
const mgl_scissor new_scissor = {
|
||||
mgl_vec2i{(int)draw_pos.x, (int)draw_pos.y},
|
||||
mgl_vec2i{(int)size.x, (int)size.y}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user