in src/state/layout/layoutReducer.ts [52:73]
export default function layoutReducer<NodeType, EdgeType>(
state: DiagramMakerData<NodeType, EdgeType> | undefined,
action: DiagramMakerAction<NodeType, EdgeType>
): DiagramMakerData<NodeType, EdgeType> {
if (!state) {
return getInitialState();
}
switch (action.type) {
case LayoutActionsType.LAYOUT:
switch (action.payload.layoutType) {
case LayoutType.HIERARCHICAL:
return adjustWorkspace(hierarchicalLayout(state, action.payload));
case LayoutType.WORKFLOW:
return adjustWorkspace(workflowLayout(state, action.payload));
default:
return state;
}
default:
return state;
}
}