|
|
|
@ -1,5 +1,5 @@ |
|
|
|
using System; |
|
|
|
using System.Linq; |
|
|
|
using System.Collections.Generic; |
|
|
|
using Avalonia.Media; |
|
|
|
using Avalonia.Platform; |
|
|
|
using Avalonia.Threading; |
|
|
|
@ -247,11 +247,26 @@ namespace Avalonia.Rendering.SceneGraph |
|
|
|
|
|
|
|
if (forceRecurse) |
|
|
|
{ |
|
|
|
foreach (var child in visual.VisualChildren.OrderBy(x => x, ZIndexComparer.Instance)) |
|
|
|
var visualChildren = (IList<IVisual>) visual.VisualChildren; |
|
|
|
|
|
|
|
if (visualChildren.Count == 1) |
|
|
|
{ |
|
|
|
var childNode = GetOrCreateChildNode(scene, child, node); |
|
|
|
var childNode = GetOrCreateChildNode(scene, visualChildren[0], node); |
|
|
|
Update(context, scene, (VisualNode)childNode, clip, forceRecurse); |
|
|
|
} |
|
|
|
else if (visualChildren.Count > 1) |
|
|
|
{ |
|
|
|
var sortedChildren = new IVisual[visualChildren.Count]; |
|
|
|
visualChildren.CopyTo(sortedChildren, 0); |
|
|
|
|
|
|
|
Array.Sort(sortedChildren, ZIndexComparer.ComparisonInstance); |
|
|
|
|
|
|
|
foreach (var child in sortedChildren) |
|
|
|
{ |
|
|
|
var childNode = GetOrCreateChildNode(scene, child, node); |
|
|
|
Update(context, scene, (VisualNode)childNode, clip, forceRecurse); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
node.SubTreeUpdated = true; |
|
|
|
contextImpl.TrimChildren(); |
|
|
|
@ -308,13 +323,17 @@ namespace Avalonia.Rendering.SceneGraph |
|
|
|
|
|
|
|
private static void Deindex(Scene scene, VisualNode node) |
|
|
|
{ |
|
|
|
foreach (VisualNode child in node.Children) |
|
|
|
var nodeChildren = node.Children; |
|
|
|
var nodeChildrenCount = nodeChildren.Count; |
|
|
|
|
|
|
|
for (var i = 0; i < nodeChildrenCount; i++) |
|
|
|
{ |
|
|
|
if (child is VisualNode visual) |
|
|
|
if (nodeChildren[i] is VisualNode visual) |
|
|
|
{ |
|
|
|
Deindex(scene, visual); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
scene.Remove(node); |
|
|
|
|
|
|
|
node.SubTreeUpdated = true; |
|
|
|
@ -323,7 +342,6 @@ namespace Avalonia.Rendering.SceneGraph |
|
|
|
|
|
|
|
node.Visual.TransformedBounds = null; |
|
|
|
|
|
|
|
|
|
|
|
if (node.LayerRoot == node.Visual && node.Visual != scene.Root.Visual) |
|
|
|
{ |
|
|
|
scene.Layers.Remove(node.LayerRoot); |
|
|
|
|