From b4d0f1355dd07679add8dea631bb14bd3e9fae9f Mon Sep 17 00:00:00 2001 From: Ansis Brammanis Date: Tue, 6 Mar 2018 10:39:09 -0500 Subject: [PATCH] rename `additionalRadius` to `queryPadding` --- src/data/feature_index.js | 6 +++--- src/source/source_cache.js | 6 +++--- src/source/tile.js | 10 +++++----- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/data/feature_index.js b/src/data/feature_index.js index fed6484564b..1e064f5a02d 100644 --- a/src/data/feature_index.js +++ b/src/data/feature_index.js @@ -25,7 +25,7 @@ type QueryParameters = { bearing: number, tileSize: number, queryGeometry: Array>, - additionalRadius: number, + queryPadding: number, params: { filter: FilterSpecification, layers: Array, @@ -98,7 +98,7 @@ class FeatureIndex { filter = featureFilter(params.filter); const queryGeometry = args.queryGeometry; - const additionalRadius = args.additionalRadius * pixelsToTileUnits; + const queryPadding = args.queryPadding * pixelsToTileUnits; let minX = Infinity; let minY = Infinity; @@ -115,7 +115,7 @@ class FeatureIndex { } } - const matching = this.grid.query(minX - additionalRadius, minY - additionalRadius, maxX + additionalRadius, maxY + additionalRadius); + const matching = this.grid.query(minX - queryPadding, minY - queryPadding, maxX + queryPadding, maxY + queryPadding); matching.sort(topDownFeatureComparator); this.filterMatching(result, matching, this.featureIndexArray, queryGeometry, filter, params.layers, styleLayers, args.bearing, pixelsToTileUnits); diff --git a/src/source/source_cache.js b/src/source/source_cache.js index 3b5836c220e..a3e5173abc9 100644 --- a/src/source/source_cache.js +++ b/src/source/source_cache.js @@ -705,15 +705,15 @@ class SourceCache extends Evented { const tile = this._tiles[ids[i]]; const tileID = tile.tileID; const scale = Math.pow(2, this.transform.zoom - tile.tileID.overscaledZ); - const additionalRadius = tile.additionalRadius * EXTENT / tile.tileSize / scale; + const queryPadding = tile.queryPadding * EXTENT / tile.tileSize / scale; const tileSpaceBounds = [ coordinateToTilePoint(tileID, new Coordinate(minX, minY, z)), coordinateToTilePoint(tileID, new Coordinate(maxX, maxY, z)) ]; - if (tileSpaceBounds[0].x - additionalRadius < EXTENT && tileSpaceBounds[0].y - additionalRadius < EXTENT && - tileSpaceBounds[1].x + additionalRadius >= 0 && tileSpaceBounds[1].y + additionalRadius >= 0) { + if (tileSpaceBounds[0].x - queryPadding < EXTENT && tileSpaceBounds[0].y - queryPadding < EXTENT && + tileSpaceBounds[1].x + queryPadding >= 0 && tileSpaceBounds[1].y + queryPadding >= 0) { const tileSpaceQueryGeometry = []; for (let j = 0; j < queryGeometry.length; j++) { diff --git a/src/source/tile.js b/src/source/tile.js index e0e31e3f394..b46f9e932f1 100644 --- a/src/source/tile.js +++ b/src/source/tile.js @@ -91,7 +91,7 @@ class Tile { refreshedUponExpiration: boolean; reloadCallback: any; resourceTiming: ?Array; - additionalRadius: number; + queryPadding: number; /** * @param {OverscaledTileID} tileID @@ -104,7 +104,7 @@ class Tile { this.tileSize = size; this.buckets = {}; this.expirationTime = null; - this.additionalRadius = 0; + this.queryPadding = 0; // Counts the number of times a response was already expired when // received. We're using this to add a delay when making a new request @@ -168,10 +168,10 @@ class Tile { } } - this.additionalRadius = 0; + this.queryPadding = 0; for (const id in this.buckets) { const bucket = this.buckets[id]; - this.additionalRadius = Math.max(this.additionalRadius, painter.style.getLayer(bucket.layerIds[0]).queryRadius(bucket)); + this.queryPadding = Math.max(this.queryPadding, painter.style.getLayer(bucket.layerIds[0]).queryRadius(bucket)); } if (data.iconAtlasImage) { @@ -266,7 +266,7 @@ class Tile { tileSize: this.tileSize, bearing: bearing, params: params, - additionalRadius: this.additionalRadius, + queryPadding: this.queryPadding, collisionBoxArray: this.collisionBoxArray, sourceID: sourceID, collisionIndex: collisionIndex,