Expand macros where they are dropped

We are using a code similar to the macros sample, where we dnd a group from the toolbox to the diagram and expand them by ungrouping them.
We need to keep the expanded nodes layout, just as they were inside the group, and also we need them to be expanded on the spot, aka where they were dropped.
In reality they lose the layout and location, and move automatically to the initial spot of the diagram (center in our case).

How can we keep the layout and force expansion on the drop location?

10x

P.S
A similar issue can be viewed on the origial the macros sample (http://gojs.net/latest/samples/macros.html).

Sorry, that’s actually a bug, it was working fine in older releases such as 1.5.9: http://gojs.net/latest/samples/macros.html

It will be fixed in 1.5.11, which should be out within a week, about. We’ll let you know when it is released.

As per your answer, we downgraded the js to 1.5.9 and it still does not work in our system, though we do see it working in the 1.5.9 samples.
Any ideas why?

I’m not sure, but the answer must lie in the differences between the sample app and your app so far. What’s changed?

Would you mind trying the 1.5.11 Beta release of GoJS that’s up at:

http://gojs.net/beta/
http://gojs.net/beta/release/go-debug.js

Tried it and it still animates the items to the center after drop. All other, non-group items stay where they should when dropped from toolbox.

Do you have a Diagram.layout? If so, have you set Diagram.isInitial to false and Diagram.isOngoing to false, so that the only way a layout happens is by calling Diagram.layoutDiagram(true) or some other code?

Does your Group have a Group.layout? If so, what are its isInitial and isOngoing property values?

FYI, 1.5.11 is now the “latest” release.

Hi Walter,

I am working with Dani on the same project.
Setting the isOngoing and isInitial did not help.
I’ve cut from our project the code and you can see it working at: [http://codepen.io/anon/pen/xwJWwj][1]
When you drag Macro 1 the nodes are expected to be laid out differently than they are now, in the center of the diagram.

This is working with the latest version but still, we are seeing the same problem.

Thanks,
Oren
[1]: http://codepen.io/anon/pen/xwJWwj

So are you saying that the member Nodes of the Group have well defined locations in the Palette as determined by some location property on the node data in the Palette.model, and that those locations are lost when the Group is ungrouped after it is dropped?

yes, exactly, And not in the point on the diagram I dropped the group.

Hi Walter,

New information: I found that if I use the same nodeTemplateMap for the diagram and palette the drag and drop is working as it should.

Thanks,
Oren

I just tried modifying the http://gojs.net/latest/samples/macros.html sample so that the Palette did not use any of the templates that the main Diagram did. In fact, the Palette just used the default templates.

Although the appearance of the items in the Palette were appropriately different, the behavior in the main Diagram remained the same.