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;
|
context.fillStyle = this.debugGridColor;
|
||||||
|
|
||||||
if ( this.viewport.degrees !== 0 ) {
|
if ( this.viewport.degrees !== 0 ) {
|
||||||
this._offsetForRotation(this.viewport.degrees);
|
this._offsetForRotation({degrees: this.viewport.degrees});
|
||||||
}
|
}
|
||||||
if (tiledImage.getRotation() !== 0) {
|
if (tiledImage.getRotation() !== 0) {
|
||||||
this._offsetForRotation(
|
this._offsetForRotation({
|
||||||
tiledImage.getRotation(),
|
degrees: tiledImage.getRotation(),
|
||||||
tiledImage.viewport.pixelFromPointNoRotate(
|
point: tiledImage.viewport.pixelFromPointNoRotate(
|
||||||
tiledImage._getRotationPoint(true), true));
|
tiledImage._getRotationPoint(true), true)
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
context.strokeRect(
|
context.strokeRect(
|
||||||
@ -588,13 +589,16 @@ $.Drawer.prototype = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
// private
|
// private
|
||||||
_offsetForRotation: function(degrees, point, useSketch) {
|
_offsetForRotation: function(options) {
|
||||||
point = point || this.getCanvasCenter();
|
var point = options.point ?
|
||||||
var context = this._getContext(useSketch);
|
options.point.times($.pixelDensityRatio) :
|
||||||
|
this.getCanvasCenter();
|
||||||
|
|
||||||
|
var context = this._getContext(options.useSketch);
|
||||||
context.save();
|
context.save();
|
||||||
|
|
||||||
context.translate(point.x, point.y);
|
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);
|
context.translate(-point.x, -point.y);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -1573,15 +1573,18 @@ function drawTiles( tiledImage, lastDrawn ) {
|
|||||||
// avoid interpolation
|
// avoid interpolation
|
||||||
if (!sketchScale) {
|
if (!sketchScale) {
|
||||||
if (tiledImage.viewport.degrees !== 0) {
|
if (tiledImage.viewport.degrees !== 0) {
|
||||||
tiledImage._drawer._offsetForRotation(
|
tiledImage._drawer._offsetForRotation({
|
||||||
tiledImage.viewport.degrees, useSketch);
|
degrees: tiledImage.viewport.degrees,
|
||||||
|
useSketch: useSketch
|
||||||
|
});
|
||||||
}
|
}
|
||||||
if (tiledImage._degrees !== 0) {
|
if (tiledImage._degrees !== 0) {
|
||||||
tiledImage._drawer._offsetForRotation(
|
tiledImage._drawer._offsetForRotation({
|
||||||
tiledImage._degrees,
|
degrees: tiledImage._degrees,
|
||||||
tiledImage.viewport.pixelFromPointNoRotate(
|
point: tiledImage.viewport.pixelFromPointNoRotate(
|
||||||
tiledImage._getRotationPoint(true), true),
|
tiledImage._getRotationPoint(true), true),
|
||||||
useSketch);
|
useSketch: useSketch
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1663,15 +1666,18 @@ function drawTiles( tiledImage, lastDrawn ) {
|
|||||||
if (useSketch) {
|
if (useSketch) {
|
||||||
if (sketchScale) {
|
if (sketchScale) {
|
||||||
if (tiledImage.viewport.degrees !== 0) {
|
if (tiledImage.viewport.degrees !== 0) {
|
||||||
tiledImage._drawer._offsetForRotation(
|
tiledImage._drawer._offsetForRotation({
|
||||||
tiledImage.viewport.degrees, false);
|
degrees: tiledImage.viewport.degrees,
|
||||||
|
useSketch: false
|
||||||
|
});
|
||||||
}
|
}
|
||||||
if (tiledImage._degrees !== 0) {
|
if (tiledImage._degrees !== 0) {
|
||||||
tiledImage._drawer._offsetForRotation(
|
tiledImage._drawer._offsetForRotation({
|
||||||
tiledImage._degrees,
|
degrees: tiledImage._degrees,
|
||||||
tiledImage.viewport.pixelFromPointNoRotate(
|
point: tiledImage.viewport.pixelFromPointNoRotate(
|
||||||
tiledImage._getRotationPoint(true), true),
|
tiledImage._getRotationPoint(true), true),
|
||||||
false);
|
useSketch: false
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
tiledImage._drawer.blendSketch({
|
tiledImage._drawer.blendSketch({
|
||||||
|
Loading…
Reference in New Issue
Block a user