mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-24 22:26:10 +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.sketchCanvas.height = sketchCanvasSize.y;
|
||||||
this.sketchContext = this.sketchCanvas.getContext( "2d" );
|
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
|
// If the viewport is not currently rotated, the sketchCanvas
|
||||||
// will have the same size as the main canvas. However, if
|
// will have the same size as the main canvas. However, if
|
||||||
// the viewport get rotated later on, we will need to resize it.
|
// the viewport get rotated later on, we will need to resize it.
|
||||||
@ -621,8 +620,7 @@ $.Drawer.prototype = {
|
|||||||
// private
|
// private
|
||||||
_calculateSketchCanvasSize: function() {
|
_calculateSketchCanvasSize: function() {
|
||||||
var canvasSize = this._calculateCanvasSize();
|
var canvasSize = this._calculateCanvasSize();
|
||||||
if (this.viewport.getRotation() === 0 &&
|
if (this.viewport.getRotation() === 0) {
|
||||||
!this.viewer.world._hasRotatedItem()) {
|
|
||||||
return canvasSize;
|
return canvasSize;
|
||||||
}
|
}
|
||||||
// If the viewport is rotated, we need a larger sketch canvas in order
|
// 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
|
// private
|
||||||
// Convert rectangle in tiled image coordinates to viewport coordinates.
|
// Convert rectangle in viewport coordinates to this tiled image point
|
||||||
_tiledImageToViewportRectangle: function(rect) {
|
// coordinates (x in [0, 1] and y in [0, aspectRatio])
|
||||||
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.
|
|
||||||
_viewportToTiledImageRectangle: function(rect) {
|
_viewportToTiledImageRectangle: function(rect) {
|
||||||
var scale = this._scaleSpring.current.value;
|
var scale = this._scaleSpring.current.value;
|
||||||
rect = rect.rotate(-this.getRotation(), this._getRotationPoint(true));
|
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.
|
* @property {?Object} userData - Arbitrary subscriber-defined object.
|
||||||
*/
|
*/
|
||||||
this.raiseEvent( 'remove-item', { item: item } );
|
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