mirror of
https://github.com/Ellpeck/MLEM.git
synced 2024-11-25 05:58:35 +01:00
Compare commits
No commits in common. "80a6c6b5e28080120965821fcf9a67194e53a476" and "68fc02b1708a6cb8d643b6fd5702d38905846260" have entirely different histories.
80a6c6b5e2
...
68fc02b170
5 changed files with 12 additions and 28 deletions
|
@ -24,8 +24,6 @@ Fixes
|
|||
Improvements
|
||||
- Allow for checkboxes and radio buttons to be disabled
|
||||
- Only set a paragraph's area dirty when a text change would cause it to change size
|
||||
- Ensure that a panel gets notified of all relevant changes by calling OnChildAreaDirty for all grandchildren
|
||||
- Avoid unnecessary panel updates by using an Epsilon comparison when scrolling children
|
||||
|
||||
Fixes
|
||||
- Fixed paragraph links having incorrect hover locations when using special text alignments
|
||||
|
|
|
@ -530,7 +530,7 @@ namespace MLEM.Ui.Elements {
|
|||
/// </summary>
|
||||
public void SetAreaDirty() {
|
||||
this.AreaDirty = true;
|
||||
this.Parent?.OnChildAreaDirty(this, false);
|
||||
this.Parent?.OnChildAreaDirty(this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -1061,18 +1061,14 @@ namespace MLEM.Ui.Elements {
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// A method that gets called by this element's <see cref="Children"/> or any of its grandchildren when their <see cref="SetAreaDirty"/> methods get called.
|
||||
/// A method that gets called by this element's <see cref="Children"/> when their <see cref="SetAreaDirty"/> methods get called.
|
||||
/// Note that the element's area might already be dirty, which will not stop this method from being called.
|
||||
/// </summary>
|
||||
/// <param name="child">The child whose area is being set dirty.</param>
|
||||
/// <param name="grandchild">Whether the <paramref name="child"/> is a grandchild of this element, rather than a direct child.</param>
|
||||
protected virtual void OnChildAreaDirty(Element child, bool grandchild) {
|
||||
if (!grandchild) {
|
||||
/// <param name="child">The child whose area is being set dirty</param>
|
||||
protected virtual void OnChildAreaDirty(Element child) {
|
||||
if (child.Anchor >= Anchor.AutoLeft || this.SetWidthBasedOnChildren || this.SetHeightBasedOnChildren)
|
||||
this.SetAreaDirty();
|
||||
}
|
||||
this.Parent?.OnChildAreaDirty(child, true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Transforms the given <paramref name="position"/> by the inverse of this element's <see cref="Transform"/> matrix.
|
||||
|
|
|
@ -120,7 +120,7 @@ namespace MLEM.Ui.Elements {
|
|||
return;
|
||||
var offset = new Vector2(0, -this.ScrollBar.CurrentValue);
|
||||
foreach (var child in this.GetChildren(c => c != this.ScrollBar, true)) {
|
||||
if (!child.ScrollOffset.Equals(offset, Epsilon)) {
|
||||
if (child.ScrollOffset != offset) {
|
||||
child.ScrollOffset = offset;
|
||||
this.relevantChildrenDirty = true;
|
||||
}
|
||||
|
@ -157,15 +157,6 @@ namespace MLEM.Ui.Elements {
|
|||
return relevant;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void OnChildAreaDirty(Element child, bool grandchild) {
|
||||
base.OnChildAreaDirty(child, grandchild);
|
||||
// we only need to scroll when a grandchild changes, since all of our children are forced
|
||||
// to be auto-anchored and so will automatically propagate their changes up to us
|
||||
if (grandchild)
|
||||
this.ScrollChildren();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void Draw(GameTime time, SpriteBatch batch, float alpha, BlendState blendState, SamplerState samplerState, DepthStencilState depthStencilState, Effect effect, Matrix matrix) {
|
||||
if (this.Texture.HasValue())
|
||||
|
|
|
@ -191,8 +191,8 @@ namespace MLEM.Ui.Elements {
|
|||
/// </summary>
|
||||
protected void SetTextDirty() {
|
||||
this.TokenizedText = null;
|
||||
// only set our area dirty if our size changed as a result of this action
|
||||
if (!this.AreaDirty && !this.CalcActualSize(this.ParentArea).Equals(this.DisplayArea.Size, Epsilon))
|
||||
// only set our area dirty if our size changed as a result of this action or if we have link children we need to update
|
||||
if (!this.AreaDirty && (!this.CalcActualSize(this.ParentArea).Equals(this.DisplayArea.Size, Epsilon) || this.Children.Count > 0))
|
||||
this.SetAreaDirty();
|
||||
}
|
||||
|
||||
|
|
|
@ -30,9 +30,8 @@ namespace MLEM.Ui.Elements {
|
|||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void OnChildAreaDirty(Element child, bool grandchild) {
|
||||
base.OnChildAreaDirty(child, grandchild);
|
||||
if (!grandchild)
|
||||
protected override void OnChildAreaDirty(Element child) {
|
||||
base.OnChildAreaDirty(child);
|
||||
this.SetAreaDirty();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue