leaflet-elevation icon indicating copy to clipboard operation
leaflet-elevation copied to clipboard

ruler on leaflet-elevation_hoverable-tracks.html

Open hupe13 opened this issue 1 year ago • 1 comments

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?

hupe13 avatar May 25 '24 17:05 hupe13

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:

  • eleDiv may never change on subsequent call to addTo(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.ruler may 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

Raruto avatar May 27 '24 06:05 Raruto