From dac4987a63de43b244a7c779b9250f34539bd648 Mon Sep 17 00:00:00 2001 From: Henrik Andersson Date: Thu, 10 Jan 2013 13:42:00 +1000 Subject: [PATCH] Fix a Panorama Mouse Event issue --- MahApps.Metro/Controls/Panorama.cs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/MahApps.Metro/Controls/Panorama.cs b/MahApps.Metro/Controls/Panorama.cs index dbb76d80d8..29a4307a01 100644 --- a/MahApps.Metro/Controls/Panorama.cs +++ b/MahApps.Metro/Controls/Panorama.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Windows.Controls; using System.Windows; using System.Windows.Threading; @@ -168,8 +168,6 @@ protected override void OnPreviewMouseDown(MouseButtonEventArgs e) tile = (IPanoramaTile)data; } } - - CaptureMouse(); } base.OnPreviewMouseDown(e); @@ -177,7 +175,7 @@ protected override void OnPreviewMouseDown(MouseButtonEventArgs e) protected override void OnPreviewMouseMove(MouseEventArgs e) { - if (IsMouseCaptured) + if (e.LeftButton == MouseButtonState.Pressed) { Point currentPoint = e.GetPosition(this); @@ -194,6 +192,7 @@ protected override void OnPreviewMouseMove(MouseEventArgs e) // Scroll to the new position. sv.ScrollToHorizontalOffset(scrollTarget.X); sv.ScrollToVerticalOffset(scrollTarget.Y); + CaptureMouse(); } base.OnPreviewMouseMove(e); @@ -203,10 +202,9 @@ protected override void OnPreviewMouseUp(MouseButtonEventArgs e) { if (IsMouseCaptured) { - Cursor = Cursors.Arrow; ReleaseMouseCapture(); } - + Cursor = Cursors.Arrow; Point currentPoint = e.GetPosition(this); // Determine the new amount to scroll.