Feature/highlighter snap (#48)

* perf: fix Home and Library screen stutter by removing main thread file checks

* feat(pdf): implement straight-line highlighter snap

- Added "Straight Line" toggle to highlighter settings popup with persistent state.
- Implemented "rubber-band" drawing effect for highlighters with cardinal direction snapping (0°, 90°, 180°, 270°).
- Optimized gesture loops in Vertical and Paginated readers to respond instantly to setting toggles.
- Rewrote eraser hit detection using point-to-line segment distance math for pixel-perfect erasure of straight lines.
This commit is contained in:
Aryan 2026-03-08 20:19:59 +05:30 committed by GitHub
parent 6ea414c9b2
commit 8c7c8cb48e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 203 additions and 61 deletions

View file

@ -1044,7 +1044,7 @@ private fun ShelfCover(shelf: Shelf) {
) {
if (booksForCovers.size <= 1) {
val imageModel = remember(shelf.topBook?.coverImagePath) {
shelf.topBook?.coverImagePath?.let { File(it) }?.takeIf { it.exists() } ?: placeholder
shelf.topBook?.coverImagePath?.let { File(it) } ?: placeholder
}
AsyncImage(
model = ImageRequest.Builder(context)
@ -1067,7 +1067,7 @@ private fun ShelfCover(shelf: Shelf) {
) {
booksForCovers.forEachIndexed { index, book ->
val imageModel = remember(book.coverImagePath) {
book.coverImagePath?.let { File(it) }?.takeIf { it.exists() } ?: placeholder
book.coverImagePath?.let { File(it) } ?: placeholder
}
Surface(
shape = MaterialTheme.shapes.small,
@ -1160,7 +1160,7 @@ private fun LibraryListItem(
FileType.EPUB, FileType.MOBI, FileType.MD, FileType.TXT, FileType.HTML -> R.drawable.epub_placeholder
}
val imageModel = remember(item.coverImagePath) {
item.coverImagePath?.let { File(it) }?.takeIf { it.exists() } ?: placeholder
item.coverImagePath?.let { File(it) } ?: placeholder
}
Surface(