Fix TileSource.getTileAtPoint

This commit is contained in:
Antoine Vandecreme 2016-10-09 14:05:22 +02:00
parent 2821c8f67b
commit cca6b47fc0

View File

@ -344,12 +344,13 @@ $.TileSource.prototype = {
* @param {Number} level * @param {Number} level
* @param {OpenSeadragon.Point} point * @param {OpenSeadragon.Point} point
*/ */
getTileAtPoint: function( level, point ) { getTileAtPoint: function(level, point) {
var numTiles = this.getNumTiles( level ); var widthScaled = this.dimensions.x * this.getLevelScale(level);
return new $.Point( var pixelX = point.x * widthScaled;
Math.floor( (point.x * numTiles.x) / 1 ), var pixelY = point.y * widthScaled;
Math.floor( (point.y * numTiles.y * this.dimensions.x) / this.dimensions.y ) var x = Math.floor(pixelX / this.getTileWidth());
); var y = Math.floor(pixelY / this.getTileHeight());
return new $.Point(x, y);
}, },
/** /**