mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-29 19:10:26 +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
Notes:
sideshowbarker
2024-07-19 14:46:59 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/93111644398
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)
|
||||
{
|
||||
// FIXME: Care about z-order.
|
||||
for (auto* ch : children()) {
|
||||
if (!ch->is_widget())
|
||||
for (int i = children().size() - 1; i >= 0; --i) {
|
||||
if (!children()[i]->is_widget())
|
||||
continue;
|
||||
auto& child = *(GWidget*)ch;
|
||||
auto& child = *(GWidget*)children()[i];
|
||||
if (!child.is_visible())
|
||||
continue;
|
||||
if (child.relative_rect().contains(x, y))
|
||||
|
|
Loading…
Reference in a new issue