File tree Expand file tree Collapse file tree 1 file changed +9
-13
lines changed Expand file tree Collapse file tree 1 file changed +9
-13
lines changed Original file line number Diff line number Diff line change @@ -169,7 +169,7 @@ export class Waveform {
169
169
*
170
170
* @param range
171
171
*/
172
- public draw ( range ? : number , force = false ) : void {
172
+ public draw ( range : number = 0 , force = false ) : void {
173
173
174
174
// measure fps
175
175
//this.fps();
@@ -188,22 +188,18 @@ export class Waveform {
188
188
189
189
let peaksRange = 0 ;
190
190
191
- if ( range !== undefined ) {
191
+ const peaksPercentage = peaksLength / 100 ;
192
192
193
- const peaksPercentage = peaksLength / 100 ;
194
-
195
- peaksRange = Math . round ( range * peaksPercentage ) ;
196
-
197
- // if the range did not change since last draw don't redraw
198
- // except if force is true
199
- if ( peaksRange === this . _latestRange && ! force ) {
200
- return ;
201
- }
202
-
203
- this . _latestRange = peaksRange ;
193
+ peaksRange = Math . round ( range * peaksPercentage ) ;
204
194
195
+ // if the range did not change since last draw don't redraw
196
+ // except if force is true
197
+ if ( peaksRange === this . _latestRange && ! force ) {
198
+ return ;
205
199
}
206
200
201
+ this . _latestRange = peaksRange ;
202
+
207
203
const canvasHeight = this . _waveLayoutOptions . waveHeightInPixel ;
208
204
209
205
// canvas dimensions
You can’t perform that action at this time.
0 commit comments