(animation = true, scale = 1, center = false, zoomOut = false, delayed = false)
| 2025 | var currentScale = 1, scalePrevData = {tranX: 0, tranX2: 0, tranY: 0, tranY2: 0, scale: 1, scrollTop: 0}, originalRect = false, originalRectReadingBody = false, originalRect2 = false, originalRectReadingBody2 = false, haveZoom = false, currentZoomIndex = false, applyScaleST = false, zoomingIn = false, prevAnime = false; |
| 2026 | |
| 2027 | function applyScale(animation = true, scale = 1, center = false, zoomOut = false, delayed = false) |
| 2028 | { |
| 2029 | let animationDurationS = ((animation) ? _config.readingViewSpeed : 0); |
| 2030 | |
| 2031 | if(currentZoomIndex === false) |
| 2032 | { |
| 2033 | if(center || !readingViewIs('scroll')) |
| 2034 | { |
| 2035 | currentZoomIndex = (currentIndex - 1); |
| 2036 | } |
| 2037 | else |
| 2038 | { |
| 2039 | let currentRect = template.contentRight('.image-position'+(currentIndex - 1)).get(0).getBoundingClientRect(); |
| 2040 | |
| 2041 | if(currentRect.top > currentPageXY.y && (currentIndex - 2) >= 0) |
| 2042 | { |
| 2043 | currentZoomIndex = (currentIndex - 2); |
| 2044 | } |
| 2045 | else if(currentRect.top + currentRect.height < currentPageXY.y && currentIndex <= indexNum) |
| 2046 | { |
| 2047 | currentZoomIndex = currentIndex; |
| 2048 | } |
| 2049 | else |
| 2050 | { |
| 2051 | currentZoomIndex = (currentIndex - 1); |
| 2052 | } |
| 2053 | } |
| 2054 | } |
| 2055 | |
| 2056 | let scrollTop = 0, translateX = 0, translateY = 0; |
| 2057 | |
| 2058 | if(scale != scalePrevData.scale) |
| 2059 | { |
| 2060 | if(scale == 1) |
| 2061 | template.barHeader('.button-reset-zoom').attr('hover-text', language.menu.view.originalSize).html('aspect_ratio'); |
| 2062 | else |
| 2063 | template.barHeader('.button-reset-zoom').attr('hover-text', language.menu.view.resetZoom).html('zoom_out_map'); |
| 2064 | |
| 2065 | let contentRight = template._contentRight(); |
| 2066 | |
| 2067 | contentRight.querySelector('.reading-body').classList.add('zooming'); |
| 2068 | dom.this(contentRight).find('img.zoomOriginalSize', true).removeClass('zoomOriginalSize'); |
| 2069 | if(scale == 1) dom.this(contentRight).find('img.zoomed', true).removeClass('zoomed'); |
| 2070 | |
| 2071 | let content = contentRight.firstElementChild; |
| 2072 | $(content).stop(true); |
| 2073 | |
| 2074 | clearTimeout(applyScaleST); |
| 2075 | |
| 2076 | if(config.readingGlobalZoom && readingViewIs('scroll')) |
| 2077 | { |
| 2078 | zoomingIn = true; |
| 2079 | disableOnScroll(true); |
| 2080 | |
| 2081 | if(originalRect === false) |
| 2082 | { |
| 2083 | originalRect = originalRect2 = contentRight.querySelector('.reading-body').getBoundingClientRect(); |
| 2084 | originalRectReadingBody = content.getBoundingClientRect(); |
no test coverage detected