From a6fcf6da19da0a308f191796dbc6a25ee3c3b5a7 Mon Sep 17 00:00:00 2001 From: Ad5001 Date: Mon, 25 Mar 2024 18:58:07 +0100 Subject: [PATCH] Fixing sequence no longer working with current rendering method. --- .../qml/eu/ad5001/LogarithmPlotter/js/math/sequence.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/math/sequence.js b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/math/sequence.js index 352a386..cd0960a 100644 --- a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/math/sequence.js +++ b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/math/sequence.js @@ -65,11 +65,15 @@ class Sequence extends Expr.Expression { cache(n = 1) { var str = Utils.simplifyExpression(this.calc.substitute('n', n-this.valuePlus).toString()) var expr = C.parser.parse(str).simplify() + // Chache values required for this one. + if(!this.calcValues[n-this.valuePlus] && n-this.valuePlus > 0) + this.cache(n-this.valuePlus) + // Setting current variables C.currentVars = Object.assign( {'n': n-this.valuePlus}, // Just in case, add n (for custom functions) - C.currentObjectsByName + C.currentObjectsByName, + {[this.name]: this.calcValues} ) - C.currentVars[this.name] = this.calcValues this.calcValues[n] = expr.evaluate(C.currentVars) }