Prevent children from recieving extra mouse events

This commit is contained in:
Grim Maple 2022-10-08 22:26:51 +03:00
parent 91fbca984e
commit b05d5a6126
2 changed files with 6 additions and 6 deletions

View File

@ -1129,12 +1129,12 @@ class Window : CustomEventTarget {
// only route mouse events to visible widgets
if (root.visibility != Visibility.Visible)
return false;
if (!root.isPointInside(event.x, event.y))
if (!root.isPointInside(event.pos))
return false;
// offer event to children first
for (int i = 0; i < root.childCount; i++) {
Widget child = root.child(i);
if (dispatchMouseEvent(child, event, cursorIsSet))
if (child.isPointInside(event.pos) && dispatchMouseEvent(child, event, cursorIsSet))
return true;
}

View File

@ -663,9 +663,9 @@ public:
}
/// returns true if point is inside of this widget
bool isPointInside(int x, int y) {
return _pos.isPointInside(x, y);
}
bool isPointInside(int x, int y) { return _pos.isPointInside(x, y); }
///
bool isPointInside(Point pt) { return isPointInside(pt.x, pt.y); }
/// return true if state has State.Enabled flag set
@property bool enabled() { return (state & State.Enabled) != 0; }
@ -1536,7 +1536,7 @@ public:
_popupMenu = popupMenu;
return this;
}
/// returns true if widget can show popup menu (e.g. by mouse right click at point x,y)
bool canShowPopupMenu(int x, int y) {
if (_popupMenu is null)