1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

Improve input width calculation in currency-display.js

This commit is contained in:
Dan 2018-05-31 12:23:12 -02:30
parent 704ba54bef
commit 990b69c655

View File

@ -98,9 +98,8 @@ CurrencyDisplay.prototype.handleChange = function (newVal) {
CurrencyDisplay.prototype.getInputWidth = function (valueToRender, readOnly) {
const valueString = String(valueToRender)
const valueLength = valueString.length || 1
const dynamicBuffer = readOnly ? 0 : 1
const decimalPointDeficit = !readOnly && valueString.match(/\./) ? -0.5 : 0
return (valueLength + dynamicBuffer + decimalPointDeficit) + 'ch'
const decimalPointDeficit = valueString.match(/\./) ? -0.5 : 0
return (valueLength + decimalPointDeficit + 0.75) + 'ch'
}
CurrencyDisplay.prototype.render = function () {