diff --git a/src/strings.js b/src/strings.js index 16f2df8a..4d98c1e2 100644 --- a/src/strings.js +++ b/src/strings.js @@ -6,21 +6,13 @@ // pythons gettext might be a reasonable approach. var I18N = { Errors: { - Failure: "Sorry, but Seadragon Ajax can't run on your browser!\n" + - "Please try using IE 7 or Firefox 3.\n", Dzc: "Sorry, we don't support Deep Zoom Collections!", Dzi: "Hmm, this doesn't appear to be a valid Deep Zoom Image.", Xml: "Hmm, this doesn't appear to be a valid Deep Zoom Image.", - Empty: "You asked us to open nothing, so we did just that.", ImageFormat: "Sorry, we don't support {0}-based Deep Zoom Images.", Security: "It looks like a security restriction stopped us from " + "loading this Deep Zoom Image.", - Status: "This space unintentionally left blank ({0} {1}).", - Unknown: "Whoops, something inexplicably went wrong. Sorry!" - }, - - Messages: { - Loading: "Loading..." + Status: "This space unintentionally left blank ({0} {1})." }, Tooltips: { diff --git a/src/viewer.js b/src/viewer.js index b6026148..a47d46d0 100644 --- a/src/viewer.js +++ b/src/viewer.js @@ -115,8 +115,7 @@ $.Viewer = function( options ) { THIS[ this.hash ] = { "fsBoundsDelta": new $.Point( 1, 1 ), "prevContainerSize": null, - "lastOpenStartTime": 0, - "lastOpenEndTime": 0, + "updateRequestId": null, "animating": false, "forceRedraw": false, "mouseInside": false, @@ -355,7 +354,11 @@ $.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.drawer ){ this.drawer.clearOverlays(); } @@ -956,16 +959,6 @@ function openTileSource( viewer, source ) { _this.close( ); } - // to ignore earlier opens - THIS[ _this.hash ].lastOpenStartTime = +new Date(); - - window.setTimeout( function () { - if ( THIS[ _this.hash ].lastOpenStartTime > THIS[ _this.hash ].lastOpenEndTime ) { - THIS[ _this.hash ].setMessage( $.getString( "Messages.Loading" ) ); - } - }, 2000); - - THIS[ _this.hash ].lastOpenEndTime = +new Date(); _this.canvas.innerHTML = ""; THIS[ _this.hash ].prevContainerSize = $.getElementSize( _this.container ); @@ -1076,7 +1069,7 @@ function openTileSource( viewer, source ) { THIS[ _this.hash ].animating = false; THIS[ _this.hash ].forceRedraw = true; - scheduleUpdate( _this, updateMulti ); + THIS[ _this.hash ].updateRequestId = scheduleUpdate( _this, updateMulti ); //Assuming you had programatically created a bunch of overlays //and added them via configuration @@ -1351,12 +1344,15 @@ function updateMulti( viewer ) { var beginTime; if ( !viewer.source ) { + THIS[ viewer.hash ].updateRequestId = null; return; } beginTime = +new Date(); updateOnce( viewer ); - scheduleUpdate( viewer, arguments.callee, beginTime ); + + THIS[ viewer.hash ].updateRequestId = scheduleUpdate( viewer, + arguments.callee, beginTime ); } function updateOnce( viewer ) {