1
0
Fork 0
mirror of https://github.com/Ellpeck/MLEM.git synced 2024-11-25 05:58:35 +01:00

Fixed dropdown menu panels not updating their width when the dropdown's width changes

This commit is contained in:
Ell 2023-05-21 11:19:24 +02:00
parent 3127ad5b74
commit 30432e43d4
2 changed files with 6 additions and 2 deletions

View file

@ -50,6 +50,7 @@ Fixes
- Fixed AutoInline elements overflowing into their parent if it's taller - Fixed AutoInline elements overflowing into their parent if it's taller
- Fixed Paragraph and Checkbox not reacting to SquishingGroup sizing properly - Fixed Paragraph and Checkbox not reacting to SquishingGroup sizing properly
- Fixed TextInput and Slider still reacting to input when they are selected, but not part of the active root - Fixed TextInput and Slider still reacting to input when they are selected, but not part of the active root
- Fixed dropdown menu panels not updating their width when the dropdown's width changes
### MLEM.Data ### MLEM.Data
Improvements Improvements

View file

@ -37,10 +37,13 @@ namespace MLEM.Ui.Elements {
/// <param name="text">The text displayed on the dropdown button</param> /// <param name="text">The text displayed on the dropdown button</param>
/// <param name="tooltipText">The text displayed as a tooltip when hovering over the dropdown button</param> /// <param name="tooltipText">The text displayed as a tooltip when hovering over the dropdown button</param>
public Dropdown(Anchor anchor, Vector2 size, string text = null, string tooltipText = null) : base(anchor, size, text, tooltipText) { public Dropdown(Anchor anchor, Vector2 size, string text = null, string tooltipText = null) : base(anchor, size, text, tooltipText) {
this.Panel = this.AddChild(new Panel(Anchor.TopCenter, size, Vector2.Zero, true) { this.Panel = this.AddChild(new Panel(Anchor.TopCenter, Vector2.Zero, Vector2.Zero, true) {
IsHidden = true IsHidden = true
}); });
this.OnAreaUpdated += e => this.Panel.PositionOffset = new Vector2(0, e.Area.Height / this.Scale); this.OnAreaUpdated += e => {
this.Panel.Size = new Vector2(e.Area.Width / e.Scale, 0);
this.Panel.PositionOffset = new Vector2(0, e.Area.Height / e.Scale);
};
this.OnOpenedOrClosed += e => this.Priority = this.IsOpen ? 10000 : 0; this.OnOpenedOrClosed += e => this.Priority = this.IsOpen ? 10000 : 0;
this.OnPressed += e => { this.OnPressed += e => {
this.IsOpen = !this.IsOpen; this.IsOpen = !this.IsOpen;