fixed #7422: Fixed image editor toolbar position

This commit is contained in:
Jaex 2024-06-03 10:03:25 +03:00
parent c442fad787
commit f04cf8ae6a

View file

@ -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;
}
} }
} }