Compare commits
No commits in common. "c66d08b3522ded83b03da42aa4df55456131725e" and "a88be8635040dc07f38f8c8ebbf91579d7bd0d37" have entirely different histories.
c66d08b352
...
a88be86350
33 changed files with 174 additions and 202 deletions
|
@ -17,11 +17,11 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Loading modules in order
|
// Loading modules in order
|
||||||
import * as Objects from "./module/objects.mjs"
|
import * as Objects from "./objects.mjs"
|
||||||
import * as ExprParser from "./module/expreval.mjs"
|
import * as ExprParser from "./lib/expr-eval/integration.mjs"
|
||||||
import * as ObjsAutoload from "./objs/autoload.mjs"
|
import * as ObjsAutoload from "./objs/autoload.mjs"
|
||||||
import * as Latex from "./module/latex.mjs"
|
import * as Latex from "./math/latex.mjs"
|
||||||
import * as History from "./module/history.mjs"
|
import * as HistoryCommon from "./history/common.mjs"
|
||||||
import * as CanvasAPI from "./module/canvas.mjs"
|
import * as CanvasAPI from "./canvas.mjs"
|
||||||
import * as IOAPI from "./module/io.mjs"
|
import * as IOAPI from "./io.mjs"
|
||||||
import * as PreferencesAPI from "./module/preferences.mjs"
|
import * as PreferencesAPI from "./preferences.mjs"
|
||||||
|
|
|
@ -16,12 +16,10 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Module } from "./common.mjs"
|
import { Module } from "./modules.mjs"
|
||||||
import { textsup } from "../utils.mjs"
|
import { textsup } from "./utils.mjs"
|
||||||
import { Expression } from "../mathlib.mjs"
|
import { Expression } from "./mathlib.mjs"
|
||||||
import Latex from "./latex.mjs"
|
import Latex from "./math/latex.mjs"
|
||||||
import Objects from "./objects.mjs"
|
|
||||||
import History from "./history.mjs"
|
|
||||||
|
|
||||||
|
|
||||||
class CanvasAPI extends Module {
|
class CanvasAPI extends Module {
|
||||||
|
@ -170,8 +168,8 @@ class CanvasAPI extends Module {
|
||||||
this._drawAxes()
|
this._drawAxes()
|
||||||
this._drawLabels()
|
this._drawLabels()
|
||||||
this._ctx.lineWidth = this.linewidth
|
this._ctx.lineWidth = this.linewidth
|
||||||
for(let objType in Objects.currentObjects) {
|
for(let objType in Modules.Objects.currentObjects) {
|
||||||
for(let obj of Objects.currentObjects[objType]){
|
for(let obj of Modules.Objects.currentObjects[objType]){
|
||||||
this._ctx.strokeStyle = obj.color
|
this._ctx.strokeStyle = obj.color
|
||||||
this._ctx.fillStyle = obj.color
|
this._ctx.fillStyle = obj.color
|
||||||
if(obj.visible)
|
if(obj.visible)
|
||||||
|
@ -182,7 +180,7 @@ class CanvasAPI extends Module {
|
||||||
console.error(e)
|
console.error(e)
|
||||||
console.log(e.stack)
|
console.log(e.stack)
|
||||||
this._drawingErrorDialog.showDialog(objType, obj.name, e.message)
|
this._drawingErrorDialog.showDialog(objType, obj.name, e.message)
|
||||||
History.undo()
|
Modules.History.undo()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -190,7 +188,7 @@ class CanvasAPI extends Module {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Calculates information for drawing gradations for axes.
|
* Calculates informations for drawing gradations for axes.
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
_computeAxes() {
|
_computeAxes() {
|
||||||
|
@ -540,4 +538,4 @@ class CanvasAPI extends Module {
|
||||||
|
|
||||||
/** @type {CanvasAPI} */
|
/** @type {CanvasAPI} */
|
||||||
Modules.Canvas = Modules.Canvas || new CanvasAPI()
|
Modules.Canvas = Modules.Canvas || new CanvasAPI()
|
||||||
export default Modules.Canvas
|
export const API = Modules.Canvas
|
|
@ -17,7 +17,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import EditedProperty from "editproperty.mjs"
|
import EditedProperty from "editproperty.mjs"
|
||||||
import Objects from "../module/objects.mjs"
|
import Objects from "../objects.mjs"
|
||||||
|
|
||||||
export default class ColorChanged extends EditedProperty {
|
export default class ColorChanged extends EditedProperty {
|
||||||
// Action used everytime when an object's color is changed
|
// Action used everytime when an object's color is changed
|
||||||
|
|
|
@ -16,8 +16,34 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import History from "../module/history.mjs"
|
import { Module } from "../modules.mjs"
|
||||||
import Latex from "../module/latex.mjs"
|
import Latex from "../math/latex.mjs"
|
||||||
|
|
||||||
|
|
||||||
|
class HistoryCommonAPI extends Module {
|
||||||
|
constructor() {
|
||||||
|
super('History', [
|
||||||
|
Modules.Latex
|
||||||
|
])
|
||||||
|
// History QML object
|
||||||
|
this.history = null;
|
||||||
|
this.themeTextColor = "#ff0000";
|
||||||
|
this.imageDepth = 2;
|
||||||
|
this.fontSize = 14;
|
||||||
|
}
|
||||||
|
|
||||||
|
undo() { this.history.undo() }
|
||||||
|
redo() { this.history.redo() }
|
||||||
|
clear() { this.history.clear() }
|
||||||
|
addToHistory(action) { this.history.addToHistory(action) }
|
||||||
|
unserialize(...data) { this.history.unserialize(...data) }
|
||||||
|
serialize() { return this.history.serialize() }
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @type {HistoryCommonAPI} */
|
||||||
|
Modules.History = Modules.History || new HistoryCommonAPI()
|
||||||
|
|
||||||
|
export const API = Modules.History
|
||||||
|
|
||||||
export class Action {
|
export class Action {
|
||||||
/**
|
/**
|
||||||
|
@ -76,7 +102,7 @@ export class Action {
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
getIconRichText(type) {
|
getIconRichText(type) {
|
||||||
return `<img source="../icons/objects/${type}.svg" style="color: ${History.themeTextColor};" width=18 height=18></img>`
|
return `<img source="../icons/objects/${type}.svg" style="color: ${Modules.History.themeTextColor};" width=18 height=18></img>`
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -89,11 +115,11 @@ export class Action {
|
||||||
if(!Latex.enabled)
|
if(!Latex.enabled)
|
||||||
throw new Error("Cannot render an item as LaTeX when LaTeX is disabled.")
|
throw new Error("Cannot render an item as LaTeX when LaTeX is disabled.")
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
let imgDepth = History.imageDepth
|
let imgDepth = Modules.History.imageDepth
|
||||||
Latex.requestAsyncRender(
|
Latex.requestAsyncRender(
|
||||||
latexString,
|
latexString,
|
||||||
imgDepth * (History.fontSize + 2),
|
imgDepth * (Modules.History.fontSize + 2),
|
||||||
History.themeTextColor
|
Modules.History.themeTextColor
|
||||||
).then((imgData) => {
|
).then((imgData) => {
|
||||||
const { source, width, height } = imgData
|
const { source, width, height } = imgData
|
||||||
resolve(`<img src="${source}" width="${width/imgDepth}" height="${height/imgDepth}" style="vertical-align: middle"/>`)
|
resolve(`<img src="${source}" width="${width/imgDepth}" height="${height/imgDepth}" style="vertical-align: middle"/>`)
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import Objects from "../module/objects.mjs"
|
import Objects from "../objects.mjs"
|
||||||
import { Action } from "common.mjs"
|
import { Action } from "common.mjs"
|
||||||
|
|
||||||
export default class CreateNewObject extends Action {
|
export default class CreateNewObject extends Action {
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import Objects from "../module/objects.mjs"
|
import Objects from "../objects.mjs"
|
||||||
import CreateNewObject from "create.mjs"
|
import CreateNewObject from "create.mjs"
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -16,8 +16,8 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import Objects from "../module/objects.mjs"
|
import Objects from "../objects.mjs"
|
||||||
import Latex from "../module/latex.mjs"
|
import Latex from "../math/latex.mjs"
|
||||||
import * as MathLib from "../mathlib.mjs"
|
import * as MathLib from "../mathlib.mjs"
|
||||||
import { Action } from "common.mjs"
|
import { Action } from "common.mjs"
|
||||||
import { DrawableObject } from "../objs/common.mjs"
|
import { DrawableObject } from "../objs/common.mjs"
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import EditedProperty from "editproperty.mjs"
|
import EditedProperty from "editproperty.mjs"
|
||||||
import Objects from "../module/objects.mjs"
|
import Objects from "../objects.mjs"
|
||||||
|
|
||||||
|
|
||||||
export default class NameChanged extends EditedProperty {
|
export default class NameChanged extends EditedProperty {
|
||||||
|
|
|
@ -16,8 +16,8 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import Objects from "../module/objects.mjs"
|
import Objects from "../objects.mjs"
|
||||||
import Latex from "../module/latex.mjs"
|
import Latex from "../math/latex.mjs"
|
||||||
import * as MathLib from "../mathlib.mjs"
|
import * as MathLib from "../mathlib.mjs"
|
||||||
import { escapeHTML } from "../utils.mjs"
|
import { escapeHTML } from "../utils.mjs"
|
||||||
import { Action } from "common.mjs"
|
import { Action } from "common.mjs"
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import EditedProperty from "editproperty.mjs"
|
import EditedProperty from "editproperty.mjs"
|
||||||
import Objects from "../module/objects.mjs"
|
import Objects from "../objects.mjs"
|
||||||
|
|
||||||
|
|
||||||
export default class EditedVisibility extends EditedProperty {
|
export default class EditedVisibility extends EditedProperty {
|
||||||
|
|
|
@ -16,15 +16,12 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Module } from "./common.mjs"
|
import {Module} from "./modules.mjs"
|
||||||
import Objects from "./objects.mjs"
|
|
||||||
import History from "./history.mjs"
|
|
||||||
import Canvas from "./canvas.mjs"
|
|
||||||
|
|
||||||
class IOAPI extends Module {
|
class IOAPI extends Module {
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super("IO", [
|
super('IO', [
|
||||||
Modules.Objects,
|
Modules.Objects,
|
||||||
Modules.History
|
Modules.History
|
||||||
])
|
])
|
||||||
|
@ -53,13 +50,13 @@ class IOAPI extends Module {
|
||||||
*/
|
*/
|
||||||
saveDiagram(filename) {
|
saveDiagram(filename) {
|
||||||
// Add extension if necessary
|
// Add extension if necessary
|
||||||
if(["lpf"].indexOf(filename.split(".")[filename.split(".").length - 1]) === -1)
|
if(['lpf'].indexOf(filename.split('.')[filename.split('.').length-1]) === -1)
|
||||||
filename += ".lpf"
|
filename += '.lpf'
|
||||||
this.saveFilename = filename
|
this.saveFilename = filename
|
||||||
let objs = {}
|
let objs = {}
|
||||||
for(let objType in Objects.currentObjects) {
|
for(let objType in Modules.Objects.currentObjects){
|
||||||
objs[objType] = []
|
objs[objType] = []
|
||||||
for(let obj of Objects.currentObjects[objType]) {
|
for(let obj of Modules.Objects.currentObjects[objType]) {
|
||||||
objs[objType].push(obj.export())
|
objs[objType].push(obj.export())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -77,15 +74,15 @@ class IOAPI extends Module {
|
||||||
"showxgrad": this.settings.showxgrad,
|
"showxgrad": this.settings.showxgrad,
|
||||||
"showygrad": this.settings.showygrad,
|
"showygrad": this.settings.showygrad,
|
||||||
"textsize": this.settings.textsize,
|
"textsize": this.settings.textsize,
|
||||||
"history": History.serialize(),
|
"history": Modules.History.serialize(),
|
||||||
"width": this.rootElement.width,
|
"width": this.rootElement.width,
|
||||||
"height": this.rootElement.height,
|
"height": this.rootElement.height,
|
||||||
"objects": objs,
|
"objects": objs,
|
||||||
"type": "logplotv1"
|
"type": "logplotv1"
|
||||||
}
|
}
|
||||||
Helper.write(filename, JSON.stringify(settings))
|
Helper.write(filename, JSON.stringify(settings))
|
||||||
this.alert.show(qsTranslate("io", "Saved plot to '%1'.").arg(filename.split("/").pop()))
|
this.alert.show(qsTranslate('io', "Saved plot to '%1'.").arg(filename.split("/").pop()))
|
||||||
History.history.saved = true
|
Modules.History.history.saved = true
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -94,16 +91,16 @@ class IOAPI extends Module {
|
||||||
*/
|
*/
|
||||||
loadDiagram(filename) {
|
loadDiagram(filename) {
|
||||||
let basename = filename.split("/").pop()
|
let basename = filename.split("/").pop()
|
||||||
this.alert.show(qsTranslate("io", "Loading file '%1'.").arg(basename))
|
this.alert.show(qsTranslate('io', "Loading file '%1'.").arg(basename))
|
||||||
let data = JSON.parse(Helper.load(filename))
|
let data = JSON.parse(Helper.load(filename))
|
||||||
let error = ""
|
let error = "";
|
||||||
if(Object.keys(data).includes("type") && data["type"] === "logplotv1") {
|
if(Object.keys(data).includes("type") && data["type"] === "logplotv1") {
|
||||||
History.clear()
|
Modules.History.clear()
|
||||||
// Importing settings
|
// Importing settings
|
||||||
this.settings.saveFilename = filename
|
this.settings.saveFilename = filename
|
||||||
this.settings.xzoom = parseFloat(data["xzoom"]) || 100
|
this.settings.xzoom = parseFloat(data["xzoom"]) || 100
|
||||||
this.settings.yzoom = parseFloat(data["yzoom"]) || 10
|
this.settings.yzoom = parseFloat(data["yzoom"]) || 10
|
||||||
this.settings.xmin = parseFloat(data["xmin"]) || 5 / 10
|
this.settings.xmin = parseFloat(data["xmin"]) || 5/10
|
||||||
this.settings.ymax = parseFloat(data["ymax"]) || 24
|
this.settings.ymax = parseFloat(data["ymax"]) || 24
|
||||||
this.settings.xaxisstep = data["xaxisstep"] || "4"
|
this.settings.xaxisstep = data["xaxisstep"] || "4"
|
||||||
this.settings.yaxisstep = data["yaxisstep"] || "4"
|
this.settings.yaxisstep = data["yaxisstep"] || "4"
|
||||||
|
@ -122,53 +119,51 @@ class IOAPI extends Module {
|
||||||
this.rootElement.width = parseFloat(data["width"]) || 1000
|
this.rootElement.width = parseFloat(data["width"]) || 1000
|
||||||
|
|
||||||
// Importing objects
|
// Importing objects
|
||||||
Objects.currentObjects = {}
|
Modules.Objects.currentObjects = {}
|
||||||
for(let key of Object.keys(Objects.currentObjectsByName)) {
|
for(let key of Object.keys(Modules.Objects.currentObjectsByName)) {
|
||||||
delete Objects.currentObjectsByName[key]
|
delete Modules.Objects.currentObjectsByName[key];
|
||||||
// Required to keep the same reference for the copy of the object used in expression variable detection.
|
// Required to keep the same reference for the copy of the object used in expression variable detection.
|
||||||
// Another way would be to change the reference as well, but I feel like the code would be less clean.
|
// Another way would be to change the reference as well, but I feel like the code would be less clean.
|
||||||
}
|
}
|
||||||
for(let objType in data["objects"]) {
|
for(let objType in data['objects']) {
|
||||||
if(Object.keys(Objects.types).indexOf(objType) > -1) {
|
if(Object.keys(Modules.Objects.types).indexOf(objType) > -1) {
|
||||||
Objects.currentObjects[objType] = []
|
Modules.Objects.currentObjects[objType] = []
|
||||||
for(let objData of data["objects"][objType]) {
|
for(let objData of data['objects'][objType]) {
|
||||||
/** @type {DrawableObject} */
|
/** @type {DrawableObject} */
|
||||||
let obj = Objects.types[objType].import(...objData)
|
let obj = Modules.Objects.types[objType].import(...objData)
|
||||||
Objects.currentObjects[objType].push(obj)
|
Modules.Objects.currentObjects[objType].push(obj)
|
||||||
Objects.currentObjectsByName[obj.name] = obj
|
Modules.Objects.currentObjectsByName[obj.name] = obj
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
error += qsTranslate("io", "Unknown object type: %1.").arg(objType) + "\n"
|
error += qsTranslate('io', "Unknown object type: %1.").arg(objType) + "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Updating object dependencies.
|
// Updating object dependencies.
|
||||||
for(let objName in Objects.currentObjectsByName)
|
for(let objName in Modules.Objects.currentObjectsByName)
|
||||||
Objects.currentObjectsByName[objName].update()
|
Modules.Objects.currentObjectsByName[objName].update()
|
||||||
|
|
||||||
// Importing history
|
// Importing history
|
||||||
if("history" in data)
|
if("history" in data)
|
||||||
History.unserialize(...data["history"])
|
Modules.History.unserialize(...data["history"])
|
||||||
|
|
||||||
// Refreshing sidebar
|
// Refreshing sidebar
|
||||||
this.rootElement.updateObjectsLists()
|
this.rootElement.updateObjectsLists()
|
||||||
} else {
|
} else {
|
||||||
error = qsTranslate("io", "Invalid file provided.")
|
error = qsTranslate('io', "Invalid file provided.")
|
||||||
}
|
}
|
||||||
if(error !== "") {
|
if(error !== "") {
|
||||||
console.log(error)
|
console.log(error)
|
||||||
this.alert.show(qsTranslate("io", "Could not save file: ") + error)
|
this.alert.show(qsTranslate('io', "Could not save file: ") + error)
|
||||||
// TODO: Error handling
|
// TODO: Error handling
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
Canvas.redraw()
|
Modules.Canvas.redraw()
|
||||||
this.alert.show(qsTranslate("io", "Loaded file '%1'.").arg(basename))
|
this.alert.show(qsTranslate('io', "Loaded file '%1'.").arg(basename))
|
||||||
History.history.saved = true
|
Modules.History.history.saved = true
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @type {IOAPI} */
|
/** @type {IOAPI} */
|
||||||
Modules.IO = Modules.IO || new IOAPI()
|
Modules.IO = Modules.IO || new IOAPI()
|
||||||
|
|
||||||
export default Modules.IO
|
|
|
@ -16,8 +16,8 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Module } from "./common.mjs"
|
import { Module } from "../../modules.mjs"
|
||||||
import { Parser } from "../lib/expr-eval/parser.mjs"
|
import { Parser } from "./parser.mjs"
|
||||||
|
|
||||||
const evalVariables = {
|
const evalVariables = {
|
||||||
// Variables not provided by expr-eval.js, needs to be provided manually
|
// Variables not provided by expr-eval.js, needs to be provided manually
|
||||||
|
@ -112,5 +112,5 @@ export class ExprParserAPI extends Module {
|
||||||
/** @type {ExprParserAPI} */
|
/** @type {ExprParserAPI} */
|
||||||
Modules.ExprParser = Modules.ExprParser || new ExprParserAPI()
|
Modules.ExprParser = Modules.ExprParser || new ExprParserAPI()
|
||||||
|
|
||||||
export default Modules.ExprParser
|
|
||||||
|
|
|
@ -17,19 +17,21 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
import Latex from "latex.mjs"
|
||||||
import * as Utils from "../utils.mjs"
|
import * as Utils from "../utils.mjs"
|
||||||
import Latex from "../module/latex.mjs"
|
|
||||||
import ExprParser from "../module/expreval.mjs"
|
|
||||||
import Objects from "../module/objects.mjs"
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents any kind of x-based or non variable based expression.
|
* Represents any kind of x-based or non variable based expression.
|
||||||
*/
|
*/
|
||||||
export class Expression {
|
export class Expression {
|
||||||
constructor(expr) {
|
constructor(expr) {
|
||||||
|
if(!Modules.ExprParser)
|
||||||
|
throw new Error('Expression parser not initialized.')
|
||||||
|
if(!Modules.Objects)
|
||||||
|
throw new Error('Objects API not initialized.')
|
||||||
if(typeof expr === "string") {
|
if(typeof expr === "string") {
|
||||||
this.expr = Utils.exponentsToExpression(expr)
|
this.expr = Utils.exponentsToExpression(expr)
|
||||||
this.calc = ExprParser.parse(this.expr).simplify()
|
this.calc = Modules.ExprParser.parse(this.expr).simplify()
|
||||||
} else {
|
} else {
|
||||||
// Passed an expression here directly.
|
// Passed an expression here directly.
|
||||||
this.calc = expr.simplify()
|
this.calc = expr.simplify()
|
||||||
|
@ -38,7 +40,7 @@ export class Expression {
|
||||||
this.cached = this.isConstant()
|
this.cached = this.isConstant()
|
||||||
this.cachedValue = null
|
this.cachedValue = null
|
||||||
if(this.cached && this.allRequirementsFullfilled())
|
if(this.cached && this.allRequirementsFullfilled())
|
||||||
this.cachedValue = this.calc.evaluate(Objects.currentObjectsByName)
|
this.cachedValue = this.calc.evaluate(Modules.Objects.currentObjectsByName)
|
||||||
this.latexMarkup = Latex.expression(this.calc.tokens)
|
this.latexMarkup = Latex.expression(this.calc.tokens)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,26 +54,26 @@ export class Expression {
|
||||||
}
|
}
|
||||||
|
|
||||||
allRequirementsFullfilled() {
|
allRequirementsFullfilled() {
|
||||||
return this.requiredObjects().every(objName => objName in Objects.currentObjectsByName)
|
return this.requiredObjects().every(objName => objName in Modules.Objects.currentObjectsByName)
|
||||||
}
|
}
|
||||||
|
|
||||||
undefinedVariables() {
|
undefinedVariables() {
|
||||||
return this.requiredObjects().filter(objName => !(objName in Objects.currentObjectsByName))
|
return this.requiredObjects().filter(objName => !(objName in Modules.Objects.currentObjectsByName))
|
||||||
}
|
}
|
||||||
|
|
||||||
recache() {
|
recache() {
|
||||||
if(this.cached)
|
if(this.cached)
|
||||||
this.cachedValue = this.calc.evaluate(Objects.currentObjectsByName)
|
this.cachedValue = this.calc.evaluate(Modules.Objects.currentObjectsByName)
|
||||||
}
|
}
|
||||||
|
|
||||||
execute(x = 1) {
|
execute(x = 1) {
|
||||||
if(this.cached) {
|
if(this.cached) {
|
||||||
if(this.cachedValue == null)
|
if(this.cachedValue == null)
|
||||||
this.cachedValue = this.calc.evaluate(Objects.currentObjectsByName)
|
this.cachedValue = this.calc.evaluate(Modules.Objects.currentObjectsByName)
|
||||||
return this.cachedValue
|
return this.cachedValue
|
||||||
}
|
}
|
||||||
ExprParser.currentVars = Object.assign({'x': x}, Objects.currentObjectsByName)
|
Modules.ExprParser.currentVars = Object.assign({'x': x}, Modules.Objects.currentObjectsByName)
|
||||||
return this.calc.evaluate(ExprParser.currentVars)
|
return this.calc.evaluate(Modules.ExprParser.currentVars)
|
||||||
}
|
}
|
||||||
|
|
||||||
simplify(x) {
|
simplify(x) {
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Module } from "./common.mjs"
|
import { Module } from "../modules.mjs"
|
||||||
import * as Instruction from "../lib/expr-eval/instruction.mjs"
|
import * as Instruction from "../lib/expr-eval/instruction.mjs"
|
||||||
import { escapeValue } from "../lib/expr-eval/expression.mjs"
|
import { escapeValue } from "../lib/expr-eval/expression.mjs"
|
||||||
|
|
|
@ -18,9 +18,7 @@
|
||||||
|
|
||||||
import * as Expr from "expression.mjs"
|
import * as Expr from "expression.mjs"
|
||||||
import * as Utils from "../utils.mjs"
|
import * as Utils from "../utils.mjs"
|
||||||
import Latex from "../module/latex.mjs"
|
import Latex from "../math/latex.mjs"
|
||||||
import Objects from "../module/objects.mjs"
|
|
||||||
import ExprParser from "../module/expreval.mjs"
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents mathematical object for sequences.
|
* Represents mathematical object for sequences.
|
||||||
|
@ -35,7 +33,7 @@ export class Sequence extends Expr.Expression {
|
||||||
this.latexValues = Object.assign({}, baseValues)
|
this.latexValues = Object.assign({}, baseValues)
|
||||||
for(let n in this.calcValues)
|
for(let n in this.calcValues)
|
||||||
if(['string', 'number'].includes(typeof this.calcValues[n])) {
|
if(['string', 'number'].includes(typeof this.calcValues[n])) {
|
||||||
let parsed = ExprParser.parse(this.calcValues[n].toString()).simplify()
|
let parsed = Modules.ExprParser.parse(this.calcValues[n].toString()).simplify()
|
||||||
this.latexValues[n] = Latex.expression(parsed.tokens)
|
this.latexValues[n] = Latex.expression(parsed.tokens)
|
||||||
this.calcValues[n] = parsed.evaluate()
|
this.calcValues[n] = parsed.evaluate()
|
||||||
}
|
}
|
||||||
|
@ -61,17 +59,17 @@ export class Sequence extends Expr.Expression {
|
||||||
|
|
||||||
cache(n = 1) {
|
cache(n = 1) {
|
||||||
let str = Utils.simplifyExpression(this.calc.substitute('n', n-this.valuePlus).toString())
|
let str = Utils.simplifyExpression(this.calc.substitute('n', n-this.valuePlus).toString())
|
||||||
let expr = ExprParser.parse(str).simplify()
|
let expr = Modules.ExprParser.parse(str).simplify()
|
||||||
// Cache values required for this one.
|
// Cache values required for this one.
|
||||||
if(!this.calcValues[n-this.valuePlus] && n-this.valuePlus > 0)
|
if(!this.calcValues[n-this.valuePlus] && n-this.valuePlus > 0)
|
||||||
this.cache(n-this.valuePlus)
|
this.cache(n-this.valuePlus)
|
||||||
// Setting current variables
|
// Setting current variables
|
||||||
ExprParser.currentVars = Object.assign(
|
Modules.ExprParser.currentVars = Object.assign(
|
||||||
{'n': n-this.valuePlus}, // Just in case, add n (for custom functions)
|
{'n': n-this.valuePlus}, // Just in case, add n (for custom functions)
|
||||||
Objects.currentObjectsByName,
|
Modules.Objects.currentObjectsByName,
|
||||||
{[this.name]: this.calcValues}
|
{[this.name]: this.calcValues}
|
||||||
)
|
)
|
||||||
this.calcValues[n] = expr.evaluate(ExprParser.currentVars)
|
this.calcValues[n] = expr.evaluate(Modules.ExprParser.currentVars)
|
||||||
}
|
}
|
||||||
|
|
||||||
toString(forceSign=false) {
|
toString(forceSign=false) {
|
||||||
|
|
|
@ -1,46 +0,0 @@
|
||||||
/**
|
|
||||||
* LogarithmPlotter - 2D plotter software to make BODE plots, sequences and distribution functions.
|
|
||||||
* Copyright (C) 2021-2024 Ad5001
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import { Module } from "./common.mjs"
|
|
||||||
import Latex from "./latex.mjs"
|
|
||||||
|
|
||||||
|
|
||||||
class HistoryAPI extends Module {
|
|
||||||
constructor() {
|
|
||||||
super('History', [
|
|
||||||
Modules.Latex
|
|
||||||
])
|
|
||||||
// History QML object
|
|
||||||
this.history = null;
|
|
||||||
this.themeTextColor = "#ff0000";
|
|
||||||
this.imageDepth = 2;
|
|
||||||
this.fontSize = 14;
|
|
||||||
}
|
|
||||||
|
|
||||||
undo() { this.history.undo() }
|
|
||||||
redo() { this.history.redo() }
|
|
||||||
clear() { this.history.clear() }
|
|
||||||
addToHistory(action) { this.history.addToHistory(action) }
|
|
||||||
unserialize(...data) { this.history.unserialize(...data) }
|
|
||||||
serialize() { return this.history.serialize() }
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @type {HistoryAPI} */
|
|
||||||
Modules.History = Modules.History || new HistoryAPI()
|
|
||||||
|
|
||||||
export default Modules.History
|
|
|
@ -16,8 +16,8 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Module } from './common.mjs'
|
import { Module } from './modules.mjs'
|
||||||
import { textsub } from '../utils.mjs'
|
import { textsub } from './utils.mjs'
|
||||||
|
|
||||||
class ObjectsAPI extends Module {
|
class ObjectsAPI extends Module {
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import Objects from "../module/objects.mjs"
|
import Objects from "../objects.mjs"
|
||||||
import { DrawableObject } from "common.mjs"
|
import { DrawableObject } from "common.mjs"
|
||||||
import Point from "point.mjs"
|
import Point from "point.mjs"
|
||||||
import Text from "text.mjs"
|
import Text from "text.mjs"
|
||||||
|
@ -43,7 +43,7 @@ function registerObject(obj) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Object.keys(Objects.types).length === 0) {
|
if(Object.keys(Modules.Objects.types).length === 0) {
|
||||||
registerObject(Point)
|
registerObject(Point)
|
||||||
registerObject(Text)
|
registerObject(Text)
|
||||||
registerObject(Function)
|
registerObject(Function)
|
||||||
|
|
|
@ -17,15 +17,17 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { parseDomain, executeExpression, Expression, EmptySet, Domain } from "../mathlib.mjs"
|
import { parseDomain, executeExpression, Expression, EmptySet, Domain } from "../mathlib.mjs"
|
||||||
import { CreateNewObject } from "../historylib.mjs"
|
|
||||||
import * as P from "../parameters.mjs"
|
import * as P from "../parameters.mjs"
|
||||||
import Objects from "../module/objects.mjs"
|
import Objects from "../objects.mjs"
|
||||||
import Latex from "../module/latex.mjs"
|
import Latex from "../math/latex.mjs"
|
||||||
import History from "../module/history.mjs"
|
|
||||||
|
|
||||||
import { ExecutableObject } from "common.mjs"
|
import { ExecutableObject } from "common.mjs"
|
||||||
import Function from "function.mjs"
|
import Function from "function.mjs"
|
||||||
|
|
||||||
|
import { API as HistoryAPI } from "../history/common.mjs"
|
||||||
|
import { CreateNewObject } from "../historylib.mjs"
|
||||||
|
|
||||||
|
|
||||||
export default class BodeMagnitude extends ExecutableObject {
|
export default class BodeMagnitude extends ExecutableObject {
|
||||||
static type(){return 'Gain Bode'}
|
static type(){return 'Gain Bode'}
|
||||||
static displayType(){return qsTranslate("bodemagnitude", 'Bode Magnitude')}
|
static displayType(){return qsTranslate("bodemagnitude", 'Bode Magnitude')}
|
||||||
|
@ -50,7 +52,7 @@ export default class BodeMagnitude extends ExecutableObject {
|
||||||
if(om_0 == null) {
|
if(om_0 == null) {
|
||||||
// Create new point
|
// Create new point
|
||||||
om_0 = Objects.createNewRegisteredObject('Point', [Objects.getNewName('ω'), true, this.color, 'name'])
|
om_0 = Objects.createNewRegisteredObject('Point', [Objects.getNewName('ω'), true, this.color, 'name'])
|
||||||
History.addToHistory(new CreateNewObject(om_0.name, 'Point', om_0.export()))
|
HistoryAPI.addToHistory(new CreateNewObject(om_0.name, 'Point', om_0.export()))
|
||||||
om_0.update()
|
om_0.update()
|
||||||
labelPosition = 'below'
|
labelPosition = 'below'
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,8 +18,8 @@
|
||||||
|
|
||||||
import { Range, Expression, Domain } from "../mathlib.mjs"
|
import { Range, Expression, Domain } from "../mathlib.mjs"
|
||||||
import * as P from "../parameters.mjs"
|
import * as P from "../parameters.mjs"
|
||||||
import Objects from "../module/objects.mjs"
|
import Objects from "../objects.mjs"
|
||||||
import Latex from "../module/latex.mjs"
|
import Latex from "../math/latex.mjs"
|
||||||
|
|
||||||
import { ExecutableObject } from "common.mjs"
|
import { ExecutableObject } from "common.mjs"
|
||||||
import Function from "function.mjs"
|
import Function from "function.mjs"
|
||||||
|
|
|
@ -17,11 +17,11 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { executeExpression, Expression } from "../mathlib.mjs"
|
import { executeExpression, Expression } from "../mathlib.mjs"
|
||||||
import { CreateNewObject } from "../historylib.mjs"
|
|
||||||
import * as P from "../parameters.mjs"
|
import * as P from "../parameters.mjs"
|
||||||
import Objects from "../module/objects.mjs"
|
import Objects from "../objects.mjs"
|
||||||
import History from "../module/history.mjs"
|
import { API as HistoryAPI } from "../history/common.mjs"
|
||||||
import Latex from "../module/latex.mjs"
|
import { CreateNewObject } from "../historylib.mjs"
|
||||||
|
import Latex from "../math/latex.mjs"
|
||||||
|
|
||||||
import { ExecutableObject } from "common.mjs"
|
import { ExecutableObject } from "common.mjs"
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ export default class BodePhase extends ExecutableObject {
|
||||||
// Create new point
|
// Create new point
|
||||||
om_0 = Objects.createNewRegisteredObject('Point', [Objects.getNewName('ω'), this.color, 'name'])
|
om_0 = Objects.createNewRegisteredObject('Point', [Objects.getNewName('ω'), this.color, 'name'])
|
||||||
om_0.labelPosition = this.phase.execute() >= 0 ? 'above' : 'below'
|
om_0.labelPosition = this.phase.execute() >= 0 ? 'above' : 'below'
|
||||||
History.history.addToHistory(new CreateNewObject(om_0.name, 'Point', om_0.export()))
|
HistoryAPI.history.addToHistory(new CreateNewObject(om_0.name, 'Point', om_0.export()))
|
||||||
labelPosition = 'below'
|
labelPosition = 'below'
|
||||||
}
|
}
|
||||||
om_0.requiredBy.push(this)
|
om_0.requiredBy.push(this)
|
||||||
|
|
|
@ -18,8 +18,8 @@
|
||||||
|
|
||||||
import { executeExpression, Expression } from "../mathlib.mjs"
|
import { executeExpression, Expression } from "../mathlib.mjs"
|
||||||
import * as P from "../parameters.mjs"
|
import * as P from "../parameters.mjs"
|
||||||
import Objects from "../module/objects.mjs"
|
import Objects from "../objects.mjs"
|
||||||
import Latex from "../module/latex.mjs"
|
import Latex from "../math/latex.mjs"
|
||||||
|
|
||||||
import { ExecutableObject } from "common.mjs"
|
import { ExecutableObject } from "common.mjs"
|
||||||
|
|
||||||
|
|
|
@ -17,8 +17,8 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { getRandomColor, textsub } from "../utils.mjs"
|
import { getRandomColor, textsub } from "../utils.mjs"
|
||||||
import Objects from "../module/objects.mjs"
|
import Objects from "../objects.mjs"
|
||||||
import Latex from "../module/latex.mjs"
|
import Latex from "../math/latex.mjs"
|
||||||
import {ensureTypeSafety, serializesByPropertyType} from "../parameters.mjs"
|
import {ensureTypeSafety, serializesByPropertyType} from "../parameters.mjs"
|
||||||
|
|
||||||
// This file contains the default data to be imported from all other objects
|
// This file contains the default data to be imported from all other objects
|
||||||
|
|
|
@ -17,8 +17,8 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import * as P from "../parameters.mjs"
|
import * as P from "../parameters.mjs"
|
||||||
import Objects from "../module/objects.mjs"
|
import Objects from "../objects.mjs"
|
||||||
import Latex from "../module/latex.mjs"
|
import Latex from "../math/latex.mjs"
|
||||||
|
|
||||||
import { ExecutableObject } from "common.mjs"
|
import { ExecutableObject } from "common.mjs"
|
||||||
|
|
||||||
|
|
|
@ -17,11 +17,11 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { textsub } from "../utils.mjs"
|
import { textsub } from "../utils.mjs"
|
||||||
import Objects from "../module/objects.mjs"
|
import Objects from "../objects.mjs"
|
||||||
import { ExecutableObject } from "common.mjs"
|
import { ExecutableObject } from "common.mjs"
|
||||||
import { parseDomain, Expression, SpecialDomain } from "../mathlib.mjs"
|
import { parseDomain, Expression, SpecialDomain } from "../mathlib.mjs"
|
||||||
import * as P from "../parameters.mjs"
|
import * as P from "../parameters.mjs"
|
||||||
import Latex from "../module/latex.mjs"
|
import Latex from "../math/latex.mjs"
|
||||||
|
|
||||||
|
|
||||||
export default class Function extends ExecutableObject {
|
export default class Function extends ExecutableObject {
|
||||||
|
|
|
@ -18,8 +18,8 @@
|
||||||
|
|
||||||
import { Expression } from "../mathlib.mjs"
|
import { Expression } from "../mathlib.mjs"
|
||||||
import * as P from "../parameters.mjs"
|
import * as P from "../parameters.mjs"
|
||||||
import Objects from "../module/objects.mjs"
|
import Objects from "../objects.mjs"
|
||||||
import Latex from "../module/latex.mjs"
|
import Latex from "../math/latex.mjs"
|
||||||
|
|
||||||
import { DrawableObject } from "common.mjs"
|
import { DrawableObject } from "common.mjs"
|
||||||
|
|
||||||
|
|
|
@ -18,8 +18,8 @@
|
||||||
|
|
||||||
import { Sequence as MathSequence, Domain } from "../mathlib.mjs"
|
import { Sequence as MathSequence, Domain } from "../mathlib.mjs"
|
||||||
import * as P from "../parameters.mjs"
|
import * as P from "../parameters.mjs"
|
||||||
import Latex from "../module/latex.mjs"
|
import Latex from "../math/latex.mjs"
|
||||||
import Objects from "../module/objects.mjs"
|
import Objects from "../objects.mjs"
|
||||||
|
|
||||||
import { ExecutableObject } from "common.mjs"
|
import { ExecutableObject } from "common.mjs"
|
||||||
import Function from "function.mjs"
|
import Function from "function.mjs"
|
||||||
|
|
|
@ -18,8 +18,8 @@
|
||||||
|
|
||||||
import { Expression } from "../mathlib.mjs"
|
import { Expression } from "../mathlib.mjs"
|
||||||
import * as P from "../parameters.mjs"
|
import * as P from "../parameters.mjs"
|
||||||
import Objects from "../module/objects.mjs"
|
import Objects from "../objects.mjs"
|
||||||
import Latex from "../module/latex.mjs"
|
import Latex from "../math/latex.mjs"
|
||||||
|
|
||||||
import { DrawableObject } from "common.mjs"
|
import { DrawableObject } from "common.mjs"
|
||||||
|
|
||||||
|
|
|
@ -18,8 +18,8 @@
|
||||||
|
|
||||||
import { Expression } from "../mathlib.mjs"
|
import { Expression } from "../mathlib.mjs"
|
||||||
import * as P from "../parameters.mjs"
|
import * as P from "../parameters.mjs"
|
||||||
import Latex from "../module/latex.mjs"
|
import Latex from "../math/latex.mjs"
|
||||||
import Objects from "../module/objects.mjs"
|
import Objects from "../objects.mjs"
|
||||||
|
|
||||||
import { DrawableObject } from "common.mjs"
|
import { DrawableObject } from "common.mjs"
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,6 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
import {parseDomain, Expression as Expr, Domain} from "./mathlib.mjs"
|
import {parseDomain, Expression as Expr, Domain} from "./mathlib.mjs"
|
||||||
import Objects from "./module/objects.mjs"
|
|
||||||
|
|
||||||
const NONE = class Empty {}
|
const NONE = class Empty {}
|
||||||
|
|
||||||
|
@ -130,8 +129,8 @@ export class ObjectType extends PropertyType {
|
||||||
|
|
||||||
parse(name) {
|
parse(name) {
|
||||||
let result = NONE
|
let result = NONE
|
||||||
if(typeof name == 'string' && name in Objects.currentObjectsByName) {
|
if(typeof name == 'string' && name in Modules.Objects.currentObjectsByName) {
|
||||||
let obj = Objects.currentObjectsByName[name]
|
let obj = Modules.Objects.currentObjectsByName[name]
|
||||||
if (obj.type === this.objType || (this.objType === 'ExecutableObject' && obj.execute)) {
|
if (obj.type === this.objType || (this.objType === 'ExecutableObject' && obj.execute)) {
|
||||||
result = obj
|
result = obj
|
||||||
} else {
|
} else {
|
||||||
|
@ -175,15 +174,15 @@ export class List extends PropertyType {
|
||||||
parse(value) {
|
parse(value) {
|
||||||
let result = NONE
|
let result = NONE
|
||||||
if(typeof value == 'object' && value.__proto__ === Array) {
|
if(typeof value == 'object' && value.__proto__ === Array) {
|
||||||
let valid = 0
|
let list = []
|
||||||
for(let v of value) {
|
for(let v of value) {
|
||||||
if (this.format.test(v)) {
|
if (this.format.test(v)) {
|
||||||
v = stringValuesValidators[this.valueType][0](v)
|
v = stringValuesValidators[this.valueType][0](v)
|
||||||
if(stringValuesValidators[this.valueType][1](v))
|
if(stringValuesValidators[this.valueType][1](v))
|
||||||
valid++
|
list.append(v)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(valid === value.length) // Ensure every value is valid.
|
if(list.length === value.length)
|
||||||
result = value
|
result = value
|
||||||
}
|
}
|
||||||
return result
|
return result
|
||||||
|
|
|
@ -15,10 +15,10 @@
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
import {Module} from "./common.mjs"
|
import {Module} from "modules.mjs"
|
||||||
import General from "../preferences/general.mjs"
|
import General from "preferences/general.mjs"
|
||||||
import Editor from "../preferences/expression.mjs"
|
import Editor from "preferences/expression.mjs"
|
||||||
import DefaultGraph from "../preferences/default.mjs"
|
import DefaultGraph from "preferences/default.mjs"
|
||||||
|
|
||||||
class PreferencesAPI extends Module {
|
class PreferencesAPI extends Module {
|
||||||
constructor() {
|
constructor() {
|
|
@ -17,8 +17,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {BoolSetting} from "common.mjs"
|
import {BoolSetting} from "common.mjs"
|
||||||
import Canvas from "../module/canvas.mjs"
|
|
||||||
import LatexAPI from "../module/latex.mjs"
|
|
||||||
|
|
||||||
const CHECK_FOR_UPDATES = new BoolSetting(
|
const CHECK_FOR_UPDATES = new BoolSetting(
|
||||||
qsTranslate("general", "Check for updates on startup"),
|
qsTranslate("general", "Check for updates on startup"),
|
||||||
|
@ -40,8 +38,8 @@ class EnableLatex extends BoolSetting {
|
||||||
set(value) {
|
set(value) {
|
||||||
if(!value || Latex.checkLatexInstallation()) {
|
if(!value || Latex.checkLatexInstallation()) {
|
||||||
super.set(value)
|
super.set(value)
|
||||||
LatexAPI.enabled = value
|
Modules.Latex.enabled = value
|
||||||
Canvas.requestPaint()
|
Modules.Canvas.requestPaint()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue