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:
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.
|
// 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 };
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue