Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
this.setState({
noteShaking: true,
heldNotes: {},
touchedNotes: {},
});
setTimeout(() => this.setState({noteShaking: false}), 500);
break
}
case "chords": {
let touched = Object.keys(this.state.touchedNotes);
if (this.state.notes.matchesHead(touched) && touched.length > 2) {
gaEvent("sight_reading", "chord", "hit");
this.state.notes.shift()
this.state.notes.pushRandom()
this.state.stats.hitNotes([])
this.setState({
notes: this.state.notes,
noteShaking: false,
heldNotes: {},
touchedNotes: {},
})
this.state.slider.add(1)
} else {
gaEvent("sight_reading", "chord", "miss");
checkPress() {
switch (this.state.currentGenerator.mode) {
case "notes": {
let touched = Object.keys(this.state.touchedNotes);
if (this.state.notes.matchesHead(touched, this.state.anyOctave)) {
gaEvent("sight_reading", "note", "hit");
this.state.notes.shift();
this.state.notes.pushRandom();
this.state.stats.hitNotes(touched);
this.setState({
notes: this.state.notes,
noteShaking: false,
heldNotes: {},
touchedNotes: {},
});
this.state.slider.add(1)
return true
} else {
gaEvent("sight_reading", "chord", "hit");
this.state.notes.shift()
this.state.notes.pushRandom()
this.state.stats.hitNotes([])
this.setState({
notes: this.state.notes,
noteShaking: false,
heldNotes: {},
touchedNotes: {},
})
this.state.slider.add(1)
} else {
gaEvent("sight_reading", "chord", "miss");
this.state.stats.missNotes([])
this.setState({
noteShaking: true,
heldNotes: {},
touchedNotes: {},
})
setTimeout(() => this.setState({noteShaking: false}), 500);
}
break
}
}
}
checkRelease() {
switch (this.state.currentGenerator.mode) {
case "notes": {
let missed = this.state.notes.currentColumn()
.filter((n) => !this.state.heldNotes[n]);
gaEvent("sight_reading", "note", "miss");
this.state.stats.missNotes(missed);
this.setState({
noteShaking: true,
heldNotes: {},
touchedNotes: {},
});
setTimeout(() => this.setState({noteShaking: false}), 500);
break
}
case "chords": {
let touched = Object.keys(this.state.touchedNotes);
if (this.state.notes.matchesHead(touched) && touched.length > 2) {