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

Add property to snap automatic routing of orthogonal connectors/lines to grid #4826

Open
2 tasks done
ErikSwan opened this issue Jan 2, 2025 · 0 comments
Open
2 tasks done

Comments

@ErikSwan
Copy link

ErikSwan commented Jan 2, 2025

  • I agree to follow the Code of Conduct that this project adheres to.
  • I have searched the issue tracker for a feature request that matches the one I want to file, without success.

Is your feature request related to a problem? Please describe.
I usually try to align my diagrams to the grid to maintain consistent visual spacing, and I very often use orthogonal connector/line styles.

I prefer to leave the default orthogonal routing alone if I am happy with it (in other words, avoiding manually dragging the edges/placing waypoints) to avoid the need to manually re-adjust the line positioning/placement of the connectors if I move the connected shapes.

However, the default routing of orthogonal connectors seems to place the middle perpendicular segment exactly halfway between the ends of the connector, so it is not aligned to the grid if the spacing between the connected shapes is not an even multiple of the grid spacing.

I would like a way to force the automatic routing to align to the grid, without having to manually place a waypoint.

As an example, here is what the current automatic routing looks like (note that the vertical segment is slightly offset from the grid):

image

I would like it to look like this (snapped/aligned to the grid):

image

This would help maintain consistent visual spacing with densely packed routing/diagrams like circuit diagrams (annotations added to show areas that would look more visually pleasing if all the routing was aligned to the grid):

image

Describe the solution you'd like
I would like an additional style property (perhaps "Snap Routing to Grid"?) that can be set on lines that would force the automatic routing (i.e., how they are routed without any manually placed waypoints) of orthogonal connectors (edgeStyle of orthogonalEdgeStyle or elbowEdgeStyle) to snap to the defined grid.

This would be sort of similar to how the "Autosize Grid" property of shapes works (the shape width and height are rounded to multiples of the grid size when autosizing), although unlike "Autosize Grid" the implementation of this new property should align the routing to the underlying grid even if the connector end points aren't aligned to the grid.

Describe alternatives you've considered
An option that is global to the diagram may work, but it would be much more flexible to implement this as an additional style property that can be enabled or disabled on individual lines as needed.

As mentioned above, it's possible to manually align the line to the grid by dragging the line to create a waypoint, but then the routing will no longer automatically adjust when the connecting shapes are moved.

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

1 participant