diff --git a/common/changes/@visactor/vgrammar-core/fix-morphing-animation_2024-08-29-11-16.json b/common/changes/@visactor/vgrammar-core/fix-morphing-animation_2024-08-29-11-16.json new file mode 100644 index 00000000..e04693f7 --- /dev/null +++ b/common/changes/@visactor/vgrammar-core/fix-morphing-animation_2024-08-29-11-16.json @@ -0,0 +1,11 @@ +{ + "changes": [ + { + "comment": "fix: fix error of no animation when direction change\n\n", + "type": "none", + "packageName": "@visactor/vgrammar-core" + } + ], + "packageName": "@visactor/vgrammar-core", + "email": "dingling112@gmail.com" +} \ No newline at end of file diff --git a/packages/vgrammar-core/src/view/View.ts b/packages/vgrammar-core/src/view/View.ts index 24b07a2b..de396111 100644 --- a/packages/vgrammar-core/src/view/View.ts +++ b/packages/vgrammar-core/src/view/View.ts @@ -923,13 +923,13 @@ export default class View extends EventEmitter implements IView { diff.prev.length === 1 && diff.next.length === 1 && diff.prev[0].markType === diff.next[0].markType; const enableMarkMorphConfig = diff.prev.every(mark => mark.getMorphConfig().morph) && diff.next.every(mark => mark.getMorphConfig().morph); - if (matched && runningConfig.reuse) { + if ((runningConfig.morph && enableMarkMorphConfig) || runningConfig.morphAll) { + (this as any).addMorphMarks?.({ prev: diff.prev, next: diff.next }); + } else if (matched && runningConfig.reuse) { diff.next[0].reuse(diff.prev[0]); diff.prev[0].detachAll(); diff.prev[0].clear(); this._cachedGrammars.unrecord(diff.prev[0]); - } else if ((runningConfig.morph && enableMarkMorphConfig) || runningConfig.morphAll) { - (this as any).addMorphMarks?.({ prev: diff.prev, next: diff.next }); } }); }