@@ -51,7 +51,7 @@ import type {
51
51
IMarkStateManager ,
52
52
StateValueType
53
53
} from '../../compile/mark/interface' ;
54
- import { array , degreeToRadian , has , isArray , isBoolean , isFunction , isNil , isObject , isValid } from '@visactor/vutils' ;
54
+ import { array , degreeToRadian , isArray , isBoolean , isFunction , isNil , isObject , isValid } from '@visactor/vutils' ;
55
55
import { curveTypeTransform , groupData , runEncoder } from '../utils/common' ;
56
56
import type { ICompilableInitOption } from '../../compile/interface' ;
57
57
import { LayoutState } from '../../compile/interface' ;
@@ -67,7 +67,8 @@ import type { ICompilableData } from '../../compile/data/interface';
67
67
import type { IAnimationConfig } from '../../animation/interface' ;
68
68
import { AnimationStateEnum , type MarkAnimationSpec } from '../../animation/interface' ;
69
69
import { CompilableData } from '../../compile/data/compilable-data' ;
70
- import { log } from '../../util' ;
70
+ import { getDiffAttributesOfGraphic } from '../../util/mark' ;
71
+ import { log } from '../../util/debug' ;
71
72
import { morph as runMorph } from '../../compile/morph' ;
72
73
73
74
export type ExChannelCall = (
@@ -1263,7 +1264,7 @@ export class BaseMark<T extends ICommonSpec> extends GrammarItem implements IMar
1263
1264
}
1264
1265
}
1265
1266
1266
- private _setAnimationState ( g : IMarkGraphic ) {
1267
+ protected _setAnimationState ( g : IMarkGraphic ) {
1267
1268
const customizedState = this . _aniamtionStateCallback ? this . _aniamtionStateCallback ( g ) : undefined ;
1268
1269
1269
1270
g . context . animationState = customizedState ?? g . context . diffState ;
@@ -1552,14 +1553,7 @@ export class BaseMark<T extends ICommonSpec> extends GrammarItem implements IMar
1552
1553
this . _graphicMap . set ( g . context . uniqueKey , g ) ;
1553
1554
}
1554
1555
} else {
1555
- // diff一下,获取差异的属性
1556
- const prevAttrs : Record < string , any > = g . getAttributes ( true ) ;
1557
- const diffAttrs : Record < string , any > = { } ;
1558
- Object . keys ( finalAttrs ) . forEach ( key => {
1559
- if ( prevAttrs [ key ] !== finalAttrs [ key ] ) {
1560
- diffAttrs [ key ] = finalAttrs [ key ] ;
1561
- }
1562
- } ) ;
1556
+ const diffAttrs = getDiffAttributesOfGraphic ( g , finalAttrs ) ;
1563
1557
g . context . diffAttrs = diffAttrs ;
1564
1558
if ( g . context . reusing ) {
1565
1559
// 表示正在被复用,需要重设属性的
@@ -1982,11 +1976,11 @@ export class BaseMark<T extends ICommonSpec> extends GrammarItem implements IMar
1982
1976
this . _aniamtionStateCallback = callback ;
1983
1977
}
1984
1978
1985
- hasAnimationByState ( state : keyof MarkAnimationSpec ) {
1986
- if ( ! state || ! this . _animationConfig || ! this . _animationConfig [ state ] ) {
1979
+ hasAnimationByState ( state : AnimationStateValues ) {
1980
+ if ( ! state || ! this . _animationConfig || ! ( this . _animationConfig as any ) [ state ] ) {
1987
1981
return false ;
1988
1982
}
1989
- const stateAnimationConfig = this . _animationConfig [ state ] ;
1983
+ const stateAnimationConfig = ( this . _animationConfig as any ) [ state ] ;
1990
1984
return ( stateAnimationConfig as IAnimationConfig [ ] ) . length > 0 || isObject ( stateAnimationConfig ) ;
1991
1985
}
1992
1986
0 commit comments