Maplair

an open-source JavaScript library
for building powerful interactive maps

← Back to the list of blog posts

Maplair 4.0 — a fork of Leaflet

Today we’re releasing Maplair 4.0.0, the first stable release of Maplair: a fork of Leaflet, the open-source JavaScript library for interactive maps that Volodymyr Agafonkin created in 2010. It brings many features which Leaflet apps used plugins or workarounds for — map rotation, fullscreen, search, heatmaps, a minimap, legends and more — all of them dropped by bundlers unless you use them.

Maplair builds on the work that went into Leaflet 2.0 — the move to ES modules, standard JavaScript classes and Pointer Events — and continues it: some changes that were proposed for Leaflet, but didn’t land there, are part of Maplair. Many thanks to Volodymyr Agafonkin and to the hundreds of Leaflet contributors, whose work Maplair is based on.

Why 4.0?

Maplair’s first version is 4.0, so that it can’t be confused with Leaflet 2.x or 3.x. If you’re coming from Leaflet 1.9.4, read on for everything that changed in between; if you already use the Leaflet 2.0 alpha, most of it will look familiar.

What’s new

New controls

Map and interaction

Layers and markers

Optional modules

These features extend existing classes, so they’re separate modules: import them to use them, e.g. import 'maplair/zoom-styles';. The bundles maplair.js and maplair-global.js contain all of them.

Theming

The colors, borders, shadows, fonts and spacing are CSS variables now, so that you can theme maps by overriding them:

:root {
	--maplair-background-color-base: #202122;
	--maplair-color-base: #eaecf0;
}

Migrating from Leaflet 1.9.4

Maplair targets browsers which support the web features that are Baseline Widely available (supported by all major browsers for at least 30 months); Internet Explorer isn’t supported anymore.

Package, files and loading

Creating objects

Classes and plugins

Events

Utilities and options

Feedback

Please report problems and share feedback on GitHub — and have fun mapping with Maplair! 🍁