The fifth beta of Leaflet 2.0 adds ProjectedCRS, a core replacement for the Proj4Leaflet plugin for maps in national grids and other projected coordinate systems, along with over 20 bug fixes.
❇️ New features
- Add
ProjectedCRSfor maps in national grids, WMTS tile matrix sets and other projected coordinate systems, replacing the unmaintained Proj4Leaflet plugin. Hooking up proj4 (or any other projection library) takes a few lines, zooming works smoothly past the defined zoom levels, and it adds nothing to your bundle unless imported (#10591)
⚡️ Performance
- Make adding many layers to a collapsed layers control much faster (#10585 by @TheNetherWatcher, #10266)
✨ Improvements
- Allow clearing a
WMSTileLayerparam by setting it toundefinedornullwithsetParams(#10590 by @ogchicken, #3441) - Add
originalEventto markerdragstartandmovestartevents, so you can check the pointer type or modifier keys that started the drag (#10574 by @ogchicken, #6953) - Show distances under a meter (like
0.3 m) in the scale control instead of an oversized1 mbar (#10583 by @SwastikTripathi) - Accept arrays and plain objects in
Point#scaleByandPoint#unscaleBy(#10573 by @Kernel-Hunter)
♿️ Accessibility
- Mark the "Leaflet" and "OpenStreetMap" attribution links as English, so screen readers pronounce them correctly on non-English maps (#10580 by @nfreear, #10579)
- Stop tooltips from overwriting other descriptions in their source's
aria-describedby(#10596 by @xiaoyao-666-coder) - Stop closed tooltips from staying in their source's
aria-describedby(#10578 by @ogchicken)
🐞 Bug fixes
- Fix CSS resets like Tailwind's shrinking video overlays and vector layers in custom panes (#10589 by @ogchicken, #4600)
- Fix canvas layers getting a
clickwhen the press started elsewhere on the map (#10588 by @b84330808, #7105) - Fix tooltips with a
Pointoffset jumping around on zoom when they open to the left, a regression in beta.4 (#10605 by @SudeepGowda55) - Fix rebinding a popup with
bindPopupleaving the old one open with no way to close it (#10606 by @SudeepGowda55) - Fix
LayerGroup#toGeoJSONmissing layers in plugins that extend layer groups, a regression in 2.0 - Fix
setMinZoom/setMaxZoomcalled during a zoom animation leaving the map outside the new limits (#10571 by @ogchicken, #9226) - Fix part of
maxBoundsbeing unreachable with some projections, such as conic ones (#10584 by @ogchicken, #7650) - Fix
GeoJSON#resetStylethrowing for layers added withaddLayer(#10598 by @Chen1098) - Fix dragging a marker with
autoPanthrowing whenautoPanPaddingis 0 on either axis (#10607 by @SudeepGowda55) - Fix the map not zooming out when a layer with
maxZoom: 0is added (#10572 by @ogchicken) - Fix disabling box zoom mid-drag leaving the box on the map and still zooming on release (#10587 by @ogchicken)
- Fix
FullscreenControlgetting stuck in fullscreen mode when the map is removed from the page while fullscreen - Fix
off()called from a listener not stopping the remaining listeners of that event (#10597 by @Chen1098) - Fix
map.remove()leaving built-in handlers likescrollWheelZoomenabled when a plugin handler re-enables them (#6474) - Fix canvas paths with
weight: '0'(as a string) still being drawn (#10581 by @ogchicken) - Fix
ZoomControl#enable/#disablethrowing when the control isn't on a map (#10582 by @ogchicken)
📝 Docs
- Clarify that
LayersControl'sautoZIndexkeeps the order of tile layers and overlays, but not of markers and vectors (#10594 by @deepujain, #5201) - Complete the keyboard shortcuts table in the accessibility tutorial (#10575 by @ogchicken)
- Fix missing OpenTopoMap tiles past zoom 17 in the layers control tutorial (#10576 by @ogchicken)
- Fix the favicon on tutorial example pages (#10577 by @ogchicken)
🔧 Workflow
- Fix debug pages broken by the v2 API changes (#10586 by @ogchicken)
- Add a test for the
LatLng#equalsdefault margin (#10608 by @ksir0601, #10603)
⚠️ Breaking changes
WMSTileLayerno longer sends params set toundefinedornull(previously sent as the strings"undefined"and"null")- A collapsed layers control updates its list only when it expands, so code reading the list's DOM while it's collapsed may see it out of date