Underline : first fix for discontinued lines
This commit is contained in:
parent
23a628a8bb
commit
c619485bb6
1 changed files with 13 additions and 3 deletions
|
|
@ -230,6 +230,7 @@ fun TimeUnitComposable(
|
|||
gridColumnCount: Int
|
||||
) {
|
||||
val col = if (tuo.getNum() % 2 == 0) Color(0xff, 0xfa, 0xf7) else Color(0xfb, 0xf3, 0xff)
|
||||
val currentDensity = LocalDensity.current
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.background(col)
|
||||
|
|
@ -339,14 +340,23 @@ fun TimeUnitComposable(
|
|||
var textLayoutResult: TextLayoutResult? by remember { mutableStateOf(null) }
|
||||
Box (modifier = Modifier.fillMaxWidth()
|
||||
.drawBehind {
|
||||
tuo.annotations().mapNotNull { ta ->
|
||||
ta.underlineSpec.mapNotNull { us ->
|
||||
tuo.annotations().map { ta ->
|
||||
ta.underlineSpec.map { us ->
|
||||
var xStart = 0f
|
||||
val separatorLength = if (tuo.sep0 in listOf(":", "!")) 1 else 0
|
||||
val leftMarginUnderlineDp = when (tuo.sep0) {
|
||||
"/" -> 8.dp
|
||||
"|" -> 5.dp
|
||||
else -> 0.dp
|
||||
}
|
||||
val leftMarginUnderline = with(currentDensity) {
|
||||
leftMarginUnderlineDp.toPx()
|
||||
}
|
||||
if (us.x > -1) {
|
||||
val lineGlobalStartOffset = textLayoutResult?.getLineStart(ta.voiceNumber - 1) ?: 0
|
||||
val globalStartIndex = lineGlobalStartOffset + us.x + separatorLength
|
||||
val globalStartIndex = lineGlobalStartOffset + us.x
|
||||
xStart = textLayoutResult?.getCursorRect(globalStartIndex)?.left ?: 0f
|
||||
xStart -= leftMarginUnderline
|
||||
}
|
||||
var xEnd = size.width
|
||||
if (us.y > -1 ) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue