From c880c3e0114a3c6e7687ffc1e69d09fad1c03dbb Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Sun, 30 Jan 2022 16:56:07 +0100 Subject: [PATCH] Update elements less aggressively when changing a ui system's style --- CHANGELOG.md | 1 + MLEM.Ui/UiSystem.cs | 6 ++---- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cb6ffd1..d6cb4cf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -35,6 +35,7 @@ Improvements - Avoid unnecessary panel updates by using an Epsilon comparison when scrolling children - Allow setting a default text alignment for paragraphs in UiStyle - Made custom values of Element.Style persist when a new ui style is set +- Update elements less aggressively when changing a ui system's style Fixes - Fixed paragraph links having incorrect hover locations when using special text alignments diff --git a/MLEM.Ui/UiSystem.cs b/MLEM.Ui/UiSystem.cs index 5e4f72f..08f2a0c 100644 --- a/MLEM.Ui/UiSystem.cs +++ b/MLEM.Ui/UiSystem.cs @@ -59,10 +59,8 @@ namespace MLEM.Ui { get => this.style; set { this.style = value; - foreach (var root in this.rootElements) { - root.Element.AndChildren(e => e.System = this); - root.Element.ForceUpdateArea(); - } + foreach (var root in this.rootElements) + root.Element.AndChildren(e => e.Style = e.Style.OrStyle(value)); } } ///