[Question] How can I make panning boundaries for any zoom?
I use MapBox map. When I pan far enough, I see white background and I don't want users to see it. The existing solution is to set LatLng for nw and se boundaries, but this approach is not valid, as it has to change according to current zoom. Is there any other solution? Thanks.
Not sure if I'm being an idiot, but why shouldn't the LatLng corners work for any zoom ? (Trying to figure if it's a bug or something else).
The way it works is it checks if the center of the screen is in boundaries. The rectangle of view can have different LatLng dimensions, which change when zoom changes. It would have worked perfectly if it checked corners for collision, not the center.
Having the same issue. The boundaries seems to change depending on zoom level. As I zoom in, the boundary seems to get slightly smaller, which cuts off part of the map.
Does anyone have a workaround for this?

A screenshot to be clear about what issue I have.
I tried to provide current bounds to isOutOfBounds but it looks like bounds are not quite correct.
A screenshot to be clear about what issue I have.
Does anyone have a workaround for this?
A screenshot to be clear about what issue I have.
Does anyone have a workaround for this?
did you ever found a solution for this? Im also facing this problem.
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.
This issue was closed because it has been stalled for 5 days with no activity.
@roderikpeeters @q869939686 @OrKoN @KaYBlitZ @maxgmer I'm also facing this issue. Did anyone of you find a work-around?
This is still an issue, so please reopen!
Needs re-open.
Same issue!
I have figured if you somehow set up the right coordinates for swPanBoundary and nePanBoundary, the user can't go out from the map. But it is difficult to find the right one.
What have you tried so far, and what are you trying to achieve ?
Hi @aadi-github, that last comment didn't make any sense, it was just the stale message. Did you mean to write something else?
Hi @aadi-github, that last comment didn't make any sense, it was just the stale message. Did you mean to write something else?
No, Actually the comment done by KaYBlitZ was actually the issue I was facing. The boundaries seems to change depending on the zoom level. As I zoom in, the boundary seems to get slightly smaller, which cuts off part of the map. ex: where you used to see the name of the river, suppose on zoom level 13; Now you won't be able to see that on zoom level 18. I think this is not just because of 'swPanBoundary' and 'nePanBoundary', it might be because zooming is related to the Coordinates of the 'center' also.
I think we'd need to see an example, maybe some code with the 2 images at different zoom levels of the edges.
I think we'd need to see an example, maybe some code with the 2 images at different zoom levels of the edges.
Ok, please look below example on zoom level 13, 14, 15.

In above in level 13 you can observe NH10, but when going to 14 or 15 it shifts off the screen. I am not able to drag it down even if I had downloaded tiles of that coordinate. you will be able to see some of the part if you rotate the map but can't go anywhere near if(no draging or zooming) as the zoom level increases.
Below is the boundries and center coord :::
FlutterMap(
mapController: _mapController,
options: MapOptions(
zoom: _minZoom,
minZoom: _minZoom,
maxZoom: _maxZoom,
center: LatLng(26.730925, 88.43126111),
swPanBoundary: LatLng(26.70650, 88.41802),
nePanBoundary: LatLng(26.72602, 88.44000),
),
I have tried maxBounds() instead of swPanBoundary and nePanBoundary which disables the every interaction to map. I don't know what causing this but this will be problem if I want to show some points which are at edge side. zoom level 13 is OK but on zoom level 18 will not have the way to go there.
I hope this will give you a brief idea about the issue.
There's 2 separate things here (easy to get confused between them and maybe we should be clearer in the docs).
Limiting Pan from the center point (swPanBoundary/nePanBoundary), so the visible corners will change depending upon zoom. Limiting Pan for the corners, so nothing outside the bounds are visible. This is maxBounds. It sounds a little bit more like this is what you are after, but I may be wrong. If this is the one, check the the latest Git version, as there was a bug in 3.0.0 with maxBounds and interactions which was fixed later.
There's 2 separate things here (easy to get confused between them and maybe we should be clearer in the docs).
Limiting Pan from the center point (swPanBoundary/nePanBoundary), so the visible corners will change depending upon zoom. Limiting Pan for the corners, so nothing outside the bounds are visible. This is maxBounds. It sounds a little bit more like this is what you are after, but I may be wrong. If this is the one, check the the latest Git version, as there was a bug in 3.0.0 with maxBounds and interactions which was fixed later.
Yes Actually, I will check with the latest Git version. Thankyou.