Abort dynamic color extraction on manga page leave
The in-flight image request updated the theme regardless of if the manga page was still opened or not
This commit is contained in:
@@ -33,6 +33,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
|||||||
- (**Browse**) Fix incorrectly showing "local source" source in the source language filter (the local source can't be disabled)
|
- (**Browse**) Fix incorrectly showing "local source" source in the source language filter (the local source can't be disabled)
|
||||||
- (**Reader**) Fix page shift when toggling the "offset double spreads" setting (currently: enable: shift to the right; disable: shift to the left – now: inverted)
|
- (**Reader**) Fix page shift when toggling the "offset double spreads" setting (currently: enable: shift to the right; disable: shift to the left – now: inverted)
|
||||||
- (**Reader**) Fix "auto webtoon mode" detection for manga source languages other than english and the current selected language
|
- (**Reader**) Fix "auto webtoon mode" detection for manga source languages other than english and the current selected language
|
||||||
|
- (**Manga**) Fix dynamic manga page color theme not getting reset after leaving the manga page
|
||||||
|
|
||||||
## [20251230.01] (r2937) - 2025-12-30
|
## [20251230.01] (r2937) - 2025-12-30
|
||||||
|
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ export const Thumbnail = ({
|
|||||||
return () => {};
|
return () => {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let aborted = false;
|
||||||
let imageRequest: ImageRequest = {
|
let imageRequest: ImageRequest = {
|
||||||
response: Promise.resolve(''),
|
response: Promise.resolve(''),
|
||||||
cleanup: noOp,
|
cleanup: noOp,
|
||||||
@@ -55,11 +56,15 @@ export const Thumbnail = ({
|
|||||||
imageRequest = await requestManager.requestImage(url);
|
imageRequest = await requestManager.requestImage(url);
|
||||||
const image = await imageRequest.response;
|
const image = await imageRequest.response;
|
||||||
|
|
||||||
|
if (aborted) {return;}
|
||||||
|
|
||||||
const img = new Image();
|
const img = new Image();
|
||||||
img.crossOrigin = 'anonymous';
|
img.crossOrigin = 'anonymous';
|
||||||
img.src = image;
|
img.src = image;
|
||||||
|
|
||||||
img.onload = () => {
|
img.onload = () => {
|
||||||
|
if (aborted) {return;}
|
||||||
|
|
||||||
const isLargeImage = img.width > 600 && img.height > 900;
|
const isLargeImage = img.width > 600 && img.height > 900;
|
||||||
|
|
||||||
Promise.all([
|
Promise.all([
|
||||||
@@ -73,6 +78,8 @@ export const Thumbnail = ({
|
|||||||
],
|
],
|
||||||
}),
|
}),
|
||||||
]).then(([palette, averageColor]) => {
|
]).then(([palette, averageColor]) => {
|
||||||
|
if (aborted) {return;}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
!palette.Vibrant ||
|
!palette.Vibrant ||
|
||||||
!palette.DarkVibrant ||
|
!palette.DarkVibrant ||
|
||||||
@@ -95,6 +102,8 @@ export const Thumbnail = ({
|
|||||||
fetchImage().catch(() => {});
|
fetchImage().catch(() => {});
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
|
aborted = true;
|
||||||
|
imageRequest.abortRequest();
|
||||||
imageRequest.cleanup();
|
imageRequest.cleanup();
|
||||||
setDynamicColor(null);
|
setDynamicColor(null);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user