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

Fix port and edge coloring/styling #4

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

LacombeJ
Copy link

@LacombeJ LacombeJ commented Dec 1, 2023

These changes add port coloring and edge gradients. Port visibility is updated to use opacity instead of background color. Also edge width is set to a float instead of an int

Issue: #3

Copy link
Contributor

@Doppelkeks Doppelkeks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you very much for this pull request and please excuse the late reply, I added two comments and will await your reply/ discuss a little bit further. Not far away from being ready to merge though.

public virtual Color DisabledPortColor { get; } = s_DefaultDisabledColor;
public virtual Color DisabledPortColor {
get {
Color color = PortColor * 0.3f;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we avoid this magic number (0.3f) here somehow? :)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it could be some constant?

private const float k_DisabledColorMultiplier = 0.3f;

@@ -11,8 +11,8 @@ public class Edge : BaseEdge {
private const float k_InterceptWidth = 6.0f;
private const float k_EdgeLengthFromPort = 12.0f;
private const float k_EdgeTurnDiameter = 20.0f;
private const int k_DefaultEdgeWidth = 2;
private const int k_DefaultEdgeWidthSelected = 2;
private const float k_DefaultEdgeWidth = 2;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i guess float gives us a more granular way to define line thickness? This is a breaking change for our NewGraph framework. But if you clarify the importance of this I can think of making the aprropiate changes.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's exactly that, float adds a larger range of possible line thickness. Which is pretty important when working with values that, imo, should probably be between 1 and 3. And 1 seems too small and 3 seems too large.

The constants above could stay int since they are local/private. I just assumed it was a mistake/oversight so I changed those as well. The important change is with EdgeWidthUnselected and EdgeWithSelected. For example, I do the following:

public override float EdgeWidthUnselected { get; } = 1.5f;
public override float EdgeWidthSelected { get; } = 2.0f;

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.

2 participants