diff options
Diffstat (limited to 'main.ts')
-rw-r--r-- | main.ts | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -36,7 +36,7 @@ const inputs = setInputs(itemEntries) inputs.map(input => { input.node.oninput = e => { if (e.target !==null) { - const parsed: ParsedNumber | undefined = parseNumber((e.target as HTMLInputElement).value) + const parsed = parseNumber((e.target as HTMLInputElement).value) if (parsed !== undefined && parsed.before === '' && parsed.after === '') { const factor = parsed.number / input.number @@ -152,7 +152,7 @@ function parseNumber(str: string): ParsedNumber | undefined { return { before: str.substring(0, start), - number: parseFloat(integerPart + (decimalPart !== '' ? '.' + decimalPart : '')), + number: parseFloat(integerPart + (decimalPart !== '' ? '.' + decimalPart.substring(0, 2) : '')), after: str.substring(end, str.length) } } |