]> git.mxchange.org Git - simgear.git/commitdiff
CanvasGroup: Fix handling z-index while moving child to front.
authorThomas Geymayer <tomgey@gmail.com>
Fri, 7 Jun 2013 14:23:44 +0000 (16:23 +0200)
committerThomas Geymayer <tomgey@gmail.com>
Fri, 7 Jun 2013 14:23:44 +0000 (16:23 +0200)
simgear/canvas/elements/CanvasGroup.cxx

index b290fb0e0de5ddea41b6b92ca6352d269445a4b2..3d29c77ee68447abc7530ce275947d6083fb5da0 100644 (file)
@@ -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 )