@rxflow/manhattan
Version:
Manhattan routing algorithm for ReactFlow - generates orthogonal paths with obstacle avoidance
33 lines (32 loc) • 674 B
JavaScript
import { Point } from "../geometry";
/**
* Default configuration for Manhattan router
*/
export var defaults = {
step: 10,
maxLoopCount: 2000,
precision: 1,
maxDirectionChange: 90,
startDirections: ['top', 'right', 'bottom', 'left'],
endDirections: ['top', 'right', 'bottom', 'left'],
excludeNodes: [],
excludeShapes: [],
excludeTerminals: [],
padding: 15,
borderRadius: 5,
extensionDistance: 20,
penalties: {
0: 0,
45: 5,
90: 5
}
};
/**
* Direction map - maps direction names to unit vectors
*/
export var directionMap = {
top: new Point(0, -1),
right: new Point(1, 0),
bottom: new Point(0, 1),
left: new Point(-1, 0)
};