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

322
Vistas
How to disable deselection when tapping the background in cytoscape.js?

I want my graph nodes not to be unselected when the user taps on the background.

From the docs of cytoscape.js I read

Gestures

Cytoscape.js supports several gestures:

  • ...
  • Tap background to unselect : desktop
  • ...

All gesture actions can be controlled by the programmer, toggling them on or off whenever needed.

I however cannot find any option to toggle that gesture off. I tried to hook up the tap event and tried to cancel the event, but to no success.

cy.on('tab', ev => {
    if (ev.target === cy) {
        ev.preventDefault();
        ev.originalEvent.preventDefault();
    }
});

How to prevent unselection on tab background?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

If anyone is still looking for a solution, I found this closed(answered) issue on the Cytoscape.js GitHub. Simon Golm's solution worked for me:

// Prevents the unselection of nodes when clicking on the background
cy.on('click', (event) => {
  if (event.target === cy) {
    // click on the background
    cy.nodes().unselectify();
  } else {
    cy.nodes().selectify();
  }
});
about 4 years ago · Juan Pablo Isaza Denunciar
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