(animation = true, index = false, apply = true, center = true, delayed = false)
| 2430 | |
| 2431 | // Reset zoom or show in original size if is current in 1 scale |
| 2432 | function resetZoom(animation = true, index = false, apply = true, center = true, delayed = false) |
| 2433 | { |
| 2434 | var animationDurationS = ((animation) ? _config.readingViewSpeed : 0); |
| 2435 | |
| 2436 | if(currentScale == 1) // Show current image in original size |
| 2437 | { |
| 2438 | let _image = imagesDistribution[currentIndex - 1][0]; |
| 2439 | if(_image.folder || _image.blank) _image = imagesDistribution[currentIndex - 1][1] || false; |
| 2440 | |
| 2441 | if(_image && !_image.folder && !_image.blank) |
| 2442 | { |
| 2443 | let image = imagesData[_image.index] || []; |
| 2444 | let img = template._contentRight().querySelector('.r-img-i'+_image.index+' oc-img'); |
| 2445 | |
| 2446 | if(img) |
| 2447 | { |
| 2448 | if(zoomMoveData.active) |
| 2449 | return; |
| 2450 | |
| 2451 | let width = +img.dataset.width; |
| 2452 | let height = +img.dataset.height; |
| 2453 | |
| 2454 | currentScale = ((image.width / width + image.height / height) / 2) / window.devicePixelRatio; |
| 2455 | |
| 2456 | if(apply) |
| 2457 | applyScale(animation, currentScale, center, (currentScale < 1) ? true : false); |
| 2458 | |
| 2459 | let _img = img.querySelector('img'); |
| 2460 | if(_img) _img.classList.add('zoomOriginalSize'); |
| 2461 | |
| 2462 | return; |
| 2463 | } |
| 2464 | } |
| 2465 | } |
| 2466 | |
| 2467 | currentScale = 1; |
| 2468 | |
| 2469 | if(apply) |
| 2470 | { |
| 2471 | if(config.readingGlobalZoom && readingViewIs('scroll')) |
| 2472 | { |
| 2473 | applyScale(animation, currentScale, true); |
| 2474 | } |
| 2475 | else |
| 2476 | { |
| 2477 | applyScale(animation, currentScale, true, false, delayed); |
| 2478 | |
| 2479 | originalRect = false; |
| 2480 | scalePrevData = {tranX: 0, tranX2: 0, tranY: 0, tranY2: 0, scale: 1, scrollTop: 0}; |
| 2481 | haveZoom = false; |
| 2482 | zoomMoveData.active = false; |
| 2483 | currentZoomIndex = false; |
| 2484 | |
| 2485 | render.setScale(1, ((config.readingGlobalZoom && readingViewIs('scroll')) || (config.readingGlobalZoomSlide && !readingViewIs('scroll'))), doublePage.active()); |
| 2486 | } |
| 2487 | } |
| 2488 | } |
| 2489 |
nothing calls this directly
no test coverage detected