diff options
author | Joris | 2020-02-03 09:51:24 +0100 |
---|---|---|
committer | Joris | 2020-02-03 09:51:24 +0100 |
commit | c7e20a6dd01a2ae049c451d18511708aaee60a19 (patch) | |
tree | a9da87416e20e05a3c161635de1b3ddb4c913e9b | |
parent | f94ae4f8e81590048ddc61c16300c10643673df5 (diff) |
Don’t update the input source
-rw-r--r-- | main.ts | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -40,9 +40,11 @@ inputs.map(input => { if (parsed !== undefined && parsed.before === '' && parsed.after === '') { const factor = parsed.number / input.number - if (factor !== 0) { - inputs.map(input2 => input2.node.value = prettyPrintNumber(input2.number * factor)) - } + inputs.map(input2 => { + if (input.node !== input2.node) { + input2.node.value = prettyPrintNumber(input2.number * factor) + } + }) } } } @@ -152,7 +154,7 @@ function parseNumber(str: string): ParsedNumber | undefined { return { before: str.substring(0, start), - number: parseFloat(integerPart + (decimalPart !== '' ? '.' + decimalPart.substring(0, 2) : '')), + number: parseFloat(integerPart + (decimalPart !== '' ? '.' + decimalPart : '')), after: str.substring(end, str.length) } } |