Apply an anchor offset for Anchor.TopRight too.
This commit is contained in:
@@ -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)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -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:
|
||||||
|
|||||||
Reference in New Issue
Block a user