File tree Expand file tree Collapse file tree 1 file changed +15
-7
lines changed Expand file tree Collapse file tree 1 file changed +15
-7
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ let cubeBetaVisu = 0;
15
15
let currentRecording = [ ] ;
16
16
let is_recording ;
17
17
let recordings = [ ] ;
18
+ let is_showing ;
18
19
19
20
const samplingAccRate = 30 ;
20
21
/* Build mobile version */
@@ -156,13 +157,20 @@ function showRecording() {
156
157
}
157
158
let time = 0 ;
158
159
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.
162
172
setTimeout ( ( ) => {
163
- cubeAlphaVisu = point [ 0 ] ;
164
- cubeBetaVisu = point [ 1 ] ;
165
- cubeGammaVisu = point [ 2 ] ;
166
- } , time ) ;
173
+ is_showing = false ;
174
+ } , samplingAccRate * recording . length ) ;
167
175
}
168
176
}
You can’t perform that action at this time.
0 commit comments