Closing the popupMenu by clicking outside, should not pass the event to the control under the mouse.

This commit is contained in:
and3md 2018-02-18 15:54:38 +01:00
parent 0048cf482b
commit b81e34b236
2 changed files with 7 additions and 4 deletions

View File

@ -1505,8 +1505,11 @@ class Window : CustomEventTarget {
if (p is modal)
break;
if (!insideOneOfPopups) {
if (p.onMouseEventOutside(event)) // stop loop when true is returned, but allow other main widget to handle event
break;
if (event.action == MouseAction.ButtonDown)
return true; // mouse button down should do nothing when click outside when popup visible
if (p.onMouseEventOutside(event)) {
return true; // mouse button up should do nothing when click outside when popup visible
}
} else {
if (dispatchMouseEvent(p, event, cursorIsSet))
return true;

View File

@ -174,10 +174,10 @@ class PopupWidget : LinearLayout {
if (visibility != Visibility.Visible)
return false;
if (_flags & PopupFlags.CloseOnClickOutside) {
if (event.action == MouseAction.ButtonDown) {
if (event.action == MouseAction.ButtonUp) {
// clicked outside - close popup
close();
return false;
return true;
}
}
if (_flags & PopupFlags.CloseOnMouseMoveOutside) {