Merge pull request #1528 from junsred/focus-back-to-textInput-after-setting-clipBoard
focus back to textInput after setting clipBoard
This commit is contained in:
@@ -76,6 +76,8 @@ class HTML5Window
|
|||||||
private var textInputRect:Rectangle;
|
private var textInputRect:Rectangle;
|
||||||
private var unusedTouchesPool = new List<Touch>();
|
private var unusedTouchesPool = new List<Touch>();
|
||||||
|
|
||||||
|
private var __focusPending:Bool;
|
||||||
|
|
||||||
public function new(parent:Window)
|
public function new(parent:Window)
|
||||||
{
|
{
|
||||||
this.parent = parent;
|
this.parent = parent;
|
||||||
@@ -340,6 +342,19 @@ class HTML5Window
|
|||||||
|
|
||||||
public function focus():Void {}
|
public function focus():Void {}
|
||||||
|
|
||||||
|
private function focusTextInput():Void
|
||||||
|
{
|
||||||
|
// Avoid changing focus multiple times per frame.
|
||||||
|
if (__focusPending) return;
|
||||||
|
__focusPending = true;
|
||||||
|
|
||||||
|
Timer.delay(function()
|
||||||
|
{
|
||||||
|
__focusPending = false;
|
||||||
|
if (textInputEnabled) textInput.focus();
|
||||||
|
}, 20);
|
||||||
|
}
|
||||||
|
|
||||||
public function getCursor():MouseCursor
|
public function getCursor():MouseCursor
|
||||||
{
|
{
|
||||||
return cursor;
|
return cursor;
|
||||||
@@ -462,10 +477,7 @@ class HTML5Window
|
|||||||
{
|
{
|
||||||
if (event.relatedTarget == null || isDescendent(cast event.relatedTarget))
|
if (event.relatedTarget == null || isDescendent(cast event.relatedTarget))
|
||||||
{
|
{
|
||||||
Timer.delay(function()
|
focusTextInput();
|
||||||
{
|
|
||||||
if (textInputEnabled) textInput.focus();
|
|
||||||
}, 20);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -930,6 +942,10 @@ class HTML5Window
|
|||||||
{
|
{
|
||||||
Browser.document.execCommand("copy");
|
Browser.document.execCommand("copy");
|
||||||
}
|
}
|
||||||
|
if (textInputEnabled)
|
||||||
|
{
|
||||||
|
focusTextInput();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setCursor(value:MouseCursor):MouseCursor
|
public function setCursor(value:MouseCursor):MouseCursor
|
||||||
|
|||||||
Reference in New Issue
Block a user