Skip to content

Commit 2ecbcd7

Browse files
Fix bug show recording
1 parent 6eacab4 commit 2ecbcd7

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

hf-data/js/mobile.js

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ let cubeBetaVisu = 0;
1515
let currentRecording = [];
1616
let is_recording;
1717
let recordings = [];
18+
let is_showing;
1819

1920
const samplingAccRate = 30;
2021
/* Build mobile version */
@@ -156,13 +157,20 @@ function showRecording() {
156157
}
157158
let time = 0;
158159
const recording = recordings[selected];
159-
for (let i = 0; i < recording.length; i++) {
160-
let point = recording[i];
161-
time = samplingAccRate * i;
160+
if (!is_showing) {
161+
is_showing = true;
162+
for (let i = 0; i < recording.length; i++) {
163+
let point = recording[i];
164+
time = samplingAccRate * i;
165+
setTimeout(() => {
166+
cubeAlphaVisu = point[0];
167+
cubeBetaVisu = point[1];
168+
cubeGammaVisu = point[2];
169+
}, time);
170+
}
171+
// Wait until the end of the recording before being able to run another.
162172
setTimeout(() => {
163-
cubeAlphaVisu = point[0];
164-
cubeBetaVisu = point[1];
165-
cubeGammaVisu = point[2];
166-
}, time);
173+
is_showing = false;
174+
}, samplingAccRate * recording.length);
167175
}
168176
}

0 commit comments

Comments
 (0)