Skip to content

Commit dfb46e1

Browse files
authored
Merge pull request #1996 from VisActor/fix/fix-issue-of-animation-state
Fix/fix issue of animation state
2 parents cd68529 + 4ab3a02 commit dfb46e1

File tree

3 files changed

+27
-10
lines changed

3 files changed

+27
-10
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"changes": [
3+
{
4+
"comment": "fix: fix issue of animation state\n\n",
5+
"type": "none",
6+
"packageName": "@visactor/vrender-core"
7+
}
8+
],
9+
"packageName": "@visactor/vrender-core",
10+
"email": "[email protected]"
11+
}

packages/vrender-core/src/graphic/graphic.ts

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -259,29 +259,29 @@ export abstract class Graphic<T extends Partial<IGraphicAttribute> = Partial<IGr
259259
declare y1WithoutTransform?: number;
260260

261261
// aabbBounds,所有图形都需要有,所以初始化即赋值
262-
declare protected _AABBBounds: IAABBBounds;
262+
protected declare _AABBBounds: IAABBBounds;
263263
get AABBBounds(): IAABBBounds {
264264
return this.tryUpdateAABBBounds();
265265
}
266266
// 具有旋转的包围盒,部分图元需要,动态初始化
267-
declare protected _OBBBounds?: IOBBBounds;
267+
protected declare _OBBBounds?: IOBBBounds;
268268
get OBBBounds(): IOBBBounds {
269269
return this.tryUpdateOBBBounds();
270270
}
271-
declare protected _globalAABBBounds: IAABBBounds;
271+
protected declare _globalAABBBounds: IAABBBounds;
272272
// 全局包围盒,部分图元需要,动态初始化,建议使用AABBBounds
273273
get globalAABBBounds(): IAABBBounds {
274274
return this.tryUpdateGlobalAABBBounds();
275275
}
276-
declare protected _transMatrix: Matrix;
276+
protected declare _transMatrix: Matrix;
277277
get transMatrix(): Matrix {
278278
return this.tryUpdateLocalTransMatrix(true);
279279
}
280-
declare protected _globalTransMatrix: Matrix;
280+
protected declare _globalTransMatrix: Matrix;
281281
get globalTransMatrix(): Matrix {
282282
return this.tryUpdateGlobalTransMatrix(true);
283283
}
284-
declare protected _updateTag: number;
284+
protected declare _updateTag: number;
285285

286286
// 上次更新的stamp
287287
declare stamp?: number;
@@ -1046,7 +1046,10 @@ export abstract class Graphic<T extends Partial<IGraphicAttribute> = Partial<IGr
10461046
// (animate as any).stateNames = stateNames;
10471047
// animate.to(animateAttrs, stateAnimateConfig.duration, stateAnimateConfig.easing);
10481048
noAnimateAttrs && this.setAttributesAndPreventAnimate(noAnimateAttrs, false, { type: AttributeUpdateType.STATE });
1049-
// Object.assign((this as any).finalAttribute, attrs);
1049+
// 应用状态的时候要更新 finalAttribute 也就是目标属性
1050+
if ((this as any).finalAttribute) {
1051+
Object.assign((this as any).finalAttribute, attrs);
1052+
}
10501053
} else {
10511054
this.stopStateAnimates();
10521055
this.setAttributesAndPreventAnimate(attrs, false, { type: AttributeUpdateType.STATE });
@@ -1095,7 +1098,7 @@ export abstract class Graphic<T extends Partial<IGraphicAttribute> = Partial<IGr
10951098
private getNormalAttribute(key: string) {
10961099
const value = (this.attribute as any)[key];
10971100

1098-
if (this.animates) {
1101+
if (this.animates && this.animates.size) {
10991102
// this.animates.forEach(animate => {
11001103
// if ((animate as any).stateNames) {
11011104
// const endProps = animate.getEndProps();

packages/vrender-core/src/plugins/builtin-plugin/edit-module.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -420,8 +420,11 @@ export class EditModule {
420420
this.textAreaDom.removeEventListener('input', this.handleInput);
421421
this.textAreaDom.removeEventListener('compositionstart', this.handleCompositionStart);
422422
this.textAreaDom.removeEventListener('compositionend', this.handleCompositionEnd);
423-
this.textAreaDom.addEventListener('focusin', this.handleFocusOut);
424-
this.textAreaDom.addEventListener('focusout', this.handleFocusOut);
423+
this.textAreaDom.removeEventListener('focusin', this.handleFocusOut);
424+
this.textAreaDom.removeEventListener('focusout', this.handleFocusOut);
425425
application.global.removeEventListener('keydown', this.handleKeyDown);
426+
427+
this.textAreaDom.parentElement?.removeChild(this.textAreaDom);
428+
this.textAreaDom = null;
426429
}
427430
}

0 commit comments

Comments
 (0)