Skip to content

Call setMinZoom, setMaxZoom, setMinPitch and setMaxPitch in the right order to avoid error in Maplibre - #2573

Merged
chrisgervang merged 9 commits into
visgl:masterfrom
Auspicus:fix/update-zoom-order
Jul 28, 2026
Merged

chrisgervang merged 9 commits into
visgl:masterfrom
Auspicus:fix/update-zoom-order

Conversation

@Auspicus

@Auspicus Auspicus commented Dec 23, 2025 •

Copy link
Copy Markdown
Contributor

Adds a test to cover different cases where minZoom and maxZoom are adjusted together. Ensures that minZoom and maxZoom never cross. The same has been done for minPitch and maxPitch.

fixes: #2572

see also: maplibre/maplibre-gl-js#6926 where a bug was fixed causing pitch to also throw an error if changed in the wrong order

@Auspicus Auspicus changed the title Call setMinZoom and setMaxZoom in the right order to ensure that minZoom and maxZoom never cross Call setMinZoom, setMaxZoom, setMinPitch and setMaxPitch in the right order to avoid error in Maplibre Jan 20, 2026
@Pessimistress

Copy link
Copy Markdown
Collaborator

Can you run yarn lint fix?

@Auspicus

Copy link
Copy Markdown
Contributor Author

@Pessimistress I've done that but I'd like to clean this up a bit before we merge if that's OK?

@Auspicus

Copy link
Copy Markdown
Contributor Author

@Pessimistress I think this is in a better state now. Let me know if you have feedback :)

@chrisgervang
chrisgervang merged commit 8a2bf7c into visgl:master Jul 28, 2026
1 check passed
chrisgervang pushed a commit that referenced this pull request Jul 29, 2026
… order to avoid error in Maplibre (#2573)

* Add updateZoomConstraint helper

* Fix types, prevent duplicate call to setMinZoom or setMaxZoom

* Add the same logic for pitch, format code

* Return whether or not changes were applied from the updatePitchConstraint and updateZoomConstraint func

* Add back propPresent

* yarn lint fix

* refactor: cleanup tests, prop names, code duplication, comments

---------

Co-authored-by: Xiaoji Chen <Pessimistress@users.noreply.github.com>
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.

[Bug] Changing minZoom and maxZoom at the same time can throw an error in Maplibre

3 participants