mirror of
https://github.com/kodjodevf/mangayomi.git
synced 2026-01-11 22:40:36 +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;
|
||||
}
|
||||
|
||||
/// 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.
|
||||
String? _getChapterIdentifier(Chapter? chapter) {
|
||||
if (chapter == null) return null;
|
||||
|
|
|
|||
|
|
@ -86,6 +86,11 @@ mixin ReaderMemoryManagement {
|
|||
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.
|
||||
Future<void> disposePreloadManager() async {
|
||||
if (!_isPreloadManagerInitialized) return;
|
||||
|
|
|
|||
|
|
@ -1207,9 +1207,7 @@ class _MangaChapterPageGalleryState
|
|||
cropBordersProvider(data: pages[index], cropBorder: true).future,
|
||||
);
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
pages[index] = pages[index]..cropImage = value;
|
||||
});
|
||||
updatePageCropImage(index, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1225,9 +1223,7 @@ class _MangaChapterPageGalleryState
|
|||
cropBordersProvider(data: pages[i], cropBorder: true).future,
|
||||
);
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
pages[i] = pages[i]..cropImage = value;
|
||||
});
|
||||
updatePageCropImage(i, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue