File tree Expand file tree Collapse file tree 2 files changed +25
-2
lines changed Expand file tree Collapse file tree 2 files changed +25
-2
lines changed Original file line number Diff line number Diff line change @@ -62,7 +62,7 @@ const Control: React.FC<{}> = ({ children }) => {
6262 < Tooltip title = "滤镜1" placement = "top" >
6363 < Filter1Icon
6464 className = { classNames ( "bg-[#333] text-white" , {
65- [ "text-orange-300" ] : filter === 1 ,
65+ [ "! text-orange-300" ] : filter === 1 ,
6666 } ) }
6767 onClick = { ( ) => onClickFilter ( 1 ) }
6868 />
Original file line number Diff line number Diff line change @@ -317,6 +317,7 @@ const HorizonImgList: React.FC<ImgListProps> = ({
317317 const [ loading , setLoading ] = useState ( true ) ;
318318 const [ scrollingDone , setScrollingDone ] = useState ( false ) ;
319319 const containerRef = useRef < HTMLDivElement > ( null ) ;
320+ const { autoScroll } = useComicContext ( ) ;
320321 useWatchComicPositionChange ( ! loading && scrollingDone , onVisitPosition ) ;
321322
322323 const { onLoad : onImgLoad } = useImgLoadAutoScrollIntoView (
@@ -358,6 +359,28 @@ const HorizonImgList: React.FC<ImgListProps> = ({
358359 return ( ) => { } ;
359360 } , [ ] ) ;
360361
362+ useEffect ( ( ) => {
363+ const container = containerRef . current ;
364+ let hasbreak = false ;
365+ if ( autoScroll && container ) {
366+ function scroll ( ) {
367+ if ( hasbreak ) {
368+ return ;
369+ }
370+ if ( containerRef . current ) {
371+ containerRef . current . scrollLeft -= 4 ;
372+ requestAnimationFrame ( scroll ) ;
373+ }
374+ }
375+
376+ requestAnimationFrame ( scroll ) ;
377+ return ( ) => {
378+ hasbreak = true ;
379+ } ;
380+ }
381+ return ( ) => { } ;
382+ } , [ autoScroll ] ) ;
383+
361384 const reverseImgList = useMemo ( ( ) => {
362385 return [ ...imgList ] . reverse ( ) ;
363386 } , [ imgList ] ) ;
@@ -374,7 +397,7 @@ const HorizonImgList: React.FC<ImgListProps> = ({
374397 return (
375398 < div
376399 key = { index }
377- className = "flex-shrink-0 px-2 bg-gray-500 h-[100vh] bg-gray-100 ml-4 border border-box flex items-center"
400+ className = "pt-3 pb-5 flex-shrink-0 px-2 h-[100vh] bg-gray-100 border-x border-box flex items-center"
378401 >
379402 < img
380403 onLoad = { onImgLoad }
You can’t perform that action at this time.
0 commit comments