diff --git a/LRReader.Shared/Internal/SettingsManager.cs b/LRReader.Shared/Internal/SettingsManager.cs index de7ac6fb..daeb8309 100644 --- a/LRReader.Shared/Internal/SettingsManager.cs +++ b/LRReader.Shared/Internal/SettingsManager.cs @@ -176,6 +176,24 @@ public int SpacebarScroll RaisePropertyChanged("SpacebarScroll"); } } + public bool FitToWidth + { + get => SettingsStorage.GetObjectRoamed("FitToWidth", true); + set + { + SettingsStorage.StoreObjectRoamed("FitToWidth", value); + RaisePropertyChanged("FitToWidth"); + } + } + public int FitScaleLimit + { + get => SettingsStorage.GetObjectLocal("FitScaleLimit", 100); + set + { + SettingsStorage.StoreObjectLocal("FitScaleLimit", value); + RaisePropertyChanged("FitScaleLimit"); + } + } public SettingsManager() { var profiles = SettingsStorage.GetObjectRoamed("Profiles"); diff --git a/LRReader.UWP.Core/Views/Tabs/Content/ArchiveTabContent.xaml.cs b/LRReader.UWP.Core/Views/Tabs/Content/ArchiveTabContent.xaml.cs index af860daa..f42632c9 100644 --- a/LRReader.UWP.Core/Views/Tabs/Content/ArchiveTabContent.xaml.cs +++ b/LRReader.UWP.Core/Views/Tabs/Content/ArchiveTabContent.xaml.cs @@ -277,7 +277,7 @@ private void ScrollViewer_DoubleTapped(object sender, DoubleTappedRoutedEventArg var center = ttv.TransformPoint(new Point(0, 0)); var zoomFactor = (float)Math.Min(ScrollViewer.ViewportWidth / ReaderControl.ActualWidth, ScrollViewer.ViewportHeight / ReaderControl.ActualHeight); if (Math.Abs(ScrollViewer.ZoomFactor - zoomFactor * Global.SettingsManager.BaseZoom) > 0.01) - ScrollViewer.ChangeView(null, null, zoomFactor * Global.SettingsManager.BaseZoom); + FitImages(false); else ScrollViewer.ChangeView(point.X - center.X * 2.0, point.Y - center.Y * 2.0, zoomFactor * Global.SettingsManager.ZoomedFactor); } @@ -296,7 +296,16 @@ private void FitImages(bool disableAnim) { if (ReaderControl.ActualWidth == 0 || ReaderControl.ActualHeight == 0) return; - var zoomFactor = (float)Math.Min(ScrollViewer.ViewportWidth / ReaderControl.ActualWidth, ScrollViewer.ViewportHeight / ReaderControl.ActualHeight); + float zoomFactor; + if (Global.SettingsManager.FitToWidth) + { + zoomFactor = (float)Math.Min(ScrollViewer.ViewportWidth / ReaderControl.ActualWidth, Global.SettingsManager.FitScaleLimit * 0.01); + } + else + { + zoomFactor = (float)Math.Min(ScrollViewer.ViewportWidth / ReaderControl.ActualWidth, ScrollViewer.ViewportHeight / ReaderControl.ActualHeight); + } + System.Diagnostics.Debug.WriteLine(zoomFactor); ScrollViewer.ChangeView(0, 0, zoomFactor * Global.SettingsManager.BaseZoom, disableAnim); } diff --git a/LRReader.UWP.Core/Views/Tabs/Content/Settings/ReaderPivot.xaml b/LRReader.UWP.Core/Views/Tabs/Content/Settings/ReaderPivot.xaml index f3c90cc0..fe5b45bf 100644 --- a/LRReader.UWP.Core/Views/Tabs/Content/Settings/ReaderPivot.xaml +++ b/LRReader.UWP.Core/Views/Tabs/Content/Settings/ReaderPivot.xaml @@ -59,6 +59,26 @@ Margin="0,0,0,10" Header="Read right-to-left" IsOn="{x:Bind Data.SettingsManager.ReadRTL, Mode=TwoWay}" ToolTipService.ToolTip="Reverses the pages read direction" /> + + + + + + + + + % + +