Raruto/leaflet-elevation

Label rotation randomly not working

hupe13 opened this issue · 1 comments

#252 (comment)

Some things do not seem to work properly.

I think I have found the reason. I tested the same page with one elevation chart in Firefox and Chrome. The label rotation was random (yes or no), even in different tabs of the same browser. I changed the line

this.on('elechart_init elechart_axis', function(e) {

to

this.on('elechart_init elechart_axis elechart_updated', function(e) {

and the effect did not occur anymore. Not even with multiple charts with different rotations on the same page.

The initial idea was to try to limit the number DOM mutations (perhaps feasible, but it would still require other thoughts..).

Anyway, something like this could suffice (I haven't tested):

this.on('elechart_updated', function(e) {

Feel free to submit a pull request to close it.

👋 Raruto