@rxflow/manhattan
Version:
Manhattan routing algorithm for ReactFlow - generates orthogonal paths with obstacle avoidance
39 lines (37 loc) • 879 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.directionMap = exports.defaults = void 0;
var _geometry = require("../geometry");
/**
* Default configuration for Manhattan router
*/
const defaults = exports.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
*/
const directionMap = exports.directionMap = {
top: new _geometry.Point(0, -1),
right: new _geometry.Point(1, 0),
bottom: new _geometry.Point(0, 1),
left: new _geometry.Point(-1, 0)
};