如何用一个 按钮来控制画布是用自动布局还是json数据的位置信息来布局?

如何用一个按钮来控制画布开启或者关闭画布的自动布局,比如,用户手动拖动,保存用当前位置信息重新渲染画布了,可是想回到之前自动布局的状态,如何控制画布的自动布局的开启呢?…

Maybe it’s a problem with the translation of your question, but layouts just arrange the locations of the nodes and route the links connecting those nodes. Layouts are not opened and closed.

So I am guessing that you have set Diagram.layout to some Layout with Layout.isInitial set to false so that loading a model does not lose the locations assigned to the nodes via a data Binding. And now are you asking about how to force a layout to occur? If so, just call Diagram.layoutDiagram with an argument of true.

Read more about this at GoJS Layouts -- Northwoods Software