Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

248
Visualizações
Best approach to replicate Google Map's "re-center" when user interacts with the map in navigation mode using Leaflet JS

I have a leaflet map where I allow the user to turn on a mode where the map will follow and update their location every 30 seconds. This is implemented with a button click that corresponds to an ActiveLocation = true variable, and as long as it is set to true the map will check for location every 30 seconds and display a location pin and center the view to it. This is needed because the map is used while users are on the move.

Problem

Sometimes users want to check something on the map while ActiveLocation is enabled and they do that without disabling it. Because the map re-centers the view every 30 seconds their work is interrupted. because there is no way to differentiate between the user moving the map and the map moving due to the map.locate() function I have no way of knowing when the user intentionally initiated the change and pause the activeLocation until they request it back.

Are you aware of an efficient and clean way to achieve that? And is there any extension for leaflet that allows features similar to Google Maps' navigation?

Thanks!

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda