Explorar o código

fix focus() when cursor not yet set

Nicolas Cannasse %!s(int64=6) %!d(string=hai) anos
pai
achega
8c39219bae
Modificáronse 1 ficheiros con 4 adicións e 0 borrados
  1. 4 0
      h2d/TextInput.hx

+ 4 - 0
h2d/TextInput.hx

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