@@ -1349,7 +1349,7 @@ function goToIndex(index, animation = true, nextPrevious = false, end = false)
13491349 currentZoomIndex = false ;
13501350 currentScale = _currentScale ;
13511351 reading . applyScale ( false , _currentScale , true , _currentScale > 1 ? false : true ) ;
1352- zoomMove ( 0 , readingDirection ? 99999 : - 99999 ) ;
1352+ if ( animation ) zoomMove ( 0 , readingDirection ? 99999 : - 99999 ) ;
13531353 }
13541354
13551355 //goToImageCL(imagesDistribution[eIndex-1][0].index, animation);
@@ -2287,54 +2287,58 @@ function zoomScrollHeight()
22872287}
22882288
22892289// Zoom in
2290- function zoomIn ( animation = true , center = false )
2290+ function zoomIn ( animation = true , center = false , delta = 120 )
22912291{
22922292 if ( zoomMoveData . active )
22932293 return ;
22942294
2295+ const multipler = 0.25 * ( delta / 120 ) ;
2296+
22952297 if ( currentScale < 8 )
2296- currentScale *= 1.25 ;
2298+ currentScale *= 1 + multipler ;
22972299
22982300 applyScale ( animation , currentScale , center ) ;
22992301}
23002302
23012303// Zoom out
2302- function zoomOut ( animation = true , center = false )
2304+ function zoomOut ( animation = true , center = false , delta = 120 )
23032305{
23042306 if ( zoomMoveData . active )
23052307 return ;
23062308
2309+ const multipler = 0.25 * ( delta / 120 ) ;
2310+
23072311 if ( currentScale > 0.2 )
2308- currentScale /= 1.25 ;
2312+ currentScale /= 1 + multipler ;
23092313
23102314 applyScale ( animation , currentScale , center , true ) ;
23112315}
23122316
2313- function zoomUp ( )
2317+ function zoomUp ( delta = 20 , animation = false )
23142318{
2315- zoomMove ( 0 , 20 ) ;
2319+ zoomMove ( 0 , delta , animation ) ;
23162320}
23172321
2318- function zoomDown ( )
2322+ function zoomDown ( delta = 20 , animation = false )
23192323{
2320- zoomMove ( 0 , - 20 ) ;
2324+ zoomMove ( 0 , - delta , animation ) ;
23212325}
23222326
2323- function zoomLeft ( )
2327+ function zoomLeft ( delta = 20 , animation = false )
23242328{
2325- zoomMove ( - 20 , 0 ) ;
2329+ zoomMove ( - delta , 0 , animation ) ;
23262330}
23272331
2328- function zoomRight ( )
2332+ function zoomRight ( delta = 20 , animation = false )
23292333{
2330- zoomMove ( 20 , 0 ) ;
2334+ zoomMove ( delta , 0 , animation ) ;
23312335}
23322336
2333- function zoomMove ( x = 0 , y = 0 )
2337+ function zoomMove ( x = 0 , y = 0 , animation = false )
23342338{
23352339 if ( ! haveZoom ) return ;
23362340
2337- dragZoom ( x , y ) ;
2341+ dragZoom ( x , y , animation ) ;
23382342 dragZoomEnd ( true ) ;
23392343}
23402344
@@ -2537,9 +2541,10 @@ function notCrossZoomLimits(x, y, scale = false)
25372541}
25382542
25392543// Drag zoom
2540- function dragZoom ( x , y )
2544+ function dragZoom ( x , y , animation = false )
25412545{
2542- let withLimits = notCrossZoomLimits ( scalePrevData . tranX2 + x , scalePrevData . tranY2 + y ) ;
2546+ const transition = animation ? app . scrollTransition ( 'dragZoom' , _config . readingViewSpeed ) : 0 ;
2547+ const withLimits = notCrossZoomLimits ( scalePrevData . tranX2 + x , scalePrevData . tranY2 + y ) ;
25432548
25442549 const diff = {
25452550 x : ( scalePrevData . tranX2 + x ) - withLimits . x ,
@@ -2549,15 +2554,15 @@ function dragZoom(x, y)
25492554 x = withLimits . x ;
25502555 y = withLimits . y ;
25512556
2552- let contentRight = template . _contentRight ( ) ;
2557+ const contentRight = template . _contentRight ( ) ;
25532558
25542559 if ( config . readingGlobalZoom && readingViewIs ( 'scroll' ) )
25552560 {
25562561 scalePrevData . tranX = zoomMoveData . tranX = x ;
25572562 zoomMoveData . tranY = scalePrevData . tranY ;
25582563
25592564 dom . this ( contentRight ) . find ( '.reading-body > div' ) . css ( {
2560- transition : 'transform 0s , z-index 0s' ,
2565+ transition : 'transform ' + transition . speed + 's ' + transition . function + ' , z-index 0s',
25612566 transform : 'translateX(' + app . roundDPR ( x ) + 'px) translateY(' + app . roundDPR ( scalePrevData . tranY ) + 'px) scale(' + scalePrevData . scale + ')' ,
25622567 transformOrigin : 'top center' ,
25632568 } ) ;
@@ -2568,7 +2573,7 @@ function dragZoom(x, y)
25682573 zoomMoveData . tranY = y ;
25692574
25702575 dom . this ( contentRight ) . find ( '.image-position' + currentZoomIndex , true ) . css ( {
2571- transition : 'transform 0s , z-index 0s' ,
2576+ transition : 'transform ' + transition . speed + 's ' + transition . function + ' , z-index 0s',
25722577 transform : 'translateX(' + app . roundDPR ( x ) + 'px) translateY(' + app . roundDPR ( y ) + 'px) scale(' + scalePrevData . scale + ')' ,
25732578 transformOrigin : 'center center' ,
25742579 } ) ;
@@ -4894,33 +4899,14 @@ async function read(path, index = 1, end = false, isCanvas = false, isEbook = fa
48944899 } ) ;
48954900 onLoadPromise = { promise : promise , resolve : resolve } ;
48964901
4897- template . contentRight ( ) . on ( 'mousewheel' , function ( e ) {
4902+ template . contentRight ( ) . on ( 'mousewheel' , function ( event ) {
48984903
48994904 if ( onReading && isLoaded )
49004905 {
4901- if ( config . readingTurnPagesWithMouseWheel && ! e . originalEvent . ctrlKey && ! readingViewIs ( 'scroll' ) )
4902- {
4903- e . preventDefault ( ) ;
4904-
4905- if ( e . originalEvent . wheelDelta / 120 > 0 )
4906- reading . goPrev ( ) ;
4907- else
4908- reading . goNext ( ) ;
4909- }
4910- else if ( e . originalEvent . ctrlKey || ! readingViewIs ( 'scroll' ) )
4911- {
4912- e . preventDefault ( ) ;
4906+ const oEvent = event . originalEvent ;
49134907
4914- if ( e . originalEvent . wheelDelta / 120 > 0 )
4915- reading . zoomIn ( ) ;
4916- else
4917- reading . zoomOut ( ) ;
4918- }
4919- else
4920- {
4921- if ( reading . scrollNextOrPrevComic ( e . originalEvent . wheelDelta / 120 > 0 , true ) )
4922- e . preventDefault ( ) ;
4923- }
4908+ if ( readingViewIs ( 'scroll' ) && ! oEvent . altKey && ! oEvent . metaKey && ! oEvent . ctrlKey && ! oEvent . shiftKey && reading . scrollNextOrPrevComic ( oEvent . wheelDelta / 120 > 0 , true ) )
4909+ event . preventDefault ( ) ;
49244910 }
49254911
49264912 } ) ;
0 commit comments