mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-25 06:36:11 +03:00
account for viewport rotation in addition to tiledImage rotation
This commit is contained in:
parent
5b2c6d7ed9
commit
d4e82d374e
@ -242,7 +242,10 @@
|
|||||||
if ( tiledImage.placeholderFillStyle && tiledImage._hasOpaqueTile === false ) {
|
if ( tiledImage.placeholderFillStyle && tiledImage._hasOpaqueTile === false ) {
|
||||||
this._drawPlaceholder(tiledImage);
|
this._drawPlaceholder(tiledImage);
|
||||||
}
|
}
|
||||||
|
this._drawPlaceholder(tiledImage);
|
||||||
|
if(!window.draw){
|
||||||
|
return;
|
||||||
|
}
|
||||||
if(tilesToDraw.length === 0 || tiledImage.getOpacity() === 0){
|
if(tilesToDraw.length === 0 || tiledImage.getOpacity() === 0){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1095,13 +1098,13 @@
|
|||||||
fillStyle = tiledImage.placeholderFillStyle;
|
fillStyle = tiledImage.placeholderFillStyle;
|
||||||
}
|
}
|
||||||
|
|
||||||
context.save();
|
this._offsetForRotation({degrees: this.viewer.viewport.getRotation(true)});
|
||||||
context.fillStyle = fillStyle;
|
context.fillStyle = fillStyle;
|
||||||
context.translate(rect.x, rect.y);
|
context.translate(rect.x, rect.y);
|
||||||
context.rotate(Math.PI / 180 * bounds.degrees);
|
context.rotate(Math.PI / 180 * bounds.degrees);
|
||||||
context.translate(-rect.x, -rect.y);
|
context.translate(-rect.x, -rect.y);
|
||||||
context.fillRect(rect.x, rect.y, rect.width, rect.height);
|
context.fillRect(rect.x, rect.y, rect.width, rect.height);
|
||||||
context.restore();
|
this._restoreRotationChanges();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,8 +64,10 @@
|
|||||||
crossOriginPolicy: 'Anonymous'
|
crossOriginPolicy: 'Anonymous'
|
||||||
});
|
});
|
||||||
|
|
||||||
viewer.addOnceHandler('canvas-click', function(event) {
|
let swapped = false;
|
||||||
if (event.quick) {
|
viewer.addHandler('canvas-click', function(event) {
|
||||||
|
if (event.quick && !swapped) {
|
||||||
|
swapped = true;
|
||||||
var standin = viewer.world.getItemAt(0);
|
var standin = viewer.world.getItemAt(0);
|
||||||
var standinBounds = standin.getBounds();
|
var standinBounds = standin.getBounds();
|
||||||
viewer.viewport.fitBounds(standinBounds);
|
viewer.viewport.fitBounds(standinBounds);
|
||||||
|
Loading…
Reference in New Issue
Block a user