mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-28 16:16:08 +03:00
Rollback sketchCanvas scaling when tiled image rotated
This commit is contained in:
parent
5ac1502ccd
commit
4b48717010
@ -323,7 +323,6 @@ $.Drawer.prototype = {
|
||||
this.sketchCanvas.height = sketchCanvasSize.y;
|
||||
this.sketchContext = this.sketchCanvas.getContext( "2d" );
|
||||
|
||||
// FIXME: should check if any tiled image get rotated as well.
|
||||
// If the viewport is not currently rotated, the sketchCanvas
|
||||
// will have the same size as the main canvas. However, if
|
||||
// the viewport get rotated later on, we will need to resize it.
|
||||
@ -621,8 +620,7 @@ $.Drawer.prototype = {
|
||||
// private
|
||||
_calculateSketchCanvasSize: function() {
|
||||
var canvasSize = this._calculateCanvasSize();
|
||||
if (this.viewport.getRotation() === 0 &&
|
||||
!this.viewer.world._hasRotatedItem()) {
|
||||
if (this.viewport.getRotation() === 0) {
|
||||
return canvasSize;
|
||||
}
|
||||
// If the viewport is rotated, we need a larger sketch canvas in order
|
||||
|
@ -550,20 +550,8 @@ $.extend($.TiledImage.prototype, $.EventSource.prototype, /** @lends OpenSeadrag
|
||||
},
|
||||
|
||||
// private
|
||||
// Convert rectangle in tiled image coordinates to viewport coordinates.
|
||||
_tiledImageToViewportRectangle: function(rect) {
|
||||
var scale = this._scaleSpring.current.value;
|
||||
return new $.Rect(
|
||||
rect.x * scale + this._xSpring.current.value,
|
||||
rect.y * scale + this._ySpring.current.value,
|
||||
rect.width * scale,
|
||||
rect.height * scale,
|
||||
rect.degrees)
|
||||
.rotate(this.getRotation(), this._getRotationPoint(true));
|
||||
},
|
||||
|
||||
// private
|
||||
// Convert rectangle in viewport coordinates to tiled image coordinates.
|
||||
// Convert rectangle in viewport coordinates to this tiled image point
|
||||
// coordinates (x in [0, 1] and y in [0, aspectRatio])
|
||||
_viewportToTiledImageRectangle: function(rect) {
|
||||
var scale = this._scaleSpring.current.value;
|
||||
rect = rect.rotate(-this.getRotation(), this._getRotationPoint(true));
|
||||
|
10
src/world.js
10
src/world.js
@ -436,16 +436,6 @@ $.extend( $.World.prototype, $.EventSource.prototype, /** @lends OpenSeadragon.W
|
||||
* @property {?Object} userData - Arbitrary subscriber-defined object.
|
||||
*/
|
||||
this.raiseEvent( 'remove-item', { item: item } );
|
||||
},
|
||||
|
||||
// private
|
||||
_hasRotatedItem: function() {
|
||||
for (var i = 0; i < this._items.length; i++) {
|
||||
if (this._items[i].getRotation() !== 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user