Skip to content

Per-value legend patch shapes, smaller saved maps, legend stacking above map controls - #236

Merged
walkerke merged 2 commits into
mainfrom
legend-patch-shapes
Nov 8, 2026
Merged

walkerke merged 2 commits into
mainfrom
legend-patch-shapes

Conversation

@walkerke

@walkerke walkerke commented Nov 8, 2026

Copy link
Copy Markdown
Owner

Smaller saved maps

Two widget dependencies used src: "htmlwidgets", so every saved map copied the package's whole widget folder twice, and three terra-draw dependencies shared one folder and copied it three times. Each dependency now ships only its own folder under lib/.

Measured with saveWidget(selfcontained = FALSE) on a bare map: the dependency folder drops from 14 MB to 3.3 MB for maplibre() and from 12 MB to 1.7 MB for mapboxgl(). A new test checks that no dependency ships the whole htmlwidgets folder or shares a folder with another.

Legends

  • Categorical legends accept one patch_shape per value (built-in names, SVG strings, or sf objects in a list), in both add_categorical_legend() and compare legends.
  • Legends in a bottom corner sit above the map's own controls there (logo, attribution, scale bar) instead of covering them.
  • A margin_* on the first legend in a corner now moves the whole stacked group, rather than taking that legend out of the stack.
  • Custom SVG patches keep fill="none" and transparent when recolored, so hollow shapes stay hollow.

Testing

  • Full test suite passes locally (1,178 tests), with new test-legend-patch-shapes.R and test-dependency-folders.R.
  • Legend stacking above map controls is browser-side and not covered by tests; not yet checked in a browser.

@walkerke
walkerke merged commit 7de2357 into main Nov 8, 2026
2 of 6 checks passed
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.

1 participant