Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem when calling this.spin(true) more times than this.spin(false) #25

Open
woodwards opened this issue May 3, 2020 · 0 comments
Open

Comments

@woodwards
Copy link

I am trying to use Leaflet.Spin in R Shiny to show the spinner when adding layers to the map. I've done this by setting up events as suggested here and shown below.

I'm having trouble because this.spin(true) increments this._spinning while this.spin(false) decrements it. If I remove more layers than I add then this._spinning remains above zero and the spinner doesn't switch off. How would I fix this? Thanks!

function(el, x) {
  console.log('spin event added'); 
  this.on('layerremove', function(e) {
    console.log('layerremove fired');
    this.spin(true);
  });
  this.on('layeradd', function(e) {
    console.log('layeradd fired');
    this.spin(false);
  })
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant