From 16f81cc1841ddeeb94585374b440c36eedf90ea6 Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Tue, 23 Mar 2021 09:32:12 +0100 Subject: [PATCH] Fix updating Label layout after font change when using automatic size #380 --- Source/Engine/UI/GUI/Common/Label.cs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Source/Engine/UI/GUI/Common/Label.cs b/Source/Engine/UI/GUI/Common/Label.cs index d549a9d85..196bbb2b6 100644 --- a/Source/Engine/UI/GUI/Common/Label.cs +++ b/Source/Engine/UI/GUI/Common/Label.cs @@ -77,7 +77,19 @@ namespace FlaxEngine.GUI public FontReference Font { get => _font; - set => _font = value; + set + { + if (_font != value) + { + _font = value; + + if (_autoWidth || _autoHeight || _autoFitText) + { + _textSize = Vector2.Zero; + PerformLayout(); + } + } + } } ///