Search code examples
gojs

how to change node highlight shape while creating link between two nodes (gojs)


image

As in the image, the nodes are circular but the highlight shape is rectangle . I want to change this rectangle shape to circular while creating link between two nodes.


Solution

  • (Copied from forum)

    You could set a portTargeted function to set the temporaryFromPort or temporaryToPort to match the figure of the targeted port.

    myDiagram.toolManager.linkingTool.portTargeted = function(realnode, realport, tempnode, tempport, toend) {
      if (realport === null) {
        tempport.figure = "Square";
      } else {
        tempport.figure = realport.figure;
      }
    }
    

    You probably want to do the same for the RelinkingTool.