diff --git a/src/webgldrawer.js b/src/webgldrawer.js index 67834f4c..d8b33f93 100644 --- a/src/webgldrawer.js +++ b/src/webgldrawer.js @@ -242,7 +242,10 @@ if ( tiledImage.placeholderFillStyle && tiledImage._hasOpaqueTile === false ) { this._drawPlaceholder(tiledImage); } - + this._drawPlaceholder(tiledImage); + if(!window.draw){ + return; + } if(tilesToDraw.length === 0 || tiledImage.getOpacity() === 0){ return; } @@ -1095,13 +1098,13 @@ fillStyle = tiledImage.placeholderFillStyle; } - context.save(); + this._offsetForRotation({degrees: this.viewer.viewport.getRotation(true)}); context.fillStyle = fillStyle; context.translate(rect.x, rect.y); context.rotate(Math.PI / 180 * bounds.degrees); context.translate(-rect.x, -rect.y); context.fillRect(rect.x, rect.y, rect.width, rect.height); - context.restore(); + this._restoreRotationChanges(); } diff --git a/test/demo/tilesource-swap.html b/test/demo/tilesource-swap.html index f5fbc084..d8da3dfb 100644 --- a/test/demo/tilesource-swap.html +++ b/test/demo/tilesource-swap.html @@ -64,8 +64,10 @@ crossOriginPolicy: 'Anonymous' }); - viewer.addOnceHandler('canvas-click', function(event) { - if (event.quick) { + let swapped = false; + viewer.addHandler('canvas-click', function(event) { + if (event.quick && !swapped) { + swapped = true; var standin = viewer.world.getItemAt(0); var standinBounds = standin.getBounds(); viewer.viewport.fitBounds(standinBounds);