I’m having trouble with the positioning of the nodes inside the group.
First I move them in specific position and after I save data and I check the json it seems that all the coordinates are saved right.
Then I close and reopen the page but the nodes doesn’t maintains the position I fix
This is the position were a move the nodes
This is the position after I reopen the page
In the console I have this message:
LOG: Auto or Spot Panel should not have zero or one elements: Panel(Panel.Auto)#1387 in Node#1392
The code of group template is:
var ofGroupsTemplate =
$(go.Group, go.Panel.Auto,
{
background: "transparent",
resizable: true,
locationSpot: go.Spot.Center,
selectionObjectName: "PH",
locationObjectName: "PH",
resizeObjectName: "PH",
// highlight when dragging into the Group
mouseDragEnter: function (e, grp, prev) { highlightGroup(e, grp, true); },
mouseDragLeave: function (e, grp, next) { highlightGroup(e, grp, false); },
//layerChanged: function(Part, Layer, Layer) { window.console.log(Part); },
computesBoundsAfterDrag: true,
// when the selection is dropped into a Group, add the selected Parts into that Group;
// if it fails, cancel the tool, rolling back any changes
mouseDrop: finishDrop,
// Groups containing Groups layout their members horizontally
layout:
$(go.GridLayout,
{ wrappingWidth: Infinity,
alignment: go.GridLayout.Position,
cellSize: new go.Size(10, 10),
spacing: new go.Size(20, 20)
}),
minSize: new go.Size(120, 70),
desiredSize: new go.Size(80, 70)
},
new go.Binding("location", "loc", go.Point.parse).makeTwoWay(go.Point.stringify),
new go.Binding("desiredSize", "size", go.Size.parse).makeTwoWay(go.Size.stringify),
$(go.Panel, go.Panel.Vertical,
$(go.Panel, go.Panel.Horizontal,
{ name: "HEADER",
stretch: go.GraphObject.Horizontal, background: "transparent", desiredSize: new go.Size(120, 50)
},
$("SubGraphExpanderButton",
{ alignment: go.Spot.TopLeft, margin: 5 }),
$(go.TextBlock,
{ alignment: go.Spot.TopLeft, editable: true, margin: 8, font: "bold 11px sans-serif", stroke: "black",
textAlign: "left"
},
new go.Binding("text", "text").makeTwoWay())
), // end Horizontal Panel
$(go.Placeholder,
{ padding: 5, alignment: go.Spot.TopLeft },
new go.Binding("background", "isHighlighted", function (h) { return h ? "white" : "transparent"; }).ofObject())
), // end Vertical Panel
$(go.Shape, "Rectangle",
{
isPanelMain: true, // the Rectangle Shape is in front of the Vertical Panel
fill: null,
stroke: "#000",
strokeWidth: 1.5
/*,resizable: false*/
})// end Rectangle Shape
); // end Group and call to add to template Map
var grouptemplmap = new go.Map("string", go.Group);
grouptemplmap.add("subprocess", subProcessGroupTemplate);
grouptemplmap.add("OfGroups", ofGroupsTemplate);
myDiagram.groupTemplateMap = grouptemplmap;