mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-25 14:46:10 +03:00
Fix TileSource.getTileAtPoint
This commit is contained in:
parent
2821c8f67b
commit
cca6b47fc0
@ -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);
|
||||
},
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user