Skip to content

Commit 76cc36c

Browse files
author
AleBles
committed
Fixed min/max value's as specified in #6
Cleaned up event listeners on destroy to fix #10
1 parent 14c0a31 commit 76cc36c

File tree

6 files changed

+22
-16
lines changed

6 files changed

+22
-16
lines changed

build/phaser-input.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ declare module Fabrique {
136136
/**
137137
* We overwrite the destroy method because we want to delete the (hidden) dom element when the inputField was removed
138138
*/
139-
destroy(): void;
139+
destroy(destroyChildren?: boolean): void;
140140
/**
141141
* Resets the text to an empty value
142142
*/

build/phaser-input.js

Lines changed: 9 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/phaser-input.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/phaser-input.min.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "phaser-input",
33
"author": "OrangeGames",
4-
"version": "1.2.4",
4+
"version": "1.2.5",
55
"description": "Adds input boxes to Phaser like CanvasInput, but also works for WebGL and Mobile, made for Phaser only.",
66
"contributors": [
77
{

ts/InputField.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -281,9 +281,9 @@ module Fabrique {
281281
}else if (this.inputOptions.type === InputType.number) {
282282
var val = parseInt(this.value);
283283
if (val < parseInt(this.inputOptions.min)) {
284-
text = this.inputOptions.min;
284+
text = this.value = this.domElement.value = this.inputOptions.min;
285285
} else if (val > parseInt(this.inputOptions.max)) {
286-
text = this.inputOptions.max;
286+
text = this.value = this.domElement.value = this.inputOptions.max;
287287
} else {
288288
text = this.value;
289289
}
@@ -469,10 +469,13 @@ module Fabrique {
469469
/**
470470
* We overwrite the destroy method because we want to delete the (hidden) dom element when the inputField was removed
471471
*/
472-
public destroy() {
472+
public destroy(destroyChildren?: boolean) {
473+
this.game.input.onDown.remove(this.checkDown, this);
474+
this.domElement.focusIn.removeAll();
475+
this.domElement.focusOut.removeAll();
473476
this.domElement.destroy();
474477

475-
super.destroy();
478+
super.destroy(destroyChildren);
476479
}
477480

478481
/**

0 commit comments

Comments
 (0)