leaflet-mount

0.0.0-alpha.11 • Public • Published

Leaflet Mount

img


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:

  1. simplify map interface design
  2. allow simple reuse and extension
  3. 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 🚀

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

Readme

Keywords

none

Package Sidebar

Install

npm i leaflet-mount

Weekly Downloads

2

Version

0.0.0-alpha.11

License

MIT

Last publish

Collaborators

  • atstp