Fix new LLView::childFromPoint(recur=true) behavior: was always NULL.

The recursive logic always used to recur to the point where there were no
children -- where the next level of recursion returned NULL -- and then return
that NULL. Fix so when that lowest-level call returns NULL, we return one
level above that.
master
Nat Goodspeed 2011-09-12 23:06:43 -04:00
parent 2d19a20025
commit 993dff2ea0
1 changed files with 6 additions and 1 deletions

View File

@ -843,7 +843,12 @@ LLView* LLView::childFromPoint(S32 x, S32 y, bool recur)
// top-level child?
if (recur)
{
return viewp->childFromPoint(local_x, local_y, recur);
LLView* leaf(viewp->childFromPoint(local_x, local_y, recur));
// Maybe viewp is already a leaf LLView, or maybe it has children
// but this particular (x, y) point falls between them. If the
// recursive call returns non-NULL, great, use that; else just use
// viewp.
return leaf? leaf : viewp;
}
return viewp;