@selenite/graph-editor
Version:
A graph editor for visual programming, based on rete and svelte.
16 lines (15 loc) • 579 B
JavaScript
import { ErrorWNotif } from '../global/todo.svelte';
import { curveBasis, curveStep, curveLinear, curveMonotoneX } from 'd3-shape';
export const connectionPathTypes = ['curve', 'monotone', 'linear', 'step'];
export const defaultConnectionPath = 'curve';
export function assignConnectionPath(type) {
if (!connectionPathTypes.includes(type))
throw new ErrorWNotif(`Unknown connection path type: ${type}`);
const map = {
curve: curveBasis,
step: curveStep,
linear: curveLinear,
monotone: curveMonotoneX
};
return map[type];
}