diff --git a/plugins/legacy-plugin-chart-map-box/src/MapBox.jsx b/plugins/legacy-plugin-chart-map-box/src/MapBox.jsx index 887130044a..de3652d05e 100644 --- a/plugins/legacy-plugin-chart-map-box/src/MapBox.jsx +++ b/plugins/legacy-plugin-chart-map-box/src/MapBox.jsx @@ -108,7 +108,15 @@ class MapBox extends React.Component { // Compute the clusters based on the original bounds and current zoom level. Note when zoom/pan // to an area outside of the original bounds, no additional queries are made to the backend to // retrieve additional data. - const bbox = [bounds[0][0], bounds[0][1], bounds[1][0], bounds[1][1]]; + // add this variable to widen the visible area + const offsetHorizontal = (width * 0.5) / 100; + const offsetVertical = (height * 0.5) / 100; + const bbox = [ + bounds[0][0] - offsetHorizontal, + bounds[0][1] - offsetVertical, + bounds[1][0] + offsetHorizontal, + bounds[1][1] + offsetVertical, + ]; const clusters = clusterer.getClusters(bbox, Math.round(viewport.zoom)); return (