From 60a81dfbd86338646e70739e34bca369d9c6753a Mon Sep 17 00:00:00 2001 From: Thomas Geymayer Date: Fri, 7 Jun 2013 16:23:44 +0200 Subject: [PATCH] CanvasGroup: Fix handling z-index while moving child to front. --- simgear/canvas/elements/CanvasGroup.cxx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/simgear/canvas/elements/CanvasGroup.cxx b/simgear/canvas/elements/CanvasGroup.cxx index b290fb0e..3d29c77e 100644 --- a/simgear/canvas/elements/CanvasGroup.cxx +++ b/simgear/canvas/elements/CanvasGroup.cxx @@ -301,11 +301,13 @@ namespace canvas } else { - ChildList::iterator prev = child; - while( prev != _children.begin() - && (--prev)->first->getIntValue("z-index", 0) > z_index) + ChildList::iterator prev = child, + check = child; + while( check != _children.begin() + && (--check)->first->getIntValue("z-index", 0) > z_index ) { --index_new; + --prev; } if( index == index_new ) -- 2.39.5