How to disable the automatic center in gojs diagram?

The first click on the diagram causes the automatic positioning of the page in the center of the same, how is it disabled?

Could you please provide more details about how things are initialized? Some screenshots might help too.

When i’ll create a new node in my diagram, the items always go to center again, and reorder automatically
in my case, I dont want the items go to center or reorder, i want then stayed in the same local.

In this code i create a node and the initial ContentAlignment go to the center, but i dont want this, i want the diagram stayed where they are created

I’m not sure what you want, but I think you could set Layout.isOngoing to false.

@walter, when i use Layout.isOngoing my nodes does not show in the screen

is there another alternative? in below is one part of my code

setupDiagram: function () {
            var self = this;

            if (typeof self._diagram === "string") {
                self._diagram = $gomake(
                    go.Diagram,
                    self._diagram,
                    {
                        initialContentAlignment: go.Spot.Center,
                        initialAutoScale: go.Diagram.UniformToFill,
                        maxScale: 1,
                        contentAlignment: go.Spot.Center,
                        'undoManager.isEnabled': true,

                        // Quando um nó é selecionado, desenhe um grande círculo amarelo atrás dele
                        nodeSelectionAdornmentTemplate: $gomake(
                            go.Adornment,
                            'Auto',
                            {
                                layerName: 'Grid'   // a camada predefinida que está por trás de tudo o resto
                            },
                            $gomake(
                                go.Shape,
                                'Circle',
                                {
                                    fill: 'yellow',
                                    stroke: null
                                }
                            ),
                            $gomake(
                                go.Placeholder
                            )
                        )
                        ,
                        // usar um layout personalizado, definido abaixo
                        layout: $gomake(
                            GenogramLayout,
                            {
                                direction: 90,
                                isOngoing: true,
                                layerSpacing: 10 + self.segmentLength * 2,
                                columnSpacing: 10
                            }
                        )
                    });
            }
        },

my job is to create a genogram and show family relationships, when I create a new node, it realigns everything on the page, but I don’t want that

node realigned

if you needed i can shared the code in the github with you.

I said to set that property to false, not true which is the default value.

When I set the isOngoing: false property, the first print error occurs, where it does not show the genogram nodes. I set it to true because I had to take the subsequent prints to send you, where it shows working.

1 Like

After you load a diagram the first time, you can explicitly call myDiagram.layoutDiagram(true); in order to force a layout to happen.

As long as Layout.isOngoing is false, further layouts won’t happen automatically.