Skip to content

Commit

Permalink
SADXLVL2: Fixed cursor wrap bug where the cursor could escape the pri…
Browse files Browse the repository at this point in the history
…mary monitor and wrap on the secondary. We now grab screen space based on the window, not the cursor.
  • Loading branch information
michael-fadely committed Feb 24, 2015
1 parent a7f7fde commit 9bbec47
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions SADXLVL2/MainForm.cs
Expand Up @@ -53,8 +53,8 @@ void Application_ThreadException(object sender, System.Threading.ThreadException
bool zoomKeyDown;

// TODO: Make these both configurable.
bool mouseWrapScreen = false;
ushort mouseWrapThreshold = 16;
bool mouseWrapScreen = true;
ushort mouseWrapThreshold = 2;

// helpers / ui stuff
TransformGizmo transformGizmo;
Expand Down Expand Up @@ -1666,7 +1666,8 @@ private void Panel1_MouseMove(object sender, MouseEventArgs e)

if (e.Button != MouseButtons.None)
{
Rectangle mouseBounds = (mouseWrapScreen) ? Screen.GetBounds(Cursor.Position) : RectangleToScreen(panel1.ClientRectangle);
// TODO: Figure out why RectangleToScreen gets offset values for panel1
Rectangle mouseBounds = (mouseWrapScreen) ? Screen.GetBounds(ClientRectangle) : RectangleToScreen(ClientRectangle);
Console.WriteLine(mouseBounds);

if (Cursor.Position.X < (mouseBounds.Left + mouseWrapThreshold))
Expand Down

0 comments on commit 9bbec47

Please sign in to comment.