Browse Source

Fixed count layers

flabbet 9 months ago
parent
commit
78bccd3f29
2 changed files with 11 additions and 7 deletions
  1. 1 1
      src/Drawie
  2. 10 6
      src/PixiEditor/ViewModels/SubViewModels/DiscordViewModel.cs

+ 1 - 1
src/Drawie

@@ -1 +1 @@
-Subproject commit f0e42219c9eff585e788c2c427de404e887ddf89
+Subproject commit 84f1a4801d78fac0b0141711069dabe3fb0a1df7

+ 10 - 6
src/PixiEditor/ViewModels/SubViewModels/DiscordViewModel.cs

@@ -3,6 +3,7 @@ using DiscordRPC;
 using PixiEditor.Helpers;
 using PixiEditor.Helpers;
 using PixiEditor.Extensions.CommonApi.UserPreferences.Settings.PixiEditor;
 using PixiEditor.Extensions.CommonApi.UserPreferences.Settings.PixiEditor;
 using PixiEditor.Models.Controllers;
 using PixiEditor.Models.Controllers;
+using PixiEditor.Models.Handlers;
 using PixiEditor.ViewModels.Document;
 using PixiEditor.ViewModels.Document;
 
 
 namespace PixiEditor.ViewModels.SubViewModels;
 namespace PixiEditor.ViewModels.SubViewModels;
@@ -99,14 +100,17 @@ internal class DiscordViewModel : SubViewModel<ViewModelMain>, IDisposable
 
 
     private int CountLayers(NodeGraphViewModel graph)
     private int CountLayers(NodeGraphViewModel graph)
     {
     {
-        int counter = 0; //TODO: Implement this
-        /*foreach (var child in folder.Children)
+        int counter = 0; 
+        graph.TryTraverse(n =>
         {
         {
-            if (child is LayerViewModel)
+            if(n is ILayerHandler layer)
+            {
                 counter++;
                 counter++;
-            else if (child is FolderViewModel innerFolder)
-                counter += CountLayers(innerFolder);
-        }*/
+            }
+
+            return true;
+        });
+        
         return counter;
         return counter;
     }
     }