mirror of
https://github.com/Ellpeck/MLEM.git
synced 2024-11-25 14:08:34 +01:00
Compare commits
2 commits
f0cc4b0c80
...
7a0464e8d6
Author | SHA1 | Date | |
---|---|---|---|
7a0464e8d6 | |||
87d04e1abd |
2 changed files with 10 additions and 6 deletions
|
@ -800,7 +800,7 @@ namespace MLEM.Ui.Elements {
|
|||
if (condition != null && !condition(child))
|
||||
continue;
|
||||
var x = !child.Anchor.IsLeftAligned() ? child.UnscrolledArea.Width : child.UnscrolledArea.Right;
|
||||
if (child.UnscrolledArea.Right >= rightmostX) {
|
||||
if (x >= rightmostX) {
|
||||
rightmost = child;
|
||||
rightmostX = x;
|
||||
}
|
||||
|
|
|
@ -32,11 +32,15 @@ namespace Tests {
|
|||
invalidPanel.AddChild(new Paragraph(Anchor.AutoRight, 1, "This is some test text!", true));
|
||||
invalidPanel.AddChild(new VerticalSpace(1));
|
||||
Assert.Throws<ArithmeticException>(() => this.AddAndUpdate(invalidPanel));
|
||||
}
|
||||
|
||||
invalidPanel = new Panel(Anchor.Center, Vector2.Zero, Vector2.Zero, true);
|
||||
invalidPanel.AddChild(new Group(Anchor.CenterRight, new Vector2(10), false));
|
||||
invalidPanel.AddChild(new Group(Anchor.BottomLeft, new Vector2(10), false));
|
||||
Assert.Throws<InvalidOperationException>(() => this.AddAndUpdate(invalidPanel));
|
||||
[Test]
|
||||
public void TestOddlyAlignedPanel() {
|
||||
var oddPanel = new Panel(Anchor.Center, Vector2.One, Vector2.Zero, true) {SetWidthBasedOnChildren = true};
|
||||
oddPanel.AddChild(new Group(Anchor.TopCenter, new Vector2(100), false));
|
||||
oddPanel.AddChild(new Group(Anchor.AutoRight, new Vector2(120), false));
|
||||
this.AddAndUpdate(oddPanel);
|
||||
Assert.AreEqual(120 + 10, oddPanel.DisplayArea.Width);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
Loading…
Reference in a new issue