diff --git a/src/imagetilesource.js b/src/imagetilesource.js index f4ef5fa9..3562bf50 100644 --- a/src/imagetilesource.js +++ b/src/imagetilesource.js @@ -166,14 +166,6 @@ return new $.Point(0, 0); } }, - /** - * @function - * @param {Number} level - * @param {OpenSeadragon.Point} point - */ - getTileAtPoint: function (level, point) { - return new $.Point(0, 0); - }, /** * Retrieves a tile url * @function diff --git a/src/legacytilesource.js b/src/legacytilesource.js index b661b967..04579034 100644 --- a/src/legacytilesource.js +++ b/src/legacytilesource.js @@ -169,16 +169,6 @@ $.extend( $.LegacyTileSource.prototype, $.TileSource.prototype, /** @lends OpenS } }, - /** - * @function - * @param {Number} level - * @param {OpenSeadragon.Point} point - */ - getTileAtPoint: function( level, point ) { - return new $.Point( 0, 0 ); - }, - - /** * This method is not implemented by this class other than to throw an Error * announcing you have to implement it. Because of the variety of tile diff --git a/src/tiledimage.js b/src/tiledimage.js index b45aa47a..e4749fbc 100644 --- a/src/tiledimage.js +++ b/src/tiledimage.js @@ -967,10 +967,14 @@ function updateLevel( tiledImage, haveDrawn, drawLevel, level, levelOpacity, lev resetCoverage( tiledImage.coverage, level ); - if ( !tiledImage.wrapHorizontal ) { + if ( tiledImage.wrapHorizontal ) { + tileTL.x -= 1; // left invisible column (othervise we will have empty space after scroll at left) + } else { tileBR.x = Math.min( tileBR.x, numberOfTiles.x - 1 ); } - if ( !tiledImage.wrapVertical ) { + if ( tiledImage.wrapVertical ) { + tileTL.y -= 1; // top invisible row (othervise we will have empty space after scroll at top) + } else { tileBR.y = Math.min( tileBR.y, numberOfTiles.y - 1 ); } diff --git a/src/tilesource.js b/src/tilesource.js index 48941848..eb5aabc0 100644 --- a/src/tilesource.js +++ b/src/tilesource.js @@ -345,11 +345,11 @@ $.TileSource.prototype = { * @param {OpenSeadragon.Point} point */ getTileAtPoint: function( level, point ) { - var pixel = point.times( this.dimensions.x ).times( this.getLevelScale(level) ), - tx = Math.floor( pixel.x / this.getTileWidth(level) ), - ty = Math.floor( pixel.y / this.getTileHeight(level) ); - - return new $.Point( tx, ty ); + var numTiles = this.getNumTiles( level ); + return new $.Point( + Math.floor( (point.x * numTiles.x) / 1 ), + Math.floor( (point.y * numTiles.y * this.dimensions.x) / this.dimensions.y ) + ); }, /**