diff --git a/shared/src/commonMain/kotlin/com/notemusicali/ui/components/StaffFullView.kt b/shared/src/commonMain/kotlin/com/notemusicali/ui/components/StaffFullView.kt index 29feaa1..691240c 100644 --- a/shared/src/commonMain/kotlin/com/notemusicali/ui/components/StaffFullView.kt +++ b/shared/src/commonMain/kotlin/com/notemusicali/ui/components/StaffFullView.kt @@ -70,9 +70,13 @@ fun StaffFullView( } // Con un vincolo di altezza dal contenitore (es. weight in Pratica) il - // viewport si adatta alla finestra; altrimenti vale il tetto di default + // viewport si adatta alla finestra; altrimenti vale il tetto di default. + // L'altezza si aggancia a righi interi per non tagliare un rigo a metà. val heightBound = if (this.maxHeight != Dp.Infinity) this.maxHeight else maxVisibleHeight - val viewportHeightDp = if (totalHeightDp < heightBound) totalHeightDp else heightBound + val stride = systemHeightDp + systemGapDp + val wholeSystems = ((heightBound + systemGapDp) / stride).toInt().coerceAtLeast(1) + val snappedBound = stride * wholeSystems - systemGapDp + val viewportHeightDp = if (totalHeightDp < snappedBound) totalHeightDp else snappedBound Box( modifier = Modifier .fillMaxWidth() diff --git a/shared/src/commonMain/kotlin/com/notemusicali/ui/practice/PracticeScreen.kt b/shared/src/commonMain/kotlin/com/notemusicali/ui/practice/PracticeScreen.kt index 0104bc0..ff8e8e2 100644 --- a/shared/src/commonMain/kotlin/com/notemusicali/ui/practice/PracticeScreen.kt +++ b/shared/src/commonMain/kotlin/com/notemusicali/ui/practice/PracticeScreen.kt @@ -274,7 +274,11 @@ fun PracticeScreen( ) } - Spacer(modifier = Modifier.weight(1f)) + if (currentMode == StaffMode.FULL) { + Spacer(modifier = Modifier.height(8.dp)) + } else { + Spacer(modifier = Modifier.weight(1f)) + } // Staff display based on mode val staffBgMod = if (lightStaff) { @@ -390,7 +394,11 @@ fun PracticeScreen( } } - Spacer(modifier = Modifier.weight(1f)) + if (currentMode == StaffMode.FULL) { + Spacer(modifier = Modifier.height(8.dp)) + } else { + Spacer(modifier = Modifier.weight(1f)) + } } } }