File tree Expand file tree Collapse file tree
packages/webgal/src/Core/Modules/perform Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -50,7 +50,7 @@ export class PerformController {
5050 // perform.isOver = true;
5151 if ( ! perform . isHoldOn ) {
5252 // 如果不是保持演出,清除
53- this . unmountPerform ( perform . performName ) ;
53+ this . softUnmountPerformObject ( perform ) ;
5454 }
5555 } , perform . duration ) ;
5656
@@ -103,6 +103,26 @@ export class PerformController {
103103 }
104104 }
105105
106+ public softUnmountPerformObject ( perform : IPerform ) {
107+ const idx = this . performList . indexOf ( perform )
108+ if ( idx < 0 ) return ;
109+ perform . stopFunction ( ) ;
110+ clearTimeout ( perform . stopTimeout as unknown as number ) ;
111+ /**
112+ * 在演出列表里删除演出对象的操作必须在调用 goNextWhenOver 之前
113+ * 因为 goNextWhenOver 会调用 nextSentence,而 nextSentence 会清除目前未结束的演出
114+ * 那么 nextSentence 函数就会删除这个演出,但是此时,在这个上下文,i 已经被确定了
115+ * 所以 goNextWhenOver 后的代码会多删东西,解决方法就是在调用 goNextWhenOver 前先删掉这个演出对象
116+ * 此问题对所有 goNextWhenOver 属性为真的演出都有影响,但只有 2 个演出有此问题
117+ */
118+ this . performList . splice ( idx , 1 ) ;
119+ if ( perform . goNextWhenOver ) {
120+ // nextSentence();
121+ this . goNextWhenOver ( ) ;
122+ }
123+
124+ }
125+
106126 public erasePerformFromState ( name : string ) {
107127 webgalStore . dispatch ( stageActions . removePerformByName ( name ) ) ;
108128 }
You can’t perform that action at this time.
0 commit comments