diff --git a/changelog.txt b/changelog.txt index 14cd06f2..dd80da47 100644 --- a/changelog.txt +++ b/changelog.txt @@ -12,6 +12,7 @@ OPENSEADRAGON CHANGELOG * Added fitBoundsWithConstraints() to the viewport (#423) * Fixed MouseTracker cross-browser issues with tracking pointers over and out of the tracked element (pull request #448, fix for #152, #404, #420, and #427) * Fixed incorrect flick direction after image is rotated (#452) +* Debug mode now works with rotate images (#453) 1.1.1: diff --git a/src/drawer.js b/src/drawer.js index 1f24fbdb..a5f35720 100644 --- a/src/drawer.js +++ b/src/drawer.js @@ -378,12 +378,24 @@ $.Drawer.prototype = /** @lends OpenSeadragon.Drawer.prototype */{ this.context.font = 'small-caps bold 13px ariel'; this.context.strokeStyle = this.debugGridColor; this.context.fillStyle = this.debugGridColor; + + this._offsetForRotation( tile, this.canvas, this.context, this.viewport.degrees ); + this.context.strokeRect( tile.position.x, tile.position.y, tile.size.x, tile.size.y ); + + var tileCenterX = tile.position.x + (tile.size.x / 2); + var tileCenterY = tile.position.y + (tile.size.y / 2); + + // Rotate the text the right way around. + this.context.translate( tileCenterX, tileCenterY ); + this.context.rotate( Math.PI / 180 * -this.viewport.degrees ); + this.context.translate( -tileCenterX, -tileCenterY ); + if( tile.x === 0 && tile.y === 0 ){ this.context.fillText( "Zoom: " + this.viewport.getZoom(), @@ -426,6 +438,7 @@ $.Drawer.prototype = /** @lends OpenSeadragon.Drawer.prototype */{ tile.position.x + 10, tile.position.y + 70 ); + this._restoreRotationChanges( tile, this.canvas, this.context ); this.context.restore(); } },