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

How do I modify the layout of only 1 node?

$
0
0

@rsshilli wrote:

I have the layout on the left and I’m trying to create the layout on the right:

The only difference is that the first node (Process) needs to have a custom layout (the alternating layout, not the regular one). Can I customize the layout somehow for just that first root node?

Here’s how I’m initializing my diagram:

    this._diagram = GO(go.Diagram, div, {
      layout: GO(go.TreeLayout, {
        alignment: go.TreeLayout.AlignmentStart,
        layerSpacing: 60,
        layerSpacingParentOverlap: 0,
        nodeIndent: 0,
        nodeIndentPastParent: 0,
        portSpot: go.Spot.Default,

        // This is what makes the alternating node links appear correctly
        treeStyle: go.TreeLayout.StyleAlternating,
        alternateAlignment: go.TreeLayout.AlignmentStart,
        alternateLayerSpacing: 40, // Left/right spacing
        alternateLayerSpacingParentOverlap: 1.0,
        alternateNodeIndent: 5,
        alternateNodeIndentPastParent: 1.0,
        alternateNodeSpacing: 20, // Up/down spacing
        alternatePortSpot: new go.Spot(0.001, 1, 15, 0),

        // Make sure the nodes are in order
        sorting: go.TreeLayout.SortingAscending,
        comparer: (v1, v2) => (v1.node.data.order - v2.node.data.order),
      }),
      "undoManager.isEnabled": true,
      "draggingTool.dragsTree": true,
      padding: GO(go.Margin, go.Margin.parse("50, 20, 50, 20")),
    });

Any ideas?

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 7069

Trending Articles