Fix step-wise formulas causing issues with reactivity
This commit is contained in:
parent
213bdd6005
commit
8284baa1a0
1 changed files with 5 additions and 4 deletions
|
@ -229,15 +229,16 @@ export abstract class InternalFormula<T extends [FormulaSource] | FormulaSource[
|
|||
start: Computable<DecimalSource>,
|
||||
formulaModifier: (value: InvertibleIntegralFormula) => GenericFormula
|
||||
) {
|
||||
const lhsRef = ref<DecimalSource>(0);
|
||||
const formula = formulaModifier(Formula.variable(lhsRef));
|
||||
const formula = formulaModifier(Formula.variable(0));
|
||||
const processedStart = convertComputable(start);
|
||||
function evalStep(lhs: DecimalSource) {
|
||||
if (Decimal.lt(lhs, unref(processedStart))) {
|
||||
return lhs;
|
||||
}
|
||||
lhsRef.value = Decimal.sub(lhs, unref(processedStart));
|
||||
return Decimal.add(formula.evaluate(), unref(processedStart));
|
||||
return Decimal.add(
|
||||
formula.evaluate(Decimal.sub(lhs, unref(processedStart))),
|
||||
unref(processedStart)
|
||||
);
|
||||
}
|
||||
function invertStep(value: DecimalSource, lhs: FormulaSource) {
|
||||
if (hasVariable(lhs) && formula.isInvertible()) {
|
||||
|
|
Loading…
Reference in a new issue