Skip to content

Commit

Permalink
feat: Make fontsize controls more granular
Browse files Browse the repository at this point in the history
Signed-off-by: starry-shivam <[email protected]>
  • Loading branch information
starry-shivam committed Oct 10, 2024
1 parent fbd93b2 commit 0c5b06f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ private fun ChapterLazyItemItem(
val paragraphs = remember { chunkText(chapter.body) }

val targetFontSize = remember(state.fontSize) {
(state.fontSize / 10) * 1.8f
(state.fontSize / 5) * 0.9f
}

val fontSize by animateFloatAsState(
Expand All @@ -103,7 +103,7 @@ private fun ChapterLazyItemItem(
label = "fontSize"
)
val titleFontSize by animateFloatAsState(
targetValue = targetFontSize * 1.4f,
targetValue = targetFontSize * 1.35f,
animationSpec = tween(durationMillis = 300),
label = "titleFontSize"
)
Expand Down Expand Up @@ -202,7 +202,7 @@ private fun ChapterLazyItemItem(
modifier = Modifier.padding(start = 12.dp, end = 4.dp, top = 10.dp),
text = chapter.title,
fontSize = titleFontSize.sp,
lineHeight = 32.sp,
lineHeight = 1.3f.em,
fontFamily = pacificoFont,
fontWeight = FontWeight.Medium,
color = MaterialTheme.colorScheme.onBackground.copy(alpha = 0.88f)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,8 @@ private fun ReaderTextScaleButton(
val context = LocalContext.current
val (iconRes, adjustment) = remember(buttonType) {
when (buttonType) {
TextScaleButtonType.DECREASE -> Pair(R.drawable.ic_reader_text_minus, -10)
TextScaleButtonType.INCREASE -> Pair(R.drawable.ic_reader_text_plus, 10)
TextScaleButtonType.DECREASE -> Pair(R.drawable.ic_reader_text_minus, -5)
TextScaleButtonType.INCREASE -> Pair(R.drawable.ic_reader_text_plus, 5)
}
}

Expand Down

0 comments on commit 0c5b06f

Please sign in to comment.