瀏覽代碼

Calculate LineEdit selection with secret character

(cherry picked from commit 395a038c85ee0b99045a6edf467f482aa7106c71)
Darren Kaste 5 年之前
父節點
當前提交
f657614760
共有 1 個文件被更改,包括 5 次插入1 次删除
  1. 5 1
      scene/gui/line_edit.cpp

+ 5 - 1
scene/gui/line_edit.cpp

@@ -1066,7 +1066,11 @@ void LineEdit::set_cursor_at_pixel_pos(int p_x) {
 
 		int char_w = 0;
 		if (font != NULL) {
-			char_w = font->get_char_size(text[ofs]).width;
+			if (is_secret()) {
+				char_w = font->get_char_size(secret_character[0]).width;
+			} else {
+				char_w = font->get_char_size(text[ofs]).width;
+			}
 		}
 		pixel_ofs += char_w;