danwild / leaflet-event-forwarder

Catches unhandled canvas layer events and re-dispatches them to the next layer in the stack

Home Page:https://danwild.github.io/leaflet-event-forwarder/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

leaflet-event-forwarder NPM version NPM Downloads

A plugin for leaflet v1^.

Catches unhandled canvas layer events and re-dispatches them to the next layer in the stack.

Example use:

const map = L.map("map");
const myEventForwarder = new L.eventForwarder({
  // ref to leaflet map
  map: map,
  // events to forward
  events: {
    click: true,
    mousemove: true
  },
  // throttle options for mousemove events (same as underscore.js)
  throttleMs: 100,
  throttleOptions: {
    leading: true,
    trailing: false
  }
});

// enable event forwarding
myEventForwarder.enable();

// disable event forwarding
myEventForwarder.disable();

Shouts outs

License

Apache 2

About

Catches unhandled canvas layer events and re-dispatches them to the next layer in the stack

https://danwild.github.io/leaflet-event-forwarder/

License:Apache License 2.0


Languages

Language:JavaScript 63.0%Language:HTML 37.0%