Apply an anchor offset for Anchor.TopRight too.

This commit is contained in:
2025-06-22 15:56:05 +02:00
parent 683656dee8
commit 95ae2de7ac
2 changed files with 3 additions and 3 deletions

View File

@@ -142,7 +142,7 @@ public class TestGame : Game
private HorizontalContainer _container = new(new Rect(128.0f, 64.0f), new(), 16) private HorizontalContainer _container = new(new Rect(128.0f, 64.0f), new(), 16)
{ {
ConfineToContents = true, ConfineToContents = true,
Anchor = Anchor.TopCenter, Anchor = Anchor.TopRight,
AnchorOffset = new Vector2(0.5f, 0.0f) AnchorOffset = new Vector2(1.0f, 0.0f)
}; };
} }

View File

@@ -185,7 +185,7 @@ public abstract class Container : IElement, IParentableElement, IUpdatableElemen
Position = new Vector2(parentPosition.X + topCenterX, topCenterY) - absoluteOffset; Position = new Vector2(parentPosition.X + topCenterX, topCenterY) - absoluteOffset;
break; break;
case Anchor.TopRight: case Anchor.TopRight:
Position = new Vector2(parentPosition.X + parentRect.Width, parentPosition.Y); Position = new Vector2(parentPosition.X + parentRect.Width, parentPosition.Y) - absoluteOffset;
break; break;
case Anchor.Fill: case Anchor.Fill: