Ability to set padding in options object on Map.setMaxBounds() method
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 12.4k
- Forks
- 2.4k
- PR merge metrics
- No merged PRs in 30d
Description
I have no idea what this looks like under the hood, so I don't know if this would be a quick change or more complicated, but it would be great to be able to pass an options object with padding to the setMaxBounds method, like I'm able to do with fitBounds.
Motivation
I've had a few times where I want to restrict panning on a map to a particular region, but want to be able to set some padding around the edges. Workarounds that I've tinkered with, but aren't ideal are:
- Manually finding the bounding coordinates for the larger "padded" area, which works, but is a little clunky/inexact and time-consuming.
- Running
fitBoundswith padding set, grabbing the new bounds withgetBounds, feeding this intomaxBoundsand then restoring the original map position without transition.
It would be great if there was a way to set this easily, if that's easy to do.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the setMaxBounds method and compare its current behavior with fitBounds, especially the existing padding option. Trace how max bounds and map padding are represented, then check the relevant tests if they can be located from those entry points. Done means callers can provide padding through setMaxBounds while existing calls continue to work.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend, web-dev
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100