Quantcast
Channel: GoJS - Northwoods Software
Viewing all articles
Browse latest Browse all 6969

LinkingTool & findLinkablePort()

$
0
0

@cardis1 wrote:

Hi,

We decide to update gojs from 1.6.22 to 1.7.2 and the we receive this error:
"Property 'findLinkablePort' is protected and only accessible within class 'LinkingTool' and its subclasses."

With the new version, how can I get the "from node" when the event "linkingTool.canStart" is triggered??

Now, I get this information in this way:

private _diagram: go.Diagram;

ngAfterViewInit(): void {
let $ = go.GraphObject.make;
this._diagram = new go.Diagram(this.getContainer().nativeElement);
this._diagram.toolManager.linkingTool.canStart = this.linkingToolCanStart.bind(this);
...
}

...

linkingToolCanStart(): boolean {
    let linkingTool = this._diagram.toolManager.linkingTool;
    if (linkingTool.findLinkablePort() && linkingTool.findLinkablePort().part) {
        let fromNode = linkingTool.findLinkablePort().part.data;

        return this.canLinkFromThisNode(fromNode);
    }

    return false;
}

Thank you

Posts: 2

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 6969

Trending Articles