progressBar offset scope

fixes progressBar offset passing a reference instead of a copy by wrapping it in a function.  also fixes click events endlessly adding when navigating through zms events.
This commit is contained in:
digital-gnome 2017-10-11 21:07:45 -04:00
parent 1c744278e7
commit 90d3067cab
1 changed files with 12 additions and 9 deletions

View File

@ -811,16 +811,19 @@ function drawProgressBar() {
for ( var index = 0; index < cells_length; index += 1 ) {
var cell = $( cells[index] );
if ( index == 0 )
cell.setStyles( { 'left': barWidth, 'width': cellWidth, 'borderLeft': 0 } );
else
cell.setStyles( { 'left': barWidth, 'width': cellWidth } );
function test (cell, index) {
if ( index == 0 )
cell.setStyles( { 'left': barWidth, 'width': cellWidth, 'borderLeft': 0 } );
else
cell.setStyles( { 'left': barWidth, 'width': cellWidth } );
var offset = parseInt( (index*eventData.Length)/cells_length );
cell.setProperty( 'title', '+'+secsToTime(offset)+'s' );
cell.removeEvent( 'click' );
cell.addEvent( 'click', function() { streamSeek( offset ); } );
barWidth += cell.getCoordinates().width;
var offset = parseInt( (index*eventData.Length)/cells_length );
cell.setProperty( 'title', '+'+secsToTime(offset)+'s' );
cell.removeEvents( 'click' );
cell.addEvent( 'click', function() { streamSeek( offset ); } );
barWidth += cell.getCoordinates().width;
}
test (cell, index);
}
$('progressBar').setStyle( 'width', barWidth );
$('progressBar').removeClass( 'invisible' );