-
Notifications
You must be signed in to change notification settings - Fork 11
Description
Feature request
It would be great to have JunctionRef and its related APIs exposed in the JavaScript bindings. The underlying C++ libavoid library supports junctions for hyperedge routing, but they are currently not accessible from JS.
Motivation
When multiple connectors originate from the same connection pin, libavoid routes them as independent parallel paths. Because they share the same pin, the resulting routes overlap or run side-by-side right from the source, making it visually
unclear that they are even connected to that port.
A "merge links" feature (similar to what ELK/ELKJS provides) would solve this: links sharing a common port first travel along a single shared trunk segment, then branch off at a junction point toward their individual targets. This is the
standard tree/bus-style routing used in circuit diagrams, network topologies, and data-flow editors.
JunctionRef is the natural libavoid primitive for this — multiple ConnRefs connect to a JunctionRef branching point, and the router handles the shared-path optimization.
The C++ API docs:
https://www.adaptagrams.org/documentation/classAvoid_1_1JunctionRef.html
An example diagram with junction points:

Requested APIs
The following would need embind bindings:
JunctionRef— constructor(router, point, id?),position(),setPositionFixed(),recommendedPosition()ConnEnd.createConnEndFromJunctionRef(junctionRef, classId)— to connect aConnRefto a junctionRouter.deleteJunction(junctionRef)— cleanupShapeConnectionPin(junctionRef, classId, visDirs?)— junction pin constructor overload (may already work ifShapeConnectionPinaccepts junctions)
Note
The routing options for junction optimization are also already exported:
improveHyperedgeRoutesMovingJunctionsimproveHyperedgeRoutesMovingAddingAndDeletingJunctions
But without JunctionRef itself exposed, these options have no effect.
Also JunctionRef is already declared in the TypeScript typings (typings/libavoid.d.ts).