Skip to content

Commit

Permalink
Fix drawing on highlight
Browse files Browse the repository at this point in the history
  • Loading branch information
Equbuxu committed Dec 11, 2021
1 parent aefa415 commit 1012381
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions PixiEditor/Helpers/GlobalMouseHook.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
using System.Runtime.InteropServices;
using System.Windows;
using System.Windows.Input;

using System.Windows.Threading;

namespace PixiEditor.Helpers
{
public delegate void MouseUpEventHandler(object sender, Point p, MouseButton button);
Expand Down Expand Up @@ -90,8 +91,9 @@ private static int MouseHookProc(int nCode, int wParam, IntPtr lParam)
{

MouseButton button = wParam == WM_LBUTTONUP ? MouseButton.Left
: wParam == WM_MBUTTONUP ? MouseButton.Middle : MouseButton.Right;
MouseUp.Invoke(null, new Point(mouseHookStruct.Pt.X, mouseHookStruct.Pt.Y), button);
: wParam == WM_MBUTTONUP ? MouseButton.Middle : MouseButton.Right;
Dispatcher.CurrentDispatcher.BeginInvoke(() =>
MouseUp.Invoke(null, new Point(mouseHookStruct.Pt.X, mouseHookStruct.Pt.Y), button));
}
}
}
Expand Down Expand Up @@ -139,4 +141,4 @@ private struct MSLLHOOKSTRUCT
public IntPtr DwExtraInfo;
}
}
}
}

0 comments on commit 1012381

Please sign in to comment.