From c7e20a6dd01a2ae049c451d18511708aaee60a19 Mon Sep 17 00:00:00 2001 From: Joris Date: Mon, 3 Feb 2020 09:51:24 +0100 Subject: Don’t update the input source --- main.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/main.ts b/main.ts index ab3f2bf..c120377 100644 --- a/main.ts +++ b/main.ts @@ -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) } } -- cgit v1.2.3