react-simple-maps icon indicating copy to clipboard operation
react-simple-maps copied to clipboard

Restrict panning of a map beyond the boundary

Open neel-tw opened this issue 1 year ago • 2 comments

I am trying to render the map of a specific country using the available GeoJSON file and wrapped it within a ZoomableGroup

The zoom and pan works fine, however the panning of the map cannot be restricted beyond a specific boundary. If the user accidentally moves the map outside the view area, then there is no way to restrict it.

image

I have tried the translateExtent prop and set a boundary but it does not seem to work. It works fine for the entire world map, but not for the country's map that I am trying to render

Is there anyway to calculate the bounds that are specific to a GeoJSON file and use that to set panning constraints ?

neel-tw avatar Apr 11 '23 09:04 neel-tw

Hi did you have any luck with this? Currently experiencing the same issue

Laurens256 avatar Oct 03 '23 12:10 Laurens256

Hey @zimrick I'm a dataviz developer and am interested in contributing to this library. I can try to tackle this issue, if no one else is already working this?

csdiehl avatar Oct 05 '23 15:10 csdiehl