Skip to content

Commit

Permalink
feat(routers.RightAngle): add useVertices option
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinKanera committed Jun 26, 2023
1 parent 4b35669 commit bba9e38
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/routers/rightAngle.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -684,6 +684,7 @@ function routeBetweenPoints(source, target, margin) {
function rightAngleRouter(vertices, opt, linkView) {
const { sourceDirection = Directions.AUTO, targetDirection = Directions.AUTO } = opt;
const margin = opt.margin || 20;
const useVertices = opt.useVertices || false;

const isSourcePort = !!linkView.model.source().port;
const sourcePoint = pointDataFromAnchor(linkView.sourceView, linkView.sourceAnchor, linkView.sourceBBox, sourceDirection, isSourcePort, linkView.sourceAnchor);
Expand All @@ -694,6 +695,10 @@ function rightAngleRouter(vertices, opt, linkView) {
let resultVertices = [];
let source = sourcePoint;

if (!useVertices) {
return routeBetweenPoints(sourcePoint, targetPoint, margin);
}

for (let i = 0; i < vertices.length; i++) {
const current = vertices[i];

Expand Down
1 change: 1 addition & 0 deletions types/joint.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3529,6 +3529,7 @@ export namespace routers {

interface RightAngleRouterArguments {
margin?: number;
useVertices?: boolean;
sourceDirection?: RightAngleDirections;
targetDirection?: RightAngleDirections;
}
Expand Down

0 comments on commit bba9e38

Please sign in to comment.