Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Undo will lose all group view ! #210

Open
bbsuuo opened this issue Feb 25, 2022 · 3 comments
Open

Undo will lose all group view ! #210

bbsuuo opened this issue Feb 25, 2022 · 3 comments

Comments

@bbsuuo
Copy link

bbsuuo commented Feb 25, 2022

when undo , it's will reload graph view, and it's will remove all elements

remove element will call GraphViewChangedCallback function

and when remove element, group view will check this node on group , and remove from base graph data

it's will lose all group view ,this kind of incorrect call can lead to many potential problems later

@bbsuuo
Copy link
Author

bbsuuo commented Feb 25, 2022

I just changed the order of the clear group view ()

the order of calls should clear the group first

and i remove graphViewChanged before reload and add later

some callback chain messed up , i try to code refactoring , and the code and ideas are valuable

@DeJhon-Huang
Copy link

I also want to know how to solve it in the end?

@shda
Copy link

shda commented May 13, 2024

When call undo, innerNodeGUIDs are removed from the group, I solved this problem like this

in the BaseGraphView.ReloadView method:

void ReloadView()
{
	...
	var innerNodeGUIDs = graph.groups.Select(graphGroup => graphGroup.innerNodeGUIDs.ToList()).ToList();

	// Remove everything
	RemoveNodeViews();

	for (var i = 0; i < innerNodeGUIDs.Count; i++)
	{
		var innerNodeGuid = innerNodeGUIDs[i];
		graph.groups[i].innerNodeGUIDs = innerNodeGuid;
	}
	...
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants