Use PopupContainer for verbs & examine popups.

Fixes #501
This commit is contained in:
Pieter-Jan Briers
2020-01-25 17:28:39 +01:00
parent 821058740f
commit daf3c28929
2 changed files with 4 additions and 10 deletions

View File

@@ -73,15 +73,14 @@ namespace Content.Client.GameObjects.EntitySystems
public async void DoExamine(IEntity entity)
{
const float minWidth = 300;
CloseTooltip();
var popupPos = _inputManager.MouseScreenPosition;
// Actually open the tooltip.
_examineTooltipOpen = new Popup();
_userInterfaceManager.StateRoot.AddChild(_examineTooltipOpen);
_userInterfaceManager.ModalRoot.AddChild(_examineTooltipOpen);
var panel = new PanelContainer();
panel.AddStyleClass(StyleClassEntityTooltip);
panel.ModulateSelfOverride = Color.LightGray.WithAlpha(0.90f);
@@ -89,7 +88,7 @@ namespace Content.Client.GameObjects.EntitySystems
//panel.SetAnchorAndMarginPreset(Control.LayoutPreset.Wide);
var vBox = new VBoxContainer();
panel.AddChild(vBox);
var hBox = new HBoxContainer { SeparationOverride = 5};
var hBox = new HBoxContainer {SeparationOverride = 5};
vBox.AddChild(hBox);
if (entity.TryGetComponent(out ISpriteComponent sprite))
{
@@ -102,11 +101,8 @@ namespace Content.Client.GameObjects.EntitySystems
SizeFlagsHorizontal = Control.SizeFlags.FillExpand,
});
const float minWidth = 300;
var size = Vector2.ComponentMax((minWidth, 0), panel.CombinedMinimumSize);
popupPos += Vector2.ComponentMin(Vector2.Zero, _userInterfaceManager.StateRoot.Size - (size + popupPos));
_examineTooltipOpen.Open(UIBox2.FromDimensions(popupPos, size));
if (entity.Uid.IsClientSide())
@@ -144,8 +140,6 @@ namespace Content.Client.GameObjects.EntitySystems
break;
}
}
//_examineTooltipOpen.Position += Vector2.ComponentMin(Vector2.Zero,_userInterfaceManager.StateRoot.Size - (panel.Size + _examineTooltipOpen.Position));
}
public void CloseTooltip()