Skip to content

Commit

Permalink
fix types
Browse files Browse the repository at this point in the history
  • Loading branch information
amcdnl committed Aug 8, 2023
1 parent 95cb7a2 commit 61e55c8
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/layout/layoutProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@ import { circular2d, CircularLayoutInputs } from './circular2d';
import { hierarchical, HierarchicalLayoutInputs } from './hierarchical';
import { NoOverlapLayoutInputs, nooverlap } from './nooverlap';
import { ForceAtlas2LayoutInputs, forceAtlas2 } from './forceatlas2';
import { custom, CustomLayoutInputs } from './custom';
import { custom } from './custom';

export type LayoutOverrides = Partial<
| Omit<ForceDirectedLayoutInputs, 'dimensions' | 'mode'>
| CircularLayoutInputs
| HierarchicalLayoutInputs
| CustomLayoutInputs
>;

const FORCE_LAYOUTS = [
Expand Down Expand Up @@ -121,7 +120,7 @@ export function layoutProvider({
} else if (type === 'hierarchicalLr') {
return hierarchical({ ...rest, mode: 'lr' } as HierarchicalLayoutInputs);
} else if (type === 'nooverlap') {
const { graph, maxIterations, ratio, margin, gridSize } =
const { graph, maxIterations, ratio, margin, gridSize, ...settings } =
rest as NoOverlapLayoutInputs;

return nooverlap({
Expand All @@ -130,7 +129,8 @@ export function layoutProvider({
margin: margin || 10,
maxIterations: maxIterations || 50,
ratio: ratio || 10,
gridSize: gridSize || 20
gridSize: gridSize || 20,
...settings
});
} else if (type === 'forceatlas2') {
const { graph, iterations, gravity, scalingRatio, ...settings } =
Expand All @@ -148,7 +148,7 @@ export function layoutProvider({
return custom({
type: 'custom',
...rest
} as CustomLayoutInputs);
} as LayoutFactoryProps);
}

throw new Error(`Layout ${type} not found.`);
Expand Down

0 comments on commit 61e55c8

Please sign in to comment.