Skip to content

Latest commit

 

History

History
62 lines (41 loc) · 1.16 KB

README.md

File metadata and controls

62 lines (41 loc) · 1.16 KB

l-advanced-control

Leaflet controls with advanced positioning capabilities.

l-advanced-control example

Requirements

Leaflet 1.3.x.

Demo

Example

Usage

  1. Include this plugin after Leaflet.js
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css" />
<script src="https://unpkg.com/[email protected]/dist/leaflet.js"></script>
<script src="https://unpkg.com/[email protected]/build/l-advanced-control.min.js"></script>

or install and use with npm:

npm i l-advanced-control --save
import 'l-advanced-control'
  1. Extend L.AdvancedControl class, to define your control.
const MyButton = L.AdvancedControl.extend({
    onAdd (map) {
        return L.DomUtil.create('div', 'my-button')
    }
})
  1. Add it to map
const button = new MyButton({ position: { corner: 'topleft', grow: 'x' } })
button.addTo(map)

API

L.AdvancedControl adds to L.Control prop grow, which defined direction, in which it will "grow".

type Grow = 'x' | 'y'

Licence

MIT