From 713fad4224ed4ac04c51fed76842d4807b527162 Mon Sep 17 00:00:00 2001 From: Ian Gilman Date: Tue, 18 Jun 2013 11:06:43 -0700 Subject: [PATCH] Exposing _updateRequestId as a semi-private member for testing purposes --- src/viewer.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/viewer.js b/src/viewer.js index 3265b027..7ea9b740 100644 --- a/src/viewer.js +++ b/src/viewer.js @@ -151,7 +151,6 @@ $.Viewer = function( options ) { THIS[ this.hash ] = { "fsBoundsDelta": new $.Point( 1, 1 ), "prevContainerSize": null, - "updateRequestId": null, "animating": false, "forceRedraw": false, "mouseInside": false, @@ -168,6 +167,8 @@ $.Viewer = function( options ) { "onfullscreenchange": null }; + this._updateRequestId = null; + //Inherit some behaviors and properties $.EventHandler.call( this ); $.ControlDock.call( this, options ); @@ -465,9 +466,9 @@ $.extend( $.Viewer.prototype, $.EventHandler.prototype, $.ControlDock.prototype, * @return {OpenSeadragon.Viewer} Chainable. */ close: function ( ) { - if ( THIS[ this.hash ].updateRequestId !== null ){ - $.cancelAnimationFrame( THIS[ this.hash ].updateRequestId ); - THIS[ this.hash ].updateRequestId = null; + if ( this._updateRequestId !== null ) { + $.cancelAnimationFrame( this._updateRequestId ); + this._updateRequestId = null; } if ( this.navigator ) { @@ -1195,7 +1196,7 @@ function openTileSource( viewer, source ) { THIS[ _this.hash ].animating = false; THIS[ _this.hash ].forceRedraw = true; - THIS[ _this.hash ].updateRequestId = scheduleUpdate( _this, updateMulti ); + _this._updateRequestId = scheduleUpdate( _this, updateMulti ); //Assuming you had programatically created a bunch of overlays //and added them via configuration @@ -1468,7 +1469,7 @@ function updateMulti( viewer ) { var beginTime; if ( !viewer.source ) { - THIS[ viewer.hash ].updateRequestId = null; + viewer._updateRequestId = null; return; } @@ -1477,7 +1478,7 @@ function updateMulti( viewer ) { // Request the next frame, unless we've been closed during the updateOnce() if ( viewer.source ) { - THIS[ viewer.hash ].updateRequestId = scheduleUpdate( viewer, + viewer._updateRequestId = scheduleUpdate( viewer, arguments.callee, beginTime ); } }