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

179
Visualizações
Openlayers on select function not always triggering

I have a map, with features that are recreated every 1 second. (layer is deleted, and recreated, with new features, new coords)

I have a function that create selection :

       selectInteraction = new Select({
          toggleCondition: this.isMultipleSelectionEnable
            ? null
            : ol.events.condition.never,

          style: self.selectedFeatureStyle,
          // and so on...
         }

        this.selectInteraction.on(['select'], function (e) {
          console.log('on select')
          self.parentRef.list.goToItem()
        })

and as you can see, on feature select, I call a method (on ref component, passed as props) that find and scroll to the selected item in a list, which is the same as selected in map. This is working like a charm, but this function is not always triggered whenever I select a feature.

I click on a feature, I have the selected feature style and everything that is related to selection, but this "this.selectInteraction.on(['select']" is not always triggering.

It's like the behaviour is really random, I can click 2 times on a same feature and have no trigger of the function, but the 3rd click will trigger it. I can click once on a feature and have the trigger, and deselect/reselect the same feature and it won't work.

If anyone has an idea why this function is not always fired on selection, that would be great, and if you need any additionnal informations, feel free to ask

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