Skip to content
This repository has been archived by the owner on May 2, 2022. It is now read-only.

Commit

Permalink
fixed bug: #30
Browse files Browse the repository at this point in the history
added TextEvent.FocusIn / FocusOut, you can use either FocusEvent.CHANGED or this new one.
  • Loading branch information
jcyuan committed Dec 11, 2018
1 parent 33862f1 commit 73b7609
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/GTextInput.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ namespace fgui {
this.type = InputType.TEXT;

this.on("removed", this.removed, this);
this.on("added", this.added, this);
this.$util.initialize();
}

Expand All @@ -46,6 +47,11 @@ namespace fgui {
this.$util.destroy();
}

private added(disp: PIXI.DisplayObject): void {
if (this.$util)
this.$util.initialize();
}

public requestFocus(): void { //tab or call actively
this.root.focus = this;
this.$util.$onFocus();
Expand Down Expand Up @@ -151,6 +157,7 @@ namespace fgui {
public dispose():void {
super.dispose();
this.off("removed", this.removed, this);
this.off("added", this.added, this);
this.$util.destroy();
this.$util = null;
}
Expand Down
2 changes: 2 additions & 0 deletions src/utils/InputDelegate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ namespace fgui.utils {
this.$textField.$isTyping = true;
this.$textField.alpha = 0;
this.$textField.emit(FocusEvent.CHANGED, "focus", this.$textField);
this.$textField.emit(TextEvent.FocusIn, this.$textField);
}
}
else if (type == "blur") {
Expand All @@ -102,6 +103,7 @@ namespace fgui.utils {
this.$textField.alpha = 1;
this.$input.$onBlur();
this.$textField.emit(FocusEvent.CHANGED, "blur", this.$textField);
this.$textField.emit(TextEvent.FocusOut, this.$textField);
}
}
}
Expand Down

0 comments on commit 73b7609

Please sign in to comment.