Quantcast
Channel: GoJS - Northwoods Software
Viewing all articles
Browse latest Browse all 7069

Why the difference in whether LayoutCompleted is called?

$
0
0

@cfarmerga wrote:

I can't seem to duplicate this in a simple fiddle yet, so I hope it's mostly my misunderstanding of the framework.

In my real app, I want to listen to the diagram's LayoutCompleted event so I can take a thumbnail image and store it away. In general, this event seems to fire when I expect, such as when I add a new node to the diagram with myDiagram.model.addNodeData(mynode). But in my app, the LayoutCompleted event fires only when there's a link added and not simply when I add a node on its own. I want to catch an event like this whenever a node is added, regardless of its links. If I do something silly like add a bogus empty link with "myDiagram.model.addLinkData({})" at the same time I add the node, this does seem to elicit the LayoutCompleted, which is nice, though it also leaves this empty link in my linkDataArray which is not nice.

I created this fiddle (https://jsfiddle.net/cfarmerga/433abk8r/1/) with the goal of trying to replicate this effect, but here the event fires every time, regardless of whether there's also a link added. So, I'm not sure how to handle this.

Is there an obvious reason why adding nodes with no links would not cause a layout followed by a LayoutComplete event?

thanks!

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 7069

Trending Articles