@@ -124,6 +124,7 @@ var Graph = /** @class */ (function () {
124
124
_this . visibleRange . start = Math . floor ( delta ) ;
125
125
_this . visibleRange . end = Math . floor ( stepsPerViewPort + delta ) ;
126
126
initialDelta = delta * _this . stepSize ;
127
+ _this . scrollPercentage = Math . round ( ( delta / ( _this . songs . length - stepsPerViewPort ) ) * 100 ) ;
127
128
} ) ;
128
129
document . addEventListener ( "mouseup" , function ( e ) {
129
130
dragging = false ;
@@ -245,6 +246,9 @@ var Graph = /** @class */ (function () {
245
246
* @returns {number } The time in seconds
246
247
*/
247
248
Graph . prototype . timeStringToSeconds = function ( timeString ) {
249
+ var regex = / ^ ( [ 0 - 9 ] | [ 0 - 9 ] { 2 } ) [: ] [ 0 - 5 ] [ 0 - 9 ] $ / ;
250
+ if ( ! regex . test ( timeString ) )
251
+ return 0 ;
248
252
var total = 0 ;
249
253
var tmp = timeString . split ( ":" ) ;
250
254
total += parseInt ( tmp [ 0 ] ) * 60 ;
@@ -256,13 +260,22 @@ var Graph = /** @class */ (function () {
256
260
* the top left of the graph
257
261
*/
258
262
Graph . prototype . drawFps = function ( ) {
263
+ var color ;
259
264
if ( this . calculatedFps > 30 ) {
260
- this . ctx . fillStyle = "#000 " ;
265
+ color = "#15871D " ;
261
266
}
262
267
else {
263
- this . ctx . fillStyle = "#FF4F19" ;
268
+ color = "#FF4F19" ;
264
269
}
270
+ this . ctx . fillStyle = color ;
265
271
this . ctx . fillText ( "FPS: " + this . calculatedFps , 5 , 12 ) ;
272
+ this . ctx . fillStyle = "#000" ;
273
+ this . ctx . fillRect ( 60 , 4 , 102 , 10 ) ;
274
+ this . ctx . fillStyle = "#fff" ;
275
+ this . ctx . fillRect ( 61 , 5 , 100 , 8 ) ;
276
+ this . ctx . fillStyle = color ;
277
+ var fpsWidth = this . calculatedFps / this . fps * 100 ;
278
+ this . ctx . fillRect ( 61 , 5 , fpsWidth , 8 ) ;
266
279
} ;
267
280
/**
268
281
* Will draw the percentage scrolled at
@@ -271,6 +284,11 @@ var Graph = /** @class */ (function () {
271
284
Graph . prototype . drawScrollPercentage = function ( ) {
272
285
this . ctx . fillStyle = "#000" ;
273
286
this . ctx . fillText ( this . scrollPercentage + "%" , 5 , 25 ) ;
287
+ this . ctx . fillRect ( 60 , 16 , 102 , 10 ) ;
288
+ this . ctx . fillStyle = "#fff" ;
289
+ this . ctx . fillRect ( 61 , 17 , 100 , 8 ) ;
290
+ this . ctx . fillStyle = "#0B0284" ;
291
+ this . ctx . fillRect ( 61 , 17 , this . scrollPercentage , 8 ) ;
274
292
} ;
275
293
/**
276
294
* Since the FPS should not be updated every
0 commit comments