Conversation
AI 改的,我也不懂喵(
横纵向滑动会同时进行,如我想横向滑动切换到主页面却滑动了歌词,我想纵向滑动歌词却进行了横向滑动,导致体验不佳 神奇的 AI 改的,我也不懂喵(
There was a problem hiding this comment.
Code Review
This pull request replaces the useSwipe hook with a custom touch handling implementation to support axis locking, ensuring horizontal page switching does not conflict with vertical scrolling. It also moves the lyric component to a separate overlay to resolve mix-blend-mode issues caused by the transform stacking context. Key feedback includes ensuring touchmove listeners are not passive to allow event prevention, managing pointer-events on the new overlay to avoid blocking underlying UI elements, providing full touch data when dispatching touchcancel, and using preventDefault on touchend to avoid ghost clicks.
| @touchstart.capture="onTouchStart" | ||
| @touchmove.capture="onTouchMove" | ||
| @touchend.capture="onTouchEnd" |
| .lyric-overlay { | ||
| position: absolute; | ||
| top: 0; | ||
| left: 0; | ||
| width: 100%; | ||
| height: 100%; | ||
| // 顶部留出 lyric-page padding-top(60px) + lyric-header 高度(约 80px) | ||
| padding: 140px 24px 0; | ||
| box-sizing: border-box; | ||
| mix-blend-mode: var(--lyric-blend-mode); | ||
| transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1); | ||
| &.swiping { | ||
| transition: none; | ||
| } | ||
| } |
There was a problem hiding this comment.
lyric-overlay 作为一个覆盖在整个播放器上方的绝对定位层,其 padding-top 区域虽然在视觉上是透明的,但默认仍会拦截触摸事件。这会导致位于其下方的 lyric-header 中的操作按钮(如喜欢按钮)无法被点击。建议为 .lyric-overlay 设置 pointer-events: none,并为其内部内容恢复点击事件。
.lyric-overlay {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
// 顶部留出 lyric-page padding-top(60px) + lyric-header 高度(约 80px)
padding: 140px 24px 0;
box-sizing: border-box;
mix-blend-mode: var(--lyric-blend-mode);
transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1);
pointer-events: none;
& > * {
pointer-events: auto;
}
&.swiping {
transition: none;
}
}
There was a problem hiding this comment.
Pull request overview
该 PR 针对移动端全屏播放器的歌词页做了交互与渲染层级调整,主要解决歌词 mix-blend-mode 被 transform 形成的 stacking context 阻断,以及歌词页横向翻页与纵向滚动手势冲突的问题。
Changes:
- 将歌词组件从
mobile-content内抽离为独立的覆盖层(lyric-overlay),以避免transform阻断混合模式效果 - 用自定义 touch 轴锁定逻辑替换
@vueuse/core的useSwipe,区分横向翻页与纵向滚动 - 调整滑动状态类名与 transform 计算,使歌词覆盖层与页面滑动视觉同步
| ref="mobileStart" | ||
| @touchstart.capture="onTouchStart" | ||
| @touchmove.capture="onTouchMove" | ||
| @touchend.capture="onTouchEnd" |
| // 确认是水平滑动时,在捕获阶段下发 touchcancel 终止子组件(如AMLL)内部的滑动状态 | ||
| if (axisLock.value === "x" && e.target instanceof EventTarget) { | ||
| e.target.dispatchEvent(new TouchEvent("touchcancel", { bubbles: true, cancelable: true })); | ||
| } |
80dfb55 to
2284b39
Compare
590e69b to
5a0476c
Compare
详情可以看每个 commit
有 99% 的是 AI 写的(