mirror of
https://github.com/ShareX/ShareX.git
synced 2024-10-03 02:36:50 +13:00
fixed #7422: Fixed image editor toolbar position
This commit is contained in:
parent
c442fad787
commit
f04cf8ae6a
1 changed files with 31 additions and 28 deletions
|
@ -1310,42 +1310,45 @@ internal void UpdateMenuMaxWidth(int width)
|
||||||
|
|
||||||
private void CheckMenuPosition()
|
private void CheckMenuPosition()
|
||||||
{
|
{
|
||||||
Rectangle rectMenu = menuForm.Bounds;
|
if (!Form.IsEditorMode)
|
||||||
Rectangle rectScreen = CaptureHelpers.GetScreenBounds();
|
|
||||||
Point pos = rectMenu.Location;
|
|
||||||
|
|
||||||
if (rectMenu.Width < rectScreen.Width)
|
|
||||||
{
|
{
|
||||||
if (rectMenu.X < rectScreen.X)
|
Rectangle rectMenu = menuForm.Bounds;
|
||||||
{
|
Rectangle rectScreen = CaptureHelpers.GetScreenBounds();
|
||||||
pos.X = rectScreen.X;
|
Point pos = rectMenu.Location;
|
||||||
}
|
|
||||||
else if (rectMenu.Right > rectScreen.Right)
|
|
||||||
{
|
|
||||||
pos.X = rectScreen.Right - rectMenu.Width;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (rectMenu.Height < rectScreen.Height)
|
if (rectMenu.Width < rectScreen.Width)
|
||||||
{
|
|
||||||
if (rectMenu.Y < rectScreen.Y)
|
|
||||||
{
|
{
|
||||||
pos.Y = rectScreen.Y;
|
if (rectMenu.X < rectScreen.X)
|
||||||
|
{
|
||||||
|
pos.X = rectScreen.X;
|
||||||
|
}
|
||||||
|
else if (rectMenu.Right > rectScreen.Right)
|
||||||
|
{
|
||||||
|
pos.X = rectScreen.Right - rectMenu.Width;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (rectMenu.Bottom > rectScreen.Bottom)
|
|
||||||
|
if (rectMenu.Height < rectScreen.Height)
|
||||||
{
|
{
|
||||||
pos.Y = rectScreen.Bottom - rectMenu.Height;
|
if (rectMenu.Y < rectScreen.Y)
|
||||||
|
{
|
||||||
|
pos.Y = rectScreen.Y;
|
||||||
|
}
|
||||||
|
else if (rectMenu.Bottom > rectScreen.Bottom)
|
||||||
|
{
|
||||||
|
pos.Y = rectScreen.Bottom - rectMenu.Height;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (pos != rectMenu.Location)
|
if (pos != rectMenu.Location)
|
||||||
{
|
{
|
||||||
menuForm.Location = pos;
|
menuForm.Location = pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Form.IsEditorMode && Options.RememberMenuState)
|
if (Options.RememberMenuState)
|
||||||
{
|
{
|
||||||
Options.MenuPosition = pos;
|
Options.MenuPosition = pos;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue