From 95ae2de7acac96a99d4efc6922c26a80b8bd04aa Mon Sep 17 00:00:00 2001 From: dnesov Date: Sun, 22 Jun 2025 15:56:05 +0200 Subject: [PATCH] Apply an anchor offset for Anchor.TopRight too. --- TestGame/TestGame.cs | 4 ++-- Voile/Source/UI/Containers/Container.cs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/TestGame/TestGame.cs b/TestGame/TestGame.cs index 24e5e6c..45f7f0a 100644 --- a/TestGame/TestGame.cs +++ b/TestGame/TestGame.cs @@ -142,7 +142,7 @@ public class TestGame : Game private HorizontalContainer _container = new(new Rect(128.0f, 64.0f), new(), 16) { ConfineToContents = true, - Anchor = Anchor.TopCenter, - AnchorOffset = new Vector2(0.5f, 0.0f) + Anchor = Anchor.TopRight, + AnchorOffset = new Vector2(1.0f, 0.0f) }; } \ No newline at end of file diff --git a/Voile/Source/UI/Containers/Container.cs b/Voile/Source/UI/Containers/Container.cs index 7942765..1b84924 100644 --- a/Voile/Source/UI/Containers/Container.cs +++ b/Voile/Source/UI/Containers/Container.cs @@ -185,7 +185,7 @@ public abstract class Container : IElement, IParentableElement, IUpdatableElemen Position = new Vector2(parentPosition.X + topCenterX, topCenterY) - absoluteOffset; break; case Anchor.TopRight: - Position = new Vector2(parentPosition.X + parentRect.Width, parentPosition.Y); + Position = new Vector2(parentPosition.X + parentRect.Width, parentPosition.Y) - absoluteOffset; break; case Anchor.Fill: