From a49bbbcb06c390eead819acce941487ca7713f73 Mon Sep 17 00:00:00 2001 From: Ian Gilman Date: Fri, 8 Sep 2017 14:03:40 -0700 Subject: [PATCH] Addressing seams that appear in wrap mode on Safari and Firefox --- src/tile.js | 15 +++++++++++++++ src/tiledimage.js | 20 +++++++++++++++++++- 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/src/tile.js b/src/tile.js index 61ba2e64..a0b29f4f 100644 --- a/src/tile.js +++ b/src/tile.js @@ -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 */ diff --git a/src/tiledimage.js b/src/tiledimage.js index b9c83838..a289026a 100644 --- a/src/tiledimage.js +++ b/src/tiledimage.js @@ -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;