This is a set of tools for leaflet:
base classes and stock components to create custom map interfaces.
intro
| code samples
| use/install
|
concepts
L.Mount has some targets in its design:
- simplify map interface design
- allow simple reuse and extension
- encourage composition over configuration
This means that it's here to let you do what you want with very little work,
but work nonetheless. Some things might strike you as odd:
- **
Leaflet
has factories everywhere! where are L.Mount
's? ** - Why doesn't this work out of the box?
- Mount is meant to be a tool: helpful defaults for one map could be nonsensical for another.
intro
With Mount, you'll notice its two changes to L.Map
:
- the new default options render a bare map
- a
figure
tag wraps the map (& figcaption
)
Now your map's ready for building :rocket:
code
L.Mount.Attribution
Attribution
is a simple component: a span
with a cite
for each visible layer (auto updates).
.leaflet-mount-attribution {
position: absolute;
bottom: 0;
right: 0;
}
map.mount(new L.Mount.Attribution());
L.Mount.ZoomIn & ZoomOut
ZoomIn
and ZoomOut
are uncoupled for flexiblility.
map
.mount(new L.Mount.ZoomIn());
.mount(new L.Mount.ZoomOut());
install
unpkg
unpkg