1234567891011121314151617181920212223242526272829303132333435 |
- import {
- getMid
- } from './LayoutUtil';
- /**
- * A base connection layouter implementation
- * that layouts the connection by directly connecting
- * mid(source) + mid(target).
- */
- export default function BaseLayouter() {}
- /**
- * Return the new layouted waypoints for the given connection.
- *
- * The connection passed is still unchanged; you may figure out about
- * the new connection start / end via the layout hints provided.
- *
- * @param {djs.model.Connection} connection
- * @param {Object} [hints]
- * @param {Point} [hints.connectionStart]
- * @param {Point} [hints.connectionEnd]
- *
- * @return {Array<Point>} the layouted connection waypoints
- */
- BaseLayouter.prototype.layoutConnection = function(connection, hints) {
- hints = hints || {};
- return [
- hints.connectionStart || getMid(connection.source),
- hints.connectionEnd || getMid(connection.target)
- ];
- };
|