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:
parent
a3d5ba8f23
commit
ad08165a25
1 changed files with 7 additions and 4 deletions
|
@ -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 };
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue