1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-20 06:55:07 +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.
for (auto* ch : children()) {
auto* child = (GWidget*)ch;
if (child->relative_rect().contains(x, y)) {
return child->hit_test(x - child->relative_rect().x(), y - child->relative_rect().y());
}
if (!ch->is_widget())
continue;
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 };
}