aboutsummaryrefslogtreecommitdiff
path: root/src/gui/DropdownButton.cpp
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2024-08-01 22:41:07 +0200
committerdec05eba <dec05eba@protonmail.com>2024-08-01 22:41:07 +0200
commitbe0ad41e745c3e6177d1159e25f7d23e45b02738 (patch)
treec1845a43e3b3c67c9fadc067f2ff851e668b4213 /src/gui/DropdownButton.cpp
parent10a5669330ba978c37d984a312ba1de7a2542503 (diff)
Use scissor for pages
Diffstat (limited to 'src/gui/DropdownButton.cpp')
-rw-r--r--src/gui/DropdownButton.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/gui/DropdownButton.cpp b/src/gui/DropdownButton.cpp
index ecc284a..bfda834 100644
--- a/src/gui/DropdownButton.cpp
+++ b/src/gui/DropdownButton.cpp
@@ -38,8 +38,13 @@ namespace gsr {
} else if(event.type == mgl::Event::MouseButtonPressed) {
const bool clicked_inside = mouse_inside;
show_dropdown = clicked_inside;
- if(on_click && mouse_inside_item >= 0 && mouse_inside_item < (int)items.size())
- on_click(items[mouse_inside_item].id);
+ if(show_dropdown)
+ move_to_top = true;
+ if(mouse_inside_item >= 0 && mouse_inside_item < (int)items.size()) {
+ if(on_click)
+ on_click(items[mouse_inside_item].id);
+ return false;
+ }
}
return true;
}
@@ -82,7 +87,7 @@ namespace gsr {
// Background
mgl::Rectangle rect(size);
rect.set_position(draw_pos);
- rect.set_color(mgl::Color(0, 0, 0, 120));
+ rect.set_color(mgl::Color(0, 0, 0, 180));
window.draw(rect);
}