diff --git a/Content.Client/Chat/Managers/ChatManager.cs b/Content.Client/Chat/Managers/ChatManager.cs index 56a4501059..9c7344752d 100644 --- a/Content.Client/Chat/Managers/ChatManager.cs +++ b/Content.Client/Chat/Managers/ChatManager.cs @@ -525,7 +525,7 @@ namespace Content.Client.Chat.Managers // Push up existing bubbles above the mob's head. foreach (var existingBubble in existing) { - existingBubble.VerticalOffset += bubble.ContentHeight; + existingBubble.VerticalOffset += bubble.ContentSize.Y; } } else diff --git a/Content.Client/Chat/UI/SpeechBubble.cs b/Content.Client/Chat/UI/SpeechBubble.cs index 5ceea05f05..7a15c88417 100644 --- a/Content.Client/Chat/UI/SpeechBubble.cs +++ b/Content.Client/Chat/UI/SpeechBubble.cs @@ -46,7 +46,7 @@ namespace Content.Client.Chat.UI public float VerticalOffset { get; set; } private float _verticalOffsetAchieved; - public float ContentHeight { get; private set; } + public Vector2 ContentSize { get; private set; } public static SpeechBubble CreateSpeechBubble(SpeechType type, string text, EntityUid senderEntity, IEyeManager eyeManager, IChatManager chatManager, IEntityManager entityManager) { @@ -83,8 +83,8 @@ namespace Content.Client.Chat.UI ForceRunStyleUpdate(); bubble.Measure(Vector2.Infinity); - ContentHeight = bubble.DesiredSize.Y; - _verticalOffsetAchieved = -ContentHeight; + ContentSize = bubble.DesiredSize; + _verticalOffsetAchieved = -ContentSize.Y; } protected abstract Control BuildBubble(string text, string speechStyleClass); @@ -133,12 +133,12 @@ namespace Content.Client.Chat.UI var offset = new Vector2(0, EntityVerticalOffset * EyeManager.PixelsPerMeter * scale); var lowerCenter = (_eyeManager.WorldToScreen(worldPos) - offset) / UIScale; - var screenPos = lowerCenter - (Width / 2, ContentHeight + _verticalOffsetAchieved); + var screenPos = lowerCenter - (ContentSize.X / 2, ContentSize.Y + _verticalOffsetAchieved); // Round to nearest 0.5 screenPos = (screenPos * 2).Rounded() / 2; LayoutContainer.SetPosition(this, screenPos); - var height = MathF.Ceiling(MathHelper.Clamp(lowerCenter.Y - screenPos.Y, 0, ContentHeight)); + var height = MathF.Ceiling(MathHelper.Clamp(lowerCenter.Y - screenPos.Y, 0, ContentSize.Y)); SetHeight = height; } diff --git a/Content.Client/Viewport/ScalingViewport.cs b/Content.Client/Viewport/ScalingViewport.cs index a7051bdae0..63f7f65de1 100644 --- a/Content.Client/Viewport/ScalingViewport.cs +++ b/Content.Client/Viewport/ScalingViewport.cs @@ -129,14 +129,10 @@ namespace Content.Client.Viewport _inputManager.ViewportKeyEvent(this, args); } - - protected override void FrameUpdate(FrameEventArgs args) - { - EnsureViewportCreated(); - } - protected override void Draw(DrawingHandleScreen handle) { + EnsureViewportCreated(); + DebugTools.AssertNotNull(_viewport); _viewport!.Render();