Repository navigation
Fit all markers into the initial view, fix dark mode map labels - #403
Merged
Merged
Conversation
The map forced minZoom 2 and maxBounds, so on most viewports MapLibre zoomed in further than fitBounds wanted and markers at the edges (US west coast, Australia) were cut off. Drop maxBounds (MapLibre already keeps the single world inside the viewport), derive minZoom from the viewport width (full world width, max 2) and use smaller fit padding on small screens. The map container gets the theme's water color so the area outside the world does not show up grey/white at low zoom levels. Theme rules for labels never applied: the property/type check expected "symbol-" but label paint properties are "text-*"/"icon-*". Dark mode kept the default dark text with white halo, which looked like outlined text. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Depending on the viewport, parts of the map were cut off in the initial view. The map forced
minZoom: 2and fixedmaxBounds, so MapLibre zoomed in further thanfitBoundswanted. On anything narrower than ~1920px the markers at the edges (US west coast, Australia) were outside the view; a phone only showed longitudes −18…48.In dark mode the map labels looked like outlined text: the theme rules for labels never applied because the property/type check expected
symbol-*, while label paint properties aretext-*/icon-*. The Liberty default (dark text, white halo) stayed active.Changes
maxBounds: MapLibre already keeps the single world (renderWorldCopies: false) inside the viewport.minZoomfrom the viewport width (full world width fits, max 2), updated on resize. Large screens keep the previous look without empty margins.text-*/icon-*properties to symbol layers. Labels are plain light text with a subtle dark halo in dark mode; the intended light mode label colors apply now as well.Result
Checked headless in Chromium (181 markers, hidden markers in the initial view):
In portrait, MapLibre always fills the viewport height with the world. The markers span 274° of longitude, so the two outermost ones cannot fit there; the rest is centered.
Initial view, desktop 1280×720
Initial view, phone 375×667
Dark mode labels
Initial view, desktop dark mode
🤖 Generated with Claude Code