From 517e1feae8fcfbef7830177a6ce256f32bc09d8b Mon Sep 17 00:00:00 2001 From: Antoine Vandecreme Date: Sun, 24 Dec 2017 10:57:29 +0100 Subject: [PATCH] Fix getTileAtPoint epsilon precision Fix #1362 --- src/tilesource.js | 2 +- test/modules/tilesource.js | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/tilesource.js b/src/tilesource.js index 84aa5a82..66badc9c 100644 --- a/src/tilesource.js +++ b/src/tilesource.js @@ -360,7 +360,7 @@ $.TileSource.prototype = { if (point.x >= 1) { x = this.getNumTiles(level).x - 1; } - var EPSILON = 1e-16; + var EPSILON = 1e-15; if (point.y >= 1 / this.aspectRatio - EPSILON) { y = this.getNumTiles(level).y - 1; } diff --git a/test/modules/tilesource.js b/test/modules/tilesource.js index bac637c8..2c1a0f42 100644 --- a/test/modules/tilesource.js +++ b/test/modules/tilesource.js @@ -107,6 +107,17 @@ maxLevel: 0, }); assertTileAtPoint(0, new OpenSeadragon.Point(1, 1239 / 4036), new OpenSeadragon.Point(0, 0)); + + // Test for issue #1362 + tileSource = new OpenSeadragon.TileSource({ + width: 2000, + height: 3033, + tileWidth: 2000, + tileHeight: 3033, + tileOverlap: 0, + maxLevel: 0, + }); + assertTileAtPoint(0, new OpenSeadragon.Point(1, 3033 / 2000), new OpenSeadragon.Point(0, 0)); }); }());