I am using goJS to show associations between specifically selected points of data in the style of the Concept Map sample, however when I reshape a link between two nodes it doesn’t always update the diagram model, despite .makeTwoWay();
Each node on the diagram will have at least other connected node, and each connected node will have 2 links (to and from)… One of these links is capable of being moved and stored, and one isn’t with the exception of a node that has 6 links (3 to and 3 from) with another node.
I discovered the problem when extracting the diagram model and storing it, as not all the links would be where I placed them. I then tried doing diagram.rebuildParts() on the ‘LinkReshaped’ event, and this just reset them to where they were before if they weren’t saved.
My node template is as follows:
oDiagram.nodeTemplate = goJs(go.Node, "Auto", {
avoidableMargin: new go.Margin(50,50,50,50),
resizable: true,
layoutConditions: go.Part.LayoutStandard & ~go.Part.LayoutNodeSized },
// define the node's outer shape, which will surround the TextBlock
goJs(go.Shape, {
name: "SHAPE",
stroke: "black",
strokeWidth: 2
},
new go.Binding('fill', 'colour'),
new go.Binding('geometryString', 'geoString')), goJs(go.TextBlock, {
font: "bold 10pt helvetica, bold arial, sans-serif",
margin: 4
},
new go.Binding("text", "text")),
new go.Binding("location", "loc", go.Point.parse),
new go.Binding('width', 'width'),
new go.Binding('height', 'height')
);
My linkTemplate is as follows
[code]
oDiagram.linkTemplate = goJs(go.Link, {
routing: go.Link.Normal,
reshapable: true,
toolTip: goJs(go.Adornment, “Auto”,
goJs(go.Shape, { fill: “lightyellow” }),
goJs(go.Panel, “Vertical”,
goJs(go.TextBlock, {
font: “bold 12pt helvetica, bold arial, sans-serif”,
textAlign: “center”,
margin: 3
},
new go.Binding(“text”, “text”)
)
)
)}, goJs(go.Shape, {
isPanelMain: true,
stroke: “black”,
strokeWidth: 2
}),
goJs(go.Shape, {
toArrow: “standard”,
stroke: null
}),
goJs(go.Panel, “Viewbox”, {
segmentIndex: 0,
segmentFraction: 0.4
},
goJs(go.TextBlock,
new go.Binding(“text”, “text”)
)
),
new go.Binding(“points”).makeTwoWay()
);[/code]
A JSON excerpt of my nodeDataArray
[
{
"key": 8,
"text": "Allow Users and Admins to be Combined",
"loc": "-899.03 771.42",
"colour": "#FEC900",
"__gohashid": 25534
},
{
"key": 22,
"text": "Self assignment of licenses",
"loc": "-580.05 992.81",
"colour": "#FEC900",
"__gohashid": 25535
},
{
"key": 23,
"text": "URL for creating sample data is broken",
"loc": "-772.04 1225.53",
"colour": "#FEC900",
"__gohashid": 25536
},
{
"key": 24,
"text": "Allow us to send emails to client accounts",
"loc": "-198.14 927.76",
"colour": "#FEC900",
"__gohashid": 25537
}
]
A JSON excerpt of my linkDataArray
[
{
"assoc": "694",
"from": 8,
"text": "associated with",
"to": 22,
"points": [
-750.86,
795.72,
-630.92,
898.17,
-504.72,
992.81
]
},
{
"assoc": "694",
"from": 23,
"text": "associated with",
"to": 22,
"points": [
-637.87,
1225.53,
-563.65,
1124.11,
-497.72,
1017.11
]
},
{
"assoc": "694",
"from": 24,
"text": "associated with",
"to": 22,
"points": [
-125.71,
952.06,
-266.56,
967.49,
-405.98,
992.81
]
},
{
"assoc": "693",
"from": 22,
"text": "associated with",
"to": 8,
"points": [
-504.73,
992.81,
-624.67,
890.36,
-750.86,
795.72
]
},
{
"assoc": "693",
"from": 22,
"text": "associated with",
"to": 23,
"points": [
-497.72,
1017.11,
-571.94,
1118.53,
-637.87,
1225.53
]
},
{
"assoc": "693",
"from": 22,
"text": "associated with",
"to": 24,
"points": [
-456.18,
992.81,
-252.46,
918.63,
-162.19,
927.76
]
},
]
Does anyone have an idea of what is causing the problem, or how to fix it?