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(() =>
9090 LottieCompositionReader . Options . IgnoreMatchNames ,
9191 out var readerIssues ) ;
9292
93- if ( lottieComposition is not null )
93+ if ( lottieComposition is not null && options . HasFlag ( LottieVisualOptions . Optimize ) )
9494 {
9595 lottieComposition = LottieMergeOptimizer . Optimize ( lottieComposition ) ;
9696 }
Original file line number Diff line number Diff line change @@ -11,6 +11,18 @@ namespace CommunityToolkit.WinUI.Lottie.LottieData.Optimization
1111 /// <summary>
1212 /// Represents directed acyclic graph of layer groups.
1313 /// 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.
1426 /// </summary>
1527#if PUBLIC_LottieData
1628 public
@@ -57,16 +69,16 @@ public bool IsChildOf(GraphNode node)
5769
5870 private bool IsChildOf ( GraphNode node , HashSet < GraphNode > visited )
5971 {
60- if ( visited . Contains ( node ) )
72+ if ( visited . Contains ( this ) )
6173 {
6274 return false ;
6375 }
6476
65- visited . Add ( node ) ;
77+ visited . Add ( this ) ;
6678
6779 foreach ( var parent in Parents )
6880 {
69- if ( parent . Equals ( node ) || parent . IsChildOf ( node ) )
81+ if ( parent . Equals ( node ) || parent . IsChildOf ( node , visited ) )
7082 {
7183 return true ;
7284 }
You can’t perform that action at this time.
0 commit comments