Add RemoveChild to IParentableElement, only resize Container if children overflow it.
This commit is contained in:
@@ -73,9 +73,16 @@ public class TestGame : Game
|
||||
_container.AddChild(new RectangleWidget(new Rect(32.0f, 32.0f), MathUtils.RandomColor()));
|
||||
}
|
||||
|
||||
if (Input.IsActionPressed("cancel") && _container.Children.Count != 0)
|
||||
{
|
||||
var lastChild = _container.Children.Last();
|
||||
_container.RemoveChild(lastChild);
|
||||
}
|
||||
|
||||
if (Input.IsMouseButtonDown(MouseButton.Left))
|
||||
{
|
||||
_particleSystem.SetEmitterPosition(_emitterId, Input.GetMousePosition());
|
||||
var mousePos = Input.GetMousePosition();
|
||||
_container.Size = new Rect(mousePos.X, mousePos.Y);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -118,5 +125,5 @@ public class TestGame : Game
|
||||
private ResourceRef<Sound> _sound;
|
||||
private ResourceRef<Texture2d> _icon;
|
||||
|
||||
private GridContainer _container = new();
|
||||
private GridContainer _container = new(minimumSize: new Rect(64.0f, 64.0f), new());
|
||||
}
|
||||
Reference in New Issue
Block a user