azerion / phaser-input

Adds input boxes to Phaser like CanvasInput, but also works for WebGL and Mobile, made for Phaser only.
MIT License
201 stars 64 forks source link

Setting borderWidth to 0 defaults back to 1 #68

Open NickH-nz opened 6 years ago

NickH-nz commented 6 years ago

This Issue is about a bug in API v2.0.5

My aim is to not show a border around the input field.

When setting the borderWidth to 0, it counts as not being set and defaults to 1. Setting to -1 works around the issue and allows the border to be hidden.

The borderWidth property does not do a comprehensive check to see if it is defined. Other properties have a more comprehensive check that should be applied to all numeric options.

The issue can be found here: https://github.com/orange-games/phaser-input/blob/master/build/phaser-input.js#L599

Old:

_this.borderWidth = inputOptions.borderWidth || 1;

New:

_this.borderWidth = (typeof inputOptions.borderWidth === 'number') ? inputOptions.borderWidth : 1;