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: support shape type extension #6209

Merged
merged 3 commits into from
Aug 22, 2024
Merged

feat: support shape type extension #6209

merged 3 commits into from
Aug 22, 2024

Conversation

Aarebecca
Copy link
Contributor

Now G6 support shape type extension, you can register or get by as follows:

import { register, getExtension, ExtensionCategory } from '@antv/g6';
import { Circle } from '@antv/g';

register(ExtensionCategory.Shape, 'circle', Circle);

const CircleCtor = getExtension(ExtensionCategory.Shape, 'circle');

The upsert method also support specific registered shape type instead of class.

import { Circle } from '@antv/g';

this.upsert('shape-key', Circle, { r: 10 }, container); // General

this.upsert('shape-key', 'circle', { r: 10 }, container); // ✅ Both Ok

@Aarebecca Aarebecca merged commit 1c9729b into v5 Aug 22, 2024
3 checks passed
@Aarebecca Aarebecca deleted the feat/extension-shape branch August 22, 2024 12:58
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