Partialy fix edge smoothing.

This commit is contained in:
Antoine Vandecreme 2016-10-06 22:18:32 +02:00
parent fbcf78c894
commit 2821c8f67b
3 changed files with 15 additions and 4 deletions

View File

@ -323,13 +323,13 @@ $.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.
if (this.viewport.getRotation() === 0) { if (this.viewport.getRotation() === 0) {
var self = this; var self = this;
this.viewer.addHandler('rotate', function resizeSketchCanvas() { this.viewer.addOnceHandler('rotate', function resizeSketchCanvas() {
self.viewer.removeHandler('rotate', resizeSketchCanvas);
var sketchCanvasSize = self._calculateSketchCanvasSize(); var sketchCanvasSize = self._calculateSketchCanvasSize();
self.sketchCanvas.width = sketchCanvasSize.x; self.sketchCanvas.width = sketchCanvasSize.x;
self.sketchCanvas.height = sketchCanvasSize.y; self.sketchCanvas.height = sketchCanvasSize.y;
@ -617,7 +617,8 @@ $.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

View File

@ -1670,7 +1670,7 @@ function drawTiles( tiledImage, lastDrawn ) {
tiledImage._degrees, tiledImage._degrees,
tiledImage.viewport.pixelFromPointNoRotate( tiledImage.viewport.pixelFromPointNoRotate(
tiledImage._getRotationPoint(true), true), tiledImage._getRotationPoint(true), true),
useSketch); false);
} }
} }
tiledImage._drawer.blendSketch({ tiledImage._drawer.blendSketch({

View File

@ -436,6 +436,16 @@ $.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;
} }
}); });