Fix custom context menu popup showing as child (eg. prefab diff)
This commit is contained in:
@@ -168,30 +168,30 @@ namespace FlaxEditor.GUI.ContextMenu
|
||||
bool isUp = false, isLeft = false;
|
||||
if (UseAutomaticDirectionFix)
|
||||
{
|
||||
var parentMenu = parent as ContextMenu;
|
||||
if (monitorBounds.Bottom < rightBottomLocationSS.Y)
|
||||
{
|
||||
// Direction: up
|
||||
isUp = true;
|
||||
locationSS.Y -= dpiSize.Y;
|
||||
|
||||
// Offset to fix sub-menu location
|
||||
if (parent is ContextMenu menu && menu._childCM != null)
|
||||
if (parentMenu != null && parentMenu._childCM != null)
|
||||
locationSS.Y += 30.0f * dpiScale;
|
||||
}
|
||||
if (monitorBounds.Right < rightBottomLocationSS.X || _parentCM?.Direction == ContextMenuDirection.LeftDown || _parentCM?.Direction == ContextMenuDirection.LeftUp)
|
||||
if (parentMenu == null)
|
||||
{
|
||||
// Direction: left
|
||||
isLeft = true;
|
||||
|
||||
if (IsSubMenu && _parentCM != null)
|
||||
{
|
||||
locationSS.X -= _parentCM.Width + dpiSize.X;
|
||||
}
|
||||
else
|
||||
if (monitorBounds.Right < rightBottomLocationSS.X)
|
||||
{
|
||||
isLeft = true;
|
||||
locationSS.X -= dpiSize.X;
|
||||
}
|
||||
}
|
||||
else if (monitorBounds.Right < rightBottomLocationSS.X || _parentCM?.Direction == ContextMenuDirection.LeftDown || _parentCM?.Direction == ContextMenuDirection.LeftUp)
|
||||
{
|
||||
isLeft = true;
|
||||
if (IsSubMenu && _parentCM != null)
|
||||
locationSS.X -= _parentCM.Width + dpiSize.X;
|
||||
else
|
||||
locationSS.X -= dpiSize.X;
|
||||
}
|
||||
}
|
||||
|
||||
// Update direction flag
|
||||
|
||||
Reference in New Issue
Block a user