Commit Graph
7 Commits
Author SHA1 Message Date
Andrew Pinkham 021cf2a985 Fix Leaflet.Draw.DrawEvents.Created.layer type (#23137)
The DrawEvents.Created layer variable is not of type Layer. As noted by
the in-code documentation, the Leaflet.Draw.DrawEvents.Created.layer
variable is one of Leaflet's vector shapes or a markers.

https://github.com/Leaflet/Leaflet.draw/blob/c6af99b761c5d9900bf5a3e2e1d8827bbde29542/src/Leaflet.Draw.Event.js#L31

The L.Draw.Event.CREATED event is only fired by Draw.Feature in the
_fireCreatedEvent method.

Draw.Feature bequeaths _fireCreatedEvent to it's subclasses Draw.Marker,
Draw.Polyline, and Draw.SimpleShape, which in turn bequeath the method
to  Draw.Circle, Draw.Rectangle (both from Draw.SimpleShape),
Draw.CircleMarker (from Draw.Marker), and Draw.Polygon (from
Draw.Polyline).

Draw.Circle, Draw.CircleMarker, Draw.Marker, Draw.Rectangle and
Draw.Polyline override the _fireCreatedEvent to pass instances of their
respective vector classes to _fireCreatedEvent, meaning that the layer
variable is not of type Layer, but instead one of the vector or marker
classes. For example, Draw.Circle passes L.Circle to
L.Draw.Feature.prototype._fireCreatedEvent as the argument to the
`layer` parameter.

Note that Draw.Polygon inherits Draw.Polyline's behavior without
changes, but changes the vector class via the Poly class variable.
2018-01-24 09:01:32 -08:00
Alejandro Sánchez b5eaa88e9e Updated leaflet typings to match v1.2.x and to use newer typescript features 2017-08-24 17:18:50 -06:00
Denis 1e51efa5be Add leaflet-draw tests 2017-07-05 12:41:50 -04:00
Max Battcher 7ba15010a5 Support Leaflet-draw explicit false options
This matches the documentation better where most of the Leaflet Draw documentation encourages to use explicit false options (rather than null), as seen in the type comments already in the typing file.
2017-06-30 15:15:41 -04:00
soucekv 9e53c56b13 leaflet-draw: Draw events should extend base leaflet event (#16673) 2017-06-02 07:29:45 -07:00
Andy b6c343f2b3 Apply new lint rules to yet more packages (#15548)
* Apply new lint rules to yet more packages

* Fix leaflet lint
2017-03-31 11:01:26 -07:00
Andy Hanson 354cec620d Move all packages to a types directory 2017-03-24 14:27:52 -07:00