Addressing seams that appear in wrap mode on Safari and Firefox

This commit is contained in:
Ian Gilman 2017-09-08 14:03:40 -07:00
parent 36dd37b931
commit a49bbbcb06
2 changed files with 34 additions and 1 deletions

View File

@ -199,12 +199,27 @@ $.Tile = function(level, x, y, bounds, exists, url, context2D, loadWithAjax, aja
* @memberof OpenSeadragon.Tile#
*/
this.beingDrawn = false;
/**
* Timestamp the tile was last touched.
* @member {Number} lastTouchTime
* @memberof OpenSeadragon.Tile#
*/
this.lastTouchTime = 0;
/**
* Whether this tile is in the right-most column for its level.
* @member {Boolean} isRightMost
* @memberof OpenSeadragon.Tile#
*/
this.isRightMost = false;
/**
* Whether this tile is in the bottom-most row for its level.
* @member {Boolean} isBottomMost
* @memberof OpenSeadragon.Tile#
*/
this.isBottomMost = false;
};
/** @lends OpenSeadragon.Tile.prototype */

View File

@ -1405,7 +1405,7 @@ function getTile(
bounds.x += ( x - xMod ) / numTiles.x;
bounds.y += (worldHeight / worldWidth) * (( y - yMod ) / numTiles.y);
tilesMatrix[ level ][ x ][ y ] = new $.Tile(
tile = new $.Tile(
level,
x,
y,
@ -1416,6 +1416,16 @@ function getTile(
tiledImage.loadTilesWithAjax,
ajaxHeaders
);
if (xMod === numTiles.x - 1) {
tile.isRightMost = true;
}
if (yMod === numTiles.y - 1) {
tile.isBottomMost = true;
}
tilesMatrix[ level ][ x ][ y ] = tile;
}
tile = tilesMatrix[ level ][ x ][ y ];
@ -1602,6 +1612,14 @@ function positionTile( tile, overlap, viewport, viewportCenter, levelVisibility,
sizeC = sizeC.plus( new $.Point( 1, 1 ) );
}
if (tile.isRightMost && tiledImage.wrapHorizontal) {
sizeC.x += 0.75; // Otherwise Firefox and Safari show seams
}
if (tile.isBottomMost && tiledImage.wrapVertical) {
sizeC.y += 0.75; // Otherwise Firefox and Safari show seams
}
tile.position = positionC;
tile.size = sizeC;
tile.squaredDistance = tileSquaredDistance;