Drag around a Link as if it were a Node. Throws Error

I am experimenting with allowing users to drag links as if they were a node (like your draggableLink Sample)

I just turned out the appropriate link parameters to my code:
this.diagram.toolManager.linkingTool.isUnconnectedLinkValid = true;
this.diagram.toolManager.relinkingTool.isUnconnectedLinkValid = true;
this.diagram.toolManager.draggingTool.dragsLink = true;

But when a stretch an input link out I get this error on releasing the mouse:

svm-select.module.ts:24 TypeError: Cannot read property ‘pi’ of null
at Tr (go.js:1710)
at Rr (go.js:1636)
at W.webpackJsonp…/node_modules/gojs/release/go.js.W.getLinkPoint (go.js:1637)
at W.webpackJsonp…/node_modules/gojs/release/go.js.W.computePoints (go.js:1632)
at W.webpackJsonp…/node_modules/gojs/release/go.js.W.updateRoute.W.co (go.js:1626)
at W. (go.js:1611)
at W.webpackJsonp…/node_modules/gojs/release/go.js.g.Nn (go.js:1161)
at xk (go.js:1014)
at E.webpackJsonp…/node_modules/gojs/release/go.js.E.CB (go.js:788)
at Ii (go.js:787)

Any pointers on how I can debug this problem?

Thanks

David

I just modified samples/minimal.html by adding these three lines:

    myDiagram.toolManager.linkingTool.isUnconnectedLinkValid = true;
    myDiagram.toolManager.relinkingTool.isUnconnectedLinkValid = true;
    myDiagram.toolManager.draggingTool.dragsLink = true;

Everything worked as I think you are expecting.

Please try using the go-debug.js library and check the console output for warnings or errors.

How do I switch to go-debug.js? Using ts, Angular 4.xx angular-cli

I did switch all my imports to: from ‘gojs/release/go-debug’

but I then get compile errors on the extensions
ERROR in C:/Users/nelson/Documents/code/svm-angular/src/app/svmesa/model-editor/editor/diagram/model-editor-diagram.component.ts (159,9): Type 'RealtimeDragSelectingTool' is not assignable to type 'DragSelectingTool'. Types of property 'box' are incompatible. Type 'go.Part' is not assignable to type 'go.Part'. Two different types with this name exist, but they are unrelated. Types of property 'adornments' are incompatible. Type 'go.Iterator<Adornment>' is not assignable to type 'go.Iterator<Adornment>'. Two different types with this name exist, but they are unrelated. Types of property 'value' are incompatible. Type 'go.Adornment' is not assignable to type 'go.Adornment'. Two different types with this name exist, but they are unrelated. Types of property 'adornedObject' are incompatible. Type 'go.GraphObject' is not assignable to type 'go.GraphObject'. Two different types with this name exist, but they are unrelated. Types of property 'actionCancel' are incompatible. Type '(e: InputEvent, obj: GraphObject) => void' is not assignable to type '(e: InputEvent, obj: GraphObject) => void'. Two different types with this name exist, but they are unrelated. Types of parameters 'e' and 'e' are incompatible. Type 'go.InputEvent' is not assignable to type 'go.InputEvent'. Two different types with this name exist, but they are unrelated.

David

Looks as if you are loading two different versions of the library.

Yea. That was also my conclusion.

I am using everywhere in my code.
import * as go from ‘gojs/release/go-debug’;

But I am also importing some goJs Extensions:
import {NodeLabelDraggingTool} from ‘gojs/extensionsTS/NodeLabelDraggingTool’;
import {RealtimeDragSelectingTool} from ‘gojs/extensionsTS/RealtimeDragSelectingTool’;

which are importing
import * as go from “…/release/go”;

which is the cause of the load of both the debug and the release code.

Do i have to go in and change the imports in the extensions themselves?

david

SO I got debugging code running by changing the imports in the extensions.

Here is the stack trace of the error I get from my original question:
svm-select.module.ts:24 TypeError: Cannot read property ‘Fi’ of null
at as (go-debug.js:1791)
at Zr (go-debug.js:1717)
at J.webpackJsonp…/node_modules/gojs/release/go-debug.js.J.getLinkPoint (go-debug.js:1718)
at J.webpackJsonp…/node_modules/gojs/release/go-debug.js.J.computePoints (go-debug.js:1713)
at J.webpackJsonp…/node_modules/gojs/release/go-debug.js.J.updateRoute.J.Ao (go-debug.js:1707)
at J. (go-debug.js:1691)
at J.webpackJsonp…/node_modules/gojs/release/go-debug.js.f.jo (go-debug.js:1223)
at Gk (go-debug.js:1071)
at E.webpackJsonp…/node_modules/gojs/release/go-debug.js.E.eC (go-debug.js:840)
at Ti (go-debug.js:839)

I can’t tell what’s going on there. Are the arguments to Link.getLinkPoint reasonable and expected?

Could you tell us how to reproduce the problem?

I have no idea. I am not calling getLinkPoint. When I release the mouse on moving the end of a link, That error is thrown.

I will double check but none of my code is in the stacktrace

David