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

223
Visualizações
Highlight nodes when while I drawing link on GOJS

I'm trying to highlight all possible nodes while drawing a new link, without success.

I want to achieve something similar to this: enter image description here

I tried to use listeners, but couldn't make it work...
Any help would be appreciated

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Here's a sample that demonstrates something similar to what I think you are asking for: https://gojs.net/extras/highlightingAllValidPorts.html The complete source code for the sample is there in the page.

Basically, as @Ba2sik suggests, you need to override the LinkingTool.doActivate and LinkingTool.doDeactivate methods to both call their super method and to do whatever highlighting you want.

class CustomLinkingTool extends go.LinkingTool {
  constructor() {
    super();
    this.temporaryFromPort.opacity = 0.0;
    this.temporaryToPort.opacity = 0.0;
  }

  doActivate() {
    super.doActivate();
    var tool = this;
    this.diagram.nodes.each(n => {
      n.ports.each(p => {
        const valid = tool.isValidLink(tool.originalFromNode, tool.originalFromPort, n, p);
        p.fill = valid ? "red" : "black";
      });
    });
  }

  doDeactivate() {
    this.diagram.nodes.each(n => {
      n.ports.each(p => {
        p.fill = "black";
      });
    });
    super.doDeactivate();
  }
}  // end CustomLinkingTool

That sample highlights all of the valid ports of each node, but you might be more interested in changing the appearance of any Node that has a valid port.

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