ugh?
This commit is contained in:
parent
c6c659535e
commit
be327165b8
|
|
@ -8,13 +8,13 @@ export class Renderer {
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
this.numStaves = 6;
|
this.numStaves = 6;
|
||||||
this.currStaveNumber = 1; // ✅ Initialize current stave number
|
this.currStaveNumber = 1;
|
||||||
this.timeIndicator = document.querySelector("#time-indicator");
|
this.timeIndicator = document.querySelector("#time-indicator");
|
||||||
|
|
||||||
this.timeIndicator.addEventListener("animationiteration", () => {
|
this.timeIndicator.addEventListener("animationiteration", () => {
|
||||||
this.currStaveNumber++;
|
this.currStaveNumber++;
|
||||||
if (this.currStaveNumber > this.numStaves) {
|
if (this.currStaveNumber > this.numStaves) {
|
||||||
this.cleanUpAndRestart(); // ✅ Use this.method
|
this.cleanUpAndRestart();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -39,7 +39,6 @@ export class Renderer {
|
||||||
placeIcon = (instrument) => {
|
placeIcon = (instrument) => {
|
||||||
if (this.currStaveNumber > this.numStaves) this.currStaveNumber = 1;
|
if (this.currStaveNumber > this.numStaves) this.currStaveNumber = 1;
|
||||||
|
|
||||||
// ✅ Use a local variable instead of overwriting this.staveWrapper
|
|
||||||
const targetWrapper = document.getElementById(
|
const targetWrapper = document.getElementById(
|
||||||
`stave-wrapper-${this.currStaveNumber}`
|
`stave-wrapper-${this.currStaveNumber}`
|
||||||
);
|
);
|
||||||
|
|
@ -61,7 +60,7 @@ export class Renderer {
|
||||||
eventIcon.data = instrument.image;
|
eventIcon.data = instrument.image;
|
||||||
|
|
||||||
newObject.appendChild(eventIcon);
|
newObject.appendChild(eventIcon);
|
||||||
targetWrapper.appendChild(newObject); // ✅ Append to local reference
|
targetWrapper.appendChild(newObject);
|
||||||
};
|
};
|
||||||
|
|
||||||
cleanUpAndRestart(reload = false) {
|
cleanUpAndRestart(reload = false) {
|
||||||
|
|
@ -77,7 +76,6 @@ export class Renderer {
|
||||||
|
|
||||||
this.currStaveNumber = 1;
|
this.currStaveNumber = 1;
|
||||||
|
|
||||||
// Assuming setTitle() exists globally or is handled elsewhere
|
|
||||||
Conductor.setTitle();
|
Conductor.setTitle();
|
||||||
|
|
||||||
if (reload) location.reload();
|
if (reload) location.reload();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue