Browse Source

[Label] Fix min. width

Pāvels Nadtočajevs 9 tháng trước cách đây
mục cha
commit
e8f3bebb5d
1 tập tin đã thay đổi với 3 bổ sung1 xóa
  1. 3 1
      scene/gui/label.cpp

+ 3 - 1
scene/gui/label.cpp

@@ -215,9 +215,11 @@ void Label::_shape() {
 	bool lines_hidden = visible_lines > 0 && visible_lines < total_line_count;
 	bool lines_hidden = visible_lines > 0 && visible_lines < total_line_count;
 
 
 	int line_index = 0;
 	int line_index = 0;
+	if (autowrap_mode == TextServer::AUTOWRAP_OFF) {
+		minsize.width = 0.0f;
+	}
 	for (Paragraph &para : paragraphs) {
 	for (Paragraph &para : paragraphs) {
 		if (autowrap_mode == TextServer::AUTOWRAP_OFF) {
 		if (autowrap_mode == TextServer::AUTOWRAP_OFF) {
-			minsize.width = 0.0f;
 			for (const RID &line_rid : para.lines_rid) {
 			for (const RID &line_rid : para.lines_rid) {
 				if (minsize.width < TS->shaped_text_get_size(line_rid).x) {
 				if (minsize.width < TS->shaped_text_get_size(line_rid).x) {
 					minsize.width = TS->shaped_text_get_size(line_rid).x;
 					minsize.width = TS->shaped_text_get_size(line_rid).x;