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

WPF Subgraph Label #313

Merged
merged 11 commits into from May 19, 2022
Merged

WPF Subgraph Label #313

merged 11 commits into from May 19, 2022

Conversation

Brains
Copy link
Contributor

@Brains Brains commented May 18, 2022

Implementation for #128, #276

Just enabled TextBlock creation for Subgraph. Only at Top position for now (better than nothing).
Then fixed some overlapping issues

@ghost
Copy link

ghost commented May 18, 2022

CLA assistant check
All CLA requirements met.

@Brains
Copy link
Contributor Author

Brains commented May 18, 2022

Currently, WpfApplicationSample looks so right after the launch
image

No margins around subgraph labels, but dragging elements or collapse/expand fixes that instantly
image

@Brains
Copy link
Contributor Author

Brains commented May 18, 2022

The last commit fixes no margins issues

The only problem is the edge from 58 to Inner subgraph. But noticed it is buggy in other cases as well, like dragging Inner subgraph. Anyway, dragging 58 node corrects this.

image

@Brains Brains marked this pull request as ready for review May 18, 2022 19:56
@Brains
Copy link
Contributor Author

Brains commented May 18, 2022

Collapsed Outer Subgraph
image

But when collapsing Inner it crashes. However, same crash happens on master, guess not related to this PR.
image

AutomaticGraphLayout.dll!Microsoft.Msagl.Routing.ShapeCreator.GetShapesOnDict(System.Collections.Generic.Dictionary<Microsoft.Msagl.Core.Layout.Node, Microsoft.Msagl.Routing.Shape> nodesToShapes, Microsoft.Msagl.Core.Layout.Cluster c) Line 51	C#
AutomaticGraphLayout.dll!Microsoft.Msagl.Routing.ShapeCreator.GetShapes(Microsoft.Msagl.Core.Layout.GeometryGraph graph) Line 31	C#
AutomaticGraphLayout.dll!Microsoft.Msagl.Routing.SplineRouter.SplineRouter(Microsoft.Msagl.Core.Layout.GeometryGraph graph, System.Collections.Generic.IEnumerable<Microsoft.Msagl.Core.Layout.Edge> edges, double tightPadding, double loosePadding, double coneAngle, Microsoft.Msagl.Core.Routing.BundlingSettings bundlingSettings) Line 128	C#
AutomaticGraphLayout.dll!Microsoft.Msagl.Miscellaneous.LayoutHelpers.RouteAndLabelEdges(Microsoft.Msagl.Core.Layout.GeometryGraph geometryGraph, Microsoft.Msagl.Core.Layout.LayoutAlgorithmSettings layoutSettings, System.Collections.Generic.IEnumerable<Microsoft.Msagl.Core.Layout.Edge> edgesToRoute, int straighLineRoutingThreshold, Microsoft.Msagl.Core.CancelToken cancelToken) Line 205	C#
AutomaticGraphLayout.dll!Microsoft.Msagl.Layout.Initial.Relayout.RunInternal() Line 89	C#
AutomaticGraphLayout.dll!Microsoft.Msagl.Core.AlgorithmBase.Run() Line 17	C#
AutomaticGraphLayout.Drawing.dll!Microsoft.Msagl.Drawing.LayoutEditor.CollapseCluster(Microsoft.Msagl.Core.Layout.Cluster cluster) Line 372	C#
AutomaticGraphLayout.Drawing.dll!Microsoft.Msagl.Drawing.LayoutEditor.RelayoutOnIsCollapsedChanged(Microsoft.Msagl.Drawing.IViewerNode iCluster) Line 306	C#
Microsoft.Msagl.WpfGraphControl.dll!Microsoft.Msagl.WpfGraphControl.VNode.InvokeIsCollapsedChanged() Line 172	C#
Microsoft.Msagl.WpfGraphControl.dll!Microsoft.Msagl.WpfGraphControl.VNode.TopMarginRectMouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e) Line 184	C#

Configure RectangularClusterBoundary
@Brains
Copy link
Contributor Author

Brains commented May 18, 2022

Now label position depends on LgNodeInfo.LabelPlacement.

  • Same problem with the edge from 58
  • Problem with top margin as well
  • Collapse button overlapped if Subgraph is collapsed

image

@levnach
Copy link
Contributor

levnach commented May 18, 2022

@Brains, thank to working on it.
The crash in GetShapesOnDict can be fixed as follows:
foreach (var cc in c.Clusters) { if (cc.IsCollapsed) continue; GetShapesOnDict(nodesToShapes, cc); cShape.AddChild(nodesToShapes[cc]); }
But then the problems, further crashes, persist in master. I will try to work on it later. I think the pull request needs to be merged after the crashes are fixed and the edge routing works correctly.

@Brains
Copy link
Contributor Author

Brains commented May 19, 2022

the edge routing works correctly.

image

Fixed
image

@Brains
Copy link
Contributor Author

Brains commented May 19, 2022

I think the pull request needs to be merged after the crashes are fixed and the edge routing works correctly.

Fixed edge routing
Fixed overlap of CollapseButton in collapsed state and few minor things
Seems like all issues related to this PR were resolved

But the crash really has no connection to my PR, it was there before on master. I tried to figure out why it happened but stuck completely, too complex, really no idea. Consider the PR and the crash separately please, they are not related to each other.

@levnach levnach merged commit 6c6e9df into microsoft:master May 19, 2022
@levnach
Copy link
Contributor

levnach commented May 19, 2022

Thanks for the change! I will try to fix the routing bugs.

@Brains
Copy link
Contributor Author

Brains commented May 19, 2022

Thank you for doing this cool project

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

Successfully merging this pull request may close these issues.

None yet

2 participants