ruler on leaflet-elevation_hoverable-tracks.html
Hi Raruto,
please see your example loading multiple .gpx tracks (hover to toggle ). You move with the mouse over a track, the chart and the ruler appear. Now you click on any track on the map, the chart disappears. Next you move with the mouse over a track again, the chart appears, the ruler doesn't.
How to fix this?
Hi @hupe13,
basically the control doesn't redraw the Ruler after calling remove() → addTo(map)
https://github.com/Raruto/leaflet-elevation/blob/bd9316bd1b7e7784b3bf3d812960eaa808ad94d6/libs/leaflet-gpxgroup.js#L279-L301
https://github.com/Raruto/leaflet-elevation/blob/bd9316bd1b7e7784b3bf3d812960eaa808ad94d6/src/control.js#L1201-L1217
https://github.com/Raruto/leaflet-elevation/blob/bd9316bd1b7e7784b3bf3d812960eaa808ad94d6/src/components/d3.js#L602-L641
Below some offending lines:
eleDivmay never change on subsequent call toaddTo(map)
https://github.com/Raruto/leaflet-elevation/blob/bd9316bd1b7e7784b3bf3d812960eaa808ad94d6/src/control.js#L248
https://github.com/Raruto/leaflet-elevation/blob/bd9316bd1b7e7784b3bf3d812960eaa808ad94d6/src/control.js#L1207
opts.rulermay be undefined
https://github.com/Raruto/leaflet-elevation/blob/bd9316bd1b7e7784b3bf3d812960eaa808ad94d6/src/control.js#L1211
https://github.com/Raruto/leaflet-elevation/blob/bd9316bd1b7e7784b3bf3d812960eaa808ad94d6/src/components/d3.js#L629-L631
https://github.com/Raruto/leaflet-elevation/blob/bd9316bd1b7e7784b3bf3d812960eaa808ad94d6/src/components/d3.js#L646
👋 Raruto