Raruto / leaflet-elevation

Leaflet plugin that allows to add elevation profiles using d3js
GNU General Public License v3.0
255 stars 85 forks source link

Hotline tracks are all displayed on the same map if there are multiple maps on one page #201

Closed hupe13 closed 2 years ago

hupe13 commented 2 years ago

Hi Raruto, unfortunately there is still a bug: if setting is hotline: "elevation", all tracks are displayed on only one map, if there are multiple maps on one page. An example is your example, which I modified. Here is one of my examples: grafik

I think, this line, e.g. the function insertBefore is the problem. But I don't know, how to solve it. https://github.com/Raruto/leaflet-elevation/blob/37372a5dcf0a68b9d520b1195a488fbd1f140869/src/control.js#L446

And you can see a second problem. The marker trkStart and trkStop should be on every map, but they are only present on one. With this I have other nice effects also, I will open another issue.

Thank you very much.

Raruto commented 2 years ago

Hi hupe,

I think, this line, e.g. the function insertBefore is the problem. But I don't know, how to solve it. https://github.com/Raruto/leaflet-elevation/blob/37372a5dcf0a68b9d520b1195a488fbd1f140869/src/control.js#L446

take a look at the following thread: https://github.com/iosphere/Leaflet.hotline/issues/20#issuecomment-694174218


And you can see a second problem. The marker trkStart and trkStop should be on every map, but they are only present on one. With this I have other nice effects also, I will open another issue.

Probably this happens because they are always referring to the same objects:

https://github.com/Raruto/leaflet-elevation/blob/37372a5dcf0a68b9d520b1195a488fbd1f140869/src/control.js#L184-L185

https://github.com/Raruto/leaflet-elevation/blob/37372a5dcf0a68b9d520b1195a488fbd1f140869/src/options.js#L52-L53

Have a nice day, Raruto

hupe13 commented 2 years ago

Ok. With this information the hotline problem is easy to fix. See here. I will make a pull request.

hupe13 commented 2 years ago

Thank you very much, now it works!