fixed edge smoothing to work with clipping and placeholderFillRect - #755

This commit is contained in:
Petar Petrov 2015-11-05 16:31:13 +02:00
parent 515c15bf98
commit 7eda39c9a9
2 changed files with 27 additions and 0 deletions

View File

@ -201,6 +201,21 @@ $.Rect.prototype = /** @lends OpenSeadragon.Rect.prototype */{
);
},
/**
* Translate/move this Rect by a vector and return new Rect.
* @function
* @param {OpenSeadragon.Point} delta The translation vector.
* @returns {OpenSeadragon.Rect} A new rect with altered position
*/
translate: function( delta ) {
return new OpenSeadragon.Rect(
this.x + delta.x,
this.y + delta.y,
this.width,
this.height
);
},
/**
* Returns the smallest rectangle that will contain this and the given rectangle.
* @param {OpenSeadragon.Rect} rect

View File

@ -1327,6 +1327,12 @@ function drawTiles( tiledImage, lastDrawn ) {
var box = tiledImage.imageToViewportRectangle(tiledImage._clip, true);
var clipRect = tiledImage._drawer.viewportToDrawerRectangle(box);
if (sketchScale) {
clipRect = clipRect.times(sketchScale);
}
if (sketchTranslate) {
clipRect = clipRect.translate(sketchTranslate);
}
tiledImage._drawer.setClip(clipRect, useSketch);
usedClip = true;
@ -1334,6 +1340,12 @@ function drawTiles( tiledImage, lastDrawn ) {
if ( tiledImage.placeholderFillStyle && tiledImage._hasOpaqueTile === false ) {
var placeholderRect = tiledImage._drawer.viewportToDrawerRectangle(tiledImage.getBounds(true));
if (sketchScale) {
placeholderRect = placeholderRect.times(sketchScale);
}
if (sketchTranslate) {
placeholderRect = placeholderRect.translate(sketchTranslate);
}
var fillStyle = null;
if ( typeof tiledImage.placeholderFillStyle === "function" ) {