-
Notifications
You must be signed in to change notification settings - Fork 1.6k
feat: title plugin #7294
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: title plugin #7294
Conversation
c766f64 to
7796cf1
Compare
| } | ||
|
|
||
| return [title, subTitle]; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个写法不太符合 G component 的写法。G component 有点类似于 React。
伪代码如下:
class TitleComponent extends CustomElement<T> {
constructor(config: DisplayObjectConfig<T>) {
super(config);
}
connectedCallback() {
}
public update(cfg = {}) {
this.attr(deepMix({}, this.attributes, cfg));
}
render(attributes, container) {
this.add(titleLabel);
this.add(subtitleLabel);
}
};There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
下一个 pr 写到 component 中。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1
| } | ||
|
|
||
| export class Title extends BasePlugin<TitleOptions> { | ||
| private static commonStyle: Partial<LabelStyleProps> = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个定义到外部常量就可以了,避免在类上挂载无关的变量和方法
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
改了
| Used to configure the horizontal alignment of the title plugin. Default is `left`. You can choose `left`, `center`, or `right`, representing left-aligned, center-aligned, and right-aligned respectively. | ||
|
|
||
| ```js | ob { pin: false } | ||
| createGraph( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个demo代码写法可以不用使用 createGraph 了,参考一下内置圆形节点效果写法
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
5b53b76 to
5f96bca
Compare

Uh oh!
There was an error while loading. Please reload this page.