Quantcast
Channel: GoJS - Northwoods Software
Viewing all articles
Browse latest Browse all 7069

Issue when adding Node to a Group (Group comes back to foreground)

$
0
0

@jjohnsonocs wrote:

I have went through all the samples and I just can't figure this out.

I have got Groups working and I have Nodes working. When I drag a node onto a Group the data shows the node is grouped with my group, but no matter what I do the Group always comes to the foreground and the Node is hidden visually.

Any suggestions would be helpful.

var finishDrop = function(e, grp) {
  var ok = (grp !== null
            ? grp.addMembers(grp.diagram.selection, true)
            : e.diagram.commandHandler.addTopLevelParts(e.diagram.selection, true));
  if (!ok) e.diagram.currentTool.doCancel();
};

var highlightGroup = function(e, grp, show) {
  if (!grp) return;
  e.handled = true;
  if (show) {
    var tool = grp.diagram.toolManager.draggingTool;
    var map = tool.draggedParts || tool.copiedParts;  // this is a Map
    if (grp.canAddMembers(map.toKeySet())) {
      grp.isHighlighted = true;
      return;
    }
  }
  grp.isHighlighted = false;
};

this.goDiagram.groupTemplate =
    this.goJs(go.Group, "Auto", {
          	background: "transparent",
          	mouseDragEnter: function(e, grp, prev) {
            	highlightGroup(e, grp, true);
          	},
          	mouseDragLeave: function(e, grp, next) {
            	highlightGroup(e, grp, false);
          	},
          	computesBoundsAfterDrag: true,
          	mouseDrop: finishDrop,
          	handlesDragDropForMembers: true,
  			locationSpot: go.Spot.Center,
            locationObjectName: "PH",
            resizable: true,
            resizeObjectName: "PH",
            locationSpot: go.Spot.Center,
            isSubGraphExpanded: false
        },
        new go.Binding("itemArray", "boundaryEventArray"),
        new go.Binding("location", "loc", go.Point.parse).makeTwoWay(go.Point.stringify),
      	this.goJs(go.Panel, "Auto",
        this.goJs(go.Shape, "RoundedRectangle",
            {
              	name: "PH",
 // 			  fill: SubprocessNodeFill,
  			  	fill: "transparent",
              	stroke: SubprocessNodeStroke,
              	minSize: new go.Size(ActivityNodeWidth, ActivityNodeHeight),
              	portId: "",
  				fromLinkable: true,
  				toLinkable: true,
  				cursor: "pointer",
              	fromSpot: go.Spot.RightSide,
  				toSpot: go.Spot.LeftSide
            },
            new go.Binding("desiredSize", "size", go.Size.parse).makeTwoWay(go.Size.stringify),
            new go.Binding("strokeWidth", "isCall", function(s) { return s ? ActivityNodeStrokeWidthIsCall : ActivityNodeStrokeWidth; })
           ),
          this.goJs(go.Panel, "Vertical",
            { defaultAlignment: go.Spot.Left },
            this.goJs(go.TextBlock,
              { margin: 3, editable: true },
              new go.Binding("text", "text").makeTwoWay(),
              new go.Binding("alignment", "isSubGraphExpanded", function(s) { return s ? go.Spot.TopLeft : go.Spot.Center; })),
            this.goJs(go.Placeholder,
              { padding: new go.Margin(5, 5) })
          )
        )


    );

TIA

Jeff

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 7069

Trending Articles