I have set GraphObject.fromSpot , GraphObject.toSpot and GraphObject.portId with string.
I don’t understand why the arrow disappear and/or changes the original direction.
This is code of my nodes:
var activityNodeTemplate =
GoLib(go.Node, “Spot”,
{ locationObjectName: “SHAPE”, locationSpot: go.Spot.Center,
resizable: false, resizeObjectName: “PANEL”,
toolTip: tooltiptemplate,
selectionAdorned: true, // use a Binding on the Shape.stroke to show selection
itemTemplate: boundaryEventItemTemplate,
contextClick: function (e, node) { var idProcesso = node.data.idProcesso; if (idProcesso != undefined && idProcesso > 0) ShowDettagliNodo(idProcesso); return false; }
},
new go.Binding(“itemArray”, “boundaryEventArray”),
new go.Binding(“location”, “loc”, go.Point.parse).makeTwoWay(go.Point.stringify),
// move a selected part into the Foreground layer, so it isn"t obscured by any non-selected parts
new go.Binding(“layerName”, “isSelected”, function (s) { return s ? “Foreground” : “”; }).ofObject(),
GoLib(go.Panel, “Auto”,
{ name: “PANEL”,
minSize: new go.Size(activityNodeWidth, activityNodeHeight),
desiredSize: new go.Size(activityNodeWidth, activityNodeHeight)
},
new go.Binding(“desiredSize”, “size”, go.Size.parse).makeTwoWay(go.Size.stringify),
GoLib(go.Panel, “Spot”,
GoLib(go.Shape, “RoundedRectangle”, // the outside rounded rectangle
{name: “SHAPE”,
fill: activityNodeFill,
stroke: activityNodeStroke,
fromLinkable: true,
toLinkable: true,
cursor: “pointer”
},
new go.Binding(“fill”, “color”),
new go.Binding(“strokeWidth”, “isCall”, function (s) { return s ? activityNodeStrokeWidthIsCall : activityNodeStrokeWidth; })
),
makePortGeneric(“T”, go.Spot.Top, true, true),
makePortGeneric(“L”, go.Spot.Left, true, true),
makePortGeneric(“R”, go.Spot.Right, true, true),
makePortGeneric(“B”, go.Spot.Bottom, true, true),
GoLib(go.Shape, “RoundedRectangle”, // the inner “Transaction” rounded rectangle
{margin: 3,
stretch: go.GraphObject.Fill,
stroke: activityNodeStroke,
parameter1: 8, fill: null, visible: false
},
new go.Binding(“visible”, “isTransaction”)),
// task icon
GoLib(go.Shape, “BpmnTaskScript”, // will be None, Script, Manual, Service, etc via converter
{alignment: new go.Spot(0, 0, 5, 5), alignmentFocus: go.Spot.TopLeft, width: 22, height: 22 },
new go.Binding(“fill”, “taskType”, nodeActivityTaskTypeColorConverter),
new go.Binding(“figure”, “taskType”, nodeActivityTaskTypeConverter)
), // end Task Icon
makeMarkerPanel(false, 1) // sub-process, loop, parallel, sequential, ad doc and compensation markers
), // end main body rectangles spot panel
GoLib(go.TextBlock, // the center text
{alignment: go.Spot.Center, textAlign: “center”, margin: 12, editable: true },
new go.Binding(“text”).makeTwoWay())
),
{ // handle mouse enter/leave events to show/hide the ports
mouseEnter: function (e, node) { showSmallPorts(node, true); },
mouseLeave: function (e, node) { showSmallPorts(node, false); }
}
); // end go.Node
function makePortGeneric(name, spot, output, input) {
// the port is basically just a small transparent square
return GoLib(go.Shape, “Rectangle”,
{
fill: null, // not seen, by default; set to a translucent gray by showSmallPorts, defined below
stroke: null,
desiredSize: new go.Size(7, 7),
alignment: spot, // align the port on the main Shape
alignmentFocus: spot, // just inside the Shape
portId: name, // declare this object to be a “port”
fromSpot: spot, toSpot: go.Spot.AllSides, /spot,/ // declare where links may connect at this port
fromLinkable: output, toLinkable: input, // declare whether the user may draw links to/from here
cursor: “pointer”, // show a different cursor to indicate potential link point
fromMaxLinks: 1,
toMaxLinks: 1
});
}
function showSmallPorts(node, show) {
node.ports.each(function (port) {
if (port.portId !== “”) { // don’t change the default port, which is the big shape
port.fill = show ? “rgba(150, 150, 150, 1)” : null;
}
});
}