Prevented author tooltip show when hovering message in log
Also simplified code & updated in-code docs
This commit is contained in:
parent
c674f1fc1e
commit
c2f28a460d
@ -6,6 +6,7 @@ import androidx.compose.foundation.*
|
|||||||
import androidx.compose.foundation.gestures.Orientation
|
import androidx.compose.foundation.gestures.Orientation
|
||||||
import androidx.compose.foundation.gestures.draggable
|
import androidx.compose.foundation.gestures.draggable
|
||||||
import androidx.compose.foundation.gestures.rememberDraggableState
|
import androidx.compose.foundation.gestures.rememberDraggableState
|
||||||
|
import androidx.compose.foundation.interaction.MutableInteractionSource
|
||||||
import androidx.compose.foundation.layout.*
|
import androidx.compose.foundation.layout.*
|
||||||
import androidx.compose.foundation.lazy.LazyListState
|
import androidx.compose.foundation.lazy.LazyListState
|
||||||
import androidx.compose.foundation.lazy.items
|
import androidx.compose.foundation.lazy.items
|
||||||
@ -197,26 +198,23 @@ private fun LogLoaded(
|
|||||||
)
|
)
|
||||||
|
|
||||||
Box {
|
Box {
|
||||||
|
|
||||||
|
// This Box is only used to get a scroll state. With this scroll state we will manually add an offset in
|
||||||
|
// the messages list
|
||||||
Box(
|
Box(
|
||||||
Modifier
|
Modifier
|
||||||
.width(graphWidth)
|
.width(graphWidth)
|
||||||
.fillMaxHeight()
|
.fillMaxHeight()
|
||||||
) {
|
|
||||||
Box(
|
|
||||||
modifier = Modifier
|
|
||||||
.fillMaxSize()
|
|
||||||
.horizontalScroll(horizontalScrollState)
|
.horizontalScroll(horizontalScrollState)
|
||||||
.padding(bottom = 8.dp)
|
.padding(bottom = 8.dp)
|
||||||
) {
|
) {
|
||||||
|
// The content has to be bigger in order to show the scroll bar in the parent component
|
||||||
Box(
|
Box(
|
||||||
modifier = Modifier.width(graphRealWidth)
|
modifier = Modifier.width(graphRealWidth)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// The commits' messages list overlaps with the graph list to catch all the click events but leaves
|
CommitsList(
|
||||||
// a padding, so it doesn't cover the graph
|
|
||||||
MessagesList(
|
|
||||||
scrollState = verticalScrollState,
|
scrollState = verticalScrollState,
|
||||||
horizontalScrollState = horizontalScrollState,
|
horizontalScrollState = horizontalScrollState,
|
||||||
hasUncommittedChanges = hasUncommittedChanges,
|
hasUncommittedChanges = hasUncommittedChanges,
|
||||||
@ -426,7 +424,7 @@ fun SearchFilter(
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun MessagesList(
|
fun CommitsList(
|
||||||
scrollState: LazyListState,
|
scrollState: LazyListState,
|
||||||
hasUncommittedChanges: Boolean,
|
hasUncommittedChanges: Boolean,
|
||||||
searchFilter: List<GraphNode>?,
|
searchFilter: List<GraphNode>?,
|
||||||
@ -729,7 +727,7 @@ fun SummaryEntry(
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun CommitLine(
|
private fun CommitLine(
|
||||||
graphWidth: Dp,
|
graphWidth: Dp,
|
||||||
logViewModel: LogViewModel,
|
logViewModel: LogViewModel,
|
||||||
graphNode: GraphNode,
|
graphNode: GraphNode,
|
||||||
@ -787,7 +785,7 @@ fun CommitLine(
|
|||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.offset(-horizontalScrollState.value.dp)
|
.offset(-horizontalScrollState.value.dp)
|
||||||
) {
|
) {
|
||||||
CommitsGraphLine(
|
CommitsGraph(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxHeight(),
|
.fillMaxHeight(),
|
||||||
plotCommit = graphNode,
|
plotCommit = graphNode,
|
||||||
@ -858,7 +856,11 @@ fun CommitMessage(
|
|||||||
onChangeDefaultUpstreamBranch: (ref: Ref) -> Unit,
|
onChangeDefaultUpstreamBranch: (ref: Ref) -> Unit,
|
||||||
) {
|
) {
|
||||||
Row(
|
Row(
|
||||||
modifier = Modifier.fillMaxSize(),
|
modifier = Modifier.fillMaxSize()
|
||||||
|
.hoverable(
|
||||||
|
// This modifier is added just to prevent committer tooltip is shown then it is underneath this message
|
||||||
|
remember { MutableInteractionSource() },
|
||||||
|
),
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
) {
|
) {
|
||||||
Row(
|
Row(
|
||||||
@ -951,7 +953,7 @@ fun SimpleDividerLog(modifier: Modifier) {
|
|||||||
|
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun CommitsGraphLine(
|
fun CommitsGraph(
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
plotCommit: GraphNode,
|
plotCommit: GraphNode,
|
||||||
nodeColor: Color,
|
nodeColor: Color,
|
||||||
|
Loading…
Reference in New Issue
Block a user