第一次初始化gojs,在使用了自动布局(go.LayeredDigraphLayout)之后样式错乱。

第一次初始化gojs,使用了自动布局(go.LayeredDigraphLayout)如下图:


导致样式错乱,大小不对。如下图:

在第二次之后的每次调用,就恢复了正常。也就是说只有第一次才会异常。如何解决?

Maybe because the images haven’t loaded yet at the time the initial layout is done? Normally, as Pictures get their images loaded, the nodes will change size, causing the layout to be invalidated and then performed again.

I suggest that you set the Picture.desiredSize (or width and height) in your template(s).