Fix opening context menus for world entities.

This commit is contained in:
Pieter-Jan Briers
2020-01-25 23:35:03 +01:00
parent 01a0a376e3
commit 7e43d574d8

View File

@@ -107,7 +107,7 @@ namespace Content.Client.GameObjects.EntitySystems
button.OnPressed += _ => OnContextButtonPressed(entity);
}
_currentPopup.UserInterfaceManager.StateRoot.AddChild(_currentPopup);
_currentPopup.UserInterfaceManager.ModalRoot.AddChild(_currentPopup);
var size = _currentPopup.List.CombinedMinimumSize;
var box = UIBox2.FromDimensions(args.ScreenCoordinates.Position, size);
@@ -198,16 +198,6 @@ namespace Content.Client.GameObjects.EntitySystems
panel.AddChild(new Label {Text = "No verbs!"});
vBox.AddChild(panel);
}
//_currentPopup.Size = vBox.CombinedMinimumSize;
// If we're at the bottom of the window and the menu would go below the bottom of the window,
// shift it up so it extends UP.
var bottomCoords = vBox.CombinedMinimumSize.Y + _currentPopup.Position.Y;
if (bottomCoords > _userInterfaceManager.StateRoot.Size.Y)
{
// _currentPopup.Position = _currentPopup.Position - new Vector2(0, vBox.CombinedMinimumSize.Y);
}
}
private Button CreateVerbButton(string text, bool disabled, string verbName, string ownerName, Action action)