ContextMenu now opens on mouse-release versus initial mouse-press. TODO: Make it an enum configuration.

This commit is contained in:
2025-06-27 15:29:17 -05:00
parent 944bd66b43
commit 4acd91b078

View File

@@ -80,8 +80,8 @@ namespace JUI {
auto* btn = AddButton(name);
// TODO: Is this memory safe at all?
btn->OnClickEvent += [this, btn, callback] (auto a, auto b) mutable {
if (this->IsVisible() && btn->IsMouseInside())
btn->OnReleaseEvent += [this, btn, callback] (auto a, auto b, bool still_focus) mutable {
if (still_focus && this->IsVisible() && btn->IsMouseInside())
callback();
};
return btn;
@@ -109,8 +109,8 @@ namespace JUI {
submenu->Position({100_percent, 0_percent});
submenu->Visible(false);
btn->OnClickEvent += [this, submenu] (auto a, auto b) mutable {
if (this->IsVisible()) {
btn->OnReleaseEvent += [this, submenu] (auto a, auto b, bool still_there) mutable {
if (still_there && this->IsVisible()) {
this->Pin();
submenu->Visible(true);
}