Merge pull request #346 from TylerAdkisson/master

Fixes #341 Magnifier not respecting screen bounds
This commit is contained in:
Jaex 2014-10-20 15:28:09 +03:00
commit a6aaca8743

View file

@ -296,6 +296,7 @@ private void DrawCrosshair(Graphics g)
private void DrawMagnifier(Graphics g)
{
Point mousePos = InputManager.MousePosition0Based;
Rectangle currentScreenRect0Based = CaptureHelpers.ScreenToClient(Screen.FromPoint(InputManager.MousePosition).Bounds);
int offsetX = RulerMode ? 20 : 10, offsetY = RulerMode ? 20 : 10;
if (Config.ShowInfo && AreaManager.IsCurrentAreaValid && AreaManager.CurrentArea.Location == mousePos)
@ -307,14 +308,14 @@ private void DrawMagnifier(Graphics g)
{
int x = mousePos.X + offsetX;
if (x + magnifier.Width > ScreenRectangle0Based.Width)
if (x + magnifier.Width > currentScreenRect0Based.Right)
{
x = mousePos.X - offsetX - magnifier.Width;
}
int y = mousePos.Y + offsetY;
if (y + magnifier.Height > ScreenRectangle0Based.Height)
if (y + magnifier.Height > currentScreenRect0Based.Bottom)
{
y = mousePos.Y - offsetY - magnifier.Height;
}
@ -419,4 +420,4 @@ protected virtual void AddShapePath(GraphicsPath graphicsPath, Rectangle rect)
graphicsPath.AddRectangle(rect);
}
}
}
}