mapbox / mapbox/mapbox-gl-js

Make the map "bounce" when reaching "maxBounds"

Open
#3,231 4 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature :green_apple:
Dominant language
TypeScript
Stars
12.4k
Forks
2.4k
PR merge metrics
No merged PRs in 30d

Description

**mapbox-gl-js version**: 0.24.0
### Steps to Trigger Behavior
1. Set maxBounds on a map
2. Try to zoom or pan out of max bounds
### Actual/Expected/Desired Behavior

Once reaching the maxBounds the map will not move, it appears to the user that interactivity is not working. In my opinion it would be better if maxBounds acted like scroll on mobile: it would allow a little bit of "give" / overscroll beyond the max bounds / zoom and bounce back.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the listed maxBounds zoom and pan steps in mapbox-gl-js version 0.24.0 and inspect the existing map interaction entry points. Determine how overscroll and bounce should behave at the bounds, including zooming and panning, then verify that reaching maxBounds allows limited movement before returning to the bounds.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.