Fix scrolling to fast on a precision touchpad

This commit is contained in:
Paddy Xu
2017-05-30 00:19:40 +03:00
parent 4dafe7eebe
commit 43e67356f2
2 changed files with 24 additions and 9 deletions

View File

@@ -92,12 +92,18 @@ namespace QuickLook.Plugin.ImageViewer
private void ViewPanel_PreviewMouseWheel(object sender, MouseWheelEventArgs e)
{
if ((Keyboard.Modifiers & ModifierKeys.Control) == 0)
return;
e.Handled = true;
var newZoom = _zoomFactor + e.Delta / 120 * 0.1;
if ((Keyboard.Modifiers & ModifierKeys.Control) == 0)
{
// normal scroll
viewPanel.ScrollToVerticalOffset(viewPanel.VerticalOffset - e.Delta);
return;
}
// zoom
var newZoom = _zoomFactor + (double) e.Delta / 120 * 0.1;
newZoom = Math.Max(newZoom, _minZoomFactor);
newZoom = Math.Min(newZoom, 3);