mirror of
https://github.com/openseadragon/openseadragon.git
synced 2025-02-22 01:33:14 +03:00
Fix rotate on rectangular overalys
Use size after rotate when positioning the overlay. Also removed check on this.scales - was there a reason these were not handled when rotating? If so we can add a option here maybe.
This commit is contained in:
parent
f8a0315757
commit
a70d082be3
@ -211,13 +211,14 @@
|
|||||||
// TODO replace the size rotation with CSS3 transforms
|
// TODO replace the size rotation with CSS3 transforms
|
||||||
// TODO add an option to overlays to not rotate with the image
|
// TODO add an option to overlays to not rotate with the image
|
||||||
// Currently only rotates position and size
|
// Currently only rotates position and size
|
||||||
if( degrees !== 0 && this.scales ) {
|
if( degrees !== 0 ) {
|
||||||
overlayCenter = new $.Point( size.x / 2, size.y / 2 );
|
overlayCenter = new $.Point( size.x / 2, size.y / 2 );
|
||||||
|
var overlayCenterAfterRotate = (degrees === 0 || degrees === 180) ? overlayCenter : new $.Point( size.y / 2, size.x / 2 );
|
||||||
|
|
||||||
position = position.plus( overlayCenter ).rotate(
|
position = position.plus( overlayCenter ).rotate(
|
||||||
degrees,
|
degrees,
|
||||||
drawerCenter
|
drawerCenter
|
||||||
).minus( overlayCenter );
|
).minus( overlayCenterAfterRotate );
|
||||||
|
|
||||||
size = size.rotate( degrees, new $.Point( 0, 0 ) );
|
size = size.rotate( degrees, new $.Point( 0, 0 ) );
|
||||||
size = new $.Point( Math.abs( size.x ), Math.abs( size.y ) );
|
size = new $.Point( Math.abs( size.x ), Math.abs( size.y ) );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user