File tree Expand file tree Collapse file tree 2 files changed +16
-4
lines changed Expand file tree Collapse file tree 2 files changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -90,7 +90,7 @@ await Task.Run(() =>
90
90
LottieCompositionReader . Options . IgnoreMatchNames ,
91
91
out var readerIssues ) ;
92
92
93
- if ( lottieComposition is not null )
93
+ if ( lottieComposition is not null && options . HasFlag ( LottieVisualOptions . Optimize ) )
94
94
{
95
95
lottieComposition = LottieMergeOptimizer . Optimize ( lottieComposition ) ;
96
96
}
Original file line number Diff line number Diff line change @@ -11,6 +11,18 @@ namespace CommunityToolkit.WinUI.Lottie.LottieData.Optimization
11
11
/// <summary>
12
12
/// Represents directed acyclic graph of layer groups.
13
13
/// Node1 is child of Node2 iff they have time ranges that intersect and Node1 goes after Node2 in z-order.
14
+ ///
15
+ /// +Z
16
+ /// |---------------------------------------------------|
17
+ /// |--Node1--|
18
+ /// |---Node2---| Time -->
19
+ /// |----Node3----|
20
+ /// |---------------------------------------------------|
21
+ /// -Z
22
+ ///
23
+ /// In this example Node1 is a child of Node2, but not of Node3.
24
+ /// Nodes can have multiple parents. Optimizations can be made to graphs that don't overlap in
25
+ /// time, which is often the case when a single Lottie file contains multiple animations.
14
26
/// </summary>
15
27
#if PUBLIC_LottieData
16
28
public
@@ -57,16 +69,16 @@ public bool IsChildOf(GraphNode node)
57
69
58
70
private bool IsChildOf ( GraphNode node , HashSet < GraphNode > visited )
59
71
{
60
- if ( visited . Contains ( node ) )
72
+ if ( visited . Contains ( this ) )
61
73
{
62
74
return false ;
63
75
}
64
76
65
- visited . Add ( node ) ;
77
+ visited . Add ( this ) ;
66
78
67
79
foreach ( var parent in Parents )
68
80
{
69
- if ( parent . Equals ( node ) || parent . IsChildOf ( node ) )
81
+ if ( parent . Equals ( node ) || parent . IsChildOf ( node , visited ) )
70
82
{
71
83
return true ;
72
84
}
You can’t perform that action at this time.
0 commit comments