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

Aperta
#4,826 3 commenti 4 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
45/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Tranquilla
Stack tecnologico
javascript
Ambito
design

Direzione di ricerca

Start by reading the orthogonalEdgeStyle and elbowEdgeStyle routing logic and how line style properties are defined and applied; the issue does not name specific files or tests. Work out how automatic routing can align to the grid even when connector endpoints are off-grid, while preserving automatic adjustment when shapes move. Done means an optional per-line property produces grid-aligned automatic routing without requiring waypoints.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

enhancement
  • 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.

Lingua principale
JavaScript
Stelle
9.4k
Fork
1.4k
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di jgraph/drawio

Tutte le issue di jgraph/drawio

Issue simili

Altre issue su JavaScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.