Skip to content

Commit

Permalink
Move Plot-funcName logic out of Core.ts and into Plot.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
amaliejvik committed Jun 28, 2024
1 parent 3c0d548 commit 565a48b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
7 changes: 3 additions & 4 deletions src/Components/Plot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ class Plot extends Component {

constructor(func: string, options?: PlotOptions) {
super();
this.setFuncName();
this.setColor();

const {
Expand Down Expand Up @@ -180,10 +181,8 @@ class Plot extends Component {
return this.func;
}

setFuncName(name: string) {
if (this.funcName === undefined) {
this.funcName = name;
}
setFuncName() {
this.funcName = String.fromCharCode("f".charCodeAt(0) + Plot.counter);
}

setColor() {
Expand Down
6 changes: 0 additions & 6 deletions src/Core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -232,12 +232,6 @@ class Core {
this.updateComponents.push(child);
}
});

if (component instanceof Plot) {
const name = String.fromCharCode("f".charCodeAt(0) + this.plotCount);
component.setFuncName(name);
this.plotCount++;
}
}

remove(component: Component) {
Expand Down

0 comments on commit 565a48b

Please sign in to comment.