mirror of
https://github.com/kodjodevf/mangayomi.git
synced 2026-05-16 13:12:40 +00:00
feat: add updatePageCropImage method for chapter page cropping
This commit is contained in:
parent
76645d97c1
commit
19a051b660
3 changed files with 15 additions and 6 deletions
|
|
@ -192,6 +192,14 @@ class ChapterPreloadManager {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Updates the cropImage for a page at the given index.
|
||||||
|
void updatePageCropImage(int index, Uint8List? cropImage) {
|
||||||
|
if (index >= 0 && index < _pages.length) {
|
||||||
|
_pages[index].cropImage = cropImage;
|
||||||
|
onPagesUpdated?.call();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Gets a unique identifier for a chapter.
|
/// Gets a unique identifier for a chapter.
|
||||||
String? _getChapterIdentifier(Chapter? chapter) {
|
String? _getChapterIdentifier(Chapter? chapter) {
|
||||||
if (chapter == null) return null;
|
if (chapter == null) return null;
|
||||||
|
|
|
||||||
|
|
@ -86,6 +86,11 @@ mixin ReaderMemoryManagement {
|
||||||
return _preloadManager.addLastChapterTransition(chapter);
|
return _preloadManager.addLastChapterTransition(chapter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Updates the cropImage for a page at the given index.
|
||||||
|
void updatePageCropImage(int index, Uint8List? cropImage) {
|
||||||
|
_preloadManager.updatePageCropImage(index, cropImage);
|
||||||
|
}
|
||||||
|
|
||||||
/// Disposes the preload manager and clears all cached data.
|
/// Disposes the preload manager and clears all cached data.
|
||||||
Future<void> disposePreloadManager() async {
|
Future<void> disposePreloadManager() async {
|
||||||
if (!_isPreloadManagerInitialized) return;
|
if (!_isPreloadManagerInitialized) return;
|
||||||
|
|
|
||||||
|
|
@ -1207,9 +1207,7 @@ class _MangaChapterPageGalleryState
|
||||||
cropBordersProvider(data: pages[index], cropBorder: true).future,
|
cropBordersProvider(data: pages[index], cropBorder: true).future,
|
||||||
);
|
);
|
||||||
if (mounted) {
|
if (mounted) {
|
||||||
setState(() {
|
updatePageCropImage(index, value);
|
||||||
pages[index] = pages[index]..cropImage = value;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1225,9 +1223,7 @@ class _MangaChapterPageGalleryState
|
||||||
cropBordersProvider(data: pages[i], cropBorder: true).future,
|
cropBordersProvider(data: pages[i], cropBorder: true).future,
|
||||||
);
|
);
|
||||||
if (mounted) {
|
if (mounted) {
|
||||||
setState(() {
|
updatePageCropImage(i, value);
|
||||||
pages[i] = pages[i]..cropImage = value;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue