mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 20:37:35 +00:00
GWidget: Make hit testing respect child z-order.
This was as simple as iterating the children in reverse order. Duh. :^)
This commit is contained in:
parent
b8f150457e
commit
9311164439
1 changed files with 3 additions and 4 deletions
|
@ -282,11 +282,10 @@ Rect GWidget::screen_relative_rect() const
|
||||||
|
|
||||||
GWidget::HitTestResult GWidget::hit_test(int x, int y)
|
GWidget::HitTestResult GWidget::hit_test(int x, int y)
|
||||||
{
|
{
|
||||||
// FIXME: Care about z-order.
|
for (int i = children().size() - 1; i >= 0; --i) {
|
||||||
for (auto* ch : children()) {
|
if (!children()[i]->is_widget())
|
||||||
if (!ch->is_widget())
|
|
||||||
continue;
|
continue;
|
||||||
auto& child = *(GWidget*)ch;
|
auto& child = *(GWidget*)children()[i];
|
||||||
if (!child.is_visible())
|
if (!child.is_visible())
|
||||||
continue;
|
continue;
|
||||||
if (child.relative_rect().contains(x, y))
|
if (child.relative_rect().contains(x, y))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue