aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoris2020-02-03 09:51:24 +0100
committerJoris2020-02-03 09:51:24 +0100
commitc7e20a6dd01a2ae049c451d18511708aaee60a19 (patch)
treea9da87416e20e05a3c161635de1b3ddb4c913e9b
parentf94ae4f8e81590048ddc61c16300c10643673df5 (diff)
Don’t update the input source
-rw-r--r--main.ts10
1 files 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)
}
}