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

Marker tooltip with negative elevation

Open mttucl opened this issue 2 years ago • 1 comments

When displaying bathymetry data, the marker tooltip line is shown above the path with the tip outside the map. This only happens if all data is negative. If there is another path with positive elevation data, it will only happen if I display the bathymetry data first for the first time after loading the page. Once I check the other path, it will display the bathymetry data tooltip correctly.

Sorry, I don't have a working example but you can try the geojson demo example with attachment (change txt to geojson).

demo.txt

mttucl avatar Nov 18 '23 21:11 mttucl

Hi @mttucl,

If you're interested in seeing it resolved, please check it out and pitch a PR.

I would say that the problem is related to yMax calculation (I haven't checked in detail):

image

https://github.com/Raruto/leaflet-elevation/blob/bd9316bd1b7e7784b3bf3d812960eaa808ad94d6/src/components/marker.js#L55

https://github.com/Raruto/leaflet-elevation/blob/bd9316bd1b7e7784b3bf3d812960eaa808ad94d6/src/components/marker.js#L63-L64

https://github.com/Raruto/leaflet-elevation/blob/bd9316bd1b7e7784b3bf3d812960eaa808ad94d6/src/components/d3.js#L129-L134

which also depends on yCoordMax variable:

https://github.com/Raruto/leaflet-elevation/blob/bd9316bd1b7e7784b3bf3d812960eaa808ad94d6/src/control.js#L189

https://github.com/Raruto/leaflet-elevation/blob/bd9316bd1b7e7784b3bf3d812960eaa808ad94d6/src/control.js#L365

https://github.com/Raruto/leaflet-elevation/blob/bd9316bd1b7e7784b3bf3d812960eaa808ad94d6/src/control.js#L1257-L1269

If you're interested in seeing it resolved, please take a hard look and pitch a PR.

👋 Raruto

Raruto avatar Nov 19 '23 10:11 Raruto