mpetazzoni / leaflet-gpx

A GPX track plugin for Leaflet.js
http://mpetazzoni.github.io/leaflet-gpx
BSD 2-Clause "Simplified" License
529 stars 114 forks source link

Added XML element to event data to enable handling of custom extensions #68

Closed molnarm closed 6 years ago

molnarm commented 6 years ago

I added a couple more events that give access to both the XML node and the Leaflet object created from it. This enables the handling of any custom extension (device- or application-specific information, styling, etc.) without having to change the library too much.

I'm only using the parse_segment one for adding custom popups to track segments with information, so I'm not sure how useful the others would be, but I added them for completeness.

molnarm commented 6 years ago

You're perfectly right, I'll make the changes. I duplicated the events out of habit - I mostly work with strongly typed languages where changing the event parameter type could cause issues, but of course, it's OK in javascript.

mpetazzoni commented 6 years ago

Thanks!