Преглед на файлове

Add setting to adjust whether to allow zooming out or not #168

Ruben преди 1 година
родител
ревизия
4320e044ef

+ 12 - 0
src/PicView.Avalonia/ViewModels/MainViewModel.cs

@@ -528,6 +528,18 @@ public class MainViewModel : ViewModelBase
 
     #region Booleans
     
+    private bool _isAvoidingZoomingOut = SettingsHelper.Settings.Zoom.AvoidZoomingOut;
+    
+    public bool IsAvoidingZoomingOut
+    {
+        get => _isAvoidingZoomingOut;
+        set
+        {
+            SettingsHelper.Settings.Zoom.AvoidZoomingOut = value;
+            this.RaiseAndSetIfChanged(ref _isAvoidingZoomingOut, value);
+        } 
+    }
+    
     private IImage? _changeCtrlZoomImage;
 
     public IImage? ChangeCtrlZoomImage

+ 9 - 0
src/PicView.Avalonia/ViewModels/ViewModelBase.cs

@@ -223,10 +223,19 @@ public class ViewModelBase : ReactiveObject
         SideBySide = TranslationHelper.Translation.SideBySide;
         SideBySideTooltip = TranslationHelper.Translation.SideBySideTooltip;
         HighlightColor = TranslationHelper.Translation.HighlightColor;
+        AllowZoomOut = TranslationHelper.Translation.AllowZoomOut;
     }
 
     #region Strings
     
+    private string? _allowZoomOut;
+    
+    public string? AllowZoomOut
+    {
+        get => _allowZoomOut;
+        set => this.RaiseAndSetIfChanged(ref _allowZoomOut, value);
+    }
+    
     private string? _highlightColor;
     
     public string? HighlightColor

+ 17 - 0
src/PicView.Avalonia/Views/ZoomSettingsView.axaml

@@ -43,6 +43,23 @@
             Text="{CompiledBinding GetZoomSpeed,
                                    Mode=OneWay}" />
 
+        <ToggleButton
+            Background="Transparent"
+            BorderThickness="0"
+            Classes="altHover alt"
+            IsChecked="{CompiledBinding IsAvoidingZoomingOut}"
+            Margin="0,0,0,10"
+            Width="300">
+            <TextBlock
+                Classes="txt"
+                Foreground="{StaticResource SecondaryTextColor}"
+                Margin="0"
+                MaxWidth="240"
+                Padding="0,1,5,0"
+                Text="{CompiledBinding AllowZoomOut,
+                                       Mode=OneWay}" />
+        </ToggleButton>
+
 
 
     </StackPanel>