@@ -111,7 +111,7 @@ export class Analyser extends React.Component<AnalyseProps, {}> {
111111 if ( props . isStored && window . location . hash ) {
112112 const parsed = parseInt ( window . location . hash . substr ( 1 ) , 10 ) ;
113113 if ( ( '#' + parsed ) === window . location . hash ) {
114- this . state . tick = Math . floor ( parsed / 2 ) ;
114+ this . state . tick = Math . floor ( parsed ) ;
115115 } else {
116116 this . joinSession ( window . location . hash . substr ( 1 ) ) ;
117117 }
@@ -271,15 +271,15 @@ export class Analyser extends React.Component<AnalyseProps, {}> {
271271
272272 private setHash = debounce ( 250 , ( tick ) => {
273273 if ( ! this . session && this . props . isStored ) {
274- history . replaceState ( '' , '' , '#' + tick * 2 ) ;
274+ history . replaceState ( '' , '' , '#' + tick ) ;
275275 }
276276 } ) ;
277277
278278 animFrame ( timestamp ) {
279- const timePassed = timestamp - this . playStartTime ;
280- const targetTick = this . playStartTick + ( Math . round ( timePassed * this . intervalPerTick * 2 ) ) ;
279+ const timePassed = ( timestamp - this . playStartTime ) / 1000 ;
280+ const targetTick = this . playStartTick + ( Math . round ( timePassed / this . intervalPerTick ) ) ;
281281 this . lastFrameTime = timestamp ;
282- if ( targetTick >= ( this . parser . demo . tickCount - 1 ) ) {
282+ if ( targetTick >= ( this . parser . demo . tick - 1 ) ) {
283283 this . pause ( ) ;
284284 }
285285 this . setHash ( this . state . tick ) ;
@@ -330,7 +330,7 @@ export class Analyser extends React.Component<AnalyseProps, {}> {
330330 players = { players } kills = { kills } />
331331 </ div >
332332 < div className = "time-control"
333- title = { `${ tickToTime ( this . state . tick ) } (tick ${ this . state . tick * 2 } )` } >
333+ title = { `${ tickToTime ( this . state . tick , this . intervalPerTick ) } (tick ${ this . state . tick } )` } >
334334 < input className = "play-pause-button" type = "button"
335335 onClick = { this . togglePlay . bind ( this ) }
336336 value = { playButtonText }
@@ -347,7 +347,7 @@ export class Analyser extends React.Component<AnalyseProps, {}> {
347347 }
348348}
349349
350- function tickToTime ( tick : number ) : string {
351- let seconds = Math . floor ( tick / 33 ) ;
350+ function tickToTime ( tick : number , intervalPerTick : number ) : string {
351+ let seconds = Math . floor ( tick * intervalPerTick ) ;
352352 return `${ Math . floor ( seconds / 60 ) } :${ String ( seconds % 60 ) . padStart ( 2 , '0' ) } ` ;
353353}
0 commit comments