Strange 'jump' in animation on calling model.addNodeData when using groups

I am developing a business process animation. It works great except when I use groups, then I get a reformatting ‘jump’ whenever I add a token to the animation.

Example:

https://clients.areaweb.cl/.pub/localjson-group-anim.html

the code that adds the token is at line 283:

function add_token(tick) {
                const found = anims.filter(x => x.start === tick);
                found.forEach(token => {
                    token.increment = 1 / (token.end - token.start);
                    token.category = 'token';
                    token.frac = 0;
                    token.isLayoutPositioned = false;

                    diagram.model.addNodeData(token);
                })
            }

If I disable the call to addNodeData, there are no jumps, but also no animation.

It seems like the node additions are triggering layouts in your Groups, which are causing this behavior.

One simple way to fix this would be to remove LayoutAdded from the list of layout conditions, so that adding a part does not cause a relayout. Or else you must change the layout so that it does not do this undesired behavior as you are adding parts.

I tested changing the layout conditions by writing:

diagram.nodeTemplateMap.get('token').layoutConditions = go.Part.LayoutStandard & ~go.Part.LayoutAdded;

And it seemed to fix it.

That did it, thanks for the quick and effective response.