(scale = 1, index = false)
| 2489 | |
| 2490 | // Fix blur on zoom cause by tranform scale, still happening in vertical reader in some conditions |
| 2491 | function fixBlurOnZoom(scale = 1, index = false) |
| 2492 | { |
| 2493 | const _scale = 1 / scale; |
| 2494 | |
| 2495 | const contentRight = template._contentRight(); |
| 2496 | const images = index !== false ? contentRight.querySelectorAll('.image-position'+index+' oc-img img') : contentRight.querySelectorAll('.r-img oc-img img'); |
| 2497 | |
| 2498 | for(let i = 0, len = images.length; i < len; i++) |
| 2499 | { |
| 2500 | const img = images[i]; |
| 2501 | const image = imagesData[+img.dataset.index] || []; |
| 2502 | |
| 2503 | const ocImg = img.parentElement; |
| 2504 | |
| 2505 | let width, height; |
| 2506 | |
| 2507 | width = +ocImg.dataset.width; |
| 2508 | height = +ocImg.dataset.height; |
| 2509 | |
| 2510 | width = Math.round(width * scale * window.devicePixelRatio); |
| 2511 | height = Math.round(height * scale * window.devicePixelRatio); |
| 2512 | |
| 2513 | width = (image?.rotated == 1 || image?.rotated == 2) ? height : width; |
| 2514 | height = (image?.rotated == 1 || image?.rotated == 2) ? width : height; |
| 2515 | |
| 2516 | img.style.width = (width / window.devicePixelRatio)+'px'; |
| 2517 | img.style.height = (height / window.devicePixelRatio)+'px'; |
| 2518 | |
| 2519 | if(img.classList.contains('blobRender') || img.classList.contains('zoomOriginalSize') || img.classList.contains('originalSize')) |
| 2520 | img.style.transform = 'scale('+_scale+') '+rotateImage(image?.rotated, 0.001, 0.001); |
| 2521 | else |
| 2522 | img.style.transform = 'scale('+_scale+') '+rotateImage(image?.rotated); |
| 2523 | } |
| 2524 | |
| 2525 | if(_scale == 1) |
| 2526 | return; |
| 2527 | |
| 2528 | window.requestAnimationFrame(function(){ |
| 2529 | |
| 2530 | window.requestAnimationFrame(function(){ |
| 2531 | |
| 2532 | for(let i = 0, len = images.length; i < len; i++) |
| 2533 | { |
| 2534 | const img = images[i]; |
| 2535 | const image = imagesData[+img.dataset.index] || []; |
| 2536 | |
| 2537 | const rect = img.getBoundingClientRect(); |
| 2538 | |
| 2539 | let left = -(rect.left - app.floorDPR(rect.left)); |
| 2540 | let top = -(rect.top - app.floorDPR(rect.top)); |
| 2541 | |
| 2542 | if(left < -0.5) left++; |
| 2543 | if(top < -0.5) top++; |
| 2544 | |
| 2545 | img.style.transform = 'scale('+_scale+') '+rotateImage(image?.rotated, left, top); |
| 2546 | } |
| 2547 | |
| 2548 | }); |
no test coverage detected