Browse Source

Don't add gallery items, if gallery is not opened, when new items are added to the directory

Ruben 2 months ago
parent
commit
a91761c34d
1 changed files with 11 additions and 7 deletions
  1. 11 7
      src/PicView.Avalonia/Navigation/ImageIterator.cs

+ 11 - 7
src/PicView.Avalonia/Navigation/ImageIterator.cs

@@ -241,20 +241,24 @@ public class ImageIterator : IAsyncDisposable
             return;
             return;
         }
         }
 
 
-        var isGalleryItemAdded = await GalleryFunctions.AddGalleryItem(index, fileInfo, _vm);
-        if (isGalleryItemAdded)
+        if (Settings.Gallery.IsBottomGalleryShown || GalleryFunctions.IsFullGalleryOpen)
         {
         {
-            if (Settings.Gallery.IsBottomGalleryShown && ImagePaths.Count > 1)
+            var isGalleryItemAdded = await GalleryFunctions.AddGalleryItem(index, fileInfo, _vm);
+            if (isGalleryItemAdded)
             {
             {
-                if (_vm.Gallery.GalleryMode.CurrentValue is GalleryMode.BottomToClosed or GalleryMode.FullToClosed)
+                if (Settings.Gallery.IsBottomGalleryShown && ImagePaths.Count > 1)
                 {
                 {
-                    _vm.Gallery.GalleryMode.Value = GalleryMode.ClosedToBottom;
+                    if (_vm.Gallery.GalleryMode.CurrentValue is GalleryMode.BottomToClosed or GalleryMode.FullToClosed)
+                    {
+                        _vm.Gallery.GalleryMode.Value = GalleryMode.ClosedToBottom;
+                    }
                 }
                 }
-            }
 
 
-            GalleryNavigation.CenterScrollToSelectedItem(_vm);
+                GalleryNavigation.CenterScrollToSelectedItem(_vm);
+            }
         }
         }
 
 
+
         PreLoader.Resynchronize(ImagePaths);
         PreLoader.Resynchronize(ImagePaths);
     }
     }