1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 10:18:11 +00:00

LibGUI: Hit testing should skip invisible widgets.

This commit is contained in:
Andreas Kling 2019-03-15 16:45:27 +01:00
parent a3d5ba8f23
commit ad08165a25

View file

@ -216,10 +216,13 @@ GWidget::HitTestResult GWidget::hit_test(int x, int y)
{ {
// FIXME: Care about z-order. // FIXME: Care about z-order.
for (auto* ch : children()) { for (auto* ch : children()) {
auto* child = (GWidget*)ch; if (!ch->is_widget())
if (child->relative_rect().contains(x, y)) { continue;
return child->hit_test(x - child->relative_rect().x(), y - child->relative_rect().y()); auto& child = *(GWidget*)ch;
} if (!child.is_visible())
continue;
if (child.relative_rect().contains(x, y))
return child.hit_test(x - child.relative_rect().x(), y - child.relative_rect().y());
} }
return { this, x, y }; return { this, x, y };
} }