Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

178
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda