File tree Expand file tree Collapse file tree 1 file changed +5
-0
lines changed Expand file tree Collapse file tree 1 file changed +5
-0
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import { CommonEvent, ContainerEvent } from '../constants';
4
4
import { ExtensionController } from '../registry/extension' ;
5
5
import type { BehaviorOptions , CustomBehaviorOption } from '../spec/behavior' ;
6
6
import type { Target } from '../types' ;
7
+ import { isToBeDestroyed } from '../utils/element' ;
7
8
import { eventTargetOf } from '../utils/event' ;
8
9
import type { RuntimeContext } from './types' ;
9
10
@@ -70,6 +71,10 @@ export class BehaviorController extends ExtensionController<BaseBehavior<CustomB
70
71
if ( ! target ) return ;
71
72
const { graph, canvas } = this . context ;
72
73
const { type : targetType , element : targetElement } = target ;
74
+ // 即将销毁或已销毁的元素不再触发事件
75
+ // Elements that are about to be destroyed or have been destroyed no longer trigger events
76
+ if ( 'destroyed' in targetElement && ( isToBeDestroyed ( targetElement ) || targetElement . destroyed ) ) return ;
77
+
73
78
const { type, detail, button } = event ;
74
79
const stdEvent = { ...event , target : targetElement , targetType, originalTarget } ;
75
80
You can’t perform that action at this time.
0 commit comments