1. X Cursors pointing to an object when LaTeX is enabled make LogarithmPlotter crash due to invalid LaTeX. 2. Invalid class-property types are now directly generated from the static instance. 3. Sequences didn't include sequence value properly anymore.
This commit is contained in:
parent
dc532fcd19
commit
b519e34016
9 changed files with 5 additions and 11 deletions
|
@ -252,7 +252,6 @@ Item {
|
|||
let tokenizer = new Parsing.Tokenizer(new Parsing.Input(text), true, false)
|
||||
let parsedText = ""
|
||||
let token
|
||||
console.log("Parsing text:", parsedText)
|
||||
while((token = tokenizer.next()) != null) {
|
||||
switch(token.type) {
|
||||
case Parsing.TokenType.VARIABLE:
|
||||
|
@ -280,7 +279,6 @@ Item {
|
|||
break;
|
||||
}
|
||||
}
|
||||
console.log("Parsed text:", parsedText)
|
||||
return parsedText
|
||||
}
|
||||
}
|
||||
|
|
|
@ -66,9 +66,10 @@ class Sequence extends Expr.Expression {
|
|||
var str = Utils.simplifyExpression(this.calc.substitute('n', n-this.valuePlus).toString())
|
||||
var expr = C.parser.parse(str).simplify()
|
||||
C.currentVars = Object.assign(
|
||||
{'n': n-this.valuePlus, [this.name]: this.calcValues}, // Just in case, add n (for custom functions)
|
||||
{'n': n-this.valuePlus}, // Just in case, add n (for custom functions)
|
||||
C.currentObjectsByName
|
||||
)
|
||||
C.currentVars[this.name] = this.calcValues
|
||||
this.calcValues[n] = expr.evaluate(C.currentVars)
|
||||
}
|
||||
|
||||
|
|
|
@ -112,7 +112,7 @@ class DrawableObject {
|
|||
*/
|
||||
constructor(name, visible = true, color = null, labelContent = 'name + value') {
|
||||
if(color == null) color = Utils.getRandomColor()
|
||||
this.type = 'Unknown'
|
||||
this.type = this.constructor.type()
|
||||
this.name = name
|
||||
this.visible = visible
|
||||
this.color = color
|
||||
|
|
|
@ -54,7 +54,6 @@ class Function extends Common.ExecutableObject {
|
|||
drawPoints = true, drawDashedLines = true) {
|
||||
if(name == null) name = Common.getNewName('fghjqlmnopqrstuvwabcde')
|
||||
super(name, visible, color, labelContent)
|
||||
this.type = 'Function'
|
||||
if(typeof expression == 'number' || typeof expression == 'string') expression = new MathLib.Expression(expression.toString())
|
||||
this.expression = expression
|
||||
if(typeof definitionDomain == 'string') definitionDomain = MathLib.parseDomain(definitionDomain)
|
||||
|
|
|
@ -46,7 +46,6 @@ class GainBode extends Common.ExecutableObject {
|
|||
if(name == null) name = Common.getNewName('G')
|
||||
if(name == 'G') name = 'G₀' // G is reserved for sum of BODE magnitudes (Somme gains Bode).
|
||||
super(name, visible, color, labelContent)
|
||||
this.type = 'Gain Bode'
|
||||
if(typeof om_0 == "string") {
|
||||
// Point name or create one
|
||||
om_0 = Objects.currentObjectsByName[om_0]
|
||||
|
|
|
@ -43,7 +43,6 @@ class PhaseBode extends Common.ExecutableObject {
|
|||
if(name == null) name = Common.getNewName('φ')
|
||||
if(name == 'φ') name = 'φ₀' // φ is reserved for sum of BODE phases (Somme phases Bode).
|
||||
super(name, visible, color, labelContent)
|
||||
this.type = 'Phase Bode'
|
||||
if(typeof phase == 'number' || typeof phase == 'string') phase = new MathLib.Expression(phase.toString())
|
||||
this.phase = phase
|
||||
if(typeof om_0 == "string") {
|
||||
|
|
|
@ -40,7 +40,6 @@ class Point extends Common.DrawableObject {
|
|||
x = 1, y = 0, labelPosition = 'above', pointStyle = '●') {
|
||||
if(name == null) name = Common.getNewName('ABCDEFJKLMNOPQRSTUVW')
|
||||
super(name, visible, color, labelContent)
|
||||
this.type = 'Point'
|
||||
if(typeof x == 'number' || typeof x == 'string') x = new MathLib.Expression(x.toString())
|
||||
this.x = x
|
||||
if(typeof y == 'number' || typeof y == 'string') y = new MathLib.Expression(y.toString())
|
||||
|
|
|
@ -45,7 +45,6 @@ class Text extends Common.DrawableObject {
|
|||
x = 1, y = 0, labelPosition = 'center', text = 'New text', disableLatex = false) {
|
||||
if(name == null) name = Common.getNewName('t')
|
||||
super(name, visible, color, labelContent)
|
||||
this.type = 'Text'
|
||||
if(typeof x == 'number' || typeof x == 'string') x = new MathLib.Expression(x.toString())
|
||||
this.x = x
|
||||
if(typeof y == 'number' || typeof y == 'string') y = new MathLib.Expression(y.toString())
|
||||
|
|
|
@ -49,7 +49,6 @@ class XCursor extends Common.DrawableObject {
|
|||
rounding = 3, displayStyle = '— — — — — — —', targetValuePosition = 'Next to target') {
|
||||
if(name == null) name = Common.getNewName('X')
|
||||
super(name, visible, color, labelContent)
|
||||
this.type = 'X Cursor'
|
||||
this.approximate = approximate
|
||||
this.rounding = rounding
|
||||
if(typeof x == 'number' || typeof x == 'string') x = new MathLib.Expression(x.toString())
|
||||
|
@ -78,7 +77,8 @@ class XCursor extends Common.DrawableObject {
|
|||
if(this.targetElement == null) return `${Latex.variable(this.name)} = ${this.x.latexMarkup}`
|
||||
return `\\begin{array}{l}
|
||||
${Latex.variable(this.name)} = ${this.x.latexMarkup} \\\\
|
||||
${this.getTargetValueLatexLabel()}`
|
||||
${this.getTargetValueLatexLabel()}
|
||||
\\end{array}`
|
||||
}
|
||||
|
||||
getTargetValueLabel() {
|
||||
|
|
Loading…
Reference in a new issue