Skip to content

Commit

Permalink
fix: retry를 2회 이상 호출하면 backup이 오염되는 문제
Browse files Browse the repository at this point in the history
  • Loading branch information
HyeokjinKang committed Jul 7, 2024
1 parent e7e9ae9 commit e163709
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion public/js/play.js
Original file line number Diff line number Diff line change
Expand Up @@ -1545,7 +1545,7 @@ const retry = () => {
blackOverlayContainer.classList.add("show");
setTimeout(() => {
song.stop();
pattern = patternBackup;
pattern = JSON.parse(JSON.stringify(patternBackup));
bpm = pattern.information.bpm;
speed = pattern.information.speed;
bpmsync = {
Expand Down
4 changes: 1 addition & 3 deletions public/js/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ const ctx = canvas.getContext("2d");
const missCanvas = document.getElementById("missPointCanvas");
const missCtx = missCanvas.getContext("2d");
let pattern = {};
let patternBackup = {};
let patternLength = 0;
let settings, sync, song, tracks, pixelRatio, offset, bpm, speed;
let bpmsync = {
Expand Down Expand Up @@ -163,7 +162,6 @@ const initialize = (isFirstCalled) => {
missCanvas.height = window.innerHeight * 0.05 * pixelRatio;
if (isFirstCalled) {
pattern = JSON.parse(localStorage.pattern);
patternBackup = JSON.parse(localStorage.pattern);
patternLength = pattern.patterns.length;
document.getElementById("artist").textContent = pattern.information.producer;
document.getElementById("scoreArtist").textContent = pattern.information.producer;
Expand Down Expand Up @@ -1449,7 +1447,7 @@ const retry = () => {
blackOverlayContainer.classList.add("show");
setTimeout(() => {
song.stop();
pattern = patternBackup;
pattern = JSON.parse(localStorage.pattern);
bpm = pattern.information.bpm;
speed = pattern.information.speed;
bpmsync = {
Expand Down
2 changes: 1 addition & 1 deletion public/js/tutorial.js
Original file line number Diff line number Diff line change
Expand Up @@ -1449,7 +1449,7 @@ const retry = () => {
blackOverlayContainer.classList.add("show");
setTimeout(() => {
song.stop();
pattern = patternBackup;
pattern = JSON.parse(JSON.stringify(patternBackup));
bpm = pattern.information.bpm;
speed = pattern.information.speed;
bpmsync = {
Expand Down

0 comments on commit e163709

Please sign in to comment.