mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-22 05:06:09 +03:00
Take pixelDensityRatio into account when rotating
This commit is contained in:
parent
b992d54572
commit
5ac1502ccd
@ -477,13 +477,14 @@ $.Drawer.prototype = {
|
||||
context.fillStyle = this.debugGridColor;
|
||||
|
||||
if ( this.viewport.degrees !== 0 ) {
|
||||
this._offsetForRotation(this.viewport.degrees);
|
||||
this._offsetForRotation({degrees: this.viewport.degrees});
|
||||
}
|
||||
if (tiledImage.getRotation() !== 0) {
|
||||
this._offsetForRotation(
|
||||
tiledImage.getRotation(),
|
||||
tiledImage.viewport.pixelFromPointNoRotate(
|
||||
tiledImage._getRotationPoint(true), true));
|
||||
this._offsetForRotation({
|
||||
degrees: tiledImage.getRotation(),
|
||||
point: tiledImage.viewport.pixelFromPointNoRotate(
|
||||
tiledImage._getRotationPoint(true), true)
|
||||
});
|
||||
}
|
||||
|
||||
context.strokeRect(
|
||||
@ -588,13 +589,16 @@ $.Drawer.prototype = {
|
||||
},
|
||||
|
||||
// private
|
||||
_offsetForRotation: function(degrees, point, useSketch) {
|
||||
point = point || this.getCanvasCenter();
|
||||
var context = this._getContext(useSketch);
|
||||
_offsetForRotation: function(options) {
|
||||
var point = options.point ?
|
||||
options.point.times($.pixelDensityRatio) :
|
||||
this.getCanvasCenter();
|
||||
|
||||
var context = this._getContext(options.useSketch);
|
||||
context.save();
|
||||
|
||||
context.translate(point.x, point.y);
|
||||
context.rotate(Math.PI / 180 * degrees);
|
||||
context.rotate(Math.PI / 180 * options.degrees);
|
||||
context.translate(-point.x, -point.y);
|
||||
},
|
||||
|
||||
|
@ -1573,15 +1573,18 @@ function drawTiles( tiledImage, lastDrawn ) {
|
||||
// avoid interpolation
|
||||
if (!sketchScale) {
|
||||
if (tiledImage.viewport.degrees !== 0) {
|
||||
tiledImage._drawer._offsetForRotation(
|
||||
tiledImage.viewport.degrees, useSketch);
|
||||
tiledImage._drawer._offsetForRotation({
|
||||
degrees: tiledImage.viewport.degrees,
|
||||
useSketch: useSketch
|
||||
});
|
||||
}
|
||||
if (tiledImage._degrees !== 0) {
|
||||
tiledImage._drawer._offsetForRotation(
|
||||
tiledImage._degrees,
|
||||
tiledImage.viewport.pixelFromPointNoRotate(
|
||||
tiledImage._drawer._offsetForRotation({
|
||||
degrees: tiledImage._degrees,
|
||||
point: tiledImage.viewport.pixelFromPointNoRotate(
|
||||
tiledImage._getRotationPoint(true), true),
|
||||
useSketch);
|
||||
useSketch: useSketch
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -1663,15 +1666,18 @@ function drawTiles( tiledImage, lastDrawn ) {
|
||||
if (useSketch) {
|
||||
if (sketchScale) {
|
||||
if (tiledImage.viewport.degrees !== 0) {
|
||||
tiledImage._drawer._offsetForRotation(
|
||||
tiledImage.viewport.degrees, false);
|
||||
tiledImage._drawer._offsetForRotation({
|
||||
degrees: tiledImage.viewport.degrees,
|
||||
useSketch: false
|
||||
});
|
||||
}
|
||||
if (tiledImage._degrees !== 0) {
|
||||
tiledImage._drawer._offsetForRotation(
|
||||
tiledImage._degrees,
|
||||
tiledImage.viewport.pixelFromPointNoRotate(
|
||||
tiledImage._drawer._offsetForRotation({
|
||||
degrees: tiledImage._degrees,
|
||||
point: tiledImage.viewport.pixelFromPointNoRotate(
|
||||
tiledImage._getRotationPoint(true), true),
|
||||
false);
|
||||
useSketch: false
|
||||
});
|
||||
}
|
||||
}
|
||||
tiledImage._drawer.blendSketch({
|
||||
|
Loading…
Reference in New Issue
Block a user