Hi, everybody. I have a problem since I have several nodes within a group (which has a placeholder). The thing is that the nodes can be dragged out of the group in any direction except the top of the group. If I try to do this, the whole group is dragged. I don’t know if the placeholder is interfering. Thanks in advance.
What properties have you set on the Group? If you have customized the DraggingTool, how have you done so?
I established these properties to the group. I haven’t customized any DraggingTool.
this.dia.groupTemplateMap.add("OfGroups",
$(go.Group, "Auto",
{
mouseDrop: finishDrop,
handlesDragDropForMembers: true,
memberValidation: samePrefix,
mouseDragEnter: function(e, grp, prev) { highlightGroup(e, grp, true); },
mouseDragLeave: function(e, grp, next) {
highlightGroup(e, grp, false);
},
memberAdded: updateGroupCount,
memberRemoved: updateGroupCount,
movable: false,
groupable: false,
copyable: false,
layout:
$(go.GridLayout,
{
wrappingWidth: 1, alignment: go.GridLayout.Position,
cellSize: new go.Size(1, 1), spacing: new go.Size(4, 4)
})
},
new go.Binding("background", "isHighlighted", function(h) { return h ? "rgba(255,0,0,0.2)" : "transparent"; }).ofObject(),
$(go.Shape, "RoundedRectangle",
new go.Binding("fill", "background"),
{ stroke: "#E2E2EA", strokeWidth: 1, parameter1: 15}),
$(go.Panel, "Vertical",
$(go.Panel, "Horizontal",
new go.Binding("width", "width"),
new go.Binding("height", "height"),
$(go.TextBlock,
{
alignment: go.Spot.Top,
editable: false,
margin: 12,
font: "bold 18px sans-serif",
opacity: 0.75,
},
new go.Binding("stroke", "stroke"),
new go.Binding("text", "text").makeTwoWay())
),
$(go.Placeholder,
{padding: 5, alignment: go.Spot.TopLeft }),
), // end Vertical Panel
$(go.Panel, "Auto",
{ alignment: new go.Spot(1, 0) },
$(go.Shape, "Circle", { fill: "#FFFFFF"}),
$(go.TextBlock, { name: "COUNT" })
),
));
If you haven’t set Group | GoJS API to true, I do not see how the user can drag out a member node in any direction, not just upwards.
That’s works, it was missing to give true to that property. Thanks.