From f48a327a3350e65c3214794cc7e7a508ae94755d Mon Sep 17 00:00:00 2001 From: luciano Date: Wed, 22 Jul 2026 21:24:56 +0200 Subject: [PATCH] =?UTF-8?q?fix(ui):=20in=20modalit=C3=A0=20Spartito=20lo?= =?UTF-8?q?=20spartito=20assorbe=20lo=20spazio=20residuo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Gli Spacer elastici che centravano il contenuto collassano in FULL (si dividevano lo spazio col pentagramma lasciandogli un terzo); il viewport si aggancia a righi interi per non tagliare un rigo a metà. Co-Authored-By: Claude Fable 5 --- .../com/notemusicali/ui/components/StaffFullView.kt | 8 ++++++-- .../com/notemusicali/ui/practice/PracticeScreen.kt | 12 ++++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) 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)) + } } } }