Fix bug not collapsing NestedResistors

This commit is contained in:
Dominic Zimmer 2020-11-19 00:17:39 +01:00
parent 32e10a3cf4
commit 7644a5cf30
2 changed files with 2 additions and 2 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 MiB

After

Width:  |  Height:  |  Size: 2.3 MiB

View File

@ -47,7 +47,7 @@ class Resistor {
${svg} ${svg}
</g> </g>
</svg>` </svg>`
element.innerHTML += thesvg; element.innerHTML = thesvg;
} }
} }
@ -57,7 +57,7 @@ class NestedResistor extends Resistor {
constructor(l, func, instance) { constructor(l, func, instance) {
super(func(l.map(e => e.getOhmage()))); super(func(l.map(e => e.getOhmage())));
this.func = func this.func = func
this.children = flatten(l, instance.constructor.name); this.children = flatten(l, instance);
} }
cost() { cost() {
return sum(this.children.map(e => e.cost())); return sum(this.children.map(e => e.cost()));