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.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.
if (this.viewport.getRotation() === 0) {
var self = this;
this.viewer.addHandler('rotate', function resizeSketchCanvas() {
self.viewer.removeHandler('rotate', resizeSketchCanvas);
this.viewer.addOnceHandler('rotate', function resizeSketchCanvas() {
var sketchCanvasSize = self._calculateSketchCanvasSize();
self.sketchCanvas.width = sketchCanvasSize.x;
self.sketchCanvas.height = sketchCanvasSize.y;
@ -617,7 +617,8 @@ $.Drawer.prototype = {
// private
_calculateSketchCanvasSize: function() {
var canvasSize = this._calculateCanvasSize();
if (this.viewport.getRotation() === 0) {
if (this.viewport.getRotation() === 0 &&
!this.viewer.world._hasRotatedItem()) {
return canvasSize;
}
// 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.viewport.pixelFromPointNoRotate(
tiledImage._getRotationPoint(true), true),
useSketch);
false);
}
}
tiledImage._drawer.blendSketch({

View File

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