So I’m trying to get a “fake” link coming off some nodes, that’s just a short link to nothing coming off that node. Basically something that looks like this:
The way I’m doing this is with a small invisible panel (portId terminal) off to the right, and I’m linking from the blank port (which is the main/central panel) to terminal, both on spot.RightCenter.
The issue I’m running into is that I can’t figure out how to get the panel to be ignored by the layout. I can set visible:false, but then the link doesn’t connect appropriately. If I leave the panel visible, then the links look correct, but the margins between nodes are changed in a way I don’t want. Is there a way to mix these two behaviors?
I’ve also tried using spots with offsets, but the behavior of the link itself seems really odd in that case, I’m not sure if that’s down to something I did, or the spots not being intended for use that way.
Edit: I should also note that if possible, I’d like to keep the behavior of having the node link to itself, as there’s some side effects of that that are handy for other features.
node template:
export const getTaskTemplate = (localize: Function) => {
return GO(
go.Node,
'Spot',
{
locationObjectName: 'TASK_BODY',
selectionObjectName: 'TASK_BODY',
avoidableMargin: new go.Margin(30),
deletable: false,
selectionAdornmentTemplate: GO(
go.Adornment,
'Auto',
GO(go.Shape, 'Rectangle', { fill: null, stroke: '#2470ad', strokeWidth: 4 }),
GO(go.Placeholder)
),
},
GO(
go.Panel,
'Auto',
{
desiredSize: new go.Size(360, 120),
isPanelMain: true,
alignment: go.Spot.Center,
click: selectTaskLinks,
doubleClick: toggleDataObjectPanels,
contextMenu: getTaskContextMenu(localize),
toolTip: GO(
'ToolTip',
GO(
go.Panel,
'Vertical',
GO(
go.TextBlock,
{
margin: 3,
},
new go.Binding('text', '', (part) => {
return part.data.inputs[0].name;
}).ofObject()
)
)
),
},
GO(
go.Shape,
'SmallRoundedRectangle',
{
name: 'TASK_BODY',
portId: '',
strokeWidth: 3,
fill: GO(go.Brush, { color: '#B5DEFF' }),
},
new go.Binding('stroke', 'state', getStatusIconColor)
),
GO(go.Panel, 'Auto', {
name: 'arrow_terminal',
desiredSize: new go.Size(30, 2),
alignment: go.Spot.RightCenter,
alignmentFocus: go.Spot.LeftCenter,
// visible: false,
background: "red",
portId: 'terminal',
toSpot: go.Spot.RightCenter,
})
);
};
link template:
map.add(
'continuationLinks',
GO(
go.Link,
{
fromSpot: go.Spot.RightCenter,
toSpot: go.Spot.RightCenter,
deletable: false,
},
GO(
go.Shape,
{
name: 'OBJSHAPE',
}
),
GO(
go.Shape,
{
name: 'ARWSHAPE',
toArrow: 'Standard',
}
)
)
);
adding link to model:
continuations.map((value: string) => {
links.push({
id: value+"continuation",
from: value,
to: value,
fromPort: '',
toPort: 'terminal',
category: 'continuationLinks',
});
});