avoid duplicate code

This commit is contained in:
Junsred
2022-04-29 00:27:16 +03:00
parent c845859bc0
commit b3af18c352

View File

@@ -339,6 +339,13 @@ class HTML5Window
public function focus():Void {} public function focus():Void {}
public function focusTextInputWithDelay():Void {
Timer.delay(function()
{
if (textInputEnabled) textInput.focus();
}, 20);
}
public function getCursor():MouseCursor public function getCursor():MouseCursor
{ {
return cursor; return cursor;
@@ -457,10 +464,7 @@ class HTML5Window
{ {
if (event.relatedTarget == null || isDescendent(cast event.relatedTarget)) if (event.relatedTarget == null || isDescendent(cast event.relatedTarget))
{ {
Timer.delay(function() focusTextInputWithDelay();
{
if (textInputEnabled) textInput.focus();
}, 20);
} }
} }
} }
@@ -925,10 +929,7 @@ class HTML5Window
{ {
Browser.document.execCommand("copy"); Browser.document.execCommand("copy");
} }
Timer.delay(function() focusTextInputWithDelay();
{
if (textInputEnabled) textInput.focus();
}, 20);
} }
public function setCursor(value:MouseCursor):MouseCursor public function setCursor(value:MouseCursor):MouseCursor