balanceLabelDimensions

abstract val balanceLabelDimensions: Boolean

If true, labels will be measured with constraints that attempt to make their dimensions closer to square. This means long labels will be broken into multiple lines.

Samples

import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.runtime.Composable
import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.SolidColor
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.font.FontFamily
import androidx.compose.ui.unit.dp
import com.zachklipp.seqdiag.ArrowHeadType
import com.zachklipp.seqdiag.BasicSequenceDiagramStyle
import com.zachklipp.seqdiag.Label
import com.zachklipp.seqdiag.LineStyle
import com.zachklipp.seqdiag.Note
import com.zachklipp.seqdiag.SequenceDiagram
import com.zachklipp.seqdiag.arrowHeadType
import com.zachklipp.seqdiag.color
import com.zachklipp.seqdiag.createParticipant
import com.zachklipp.seqdiag.noteOver
fun main() { 
   //sampleStart 
   // By default, the layout algorithm tries to measure notes and labels that don't span multiple
// participants to make them closer to square by trying to balance their width vs their height.
SequenceDiagram(style = BasicSequenceDiagramStyle(balanceLabelDimensions = false)) {
    val alice = createParticipant { Note("Alice") }
    noteOver(alice) { Note("A note with long text that would be wrapped by default.") }
} 
   //sampleEnd
}

Sources

Link copied to clipboard