Hi,
I’ve a flowchart and have used makePort to add spots to the "T"op, "L"eft, "B"ottom and "R"ight. All works well and the flowchart looks great.
I’ve now got comments associated with specific elements and need to ‘highlight’ the link to the comment as the number/size of comments may increase.
- So out of the box I have scenario (1)
- but what I'd like it to have a 'different' link that I could style and control such that it was more in line with (2) - note that the text 'sticks to vertical link of target' should be 'line' i.e. the user could move the comment up and down and the line would remain straight unto the comment is moved too far up/down.
- Option (3) would be nice but I'm not sure that the boxes can be forced to be aligned soNot quite sure where to start...
<font face="Courier New, Courier, mono" size="2"> myDiagram.nodeTemplateMap.add("Comment",</font>
$$(go.Node, “Auto”, nodeStyle(), {
selectionChanged: onSelectionChanged
,visible: isAdmin
},
new go.Binding(“location”, “loc”, go.Point.parse).makeTwoWay(go.Point.stringify),
{
//doubleClick: nodeDoubleClick
click: nodeDoubleClick
}, $$(go.Shape, “Rectangle”, {
fill: commentBGColor
, stroke: commentBorder
, strokeWidth: defaultBorder
}),
<span =“apple-tab-span”="" style=“white-space:pre”>
$$(go.Panel, “Table”,
{ defaultAlignment: go.Spot.Left },
$$(go.TextBlock, { row: 0, column: 0, margin: 4, textAlign: “left”, editable: false, font: commentNoteFont, stroke: commentFontColor}, “Note:”),
$$(go.TextBlock, { row: 1, column: 0, margin: 4, /maxSize: new go.Size(200, NaN),/ wrap: go.TextBlock.WrapFit, textAlign: “left”, editable: false, font: commentFont, stroke: commentFontColor }, new go.Binding(“text”, “text”))
)
,
// two named ports, one on each side:
//REQUIRED:
// not the default like (no arrowhead required)
// require straight line to ‘defined’ spot on left or right side (i.e. replace TopLeft with 0,10 or similar?)
makePort(“TL”, go.Spot.TopLeft, false, true)
, makePort(“TR”, go.Spot.TopRight, false, true)
));
function makePort(name, spot, output, input) {
// the port is basically just a small circle that has a white stroke when it is made visible
return $$(go.Shape, “Circle”, {
fill: “transparent”
,stroke: null
,desiredSize: new go.Size(6, 6)
,alignment: spot
,alignmentFocus: spot
,portId: name
,fromSpot: spot
,toSpot: spot
,fromLinkable: output
,toLinkable: input
,cursor: “pointer”
});
}