mirror of
https://github.com/Ellpeck/MLEM.git
synced 2024-11-25 05:58:35 +01:00
some panel improvements
- Added Panel.ScrollToTop and Panel.ScrollToBottom - Fixed Panel.ScrollToElement not scrolling correctly when the panel's area is dirty
This commit is contained in:
parent
3a055129b5
commit
bcc558f591
2 changed files with 19 additions and 0 deletions
|
@ -28,6 +28,7 @@ Additions
|
|||
- Added the ability to set the anchor that should be used when a tooltip attaches to an element or the mouse
|
||||
- Added the ability to display tooltips using the auto-nav style even when using the mouse
|
||||
- Added the ScissorGroup element, which applies a scissor rectangle when drawing its content
|
||||
- Added Panel.ScrollToTop and Panel.ScrollToBottom
|
||||
|
||||
Improvements
|
||||
- **Include the SpriteBatchContext in OnDrawn, OnElementDrawn and OnSelectedElementDrawn**
|
||||
|
@ -39,6 +40,7 @@ Fixes
|
|||
- Fixed hidden scroll bars inhibiting scrolling on their parent panel
|
||||
- Fixed scroll bars doing unnecessary calculations when hidden
|
||||
- Fixed auto-sized elements sometimes updating their location based on outdated parent positions
|
||||
- Fixed Panel.ScrollToElement not scrolling correctly when the panel's area is dirty
|
||||
|
||||
## 6.3.1
|
||||
|
||||
|
|
|
@ -236,9 +236,26 @@ namespace MLEM.Ui.Elements {
|
|||
var highestValidChild = this.Children.FirstOrDefault(c => c != this.ScrollBar && !c.IsHidden);
|
||||
if (highestValidChild == null)
|
||||
return;
|
||||
this.UpdateAreaIfDirty();
|
||||
this.ScrollBar.CurrentValue = (elementY - this.Area.Height / 2 - highestValidChild.Area.Top) / this.Scale + this.ChildPadding.Value.Height / 2;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Scrolls this panel's <see cref="ScrollBar"/> to the top, causing the top of this panel to be shown.
|
||||
/// </summary>
|
||||
public void ScrollToTop() {
|
||||
this.UpdateAreaIfDirty();
|
||||
this.ScrollBar.CurrentValue = 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Scrolls this panel's <see cref="ScrollBar"/> to the bottom, causing the bottom of this panel to be shown.
|
||||
/// </summary>
|
||||
public void ScrollToBottom() {
|
||||
this.UpdateAreaIfDirty();
|
||||
this.ScrollBar.CurrentValue = this.ScrollBar.MaxValue;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void InitStyle(UiStyle style) {
|
||||
base.InitStyle(style);
|
||||
|
|
Loading…
Reference in a new issue