diff --git a/QuickLook.Plugin/QuickLook.Plugin.ImageViewer/ImagePanel.xaml.cs b/QuickLook.Plugin/QuickLook.Plugin.ImageViewer/ImagePanel.xaml.cs index a07c32b..ac23e1a 100644 --- a/QuickLook.Plugin/QuickLook.Plugin.ImageViewer/ImagePanel.xaml.cs +++ b/QuickLook.Plugin/QuickLook.Plugin.ImageViewer/ImagePanel.xaml.cs @@ -58,6 +58,7 @@ namespace QuickLook.Plugin.ImageViewer private bool _zoomToFit = true; private double _zoomToFitFactor; + private bool _zoomWithControlKey; public ImagePanel() { @@ -99,6 +100,16 @@ namespace QuickLook.Plugin.ImageViewer Theme = ContextObject.Theme; } + public bool ZoomWithControlKey + { + get => _zoomWithControlKey; + set + { + _zoomWithControlKey = value; + OnPropertyChanged(); + } + } + public bool ShowZoomLevelInfo { get => _showZoomLevelInfo; @@ -372,7 +383,15 @@ namespace QuickLook.Plugin.ImageViewer { e.Handled = true; - // zoom + // normal scroll when Control is not pressed, useful for PdfViewer + if (ZoomWithControlKey && (Keyboard.Modifiers & ModifierKeys.Control) == 0) + { + viewPanel.ScrollToVerticalOffset(viewPanel.VerticalOffset - e.Delta); + ImageScrolled?.Invoke(this, e.Delta); + return; + } + + // otherwise, perform normal zooming var newZoom = ZoomFactor + ZoomFactor * e.Delta / 120 * 0.1; Zoom(newZoom); diff --git a/QuickLook.Plugin/QuickLook.Plugin.PDFViewer/PdfViewerControl.xaml b/QuickLook.Plugin/QuickLook.Plugin.PDFViewer/PdfViewerControl.xaml index f249174..f8cbaf4 100644 --- a/QuickLook.Plugin/QuickLook.Plugin.PDFViewer/PdfViewerControl.xaml +++ b/QuickLook.Plugin/QuickLook.Plugin.PDFViewer/PdfViewerControl.xaml @@ -75,7 +75,7 @@ + ZoomWithControlKey="True" BackgroundVisibility="Collapsed" MetaIconVisibility="Collapsed" /> \ No newline at end of file