mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-22 13:16:10 +03:00
Fixed: Invert overlay scale and rotate on flip
This commit is contained in:
parent
6abcc76a93
commit
44347fb2d0
@ -259,7 +259,16 @@
|
|||||||
|
|
||||||
var position = positionAndSize.position;
|
var position = positionAndSize.position;
|
||||||
var size = this.size = positionAndSize.size;
|
var size = this.size = positionAndSize.size;
|
||||||
var rotate = positionAndSize.rotate;
|
var rotate;
|
||||||
|
var scale = "";
|
||||||
|
|
||||||
|
if (viewport.flipped){
|
||||||
|
rotate = -positionAndSize.rotate;
|
||||||
|
scale = " scaleX(-1)";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
rotate = positionAndSize.rotate;
|
||||||
|
}
|
||||||
|
|
||||||
// call the onDraw callback if it exists to allow one to overwrite
|
// call the onDraw callback if it exists to allow one to overwrite
|
||||||
// the drawing/positioning/sizing of the overlay
|
// the drawing/positioning/sizing of the overlay
|
||||||
@ -282,7 +291,10 @@
|
|||||||
if (transformOriginProp && transformProp) {
|
if (transformOriginProp && transformProp) {
|
||||||
if (rotate) {
|
if (rotate) {
|
||||||
style[transformOriginProp] = this._getTransformOrigin();
|
style[transformOriginProp] = this._getTransformOrigin();
|
||||||
style[transformProp] = "rotate(" + rotate + "deg)";
|
style[transformProp] = "rotate(" + rotate + "deg)" + scale;
|
||||||
|
} else if (!rotate && viewport.flipped) {
|
||||||
|
style[transformOriginProp] = this._getTransformOrigin();
|
||||||
|
style[transformProp] = "scaleX(-1)";
|
||||||
} else {
|
} else {
|
||||||
style[transformOriginProp] = "";
|
style[transformOriginProp] = "";
|
||||||
style[transformProp] = "";
|
style[transformProp] = "";
|
||||||
@ -308,12 +320,21 @@
|
|||||||
var rect = new $.Rect(position.x, position.y, size.x, size.y);
|
var rect = new $.Rect(position.x, position.y, size.x, size.y);
|
||||||
var boundingBox = this._getBoundingBox(rect, viewport.getRotation(true));
|
var boundingBox = this._getBoundingBox(rect, viewport.getRotation(true));
|
||||||
position = boundingBox.getTopLeft();
|
position = boundingBox.getTopLeft();
|
||||||
|
position = boundingBox.getTopLeft();
|
||||||
|
|
||||||
|
if (viewport.flipped){
|
||||||
|
position.x = (viewport.getContainerSize().x - position.x);
|
||||||
|
}
|
||||||
|
|
||||||
size = boundingBox.getSize();
|
size = boundingBox.getSize();
|
||||||
} else {
|
} else {
|
||||||
rotate = viewport.getRotation(true);
|
rotate = viewport.getRotation(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (viewport.flipped) {
|
||||||
|
position.x = (viewport.getContainerSize().x - position.x);
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
position: position,
|
position: position,
|
||||||
size: size,
|
size: size,
|
||||||
|
Loading…
Reference in New Issue
Block a user