Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

시간표 블록 그리기 로직 수정 #370

Merged
merged 2 commits into from
Oct 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ fun calculateAdjustedTextLayout(
repeat(idealMaxLines) { appendLine() }
}
}
if (textMeasurer.measure(fullRenderParagraph).multiParagraph.height <= maxHeight) {
if (textMeasurer.measure(fullRenderParagraph).multiParagraph.height < maxHeight) {
return cellInfoList.map {
AdjustedTextLayout(
it.text,
Expand All @@ -56,7 +56,7 @@ fun calculateAdjustedTextLayout(
repeat(idealMaxLines) { appendLine() }
}
}
if (textMeasurer.measure(minifiedRenderParagraph).multiParagraph.height <= maxHeight) {
if (textMeasurer.measure(minifiedRenderParagraph).multiParagraph.height < maxHeight) {
return cellInfoList.map {
AdjustedTextLayout(
it.text,
Expand All @@ -76,9 +76,11 @@ fun calculateAdjustedTextLayout(
if (textMeasurer.measure(allOneLineParagraph).multiParagraph.height > maxHeight) {
return cellInfoList.fold(emptyList<LectureCellInfo>()) { acc, current ->
val paragraph = buildAnnotatedString {
(acc + current).forEach {
(acc + current).forEachIndexed { idx, it ->
pushStyle(it.minifiedStyle.toSpanStyle())
appendLine()
if ((acc + current).lastIndex != idx) {
appendLine()
}
}
}
if (textMeasurer.measure(paragraph).multiParagraph.height < maxHeight) {
Expand Down Expand Up @@ -125,7 +127,7 @@ fun calculateAdjustedTextLayout(
appendLine()
}
},
).multiParagraph.height <= maxHeight
).multiParagraph.height < maxHeight
) {
currentMaxLines++
// 높이 제약이 없을 때의 라인 수에 도달하면, 더 라인 수를 늘려서 계산해 볼 필요가 없으니 break
Expand Down
Loading