Explorar o código

Merge pull request #109814 from aaronp64/textedit_object_center

Update `TextEdit` to use center alignment for inline objects
Thaddeus Crews hai 2 semanas
pai
achega
8f052a4948
Modificáronse 1 ficheiros con 2 adicións e 2 borrados
  1. 2 2
      scene/gui/text_edit.cpp

+ 2 - 2
scene/gui/text_edit.cpp

@@ -312,7 +312,7 @@ void TextEdit::Text::invalidate_cache(int p_line, bool p_text_changed) {
 					float width_ratio = info["width_ratio"];
 					float width_ratio = info["width_ratio"];
 					String left_string = text_with_ime.substr(from, start - from);
 					String left_string = text_with_ime.substr(from, start - from);
 					text_line.data_buf->add_string(left_string, font, font_size, language);
 					text_line.data_buf->add_string(left_string, font, font_size, language);
-					text_line.data_buf->add_object(info, Vector2(font_height * width_ratio, font_height), INLINE_ALIGNMENT_TOP, 0);
+					text_line.data_buf->add_object(info, Vector2(font_height * width_ratio, font_height), INLINE_ALIGNMENT_CENTER, 0);
 					from = start;
 					from = start;
 				}
 				}
 			}
 			}
@@ -329,7 +329,7 @@ void TextEdit::Text::invalidate_cache(int p_line, bool p_text_changed) {
 				}
 				}
 				Dictionary info = key;
 				Dictionary info = key;
 				float width_ratio = info["width_ratio"];
 				float width_ratio = info["width_ratio"];
-				text_line.data_buf->resize_object(info, Vector2(font_height * width_ratio, font_height), INLINE_ALIGNMENT_TOP, 0);
+				text_line.data_buf->resize_object(info, Vector2(font_height * width_ratio, font_height), INLINE_ALIGNMENT_CENTER, 0);
 			}
 			}
 		}
 		}
 	}
 	}