Skip to content

fix(force): prevent graph drifting out of view during layout animation by using center-of-mass pinning#21629

Open
kortschak wants to merge 1 commit into
apache:masterfrom
kortschak:center_of_mass_force
Open

fix(force): prevent graph drifting out of view during layout animation by using center-of-mass pinning#21629
kortschak wants to merge 1 commit into
apache:masterfrom
kortschak:center_of_mass_force

Conversation

@kortschak
Copy link
Copy Markdown

Brief Information

This pull request is in the type of:

  • bug fixing
  • new feature
  • others

What does this PR do?

This prevents the graph from gliding out of the view during force relaxation.

Fixed issues

Details

Before: What was the problem?

During force relaxation in the graph visualisation , the graph can drift out of the view pane.

Originally raised in https://lists.apache.org/thread/wg71hg2wl9fb9ss4qsll29b0l10w4xkh

After: How does it behave after the fixing?

The center of mass is determined prior to relaxation and the graph's center of mass position is constrained to that during relaxation. The graph no longer drifts, but will likely rotate (this is a harder problem to solve and likely not worth fixing).

Document Info

One of the following should be checked.

  • This PR doesn't relate to document changes
  • The document should be updated later
  • The document changes have been made in apache/echarts-doc#xxx

Misc

Security Checking

  • This PR uses security-sensitive Web APIs.

ZRender Changes

  • This PR depends on ZRender changes (ecomfe/zrender#xxx).

Related test cases or examples to use the new APIs

N.A.

Merging options

  • Please squash the commits into a single one when merging.

Other information

@echarts-bot
Copy link
Copy Markdown

echarts-bot Bot commented May 26, 2026

Thanks for your contribution!
The community will review it ASAP. In the meanwhile, please checkout the coding standard and Wiki about How to make a pull request.

Please DO NOT commit the files in dist, i18n, and ssr/client/dist folders in a non-release pull request. These folders are for release use only.

@kortschak kortschak marked this pull request as ready for review May 26, 2026 07:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant