|
|
@@ -412,17 +412,27 @@ export struct LocalMusic {
|
|
|
// 返回专辑列表时恢复滚动偏移量,支持列表和网格
|
|
|
setTimeout(() => {
|
|
|
if (this.modeType == 2) {
|
|
|
- if (this.isGridMusic) {
|
|
|
+ if (this.isGridMusic||this.twoFingerType==4) {
|
|
|
let lastOffset = this.mScrollMap.get('lastGridArtistScrollOffset') ?? 0
|
|
|
- this.scroller.scrollTo({ xOffset: 0, yOffset: lastOffset })
|
|
|
+ let lastWaterOffset = this.mScrollMap.get('lastWaterArtistScrollOffset') ?? 0
|
|
|
+ if(this.twoFingerType==4){
|
|
|
+ this.waterScroller.scrollTo({ xOffset: 0, yOffset: lastWaterOffset })
|
|
|
+ }else{
|
|
|
+ this.scroller.scrollTo({ xOffset: 0, yOffset: lastOffset })
|
|
|
+ }
|
|
|
} else {
|
|
|
let lastOffset = this.mScrollMap.get('lastListArtistScrollOffset') ?? 0
|
|
|
this.listScroller.scrollTo({ xOffset: 0, yOffset: lastOffset })
|
|
|
}
|
|
|
} else if (this.modeType == 3) {
|
|
|
- if (this.isGridMusic) {
|
|
|
+ if (this.isGridMusic||this.twoFingerType==4) {
|
|
|
let lastOffset = this.mScrollMap.get('lastGridAlBumScrollOffset') ?? 0
|
|
|
- this.scroller.scrollTo({ xOffset: 0, yOffset: lastOffset })
|
|
|
+ let lastWaterOffset = this.mScrollMap.get('lastWaterAlBumScrollOffset') ?? 0
|
|
|
+ if(this.twoFingerType==4){
|
|
|
+ this.waterScroller.scrollTo({ xOffset: 0, yOffset: lastWaterOffset })
|
|
|
+ }else{
|
|
|
+ this.scroller.scrollTo({ xOffset: 0, yOffset: lastOffset })
|
|
|
+ }
|
|
|
} else {
|
|
|
let lastOffset = this.mScrollMap.get('lastListAlBumScrollOffset') ?? 0
|
|
|
this.listScroller.scrollTo({ xOffset: 0, yOffset: lastOffset })
|
|
|
@@ -449,9 +459,15 @@ export struct LocalMusic {
|
|
|
//返回上一级歌单的滚动位置
|
|
|
setTimeout(() => {
|
|
|
if (this.modeType == 0) {
|
|
|
- if (this.isGridMusic) {
|
|
|
+ if (this.isGridMusic||this.twoFingerType==4) {
|
|
|
let lastOffset = this.mScrollMap.get('lastGridDirScrollOffset') ?? 0
|
|
|
- this.scroller.scrollTo({ xOffset: 0, yOffset: lastOffset })
|
|
|
+ let lastWaterOffset = this.mScrollMap.get('lastWaterDirScrollOffset') ?? 0
|
|
|
+ if(this.twoFingerType==4){
|
|
|
+ this.waterScroller.scrollTo({ xOffset: 0, yOffset: lastWaterOffset })
|
|
|
+ }else{
|
|
|
+ this.scroller.scrollTo({ xOffset: 0, yOffset: lastOffset })
|
|
|
+ }
|
|
|
+
|
|
|
} else {
|
|
|
let lastOffset = this.mScrollMap.get('lastListDirScrollOffset') ?? 0
|
|
|
this.listScroller.scrollTo({ xOffset: 0, yOffset: lastOffset })
|
|
|
@@ -4743,7 +4759,16 @@ export struct LocalMusic {
|
|
|
case CommonConstants.TYPE_IS_DIR:
|
|
|
// 进入歌单前安全保存当前滚动偏移量,支持列表和网格
|
|
|
let offsetB = 0
|
|
|
- if (this.isGridMusic) {
|
|
|
+ if(this.twoFingerType==4){
|
|
|
+ if (this.waterScroller && typeof this.waterScroller.currentOffset === 'function') {
|
|
|
+ let cur = this.waterScroller.currentOffset()
|
|
|
+ if (cur && typeof cur.yOffset === 'number') {
|
|
|
+ offsetB = cur.yOffset
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.mScrollMap.set('lastWaterDirScrollOffset', offsetB)
|
|
|
+ }else
|
|
|
+ if (this.isGridMusic) {
|
|
|
if (this.scroller && typeof this.scroller.currentOffset === 'function') {
|
|
|
let cur = this.scroller.currentOffset()
|
|
|
if (cur && typeof cur.yOffset === 'number') {
|
|
|
@@ -4801,25 +4826,30 @@ export struct LocalMusic {
|
|
|
|
|
|
}
|
|
|
//进入歌单的时候的滚动位置在顶部
|
|
|
- if (this.isGridMusic) {
|
|
|
- this.scroller.scrollToIndex(0)
|
|
|
- }
|
|
|
- setTimeout(() => {
|
|
|
- if (this.modeType == 0) {
|
|
|
- if (!this.isGridMusic) {
|
|
|
- this.listScroller.scrollToIndex(0)
|
|
|
- }
|
|
|
- if(this.twoFingerType==4){
|
|
|
- this.scroller.scrollTo({ xOffset: 0, yOffset: 0 })
|
|
|
- this.waterScroller.scrollTo({ xOffset: 0, yOffset: 0 })
|
|
|
- }
|
|
|
+ if(this.twoFingerType==4){
|
|
|
+ setTimeout(() => {
|
|
|
+ this.waterScroller.scrollEdge(Edge.Top)
|
|
|
+ this.scroller.scrollEdge(Edge.Top)
|
|
|
+ }, 380)
|
|
|
+ }else{
|
|
|
+ if (this.isGridMusic) {
|
|
|
+ this.scroller.scrollEdge(Edge.Top)
|
|
|
}
|
|
|
- }, 300)
|
|
|
+ }
|
|
|
break;
|
|
|
case CommonConstants.TYPE_IS_ARTIST:
|
|
|
// 进入艺术家前安全保存当前滚动偏移量,支持列表和网格
|
|
|
let offsetA = 0
|
|
|
- if (this.isGridMusic) {
|
|
|
+ if(this.twoFingerType==4){
|
|
|
+ if (this.waterScroller && typeof this.waterScroller.currentOffset === 'function') {
|
|
|
+ let cur = this.waterScroller.currentOffset()
|
|
|
+ if (cur && typeof cur.yOffset === 'number') {
|
|
|
+ offsetA = cur.yOffset
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.mScrollMap.set('lastWaterArtistScrollOffset', offsetA)
|
|
|
+ }else
|
|
|
+ if (this.isGridMusic) {
|
|
|
if (this.scroller && typeof this.scroller.currentOffset === 'function') {
|
|
|
let cur = this.scroller.currentOffset()
|
|
|
if (cur && typeof cur.yOffset === 'number') {
|
|
|
@@ -4850,15 +4880,31 @@ export struct LocalMusic {
|
|
|
}
|
|
|
|
|
|
//进入歌单的时候的滚动位置在顶部
|
|
|
- if (this.isGridMusic) {
|
|
|
- this.scroller.scrollToIndex(0)
|
|
|
+ if(this.twoFingerType==4){
|
|
|
+ setTimeout(() => {
|
|
|
+ this.waterScroller.scrollEdge(Edge.Top)
|
|
|
+ this.scroller.scrollEdge(Edge.Top)
|
|
|
+ }, 380)
|
|
|
+ }else{
|
|
|
+ if (this.isGridMusic) {
|
|
|
+ this.scroller.scrollEdge(Edge.Top)
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
break;
|
|
|
case CommonConstants.TYPE_IS_ALBUM:
|
|
|
// 进入专辑前安全保存当前滚动偏移量,支持列表和网格
|
|
|
let offset = 0
|
|
|
- if (this.isGridMusic) {
|
|
|
+ if(this.twoFingerType==4){
|
|
|
+ if (this.waterScroller && typeof this.waterScroller.currentOffset === 'function') {
|
|
|
+ let cur = this.waterScroller.currentOffset()
|
|
|
+ if (cur && typeof cur.yOffset === 'number') {
|
|
|
+ offset = cur.yOffset
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.mScrollMap.set('lastWaterAlBumScrollOffset', offset)
|
|
|
+ }else
|
|
|
+ if (this.isGridMusic) {
|
|
|
if (this.scroller && typeof this.scroller.currentOffset === 'function') {
|
|
|
let cur = this.scroller.currentOffset()
|
|
|
if (cur && typeof cur.yOffset === 'number') {
|
|
|
@@ -4889,10 +4935,16 @@ export struct LocalMusic {
|
|
|
this.mScrollMap.set(item.name, this.selectedIndex)
|
|
|
}
|
|
|
//进入歌单的时候的滚动位置在顶部
|
|
|
- if (this.isGridMusic) {
|
|
|
- this.scroller.scrollToIndex(0)
|
|
|
+ if(this.twoFingerType==4){
|
|
|
+ setTimeout(() => {
|
|
|
+ this.waterScroller.scrollEdge(Edge.Top)
|
|
|
+ this.scroller.scrollEdge(Edge.Top)
|
|
|
+ }, 380)
|
|
|
+ }else{
|
|
|
+ if (this.isGridMusic) {
|
|
|
+ this.scroller.scrollEdge(Edge.Top)
|
|
|
+ }
|
|
|
}
|
|
|
-
|
|
|
break;
|
|
|
case CommonConstants.TYPE_IS_CSJAD:
|
|
|
return
|