Skip to content

Commit

Permalink
Merge pull request #238 from reaviz/fix/Jerky-layout-switching
Browse files Browse the repository at this point in the history
Fix jerky layout switching
  • Loading branch information
amcdnl committed Apr 30, 2024
2 parents 81e0cea + 6a0e89f commit 54a753d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/layout/forceDirected.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import {
forceManyBody as d3ForceManyBody,
forceX as d3ForceX,
forceY as d3ForceY,
forceZ as d3ForceZ
forceZ as d3ForceZ,
forceCenter as d3ForceCenter
} from 'd3-force-3d';
import { forceRadial, DagMode } from './forceUtils';
import { LayoutFactoryProps, LayoutStrategy } from './types';
Expand Down Expand Up @@ -123,6 +124,7 @@ export function forceDirected({

// Create the simulation
const sim = d3ForceSimulation()
.force('center', d3ForceCenter(0, 0))
.force('link', d3ForceLink())
.force('charge', d3ForceManyBody().strength(nodeStrengthAdjustment))
.force('x', forceX)
Expand Down

0 comments on commit 54a753d

Please sign in to comment.