Fix TileSource.getTileAtPoint

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

View File

@ -345,11 +345,12 @@ $.TileSource.prototype = {
* @param {OpenSeadragon.Point} point
*/
getTileAtPoint: function(level, point) {
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 )
);
var widthScaled = this.dimensions.x * this.getLevelScale(level);
var pixelX = point.x * widthScaled;
var pixelY = point.y * widthScaled;
var x = Math.floor(pixelX / this.getTileWidth());
var y = Math.floor(pixelY / this.getTileHeight());
return new $.Point(x, y);
},
/**