-
Notifications
You must be signed in to change notification settings - Fork 3
[REFACTOR] 모임방 생성화면 책 선택 수정, Dialog 팝업 구현 #151
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
base: develop
Are you sure you want to change the base?
Changes from all commits
bc500ca
ae4a546
3233a9e
f10150d
34f50ad
fe231e0
fbfb443
aee09b5
b0c1505
1bedd40
39e96f4
01f35db
18530c5
a52cb8d
2ed3600
9d41493
c215909
5c58a6d
a4814ab
75f23b0
8b215a5
a106650
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,14 +1,13 @@ | ||
| package com.texthip.thip.ui.common.modal | ||
|
|
||
| import androidx.compose.foundation.ScrollState | ||
| import androidx.compose.runtime.Composable | ||
| import androidx.compose.foundation.lazy.LazyListState | ||
| import androidx.compose.ui.Modifier | ||
| import androidx.compose.ui.draw.drawBehind | ||
| import androidx.compose.ui.geometry.CornerRadius | ||
| import androidx.compose.ui.geometry.Offset | ||
| import androidx.compose.ui.geometry.Size | ||
| import androidx.compose.ui.graphics.Color | ||
| import androidx.compose.ui.tooling.preview.Preview | ||
| import androidx.compose.ui.unit.Dp | ||
| import androidx.compose.ui.unit.dp | ||
|
|
||
|
|
@@ -26,6 +25,62 @@ fun Modifier.drawVerticalScrollbar( | |
| val scrollProgress = scrollState.value.toFloat() / scrollState.maxValue | ||
| val scrollbarOffsetY = (size.height - scrollbarHeight) * scrollProgress | ||
|
|
||
| //전체 고정 바 | ||
| drawRoundRect( | ||
| color = trackColor, | ||
| topLeft = Offset(x = size.width - trackThickness.toPx(), y = 0f), | ||
| size = Size(trackThickness.toPx(), size.height), | ||
| cornerRadius = CornerRadius(trackThickness.toPx() / 2) | ||
| ) | ||
| //핸들 바 | ||
| drawRoundRect( | ||
| color = thumbColor, | ||
| topLeft = Offset(x = size.width - thumbThickness.toPx(), y = scrollbarOffsetY), | ||
| size = Size(thumbThickness.toPx(), scrollbarHeight), | ||
| cornerRadius = CornerRadius(thumbThickness.toPx() / 2) | ||
| ) | ||
| } | ||
| ) | ||
|
|
||
| fun Modifier.drawVerticalScrollbar( | ||
| lazyListState: LazyListState, | ||
| trackThickness: Dp = 1.dp, | ||
| thumbThickness: Dp = 3.dp, | ||
| trackColor: Color = Color.White.copy(alpha = 0.2f), | ||
| thumbColor: Color = Color.White.copy(alpha = 0.8f), | ||
| ): Modifier = this.then( | ||
| Modifier.drawBehind { | ||
| val layoutInfo = lazyListState.layoutInfo | ||
| val totalItemsCount = layoutInfo.totalItemsCount | ||
| val viewportHeight = layoutInfo.viewportEndOffset - layoutInfo.viewportStartOffset | ||
|
|
||
| // 스크롤이 필요 없으면 스크롤바 표시 안 함 | ||
| if (totalItemsCount == 0) return@drawBehind | ||
| if (!lazyListState.canScrollForward && !lazyListState.canScrollBackward) return@drawBehind | ||
|
|
||
| val scrollbarHeight = size.height / 8f | ||
|
|
||
| // 전체 컨텐츠 높이 추정 | ||
| val averageItemHeight = if (layoutInfo.visibleItemsInfo.isNotEmpty()) { | ||
| layoutInfo.visibleItemsInfo.map { it.size }.average().toFloat() | ||
| } else { | ||
| 100f | ||
| } | ||
|
Comment on lines
+64
to
+68
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion | 🟠 Major 🧩 Analysis chain평균 아이템 높이 계산이 이질적인 리스트에서 부정확할 수 있습니다. 현재 구현은 표시되는 아이템들의 평균 높이를 사용하여 전체 컨텐츠 높이를 추정합니다. 아이템 크기가 크게 다를 경우 스크롤바 위치가 부정확해질 수 있습니다. 또한 fallback 값 이 컴포넌트가 크기가 균일한 아이템 리스트에서만 사용되는지 확인하세요: 🏁 Script executed: #!/bin/bash
# drawVerticalScrollbar(LazyListState) 사용처 확인
rg -nP --type=kotlin -C10 'drawVerticalScrollbar\s*\(\s*\w+\s*:\s*LazyListState'Length of output: 0 검증을 위해 더 광범위한 코드베이스 검색이 필요합니다. Length of output: 0 🏁 Script executed: #!/bin/bash
# drawVerticalScrollbar 함수의 모든 호출처 검색
rg -nP --type=kotlin 'drawVerticalScrollbar\s*\(' -B 5 -A 2Length of output: 3398 🏁 Script executed: #!/bin/bash
# ScrollbarUtil.kt 파일 전체 내용 확인
fd -t f 'ScrollbarUtil\.kt' --exec cat {}Length of output: 3756 추가 검증을 위해 실제 사용 사례를 확인하겠습니다. Length of output: 3464 🏁 Script executed: #!/bin/bash
# GroupBookListWithScrollbar의 컴포지션 호출처 검색
rg -nP --type=kotlin 'GroupBookListWithScrollbar\s*\(' -B 3 -A 3Length of output: 4887 LazyListState 버전 스크롤바 위치 계산을 개선해야 합니다. 현재 구현( 더 정확한 스크롤 위치 계산을 위해 다음을 고려해야 합니다:
🤖 Prompt for AI Agents |
||
| val estimatedTotalHeight = averageItemHeight * totalItemsCount | ||
|
|
||
| // 스크롤 진행률 계산 | ||
| val firstVisibleIndex = lazyListState.firstVisibleItemIndex.toFloat() | ||
| val firstVisibleOffset = lazyListState.firstVisibleItemScrollOffset.toFloat() | ||
|
|
||
| val scrollProgress = if (estimatedTotalHeight > 0) { | ||
| ((firstVisibleIndex * averageItemHeight + firstVisibleOffset) / estimatedTotalHeight) | ||
| .coerceIn(0f, 1f) | ||
| } else { | ||
| 0f | ||
| } | ||
|
|
||
| val scrollbarOffsetY = (size.height - scrollbarHeight) * scrollProgress | ||
|
|
||
| //전체 고정 바 | ||
| drawRoundRect( | ||
| color = trackColor, | ||
|
|
||
This comment was marked as resolved.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.