1
0
Fork 0
mirror of https://github.com/Ellpeck/MLEM.git synced 2024-11-25 14:08:34 +01:00

Compare commits

..

No commits in common. "cd32372994270337b8a43d8297873c5d475235f7" and "96f0c517574f49d5be16f82638656572ad2da813" have entirely different histories.

2 changed files with 3 additions and 4 deletions

View file

@ -53,7 +53,6 @@ Improvements
Fixes Fixes
- Fixed paragraph links having incorrect hover locations when using special text alignments - Fixed paragraph links having incorrect hover locations when using special text alignments
- Fixed the graphics device's viewport being ignored for mouse and touch queries - Fixed the graphics device's viewport being ignored for mouse and touch queries
- Fixed auto-navigating panels not scrolling to the center of elements properly
Removals Removals
- Marked StyleProp equality members as obsolete - Marked StyleProp equality members as obsolete

View file

@ -79,13 +79,13 @@ namespace MLEM.Ui.Elements {
}; };
// handle automatic element selection, the scroller needs to scroll to the right location // handle automatic element selection, the scroller needs to scroll to the right location
this.OnSelectedElementChanged += (_, e) => { this.OnSelectedElementChanged += (element, otherElement) => {
if (!this.Controls.IsAutoNavMode) if (!this.Controls.IsAutoNavMode)
return; return;
if (e == null || !e.GetParentTree().Contains(this)) if (otherElement == null || !otherElement.GetParentTree().Contains(this))
return; return;
var firstChild = this.Children.First(c => c != this.ScrollBar); var firstChild = this.Children.First(c => c != this.ScrollBar);
this.ScrollBar.CurrentValue = (e.Area.Center.Y - this.Area.Height / 2 - firstChild.Area.Top) / e.Scale + this.ChildPadding.Value.Height / 2; this.ScrollBar.CurrentValue = (otherElement.Area.Bottom - firstChild.Area.Top - this.Area.Height / 2) / this.Scale;
}; };
this.AddChild(this.ScrollBar); this.AddChild(this.ScrollBar);
} }