How to change the space of each nodes in a palette

After my palette is initialized, I hope that each node is only 1 PX apart. How can I do that?
我的调色板初始化之后,我希望是每个节点只有 1px 的间距,这该如何实现呢?

I found that the palette seems to have default spacing, and I don’t know how to modify this value. Does the property not support modification?
我发现调色板似乎有默认的间距,而且不知道如何修改这个值,难道属性不支持修改?

I tried to set properties(nodeSpacing or layerSpacing) but it didn’t work.
我试着去设置属性但是不起作用,why?

// this is my code which does not meeting my expectations.

Modifying the Palette’s layout is the correct action. But the Palette by default has a Diagram.layout that is an instance of GridLayout, which I would think would be more appropriate and more efficient than a TreeLayout.

So all you would need to do is:

    let myPalette = G(go.Palette, div,
      {
        "layout.spacing": new go.Size(1, 1),
        maxSelectionCount: 1,
        allowHorizontalScroll: false,
        allowVerticalScroll: false,
        model: new go.GraphLinksModel(operators)
      });
1 Like

thank you very much, it works after I modify my code as you apply!
I have another problem:

When I select a node in Palette, a blue border appears around the node. How can I modify the style of the border or delete the border?

https://gojs.net/latest/intro/selection.html#SelectionAdornments

Thank you!According to your prompt, I have finished it smoothly.