I (end user) need a link was attached to the place where I placed it at first

we implemented the LinkShiftingTool, it is working good But I need also a link was attached to the place where I placed it at first (when I draw it, not after drawing). with the following reference implemented the code below
https://forum.nwoods.com/t/linkshiftingtool-fromspot-tospot/10401

private SpotLinkingTool() {
    return go.LinkingTool.call(this);
  }

  private SpotRelinkingTool() {
    return go.RelinkingTool.call(this);
  }

  public initDiagram(): go.Diagram {
    const that = this;
    const $ = go.GraphObject.make;
    this.dia = $(go.Diagram, {
      "draggingTool.dragsLink": true,
      "draggingTool.isGridSnapEnabled": true,
      "linkingTool.isUnconnectedLinkValid": false,
      "linkingTool.portGravity": 50,
      "relinkingTool.isUnconnectedLinkValid": true,
      "relinkingTool.portGravity": 50,
      "relinkingTool.fromHandleArchetype":
        $(go.Shape, "Diamond", { segmentIndex: 0, cursor: "pointer", desiredSize: new go.Size(8, 8), fill: "tomato", stroke: "darkred" }),
      "relinkingTool.toHandleArchetype":
        $(go.Shape, "Diamond", { segmentIndex: -1, cursor: "pointer", desiredSize: new go.Size(8, 8), fill: "darkred", stroke: "tomato" }),
      "linkReshapingTool.handleArchetype":
        $(go.Shape, "Diamond", { desiredSize: new go.Size(7, 7), fill: "lightblue", stroke: "deepskyblue" }),
      "rotatingTool.handleAngle": 270,
      "rotatingTool.handleDistance": 20,
      "rotatingTool.snapAngleMultiple": 15,
      "rotatingTool.snapAngleEpsilon": 15,
      'undoManager.isEnabled': true,
      linkingTool: $(this.SpotLinkingTool()),
      relinkingTool: $(this.SpotRelinkingTool()),
      allowDelete: true,
      allowCopy: false,
      model: $(go.GraphLinksModel,
        {
          copiesArrays: true,
          copiesArrayObjects: true,
          linkKeyProperty: 'key'
        }
      )
    });


    go.Diagram.inherit(this.SpotLinkingTool(), go.LinkingTool);

    this.SpotLinkingTool().prototype.insertLink = ((fromnode, fromport, tonode, toport) => {
      var link = go.LinkingTool.prototype.insertLink.call(this, fromnode, fromport, tonode, toport);
      if (link !== null) {
        var port;
        if (link.isForwards) {
          port = toport;
        } else {
          port = fromport;
        }
        var portb = new go.Rect(port.getDocumentPoint(go.Spot.TopLeft),
                                port.getDocumentPoint(go.Spot.BottomRight));
        var lp = link.getLinkPointFromPoint(port.part, port, port.getDocumentPoint(go.Spot.Center),
                                            this.dia.lastInput.documentPoint, !link.isForwards);
        var spot = new go.Spot((lp.x - portb.x) / (portb.width || 1), (lp.y - portb.y) / (portb.height || 1));
        if (link.isForwards) {
          link.toSpot = spot;
        } else {
          link.fromSpot = spot;
        }
      }
      return link;
    })


    go.Diagram.inherit(this.SpotRelinkingTool(), go.RelinkingTool);

    this.SpotRelinkingTool().prototype.reconnectLink = ((link, newnode, newport, toend) => {
      go.RelinkingTool.prototype.reconnectLink.call(this, link, newnode, newport, toend);
      if (link !== null) {
        var port = newport;
        var portb = new go.Rect(port.getDocumentPoint(go.Spot.TopLeft),
                                port.getDocumentPoint(go.Spot.BottomRight));
        var lp = link.getLinkPointFromPoint(port.part, port, port.getDocumentPoint(go.Spot.Center),
                                            this.dia.lastInput.documentPoint, !toend);
        var spot = new go.Spot((lp.x - portb.x) / (portb.width || 1), (lp.y - portb.y) / (portb.height || 1));
        if (toend) {
          link.toSpot = spot;
        } else {
          link.fromSpot = spot;
        }
      }
      return link;
    })

this is in typescript, getting issue here, i tried with created the global var for spotLiningTool and SpotRelinkingTool also

 linkingTool: $(this.SpotLinkingTool()),
      relinkingTool: $(this.SpotRelinkingTool())
  1. need to allow the user only one link between nodes is it possible to do like that?
  1. Try removing the parentheses there.

  2. GoJS Validation -- Northwoods Software

  1. tried it is giving the error. this is in typescript
linkingTool: $(this.SpotLinkingTool),
      relinkingTool: $(this.SpotRelinkingTool)```

even tried create the objects instead of SpotLinkingTool(), SpotRelinkingTool() functions

Why aren’t you declaring those two as classes inheriting from the respective go classes?

sorry not understanding exactly what you are suggesting, can you please post an example piece of that code

hi Walter can you please post example with code if possible?

This seems to be a syntax problem in TypeScript. Or are you asking about something else? I have no idea of what your question really is.

i thing there is not syntax issue, code is compiling good in typescript, but functionality not working , if there is any changes in code can you please post modified code of above one?

You seemed to be saying that there were TypeScript compilation errors in this forum topic.

If that’s not the case, could you please post the code that find is not working the way that you want? Exactly what is wrong, and what do you want to do instead?

this is the error i’m getting at
linkingTool: $(this.SpotLinkingTool())

code: no change in code, please find the code above.

Why isn’t the code
{ linkingTool: new SpotLinkingTool() }
or
{ linkingTool: $(SpotLinkingTool) }