Closed hupe13 closed 1 year ago
As I remember lately I added this option as well (mainly in use within the various handlers):
Regarding the following options:
they are a legacy of MrMufflon/Leaflet.Elevation library. Honestly, I don't know how much they are in use today and personally I've never even felt the need to use them.
Isn't it better to use the same precision for the marker and tooltip?
If I'm not mistaken in the beginning it was like this, but in my opinion the information showed inside the map marker was more difficult to read, also because the tooltip moves in multiple dimensions while hovering. For example, the acceleration value showed too many useless changes in the decimals part that could distract the user too much from the value contained inside the integer part (which should be the most relevant part).
Or even better you can make the accuracy dependent on the size of value. Is this useful and possible?
Possible, but I don't think we can make it a general rule that applies to everyone, anyway, let me know if you think you have a pretty nifty solution.
Have a nice day, Raruto
I think the best is when the accuracy is dependent on the size. What do I care about the decimal places when the speed is 500 km/h? But it's not really true when the displayed value on the marker is always 0 when in the tooltip it's in the range from 0 to 0.5 (e.g.) I will think about it.
https://github.com/Raruto/leaflet-elevation/pull/210#discussion_r977833344 I will use
parseFloat((x).toPrecision(n))
because of
// note that exponential notation might be returned in some circumstances console.log((1234.5).toPrecision(2)) // logs '1.2e+3'
Hi Raruto,
during my tests, I noticed the accuracy of the tooltip and marker information. Most of the time, the marker is rounded to whole numbers, altitude and distance have options opts.decimalsX and opts.decimalsY. Isn't it better to use the same precision for the marker and tooltip? Or even better you can make the accuracy dependent on the size of value. Is this useful and possible?
Thank you very much.