Fix bug not collapsing NestedResistors
This commit is contained in:
parent
32e10a3cf4
commit
7644a5cf30
BIN
imgs/127ohm.png
BIN
imgs/127ohm.png
Binary file not shown.
Before Width: | Height: | Size: 2.6 MiB After Width: | Height: | Size: 2.3 MiB |
@ -47,7 +47,7 @@ class Resistor {
|
||||
${svg}
|
||||
</g>
|
||||
</svg>`
|
||||
element.innerHTML += thesvg;
|
||||
element.innerHTML = thesvg;
|
||||
}
|
||||
}
|
||||
|
||||
@ -57,7 +57,7 @@ class NestedResistor extends Resistor {
|
||||
constructor(l, func, instance) {
|
||||
super(func(l.map(e => e.getOhmage())));
|
||||
this.func = func
|
||||
this.children = flatten(l, instance.constructor.name);
|
||||
this.children = flatten(l, instance);
|
||||
}
|
||||
cost() {
|
||||
return sum(this.children.map(e => e.cost()));
|
||||
|
Loading…
Reference in New Issue
Block a user