@@ -16,6 +16,8 @@ interface LyricPanelProps {
1616 fontScale : number ;
1717 /** 是否显示翻译 */
1818 showTranslation : boolean ;
19+ /** 是否处于文本选择模式 */
20+ isSelectable : boolean ;
1921}
2022
2123/** 活跃行基准字号 (px) — 对标设计稿 32px */
@@ -32,13 +34,20 @@ const USER_SCROLL_PAUSE = 4000;
3234const prefersReducedMotion =
3335 typeof window !== 'undefined' && window . matchMedia ( '(prefers-reduced-motion: reduce)' ) . matches ;
3436
35- const LyricPanel = memo ( function LyricPanel ( { fontScale, showTranslation } : LyricPanelProps ) {
37+ const LyricPanel = memo ( function LyricPanel ( {
38+ fontScale,
39+ showTranslation,
40+ isSelectable,
41+ } : LyricPanelProps ) {
3642 const { t } = useTranslation ( ) ;
3743 const lyricState = useLyric ( ) ;
3844 const containerRef = useRef < HTMLDivElement > ( null ) ;
3945 const activeIndexRef = useRef < number > ( - 1 ) ;
4046 const isInitialRef = useRef ( true ) ;
4147
48+ const isSelectableRef = useRef ( false ) ;
49+ isSelectableRef . current = isSelectable ;
50+
4251 // 拖拽滚动状态
4352 const dragState = useRef ( {
4453 isDragging : false ,
@@ -96,8 +105,10 @@ const LyricPanel = memo(function LyricPanel({ fontScale, showTranslation }: Lyri
96105 } ) ;
97106 } , [ activeIndex ] ) ;
98107
99- /** 拖拽开始 */
108+ /** 拖拽开始(文本选择模式下跳过) */
100109 const handlePointerDown = useCallback ( ( e : React . PointerEvent < HTMLDivElement > ) => {
110+ if ( isSelectableRef . current ) return ;
111+
101112 const container = containerRef . current ;
102113 if ( ! container ) return ;
103114
@@ -111,8 +122,10 @@ const LyricPanel = memo(function LyricPanel({ fontScale, showTranslation }: Lyri
111122 wasDraggedRef . current = false ;
112123 } , [ ] ) ;
113124
114- /** 拖拽移动 */
125+ /** 拖拽移动(文本选择模式下跳过) */
115126 const handlePointerMove = useCallback ( ( e : React . PointerEvent < HTMLDivElement > ) => {
127+ if ( isSelectableRef . current ) return ;
128+
116129 const state = dragState . current ;
117130 if ( ! state . isDragging ) return ;
118131
@@ -159,10 +172,9 @@ const LyricPanel = memo(function LyricPanel({ fontScale, showTranslation }: Lyri
159172 [ pauseAutoScroll ] ,
160173 ) ;
161174
162- /** 点击歌词行跳转播放位置(拖拽时不触发 ) */
175+ /** 双击歌词行跳转播放位置(拖拽或文本选择模式下不触发 ) */
163176 const handleLyricClick = useCallback ( ( item : IParsedLrcItem ) => {
164- console . log ( '点击歌词行' , item ) ;
165- if ( wasDraggedRef . current ) return ;
177+ if ( wasDraggedRef . current || isSelectableRef . current ) return ;
166178 trackPlayer . seekTo ( item . time ) ;
167179 } , [ ] ) ;
168180
@@ -191,7 +203,7 @@ const LyricPanel = memo(function LyricPanel({ fontScale, showTranslation }: Lyri
191203 return (
192204 < div
193205 ref = { containerRef }
194- className = " l-fullscreen-player__lyric-scroll"
206+ className = { ` l-fullscreen-player__lyric-scroll${ isSelectable ? ' is-selectable' : '' } ` }
195207 onPointerDown = { handlePointerDown }
196208 onPointerMove = { handlePointerMove }
197209 onPointerUp = { handlePointerUp }
0 commit comments