Skip to content

Commit

Permalink
Merge pull request #526 from VisActor/fix/morphing-animation
Browse files Browse the repository at this point in the history
Fix/morphing animation
  • Loading branch information
xile611 authored Aug 30, 2024
2 parents 892e31b + 4e68bac commit 6d2966a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -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"
}
6 changes: 3 additions & 3 deletions packages/vgrammar-core/src/view/View.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
}
});
}
Expand Down

0 comments on commit 6d2966a

Please sign in to comment.