mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-25 06:36:11 +03:00
FIXED: Rotation works improperly on retina display #683
This commit is contained in:
parent
5a2733bbc1
commit
11024f44f2
@ -488,29 +488,18 @@ $.Drawer.prototype = /** @lends OpenSeadragon.Drawer.prototype */{
|
|||||||
// private
|
// private
|
||||||
_offsetForRotation: function( tile, degrees, useSketch ){
|
_offsetForRotation: function( tile, degrees, useSketch ){
|
||||||
var cx = this.canvas.width / 2,
|
var cx = this.canvas.width / 2,
|
||||||
cy = this.canvas.height / 2,
|
cy = this.canvas.height / 2;
|
||||||
px = tile.position.x - cx,
|
|
||||||
py = tile.position.y - cy;
|
|
||||||
|
|
||||||
var context = this._getContext( useSketch );
|
var context = this._getContext( useSketch );
|
||||||
context.save();
|
context.save();
|
||||||
|
|
||||||
context.translate(cx, cy);
|
context.translate(cx, cy);
|
||||||
context.rotate( Math.PI / 180 * degrees);
|
context.rotate( Math.PI / 180 * degrees);
|
||||||
tile.position.x = px;
|
context.translate(-cx, -cy);
|
||||||
tile.position.y = py;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
// private
|
// private
|
||||||
_restoreRotationChanges: function( tile, useSketch ){
|
_restoreRotationChanges: function( tile, useSketch ){
|
||||||
var cx = this.canvas.width / 2,
|
|
||||||
cy = this.canvas.height / 2,
|
|
||||||
px = tile.position.x + cx,
|
|
||||||
py = tile.position.y + cy;
|
|
||||||
|
|
||||||
tile.position.x = px;
|
|
||||||
tile.position.y = py;
|
|
||||||
|
|
||||||
var context = this._getContext( useSketch );
|
var context = this._getContext( useSketch );
|
||||||
context.restore();
|
context.restore();
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user