diff --git a/js/data/feature_tree.js b/js/data/feature_tree.js index 3091faff8a4..1c9399fa783 100644 --- a/js/data/feature_tree.js +++ b/js/data/feature_tree.js @@ -46,7 +46,7 @@ FeatureTree.prototype.query = function(args, callback) { var radius, bounds; if (typeof x !== 'undefined' && typeof y !== 'undefined') { // a point (or point+radius) query - radius = (params.radius || 0) * EXTENT / args.scale; + radius = (params.radius || 0) * EXTENT / args.tileSize / args.scale; bounds = [x - radius, y - radius, x + radius, y + radius]; } else { // a rectangle query diff --git a/js/source/source.js b/js/source/source.js index 7659c1091f8..ff624464b7e 100644 --- a/js/source/source.js +++ b/js/source/source.js @@ -81,6 +81,7 @@ exports._vectorFeaturesAt = function(coord, params, callback) { x: result.x, y: result.y, scale: result.scale, + tileSize: result.tileSize, source: this.id, params: params }, callback, result.tile.workerID); diff --git a/js/source/tile_pyramid.js b/js/source/tile_pyramid.js index fbabeaa399c..371d15b3aea 100644 --- a/js/source/tile_pyramid.js +++ b/js/source/tile_pyramid.js @@ -368,7 +368,8 @@ TilePyramid.prototype = { tile: tile, x: pos.x, y: pos.y, - scale: this.transform.worldSize / Math.pow(2, tile.coord.z) + scale: Math.pow(2, this.transform.zoom - tile.coord.z), + tileSize: tile.tileSize }; } }