Skip to content

Commit d851178

Browse files
committed
Fix: Cancelling prev/next chapter breaks the magnifier tool
1 parent 3c20d94 commit d851178

2 files changed

Lines changed: 24 additions & 13 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
44

55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## v1.6.5 (dd-mm-yyyy)
8+
9+
##### 🐛 Bug Fixes
10+
11+
- Cancelling prev/next chapter breaks the magnifier tool
12+
713
## [v1.6.4] (https://github.com/ollm/OpenComic/releases/tag/v1.6.4) (11-10-2025)
814

915
##### 🐛 Bug Fixes

‎scripts/reading.js‎

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1820,7 +1820,7 @@ function rightClick(e)
18201820
return false;
18211821
}
18221822

1823-
var showComicSkip;
1823+
var showComicSkip = false;
18241824

18251825
//Begins to show the next comic
18261826
function showNextComic(mode, animation = true, invert = false)
@@ -1849,7 +1849,7 @@ function showNextComic(mode, animation = true, invert = false)
18491849

18501850
var scale = ((contentHeight - 132) / contentHeight);
18511851

1852-
template.contentRight('.reading-body, .reading-lens > div').css({
1852+
template.contentRight('.reading-body').css({
18531853
'transform-origin': 'center '+(template.contentRight('.reading-body').height() - contentHeight)+'px',
18541854
'transition': 'transform '+((animation) ? transition : 0)+'s, background-color 0.2s, box-shadow 0.2s',
18551855
'transition-property': 'transform',
@@ -1868,7 +1868,7 @@ function showNextComic(mode, animation = true, invert = false)
18681868

18691869
var scale = ((contentWidth - 132) / contentWidth);
18701870

1871-
template.contentRight('.reading-body > div, .reading-lens > div > div').css({
1871+
template.contentRight('.reading-body > div').css({
18721872
'transform-origin': '0px center',
18731873
'transition': 'transform '+((animation) ? transition : 0)+'s, background-color 0.2s, box-shadow 0.2s',
18741874
'transition-property': 'transform',
@@ -1896,7 +1896,7 @@ function showNextComic(mode, animation = true, invert = false)
18961896
'opacity': 0,
18971897
});
18981898

1899-
template.contentRight('.reading-body, .reading-lens > div').css({
1899+
template.contentRight('.reading-body').css({
19001900
'transition': 'transform '+_config.readingViewSpeed+'s, background-color 0.2s, box-shadow 0.2s',
19011901
'transform': 'scale(1) translate(0px, 0px)',
19021902
});
@@ -1909,12 +1909,13 @@ function showNextComic(mode, animation = true, invert = false)
19091909
'opacity': 0,
19101910
});
19111911

1912-
template.contentRight('.reading-body > div, .reading-lens > div > div').css({
1912+
template.contentRight('.reading-body > div').css({
19131913
'transition': 'transform '+_config.readingViewSpeed+'s, background-color 0.2s, box-shadow 0.2s',
19141914
'transform': 'scale(1) translate(-'+(contentWidth * (readingViewIs('slide') ? (indexNum - 1) : 0))+'px, 0px)',
19151915
});
19161916
}
19171917

1918+
showComicSkip = setTimeout(function(){showComicSkip = false}, _config.readingViewSpeed * 1000);
19181919
currentIndex = indexNum;
19191920
}
19201921
}
@@ -1946,7 +1947,7 @@ function showPreviousComic(mode, animation = true, invert = false)
19461947

19471948
var scale = ((contentHeight - 132) / contentHeight);
19481949

1949-
template.contentRight('.reading-body, .reading-lens > div').css({
1950+
template.contentRight('.reading-body').css({
19501951
'transform-origin': 'center '+contentHeight+'px',
19511952
'transition': 'transform '+((animation) ? transition : 0)+'s, background-color 0.2s, box-shadow 0.2s',
19521953
'transition-property': 'transform',
@@ -1965,7 +1966,7 @@ function showPreviousComic(mode, animation = true, invert = false)
19651966

19661967
var scale = ((contentWidth - 132) / contentWidth);
19671968

1968-
template.contentRight('.reading-body, .reading-lens > div').css({
1969+
template.contentRight('.reading-body').css({
19691970
'transform-origin': contentWidth+'px center',
19701971
'transition': 'transform '+((animation) ? transition : 0)+'s, background-color 0.2s, box-shadow 0.2s',
19711972
'transition-property': 'transform',
@@ -1995,7 +1996,7 @@ function showPreviousComic(mode, animation = true, invert = false)
19951996
'opacity': 0,
19961997
});
19971998

1998-
template.contentRight('.reading-body, .reading-lens > div').css({
1999+
template.contentRight('.reading-body').css({
19992000
'transition': 'transform '+_config.readingViewSpeed+'s, background-color 0.2s, box-shadow 0.2s',
20002001
'transform': 'scale(1) translate(0px, 0px)',
20012002
});
@@ -2010,12 +2011,13 @@ function showPreviousComic(mode, animation = true, invert = false)
20102011
'opacity': 0,
20112012
});
20122013

2013-
template.contentRight('.reading-body, .reading-lens > div').css({
2014+
template.contentRight('.reading-body').css({
20142015
'transition': 'transform '+_config.readingViewSpeed+'s, background-color 0.2s, box-shadow 0.2s',
20152016
'transform': 'scale(1) translate(0px, 0px)',
20162017
});
20172018
}
20182019

2020+
showComicSkip = setTimeout(function(){showComicSkip = false}, _config.readingViewSpeed * 1000);
20192021
currentIndex = 1;
20202022
}
20212023
}
@@ -2842,7 +2844,7 @@ function magnifyingGlassControlPrev()
28422844
}
28432845

28442846
//Magnifying glass control
2845-
var magnifyingGlassControlST = false;
2847+
var magnifyingGlassControlST = false, prevMagnifyingGlassControlRect = false;
28462848

28472849
function magnifyingGlassControl(mode, event = false, lensData = false)
28482850
{
@@ -2874,7 +2876,8 @@ function magnifyingGlassControl(mode, event = false, lensData = false)
28742876
let top = (y - lensHeightM);
28752877
let left = (x - (lensWidth / 2));
28762878

2877-
let rect = contentRight.querySelector('.reading-body').getBoundingClientRect();
2879+
let rect = showComicSkip !== false && prevMagnifyingGlassControlRect ? prevMagnifyingGlassControlRect : contentRight.querySelector('.reading-body').getBoundingClientRect();
2880+
prevMagnifyingGlassControlRect = rect;
28782881

28792882
let topLens = y - rect.top - (lensHeightM / zoom);
28802883
let leftLens = x - rect.left - lensWidthM;
@@ -2889,7 +2892,9 @@ function magnifyingGlassControl(mode, event = false, lensData = false)
28892892
}).removeClass('d', 'h').addClass('a');
28902893

28912894
dom.this(contentRight).find('.reading-lens > div').css({
2892-
transform: ' scale('+zoom+') translate(' + (-(leftLens)) + 'px, ' + (-(topLens)) + 'px)'
2895+
transform: 'scale('+zoom+') translate(' + (-(leftLens)) + 'px, ' + (-(topLens)) + 'px)',
2896+
transformOrigin: '',
2897+
transition: '',
28932898
});
28942899

28952900
magnifyingGlassView = true;
@@ -5069,7 +5074,7 @@ var touchTimeout, mouseleave = {lens: false, body: false, window: false}, isMous
50695074
//It starts with the reading of a comic, events, argar images, counting images ...
50705075
async function read(path, index = 1, end = false, isCanvas = false, isEbook = false, imagePath = false)
50715076
{
5072-
images = {}, imagesData = {}, imagesDataClip = {}, imagesPath = {}, imagesNum = 0, contentNum = 0, imagesNumLoad = 0, currentIndex = index, foldersPosition = {}, currentScale = 1, currentZoomIndex = false, previousScrollTop = 0, scalePrevData = {tranX: 0, tranX2: 0, tranY: 0, tranY2: 0, scale: 1, scrollTop: 0}, originalRect = false, scrollInStart = false, scrollInEnd = false, prevChangeHeaderButtons = {}, trackingCurrent = false, pageRangeHistory = [];
5077+
images = {}, imagesData = {}, imagesDataClip = {}, imagesPath = {}, imagesNum = 0, contentNum = 0, imagesNumLoad = 0, currentIndex = index, foldersPosition = {}, currentScale = 1, currentZoomIndex = false, previousScrollTop = 0, scalePrevData = {tranX: 0, tranX2: 0, tranY: 0, tranY2: 0, scale: 1, scrollTop: 0}, originalRect = false, scrollInStart = false, scrollInEnd = false, prevChangeHeaderButtons = {}, trackingCurrent = false, pageRangeHistory = [], showComicSkip = false;
50735078

50745079
isLoaded = false;
50755080
magnifyingGlassPosition.mode = false;

0 commit comments

Comments
 (0)