@wikimedia/leaflet-sleep

0.5.1 • Public • Published

Leaflet.Sleep

This is a fork of CliffCloud/Leaflet.Sleep. It is a lighter version of the plugin, optimized for Mediawiki use case.

Leaflet's stock maps are event-greedy and interfere with scrolling.

Leaflet.Sleep is an interaction manager, helping your map do what you want when you want.

Demo

Use

Available on npm, bower, and straight from the single. source file

Leaflet.Sleep is enabled by default, and can be disabled with the map's sleep option.

npm

npm install leaflet-sleep

bower

bower install leaflet-sleep

Config

These are the new options available for L.map and their defaults.

{
    // false if you want an unruly map
    sleep: true,

    // time(ms) until map sleeps on mouseout
    sleepTime: 750,

    // time(ms) until map wakes on mouseover
    wakeTime: 750,

    // should the user receive wake instructions?
    sleepNote: true,

    // should hovering wake the map? (non-touch devices only)
    hoverToWake: true,

    // a message to inform users about waking the map
    wakeMessage: 'Click or Hover to Wake',

    // a constructor for a control button
    sleepButton: L.Control.sleepMapControl,

    // opacity for the sleeping map
    sleepOpacity: .7
}

MIT Licensed

Readme

Keywords

none

Package Sidebar

Install

npm i @wikimedia/leaflet-sleep

Weekly Downloads

30

Version

0.5.1

License

MIT

Unpacked Size

19.2 kB

Total Files

6

Last publish

Collaborators

  • mvolz
  • lwatz16
  • tchin25
  • egardner
  • ottomata
  • annetee
  • jgiannelos-wmf
  • joakin
  • krinkle
  • jdforrester
  • edg2s
  • volker_e
  • catrope
  • santhosh.thottingal
  • cscott
  • subbu_ss
  • arlolra
  • jdlrobson
  • mateusbs17
  • brightbyte
  • phuedx
  • nrayio
  • jandre3000
  • sbassett29
  • nikerabbit
  • adamwight
  • wmde-fisch
  • thiemowmde