浏览代码

Merge pull request #22255 from guilhermefelipecgs/fix_label_min_size

Fix Label::get_minimum_size not updating cache size for autowrap
Rémi Verschelde 7 年之前
父节点
当前提交
7adaad1c64
共有 1 个文件被更改,包括 4 次插入5 次删除
  1. 4 5
      scene/gui/label.cpp

+ 4 - 5
scene/gui/label.cpp

@@ -295,14 +295,13 @@ Size2 Label::get_minimum_size() const {
 
 	Size2 min_style = get_stylebox("normal")->get_minimum_size();
 
+	// don't want to mutable everything
+	if (word_cache_dirty)
+		const_cast<Label *>(this)->regenerate_word_cache();
+
 	if (autowrap)
 		return Size2(1, clip ? 1 : minsize.height) + min_style;
 	else {
-
-		// don't want to mutable everything
-		if (word_cache_dirty)
-			const_cast<Label *>(this)->regenerate_word_cache();
-
 		Size2 ms = minsize;
 		if (clip)
 			ms.width = 1;