1
0
Fork 0
mirror of https://github.com/Ellpeck/MLEM.git synced 2024-11-26 06:28:35 +01:00

Avoid unnecessary panel updates by using an Epsilon comparison when scrolling children

This commit is contained in:
Ell 2022-01-09 01:15:05 +01:00
parent c28f6d858c
commit 80a6c6b5e2
2 changed files with 2 additions and 1 deletions

View file

@ -25,6 +25,7 @@ Improvements
- Allow for checkboxes and radio buttons to be disabled - 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 - 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 - 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 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

View file

@ -120,7 +120,7 @@ namespace MLEM.Ui.Elements {
return; return;
var offset = new Vector2(0, -this.ScrollBar.CurrentValue); var offset = new Vector2(0, -this.ScrollBar.CurrentValue);
foreach (var child in this.GetChildren(c => c != this.ScrollBar, true)) { foreach (var child in this.GetChildren(c => c != this.ScrollBar, true)) {
if (child.ScrollOffset != offset) { if (!child.ScrollOffset.Equals(offset, Epsilon)) {
child.ScrollOffset = offset; child.ScrollOffset = offset;
this.relevantChildrenDirty = true; this.relevantChildrenDirty = true;
} }