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

Edge with equal SourceConnectionPoint and TargetConnectionPoint #58

Closed
galakt opened this issue Jul 14, 2016 · 6 comments
Closed

Edge with equal SourceConnectionPoint and TargetConnectionPoint #58

galakt opened this issue Jul 14, 2016 · 6 comments

Comments

@galakt
Copy link
Contributor

galakt commented Jul 14, 2016

WPF:
GraphX.Controls.EdgeControlBase.PrepareEdgePath method

We can place items when SourceConnectionPoint of edge equals TargetConnectionPoint of edge.
https://github.com/panthernet/GraphX/blob/PCL/GraphX.Controls/Controls/EdgeControlBase.cs#L778
That cause a little bit odd behavior of edge.

I think i can add check equal condition and change point little.

1
2

@panthernet
Copy link
Owner

Hello, thanks for report. This scenarion wasn't the expected one :) I don't see much sense in assigning the same connetion point to surce and target. I'm in for not allowing to do so, will it be correct for your case?

@galakt
Copy link
Contributor Author

galakt commented Jul 15, 2016

My main goal is prevent showing alone arrow (in [0;0] point) when source and target points are equal (that can happen accidentally after manual graph generation and sometimes after dragging).
It is not cool, but now for a while i just added:

        if (p1 == p2)
        {
            p1.X = double.PositiveInfinity;
            p1.Y = double.PositiveInfinity;
            p2.X = double.PositiveInfinity;
            p2.Y = double.PositiveInfinity;
        }
        SourceConnectionPoint = p1;
        TargetConnectionPoint = p2;

@panthernet
Copy link
Owner

I've checked how it works and it looks like self looped edge. If you have an edge where source and target vertices are the same then the self looped edge indicator will be drawn in the top left corner of the vertex. On the other side the code execution should not pass to the place you'd made the fix in if it is the self looped edge we talk about. Unless you'd changed something in original logic. Originally edge can't have equal source and target connection points.

@galakt
Copy link
Contributor Author

galakt commented Jul 22, 2016

I have made sample to show what i mean:
https://github.com/galakt/GraphXSample2

@panthernet
Copy link
Owner

Thanks for the sample, unfortunately i'm quite busy right now. Can't promise much but will try to spare some time on the issue.

@panthernet
Copy link
Owner

Fixed! That was an intersting case where vertices were so close together that edge were almost zero length making rotation calc return NaN value messing up the final pointer position. Also i've implemented the EdgeControlBase::HideEdgePointerOnVertexOverlap property which allows you to hide edge pointer in such cases (default) or display them at the edge pos if set to false.

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

2 participants