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

313
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
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