Shape drop from Palette to TreeLayout Diagram

Hi there, Walter – quick question on overriding the default/initial positioning of a node/shape that was drag/dropped from the palette to a TreeLayout diagram.

I would prefer that, instead of snapping to area below the bottom of the tree, the initial drop of the shape (from the palette) stays right where you initially dropped it.

How would I accomplish that, while retaining the overall layout rules associated with a TreeLayout?

Thanks!

My guess is that you have a Diagram.layout which is a TreeLayout. That TreeLayout is invalidated every time that you add or remove a node or a link, so that the layout is performed again at the end of the transaction.

I suggest that you set the Part.layoutConditions property in your Node template:
{ layoutConditions: go.Part.LayoutStandard & ~go.Part.LayoutAdded }
Read about the property in the documentation: http://gojs.net/latest/api/symbols/Part.html
You might want to use somewhat different layoutConditions flags, depending on the behaviors that you want.

1 Like