Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add parameter support to layout function #6747

Open
wants to merge 3 commits into
base: v5
Choose a base branch
from

Conversation

zhongyunWan
Copy link

No description provided.

Copy link

Walkthrough

This pull request introduces parameter support to the layout function in the G6 library. It modifies the layout execution process by allowing layout options to be passed as parameters, enhancing flexibility in layout configurations. The changes include updates to the layout execution logic, test cases, and examples to accommodate the new parameterized approach.

Changes

Files Summary
packages/g6/src/runtime/graph.ts, packages/g6/src/runtime/layout.ts Added parameter support to layout functions, modifying the layout execution logic to accept layout options.
packages/g6/__tests__/unit/runtime/layout.spec.ts Added new test cases to verify the functionality of the layout with different options.
packages/site/examples/layout/mechanism/demo/switch.js Updated example to use the new parameterized layout function.
packages/g6/__tests__/snapshots/... Updated snapshot tests to reflect changes in layout rendering.

if (!this.options) return;
const pipeline = Array.isArray(this.options) ? this.options : [this.options];
public async postLayout(layoutOptions?: LayoutOptions) {
const executeLayoutOptions = layoutOptions ? layoutOptions : this.options;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The postLayout function now accepts layoutOptions as an optional parameter, which is a significant change. Ensure that all dependent functions and modules are compatible with this new parameter to avoid potential runtime errors.

packages/g6/__tests__/unit/runtime/layout.spec.ts Outdated Show resolved Hide resolved
packages/g6/src/runtime/graph.ts Outdated Show resolved Hide resolved
packages/g6/src/runtime/layout.ts Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants