Cleaned out dead code in scheduleUpdate and updateMulti

… as pointed out by @ventero
This commit is contained in:
Ian Gilman 2013-06-19 09:58:09 -07:00
parent b38e319f2c
commit dbc8a59ae8

View File

@ -1243,23 +1243,7 @@ function openTileSource( viewer, source ) {
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
// Schedulers provide the general engine for animation // Schedulers provide the general engine for animation
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
function scheduleUpdate( viewer, updateFunc, prevUpdateTime ){ function scheduleUpdate( viewer, updateFunc ){
var currentTime,
targetTime,
deltaTime;
if ( THIS[ viewer.hash ].animating ) {
return $.requestAnimationFrame( function(){
updateFunc( viewer );
} );
}
currentTime = +new Date();
prevUpdateTime = prevUpdateTime ? prevUpdateTime : currentTime;
// 60 frames per second is ideal
targetTime = prevUpdateTime + 1000 / 60;
deltaTime = Math.max( 1, targetTime - currentTime );
return $.requestAnimationFrame( function(){ return $.requestAnimationFrame( function(){
updateFunc( viewer ); updateFunc( viewer );
} ); } );
@ -1465,21 +1449,16 @@ function onContainerEnter( tracker, position, buttonDownElement, buttonDownAny )
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
function updateMulti( viewer ) { function updateMulti( viewer ) {
var beginTime;
if ( !viewer.source ) { if ( !viewer.source ) {
viewer._updateRequestId = null; viewer._updateRequestId = null;
return; return;
} }
beginTime = +new Date();
updateOnce( viewer ); updateOnce( viewer );
// Request the next frame, unless we've been closed during the updateOnce() // Request the next frame, unless we've been closed during the updateOnce()
if ( viewer.source ) { if ( viewer.source ) {
viewer._updateRequestId = scheduleUpdate( viewer, viewer._updateRequestId = scheduleUpdate( viewer, updateMulti );
arguments.callee, beginTime );
} }
} }