-
Notifications
You must be signed in to change notification settings - Fork 203
Feat/animate enhance #3870
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/animate enhance #3870
Conversation
| * 水平柱状图拆分策略 | ||
| * 针对水平柱状图,先更新y和height,再更新x和width | ||
| */ | ||
| export class HorizontalBarSplitStrategy implements IAnimationSplitStrategy { |
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.
按照代码规范,最好不要把两个 class 定义放在一个文件里面
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.
按照代码规范,最好不要把两个 class 定义放在一个文件里面
已修改
| .find(e => e.context.data[0]?.[DEFAULT_DATA_INDEX] < dataIndex); | ||
| if (outState.includes(state)) { | ||
| return prevMarkElement?.getNextGraphicAttributes()?.endAngle; | ||
| return prevMarkElement?.getFinalAttribute()?.endAngle; |
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.
vrender getFinalAttribute 是什么含义?只有这里需要改成这个api吗
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.
vrender
getFinalAttribute是什么含义?只有这里需要改成这个api吗
就是获取最终的属性,只要有动画,就用这个拿到encode出来的属性
| /** | ||
| * 用于保存mark对应series的fieldX | ||
| */ | ||
| _originalFieldX?: string[]; |
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.
public 属性,最好不要 以 "_"开头
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.
以修改
| if (!this._animationConfig) { | ||
| return false; | ||
| } | ||
| return Object.keys(this._animationConfig).length > 0; |
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.
这里应该会有问题,this._animationConfig 里面会有如下配置吧:
{
state: false
}
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.
没有,_animationConfig是个对象,里面结构如下
{
"appear": [
{
"duration": 300,
"easing": "cubicOut",
"type": "growHeightIn"
}
],
"update": [
{
"type": "update",
"duration": 300,
"easing": "linear"
}
],
"enter": [
{
"duration": 300,
"easing": "linear",
"type": "growHeightIn"
}
],
"exit": [
{
"duration": 300,
"easing": "linear",
"type": "growHeightOut",
"controlOptions": {
"stopWhenStateChange": true
}
}
],
"disappear": [
{
"duration": 500,
"easing": "cubicIn",
"type": "growHeightOut"
}
],
"state": {
"duration": 300,
"easing": "linear"
}
}| // 有可能又被复用了,所以这里需要判断,如果还是在exiting阶段的话才删除 | ||
| // TODO 这里如果频繁执行的话,可能会误判 | ||
| if (g.isExiting) { | ||
| this._graphicMap.delete(key); |
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.
下面这段代码有重复使用,可以抽一个函数
this._graphicMap.delete(key);
if (g.parent) {
g.parent.removeChild(g);
}
if (g.release) {
g.release();
}
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.
已抽象
| if (planner.state === 'exit') { | ||
| planner.graphics.forEach(g => { | ||
| if (g.isExiting) { | ||
| (this as any)._graphicMap.delete(g.context.uniqueKey); |
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.
下面的代码出现了三次了,可以抽象一个函数
(this as any)._graphicMap.delete(g.context.uniqueKey);
if (g.parent) {
g.parent.removeChild(g);
}
if (g.release) {
g.release();
}
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.
已修复
| ); | ||
|
|
||
| // 按顺序执行planner | ||
| this._executePlanners(planners, 0); |
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.
如果有多个 planners ,是什么时机去执行 index > 0 的planner?
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.
里面有递归的,串行调用
| const enterGraphics: IMarkGraphic[] = []; | ||
| const appearGraphics: IMarkGraphic[] = []; | ||
|
|
||
| const fieldX = (this.mark.model as any).fieldX; |
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.
model 哪里来的?
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.
接口上mark是有model的,this.mark就是图元mark
|
|
||
| // 保存原始fieldX/fieldY以供比较 | ||
| if (context.fieldX) { | ||
| context._originalFieldX = context.fieldX; |
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.
已修改
| context.fieldY = fieldY; | ||
|
|
||
| const state = defaultState ?? g.context.animationState; | ||
| switch (state) { |
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.
@xiaoluoHe 一起看看这段有必要吗
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.
其实现在。animationState 和。diffState. 就是一样的,这样反复处理,有必要吗
4813af1 to
e9bfb53
Compare
…ieldX/Y, remove defaultState params
7af479f to
b677cfa
Compare
[中文版模板 / Chinese template]
🤔 This is a ...
🔗 Related issue link
🔗 Related PR link
🐞 Bugserver case id
💡 Background and solution
📝 Changelog
☑️ Self-Check before Merge
🚀 Summary
copilot:summary
🔍 Walkthrough
copilot:walkthrough