|
|
@@ -332,14 +332,24 @@ export struct LyricView2 {
|
|
|
isTopBottomLine(index:number){
|
|
|
return index === 0 || index === this.listAdapter.totalCount() - 1;
|
|
|
}
|
|
|
-
|
|
|
+ //修复get Property index out of bounds
|
|
|
private handleSeekAction() {
|
|
|
clearTimeout(this.seekUiHideTimeout);
|
|
|
- let targetPosition = this.listAdapter.getData(this.seekIndex).beginTime;
|
|
|
- let isPlayerHandled = this.onSeekAction(targetPosition);
|
|
|
- if (!isPlayerHandled) {
|
|
|
- this.animateToIndex(this.currentIndex);
|
|
|
+
|
|
|
+ let itemCount = this.listAdapter.totalCount(); // 获取数据项的总数
|
|
|
+
|
|
|
+ // 确保 seekIndex 在有效范围内
|
|
|
+ if (this.seekIndex >= 0 && this.seekIndex < itemCount) {
|
|
|
+ let targetPosition = this.listAdapter.getData(this.seekIndex).beginTime;
|
|
|
+ let isPlayerHandled = this.onSeekAction(targetPosition);
|
|
|
+ if (!isPlayerHandled) {
|
|
|
+ this.animateToIndex(this.currentIndex);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ console.error("Seek index out of bounds:", this.seekIndex);
|
|
|
+ // 处理超出范围的情况,比如设定默认值或抛出错误
|
|
|
}
|
|
|
+
|
|
|
this.isUserTouching = false;
|
|
|
}
|
|
|
|