Skip to content

Conversation

@KristjanESPERANTO
Copy link
Contributor

Add support for array syntax in keepCurrentZoomLevel option to allow specifying a zoom range like [13, 18]. When the current zoom is within this range, the map only pans. Outside the range, it zooms normally.

Changes:

  • Extract zoom-keeping logic into _shouldKeepCurrentZoom() helper
  • Support three modes: false (default), true (always), or [min, max]
  • Update README with usage examples and clarified maxZoom behavior

This implements the feature originally requested in #246 and supersedes the stale PR #247 from 2019. This implementation uses a dedicated helper method for better testability and maintainability.

Add support for array syntax in keepCurrentZoomLevel option to allow
specifying a zoom range like [13, 18]. When the current zoom is within
this range, the map only pans. Outside the range, it zooms normally.

Changes:
- Extract zoom-keeping logic into _shouldKeepCurrentZoom() helper
- Support three modes: false (default), true (always), or [min, max]
- Update README with usage examples and clarified maxZoom behavior

This implements the feature originally requested in domoritz#246 and supersedes
the stale PR domoritz#247 from 2019. The implementation uses a dedicated helper
method for better testability and maintainability.
@domoritz domoritz merged commit 6cffe1a into domoritz:gh-pages Jan 5, 2026
1 check passed
@KristjanESPERANTO KristjanESPERANTO deleted the feature/keepCurrentZoomLevel-range branch January 6, 2026 22:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants