@@ -418,8 +418,8 @@ function disposeImages(data = false)
418
418
{
419
419
let image = image0 [ i ] ;
420
420
421
- image . style . height = imageHeight0 + 'px' ;
422
- image . style . width = imageWidth0 + 'px' ;
421
+ image . style . height = app . roundDPR ( imageHeight0 ) + 'px' ;
422
+ image . style . width = app . roundDPR ( imageWidth0 ) + 'px' ;
423
423
image . style . marginLeft = app . roundDPR ( marginLeft0 ) + 'px' ;
424
424
image . style . marginTop = app . roundDPR ( marginTop0 ) + 'px' ;
425
425
image . style . marginBottom = app . roundDPR ( ( readingViewIs ( 'scroll' ) && ( ( + key1 ) + 1 ) == indexNum ) ? marginVertical : 0 ) + 'px' ;
@@ -481,8 +481,8 @@ function disposeImages(data = false)
481
481
{
482
482
let image = image1 [ i ] ;
483
483
484
- image . style . height = imageHeight1 + 'px' ;
485
- image . style . width = imageWidth1 + 'px' ;
484
+ image . style . height = app . roundDPR ( imageHeight1 ) + 'px' ;
485
+ image . style . width = app . roundDPR ( imageWidth1 ) + 'px' ;
486
486
image . style . marginLeft = app . roundDPR ( marginLeft1 ) + 'px' ;
487
487
image . style . marginTop = app . roundDPR ( marginTop1 ) + 'px' ;
488
488
image . style . marginBottom = app . roundDPR ( ( readingViewIs ( 'scroll' ) && ( ( + key1 ) + 1 ) == indexNum ) ? marginVertical : 0 ) + 'px' ;
@@ -586,8 +586,8 @@ function disposeImages(data = false)
586
586
{
587
587
let image = image0 [ i ] ;
588
588
589
- image . style . height = imageHeight + 'px' ;
590
- image . style . width = imageWidth + 'px' ;
589
+ image . style . height = app . roundDPR ( imageHeight ) + 'px' ;
590
+ image . style . width = app . roundDPR ( imageWidth ) + 'px' ;
591
591
image . style . marginLeft = app . roundDPR ( marginLeft ) + 'px' ;
592
592
image . style . marginTop = app . roundDPR ( marginTop ) + 'px' ;
593
593
image . style . marginBottom = app . roundDPR ( ( readingViewIs ( 'scroll' ) && ( ( + key1 ) + 1 ) == indexNum ) ? marginVertical : 0 ) + 'px' ;
@@ -715,11 +715,24 @@ function calculateView()
715
715
}
716
716
}
717
717
718
- var previousScrollTop = 0 , previousContentHeight = 0 ;
718
+ var previousScrollTop = 0 , previousScrollHeight = 0 , previousContentHeight = 0 , stayInLineData = { scrollTop : false , scrollHeight : false , heigth : false , setTimeout : false } ;
719
+
720
+ function getPreviusContentSize ( )
721
+ {
722
+ if ( ! readingViewIs ( 'scroll' ) ) return ;
723
+
724
+ let contentRight = template . _contentRight ( ) ;
725
+ let content = contentRight . firstElementChild ;
726
+ let rect = content . getBoundingClientRect ( ) ;
727
+
728
+ previousContentHeight = rect . height ;
729
+ previousScrollHeight = content . scrollHeight ;
730
+ previousScrollTop = content . scrollTop ;
731
+ }
719
732
720
733
function stayInLine ( )
721
734
{
722
- if ( readingViewIs ( 'slide' ) || ( readingViewIs ( 'scroll' ) && ! _config . readingViewAdjustToWidth && ! _config . readingWebtoon ) )
735
+ if ( readingViewIs ( 'slide' ) /* || (readingViewIs('scroll') && !_config.readingViewAdjustToWidth && !_config.readingWebtoon)*/ )
723
736
{
724
737
if ( currentIndex < 1 && dom . previousComic ( ) )
725
738
showPreviousComic ( 1 , false ) ;
@@ -730,12 +743,31 @@ function stayInLine()
730
743
}
731
744
else if ( readingViewIs ( 'scroll' ) )
732
745
{
733
- if ( currentIndex < 1 && dom . previousComic ( ) )
734
- showPreviousComic ( 1 , false ) ;
735
- else if ( currentIndex > contentNum && dom . nextComic ( ) )
736
- showNextComic ( 1 , false ) ;
746
+ let contentRight = template . _contentRight ( ) ;
747
+ let content = contentRight . firstElementChild ;
748
+ let rect = content . getBoundingClientRect ( ) ;
749
+
750
+ disableOnScroll ( true ) ;
751
+
752
+ if ( stayInLineData . scrollTop === false )
753
+ {
754
+ stayInLineData = { scrollTop : previousScrollTop , scrollHeight : previousScrollHeight , height : previousContentHeight , setTimeout : false } ;
755
+ }
737
756
else
738
- goToIndex ( currentIndex , false , currentPageVisibility ) ;
757
+ {
758
+ clearTimeout ( stayInLineData . setTimeout ) ;
759
+ stayInLineData . setTimeout = setTimeout ( function ( ) {
760
+
761
+ previousContentHeight = stayInLineData . height ;
762
+ previousScrollHeight = stayInLineData . scrollHeight ;
763
+ stayInLineData = { scrollTop : false , scrollHeight : false , setTimeout : false } ;
764
+
765
+ disableOnScroll ( false ) ;
766
+
767
+ } , 400 ) ;
768
+ }
769
+
770
+ content . scrollTop = ( ( stayInLineData . scrollTop + ( stayInLineData . height / 2 ) ) / stayInLineData . scrollHeight * content . scrollHeight ) - ( rect . height / 2 ) ;
739
771
}
740
772
}
741
773
@@ -1428,6 +1460,7 @@ function onScroll(event)
1428
1460
scrollPart = ( ( rightSize . height - contentHeightRes ) - rightSize . height / pageVisibility ) ;
1429
1461
1430
1462
currentPageVisibility = Math . round ( ( previousScrollTop - ( imagesFullPosition [ selIndex ] [ 0 ] . top - readingMargin ( ) . top ) ) / scrollPart ) ;
1463
+ if ( currentPageVisibility < 0 ) currentPageVisibility = 0 ;
1431
1464
1432
1465
if ( currentIndex != selIndex + 1 )
1433
1466
{
@@ -2508,7 +2541,7 @@ function resized()
2508
2541
generateEbookPagesDelayed ( ) ;
2509
2542
}
2510
2543
2511
- previousContentHeight = template . contentRight ( ) . children ( 'div' ) . children ( 'div' ) . height ( ) ;
2544
+ // getPreviusContentSize ();
2512
2545
}
2513
2546
2514
2547
var hiddenContentLeft = false , hiddenBarHeader = false , hideContentDisableTransitionsST = false , hideContentST = false , hideContentRunningST = false , shownContentLeft = false , shownBarHeader = false ;
@@ -2629,6 +2662,7 @@ var activeOnScroll = true;
2629
2662
function disableOnScroll ( disable = true )
2630
2663
{
2631
2664
activeOnScroll = ! disable ;
2665
+ if ( ! disable ) getPreviusContentSize ( ) ;
2632
2666
}
2633
2667
2634
2668
function setReadingDragScroll ( dragScroll )
@@ -3976,7 +4010,7 @@ async function generateEbookPages(end = false, reset = false, fast = false, imag
3976
4010
goToIndex ( newIndex , false , end , end ) ;
3977
4011
3978
4012
if ( readingViewIs ( 'scroll' ) )
3979
- previousContentHeight = template . contentRight ( ) . children ( 'div' ) . children ( 'div' ) . height ( ) ;
4013
+ getPreviusContentSize ( ) ;
3980
4014
3981
4015
setTimeout ( function ( ) { onScroll . call ( template . _contentRight ( ) . firstElementChild ) } , 500 ) ;
3982
4016
@@ -4899,7 +4933,7 @@ async function read(path, index = 1, end = false, isCanvas = false, isEbook = fa
4899
4933
goToIndex ( newIndex , false , end , end ) ;
4900
4934
4901
4935
if ( readingViewIs ( 'scroll' ) )
4902
- previousContentHeight = template . contentRight ( ) . children ( 'div' ) . children ( 'div' ) . height ( ) ;
4936
+ getPreviusContentSize ( ) ;
4903
4937
4904
4938
setTimeout ( function ( ) { onScroll . call ( template . _contentRight ( ) . firstElementChild ) } , 500 ) ;
4905
4939
@@ -4946,7 +4980,7 @@ async function read(path, index = 1, end = false, isCanvas = false, isEbook = fa
4946
4980
goToIndex ( newIndex , false , end , end ) ;
4947
4981
4948
4982
if ( readingViewIs ( 'scroll' ) )
4949
- previousContentHeight = template . contentRight ( ) . children ( 'div' ) . children ( 'div' ) . height ( ) ;
4983
+ getPreviusContentSize ( ) ;
4950
4984
4951
4985
setTimeout ( function ( ) { onScroll . call ( template . _contentRight ( ) . firstElementChild ) } , 500 ) ;
4952
4986
@@ -4980,7 +5014,7 @@ async function read(path, index = 1, end = false, isCanvas = false, isEbook = fa
4980
5014
goToIndex ( newIndex , false , end , end ) ;
4981
5015
4982
5016
if ( readingViewIs ( 'scroll' ) )
4983
- previousContentHeight = template . contentRight ( ) . children ( 'div' ) . children ( 'div' ) . height ( ) ;
5017
+ getPreviusContentSize ( ) ;
4984
5018
4985
5019
setTimeout ( function ( ) { onScroll . call ( template . _contentRight ( ) . firstElementChild ) } , 500 ) ;
4986
5020
0 commit comments