I sort of got it working. I made the Node a Viewbox and then made the Panel underneath it a “spot” panel. I put the inports and outports panel underneath this “spot” panel. Only thing is that the outports weren’t showing up with original go.Spot(1,0.5,8,0) and had to change it to go.Spot(1,0.5,-8,0) and the outports are now showing inside the panel. It works though now. It would be better to have the outports showing out rather than be inside the rectangle but I am happy with it for now that I am going to move on.
function makeTemplate(typename, icon, background, inports, outports) {
var node = /(go.Part, "Spot",
{resizable: true, resizeObjectName: "PANEL"},*/
(go.Node, “Viewbox”, {resizable: true},
(go.Panel, "Spot",
{ width: 100, height: 120},
//{stretch: go.GraphObject.Fill, minSize: new go.Size(50, 50)},
(go.Shape, “Rectangle”,
{
fill: background, stroke: null, strokeWidth: 0,
//spot1: go.Spot.TopLeft, spot2: go.Spot.BottomRight
}),
(go.Panel, "Table",
(go.TextBlock, typename,
{
row: 0,
margin: 3,
//stretch: go.GraphObject.Fill,
maxSize: new go.Size(80, NaN),
stroke: “white”,
font: “bold 11pt sans-serif”
}),
/(go.Picture, icon,
{ row: 1, width: 55, height: 55 }),*/
(go.TextBlock,
{
row: 2,
margin: 3,
editable: true,
//stretch: go.GraphObject.Fill,
maxSize: new go.Size(8, 4),
stroke: “white”,
font: “bold 9pt sans-serif”
},
new go.Binding(“text”, “name”).makeTwoWay())
),
(go.Panel, "Vertical",
{
alignment: go.Spot.Left,
alignmentFocus: new go.Spot(0, 0.5, -8, 0)
},
inports),
(go.Panel, “Vertical”,
{
alignment: go.Spot.Right,
alignmentFocus: new go.Spot(1, 0.5, -8, 0)
},
outports)
),
/(go.Panel, "Vertical",
{
alignment: go.Spot.Left,
alignmentFocus: new go.Spot(0, 0.5, -8, 0)
},
inports),
(go.Panel, “Vertical”,
{
alignment: go.Spot.Right,
alignmentFocus: new go.Spot(1, 0.5, 8, 0)
},
outports)/
);
myDiagram.nodeTemplateMap.add(typename, node);
}