浏览代码

Correct binding paths, adjust gallery item height logic, and correct navigation validation conditions.

Ruben 3 月之前
父节点
当前提交
a87149acdd

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

@@ -130,7 +130,7 @@ public static class NavigationManager
     public static bool CanNavigate(MainViewModel vm) =>
         ImageIterator?.ImagePaths is not null &&
         ImageIterator.ImagePaths.Count > 0 && !CropFunctions.IsCropping &&
-        !DialogManager.IsDialogOpen && vm is { MainWindow.IsLoadingIndicatorShown.Value: false, PicViewer.FileInfo: not null };
+        !DialogManager.IsDialogOpen && vm is { MainWindow.IsEditableTitlebarOpen.CurrentValue: false, PicViewer.FileInfo.CurrentValue: not null };
 
     /// <summary>
     ///     Navigates to the next or previous image based on the <paramref name="next" /> parameter.

+ 8 - 10
src/PicView.Avalonia/SettingsManagement/SettingsUpdater.cs

@@ -22,25 +22,23 @@ public static class SettingsUpdater
         {
             return;
         }
-        vm.Gallery.GalleryItem.ExpandedGalleryItemHeight.Value  = Settings.Gallery.ExpandedGalleryItemSize;
-        vm.Gallery.GalleryItem.BottomGalleryItemHeight.Value = Settings.Gallery.BottomGalleryItemSize;
+        gallery.GalleryItem.ExpandedGalleryItemHeight.Value  = Settings.Gallery.ExpandedGalleryItemSize;
+        gallery.GalleryItem.BottomGalleryItemHeight.Value = Settings.Gallery.BottomGalleryItemSize;
         if (!settingsExists)
         {
-            vm.Gallery.GalleryItem.BottomGalleryItemHeight.Value = GalleryDefaults.DefaultBottomGalleryHeight;
-            vm.Gallery.GalleryItem.ExpandedGalleryItemHeight.Value = GalleryDefaults.DefaultFullGalleryHeight;
+            gallery.GalleryItem.BottomGalleryItemHeight.Value = GalleryDefaults.DefaultBottomGalleryHeight;
+            gallery.GalleryItem.ExpandedGalleryItemHeight.Value = GalleryDefaults.DefaultFullGalleryHeight;
         }
 
         // Set default gallery sizes if they are out of range or upgrading from an old version
-        if (vm.Gallery.GalleryItem.BottomGalleryItemHeight.CurrentValue < GalleryDefaults.MinBottomGalleryItemHeight ||
-            vm.Gallery.GalleryItem.BottomGalleryItemHeight.CurrentValue > GalleryDefaults.MaxBottomGalleryItemHeight)
+        if (gallery.GalleryItem.BottomGalleryItemHeight.CurrentValue is < GalleryDefaults.MinBottomGalleryItemHeight or > GalleryDefaults.MaxBottomGalleryItemHeight)
         {
-            vm.Gallery.GalleryItem.BottomGalleryItemHeight.Value = GalleryDefaults.DefaultBottomGalleryHeight;
+            gallery.GalleryItem.BottomGalleryItemHeight.Value = GalleryDefaults.DefaultBottomGalleryHeight;
         }
 
-        if (vm.Gallery.GalleryItem.ExpandedGalleryItemHeight.CurrentValue < GalleryDefaults.MinFullGalleryItemHeight ||
-            vm.Gallery.GalleryItem.ExpandedGalleryItemHeight.CurrentValue > GalleryDefaults.MaxFullGalleryItemHeight)
+        if (gallery.GalleryItem.ExpandedGalleryItemHeight.CurrentValue is < GalleryDefaults.MinFullGalleryItemHeight or > GalleryDefaults.MaxFullGalleryItemHeight)
         {
-            vm.Gallery.GalleryItem.ExpandedGalleryItemHeight.Value = GalleryDefaults.DefaultFullGalleryHeight;
+            gallery.GalleryItem.ExpandedGalleryItemHeight.Value = GalleryDefaults.DefaultFullGalleryHeight;
         }
 
         if (settingsExists)

+ 2 - 2
src/PicView.Avalonia/Views/MainView.axaml

@@ -378,7 +378,7 @@
                     Command="{CompiledBinding Tools.ShowSideBySideCommand}"
                     Header="{CompiledBinding Translation.SideBySide.Value,
                                              Mode=OneWay}"
-                    IsChecked="{CompiledBinding PicViewer.IsShowingSideBySide}"
+                    IsChecked="{CompiledBinding PicViewer.IsShowingSideBySide.Value}"
                     ToggleType="CheckBox" />
 
                 <Separator />
@@ -406,7 +406,7 @@
                     <MenuItem.Icon>
                         <Image
                             Height="12"
-                            Source="{CompiledBinding MainWindow.ChangeCtrlZoomImage}"
+                            Source="{CompiledBinding MainWindow.ChangeCtrlZoomImage.Value}"
                             Width="12" />
                     </MenuItem.Icon>
                 </MenuItem>