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 config support to layout function #6762

Merged
merged 2 commits into from
Feb 10, 2025

Conversation

zhongyunWan
Copy link
Contributor

@zhongyunWan zhongyunWan commented Feb 10, 2025

Allow users to configure the layoutOptions parameter when calling the layout function to perform the layout, and this layout will not modify the default configuration.

Copy link

Walkthrough

This pull request introduces parameter configuration support to the layout function in the G6 library. It modifies the layout execution to accept optional layout options, enhancing flexibility in layout customization. Additionally, it updates tests and examples to reflect these changes.

Changes

Files Summary
packages/g6/__tests__/snapshots/runtime/layout/*.svg Added new snapshot files for different layout configurations.
packages/g6/__tests__/unit/runtime/layout.spec.ts Introduced unit tests for various layout options including empty, extra, other types, and array options.
packages/g6/src/runtime/graph.ts Modified the layout method to accept optional LayoutOptions.
packages/g6/src/runtime/layout.ts Updated postLayout method to handle optional LayoutOptions.
packages/site/examples/layout/mechanism/demo/switch.js Adjusted example to use the new layout options parameter.

* @apiCategory layout
*/
public async layout() {
await this.context.layout!.postLayout();
public async layout(layoutOptions?: LayoutOptions) {

Choose a reason for hiding this comment

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

The change in the layout method signature to accept layoutOptions is a critical update. Ensure that all calls to this method across the codebase are updated to handle this optional parameter to avoid potential runtime errors.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

okk

@hustcc
Copy link
Member

hustcc commented Feb 10, 2025

有关联的 issue 吗?

@zhongyunWan
Copy link
Contributor Author

有关联的 issue 吗?

这个目前没有对应 issue,是 25 年规划里的一项,这个需要提个 issue 绑定上不

@Aarebecca Aarebecca merged commit a82674b into antvis:v5 Feb 10, 2025
2 checks passed
@hustcc
Copy link
Member

hustcc commented Feb 10, 2025

这个目前没有对应 issue,是 25 年规划里的一项,这个需要提个 issue 绑定上不

如果就关联一下,没有就不需要了。

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.

None yet

3 participants