From 438e0c0bb376428a9478959d0b8f9d2f98a26c1a Mon Sep 17 00:00:00 2001 From: Mitchell McCaffrey Date: Fri, 2 Oct 2020 11:15:20 +1000 Subject: [PATCH] Updated map grid to use lowest resolution for lightness detection --- src/components/map/MapGrid.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/components/map/MapGrid.js b/src/components/map/MapGrid.js index 3382ee7..b968e47 100644 --- a/src/components/map/MapGrid.js +++ b/src/components/map/MapGrid.js @@ -11,7 +11,15 @@ import { getStrokeWidth } from "../../helpers/drawing"; import { getImageLightness } from "../../helpers/image"; function MapGrid({ map, gridSize }) { - const mapSource = useDataSource(map, defaultMapSources); + let mapSourceMap = map; + // Use lowest resolution for grid lightness + if (map && map.type === "file" && map.resolutions) { + const resolutionArray = Object.keys(map.resolutions); + if (resolutionArray.length > 0) { + mapSourceMap = map.resolutions[resolutionArray[0]]; + } + } + const mapSource = useDataSource(mapSourceMap, defaultMapSources); const [mapImage, mapLoadingStatus] = useImage(mapSource); const gridX = map && map.gridX;