mirror of
https://github.com/ShareX/ShareX.git
synced 2024-10-02 18:26:27 +13:00
Merge pull request #346 from TylerAdkisson/master
Fixes #341 Magnifier not respecting screen bounds
This commit is contained in:
commit
a6aaca8743
1 changed files with 4 additions and 3 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue