Modern Apps git

← Modern-Apps.git

wordmaker: draw the swipe trail above the letter tiles (#ux-audit)

Commit
ffb04db6ca0610028affd24484d02c157ecf3e71
Author
Vayun Mathur <[email protected]>
When
2026-11-13 01:17 UTC (23 days ago)
Parents
c49ab2b
Symptom: the line that follows a swipe was hard to see. The live
segment from the last letter to the finger disappeared whenever it
crossed a tile, and the whole trail was dimmed by the translucent
wheel backdrop.

Root cause: the trail Canvas was the first child of the wheel box, so
the backdrop circle (secondaryContainer at 50% alpha) and every letter
tile were painted over it.

Fix: the Canvas is now the last child of the wheel's tile container,
so it paints after the backdrop and the tiles. The Canvas has no
pointer input, so it does not intercept the tile taps used by
tap-to-spell; drag handling stays on the container.

User-visible effect: the trail is drawn at full strength between
letters and the segment to the finger stays visible over unselected
tiles. Over selected tiles it is the same primary colour as the tile,
so it reads as one connected stroke.

Verification: draw order only - no behavioural unit test is
practical (Robolectric does not render Canvas output by default);
existing gesture tests still exercise the trail state. On-device
check listed in the report.

Diff

games/wordmaker/src/main/java/com/vayunmathur/games/wordmaker/ui/components/LetterChooser.kt
diff --git a/games/wordmaker/src/main/java/com/vayunmathur/games/wordmaker/ui/components/LetterChooser.kt b/games/wordmaker/src/main/java/com/vayunmathur/games/wordmaker/ui/components/LetterChooser.ktindex 0e0edc87f0..5b1a406308 100644--- a/games/wordmaker/src/main/java/com/vayunmathur/games/wordmaker/ui/components/LetterChooser.kt+++ b/games/wordmaker/src/main/java/com/vayunmathur/games/wordmaker/ui/components/LetterChooser.kt@@ -226,18 +226,6 @@ fun LetterChooser(                         },                     contentAlignment = Alignment.Center                 ) {-                    val primaryColor = MaterialTheme.colorScheme.primary-                    Canvas(modifier = Modifier.fillMaxSize()) {-                        val centers = geometry.centers-                        selectedLettersIndices.zipWithNext { a, b ->-                            drawLine(primaryColor, centers[a], centers[b], 10f, cap = StrokeCap.Round)-                        }-                        val lastLetter = selectedLettersIndices.lastOrNull()-                        val dragPosition = currentDragPosition-                        if (lastLetter != null && dragPosition != null) {-                            drawLine(primaryColor, centers[lastLetter], dragPosition, 10f, cap = StrokeCap.Round)-                        }-                    }                     Surface(                         Modifier.fillMaxSize(0.9f),                         CircleShape,@@ -273,6 +261,21 @@ fun LetterChooser(                             )                         }                     }++                    // The trail goes on top of the tiles: drawn first, it vanished under them and+                    // under the wheel backdrop, so the live segment to the finger was hidden.+                    val primaryColor = MaterialTheme.colorScheme.primary+                    Canvas(modifier = Modifier.fillMaxSize()) {+                        val centers = geometry.centers+                        selectedLettersIndices.zipWithNext { a, b ->+                            drawLine(primaryColor, centers[a], centers[b], 10f, cap = StrokeCap.Round)+                        }+                        val lastLetter = selectedLettersIndices.lastOrNull()+                        val dragPosition = currentDragPosition+                        if (lastLetter != null && dragPosition != null) {+                            drawLine(primaryColor, centers[lastLetter], dragPosition, 10f, cap = StrokeCap.Round)+                        }+                    }                 }             }             Column(