From 993dff2ea01c7b11ea7cfc0bffa66adac2a70f82 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Mon, 12 Sep 2011 23:06:43 -0400 Subject: 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. --- indra/llui/llview.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp index e2b9527cc5..f457ff1052 100644 --- a/indra/llui/llview.cpp +++ b/indra/llui/llview.cpp @@ -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; -- cgit v1.2.3