Browse Source

Fix instances where height is reserved for the bottom gallery, even though it isn't shown. Disable `Side by side` and the toggle bottom gallery buttons, when functionality is unavailable.

Ruben 4 months ago
parent
commit
5ab6cf5aa0

+ 1 - 0
src/PicView.Avalonia/Navigation/NavigationManager.cs

@@ -554,6 +554,7 @@ public static class NavigationManager
         }
         else
         {
+            vm.IsSingleImage = false;
             var isTiffUpdated = await CheckIfTiffAndUpdate(vm, fileInfo, index); 
             if (!isTiffUpdated)
             {

+ 2 - 0
src/PicView.Avalonia/Navigation/UpdateImage.cs

@@ -329,6 +329,7 @@ public static class UpdateImage
             vm.GalleryMargin = new Thickness(0);
         }
 
+        vm.IsSingleImage = true;
         await dispatchAction(() => { UIHelper.GetGalleryView.IsVisible = false; }, DispatcherPriority.Render);
         await NavigationManager.DisposeImageIteratorAsync();
     }
@@ -339,6 +340,7 @@ public static class UpdateImage
 
     public static void SetStats(MainViewModel vm, int index, ImageModel imageModel)
     {
+        vm.IsSingleImage = false;
         vm.PicViewer.PixelWidth = imageModel.PixelWidth;
         vm.PicViewer.PixelHeight = imageModel.PixelHeight;
         vm.GetIndex = index + 1;

+ 7 - 2
src/PicView.Avalonia/ViewModels/MainViewModel.cs

@@ -265,7 +265,6 @@ public class MainViewModel : ReactiveObject
         ChangeCtrlZoomCommand = FunctionsHelper.CreateReactiveCommand(FunctionsMapper.ChangeCtrlZoom);
 
         ColorPickerCommand = FunctionsHelper.CreateReactiveCommand(FunctionsMapper.ColorPicker);
-
         SlideshowCommand = FunctionsHelper.CreateReactiveCommand<int>(StartSlideShowTask);
 
         ToggleTaskbarProgressCommand = FunctionsHelper.CreateReactiveCommand(FunctionsMapper.ToggleTaskbarProgress);
@@ -370,7 +369,7 @@ public class MainViewModel : ReactiveObject
     {
         get
         {
-            if (!Settings.Gallery.IsBottomGalleryShown)
+            if (!Settings.Gallery.IsBottomGalleryShown || IsSingleImage || Slideshow.IsRunning)
             {
                 return 0;
             }
@@ -893,6 +892,12 @@ public class MainViewModel : ReactiveObject
         }
     }
 
+    public bool IsSingleImage
+    {
+        get;
+        set => this.RaiseAndSetIfChanged(ref field, value);
+    }
+
     #endregion Booleans
     
     public Brush? ImageBackground

+ 2 - 2
src/PicView.Avalonia/Views/UC/Menus/ImageMenu.axaml

@@ -270,8 +270,6 @@
                     CommandParameter="0"
                     Foreground="{DynamicResource MainTextColor}"
                     Height="46"
-                    IsEnabled="{CompiledBinding PicViewer.FileInfo,
-                                                Converter={x:Static ObjectConverters.IsNotNull}}"
                     ToolTip.Tip="{CompiledBinding Translation.Slideshow,
                                                   Mode=OneWay}"
                     x:Name="SlideShowButton">
@@ -392,6 +390,7 @@
                     Foreground="{DynamicResource MainTextColor}"
                     Height="46"
                     IsChecked="{CompiledBinding PicViewer.IsShowingSideBySide}"
+                    IsEnabled="{CompiledBinding !IsSingleImage}"
                     ToolTip.Tip="{CompiledBinding Translation.SideBySideTooltip}">
                     <TextBlock
                         Classes="txt btnTxt"
@@ -407,6 +406,7 @@
                     Command="{CompiledBinding ToggleBottomGalleryCommand}"
                     Foreground="{DynamicResource MainTextColor}"
                     Height="46"
+                    IsEnabled="{CompiledBinding !IsSingleImage}"
                     ToolTip.Tip="{CompiledBinding Translation.IsShowingBottomGallery,
                                                   Mode=OneWay}"
                     Width="300">