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

보드판 애니메이션 개선 #71

Merged
merged 4 commits into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
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 @@ -43,6 +43,7 @@ fun MissionBoardResponse.toModel() : MissionBoard {

fun MissionBoardMembersResponse.toModel() : MissionBoardMembers {
return MissionBoardMembers(
memberId = memberId,
nickname = nickname,
characterType = characterType.toModel()
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.goalpanzi.mission_mate.core.domain.mission.model
import com.goalpanzi.mission_mate.core.domain.common.model.user.CharacterType

data class MissionBoardMembers(
val memberId : Long,
val nickname : String,
val characterType : CharacterType = CharacterType.RABBIT
)
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import kotlinx.serialization.Serializable

@Serializable
data class MissionBoardMembersResponse(
//val memberId : Long,
val memberId : Long,
val nickname : String,
val characterType : CharacterTypeResponse = CharacterTypeResponse.RABBIT
)
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package com.goalpanzi.mission_mate.feature.board.component

import android.annotation.SuppressLint
import androidx.compose.animation.core.animateDpAsState
import androidx.compose.animation.core.tween
import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.LocalOverscrollConfiguration
import androidx.compose.foundation.ScrollState
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.BoxWithConstraints
Expand All @@ -19,7 +19,6 @@ import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.navigationBars
import androidx.compose.foundation.layout.navigationBarsPadding
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.statusBars
import androidx.compose.foundation.layout.statusBarsPadding
import androidx.compose.foundation.verticalScroll
Expand All @@ -29,6 +28,7 @@ import androidx.compose.material.pullrefresh.PullRefreshState
import androidx.compose.material.pullrefresh.pullRefresh
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.derivedStateOf
import androidx.compose.runtime.getValue
Expand Down Expand Up @@ -102,7 +102,7 @@ fun Board(
LaunchedEffect(myIndex) {
scrollState.animateScrollTo(
getPositionScrollToMyIndex(
myIndex = myIndex,
myIndex = if(myIndex in 3 .. 5) myIndex - 3 else myIndex,
numberOfColumns = numberOfColumns,
blockSize = (configuration.screenWidthDp - 48) / numberOfColumns,
localDensity = localDensity
Expand Down Expand Up @@ -176,33 +176,39 @@ fun Board(
modifier
)
}

if (isVisiblePieces) {
Column(
modifier = modifier.modifierWithClipRect(
scrollState = scrollState,
isVisiblePieces = isVisiblePieces,
innerModifier = Modifier
.drawWithContent {
clipRect(top = (size.height + navigationBarHeight.toPx() - bottomViewHeight.toPx() + 1.dp.toPx())) {
[email protected]()
}
}
.blur(10.dp, 10.dp)
)
) {
Spacer(modifier = Modifier.height(refreshingSpacerSize))
BoardContent(
missionBoards,
missionDetail,
numberOfColumns,
boardPieces,
profile,
missionState,
isVisiblePieces = isVisiblePieces,
onClickPassedBlock = onClickPassedBlock,
modifier
)
}
CompositionLocalProvider(
LocalOverscrollConfiguration provides null,
content = {
Column(
modifier = modifier.modifierWithClipRect(
scrollState = scrollState,
isVisiblePieces = isVisiblePieces,
innerModifier = Modifier
.drawWithContent {
clipRect(top = (size.height + navigationBarHeight.toPx() - bottomViewHeight.toPx() + 1.dp.toPx())) {
[email protected]()
}
}
.blur(10.dp, 10.dp)
)
) {
Spacer(modifier = Modifier.height(refreshingSpacerSize))
BoardContent(
missionBoards,
missionDetail,
numberOfColumns,
boardPieces,
profile,
missionState,
isVisiblePieces = isVisiblePieces,
onClickPassedBlock = onClickPassedBlock,
modifier
)
}
}
)
}
PullRefreshIndicator(
refreshing = isRefreshLoading,
Expand Down Expand Up @@ -285,7 +291,7 @@ fun ColumnScope.BoardContent(
}
if (isVisiblePieces) {
boardPieces.forEach { piece ->
key(piece.nickname) {
key(piece.memberId,piece.needToDraw) {
Piece(
boardPiece = piece,
sizePerBlock = width / numberOfColumns,
Expand Down
Loading
Loading