Просмотр исходного кода

fix focus() when cursor not yet set

Nicolas Cannasse 6 лет назад
Родитель
Сommit
8c39219bae
1 измененных файлов с 4 добавлено и 0 удалено
  1. 4 0
      h2d/TextInput.hx

+ 4 - 0
h2d/TextInput.hx

@@ -336,6 +336,10 @@ class TextInput extends Text {
 
 
 	public function focus() {
 	public function focus() {
 		interactive.focus();
 		interactive.focus();
+		if( cursorIndex < 0 ) {
+			cursorIndex = 0;
+			if( text != "" ) selectionRange = { start : 0, length : text.length };
+		}
 	}
 	}
 
 
 	public function hasFocus() {
 	public function hasFocus() {