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

226
Vistas
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 Respuestas
Responde la pregunta

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 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