package link.roadio.riff.ui /** * Round cumulative column edges, not each width: independent rounding squeezes the last key. * AI-INTENT: Reserve the rounded physical gaps first; a spanning key includes its internal gaps. * https://wiki.271.pics/Riff/LATEST/player-az-navigation#progressive-a-z-matching-and-automatic-completion */ internal fun azColumnWidths( rowWidthPx: Int, columns: Int, gapPx: Int, ): IntArray { require(columns > 0 && gapPx >= 0) val available = rowWidthPx.toLong() - gapPx.toLong() * (columns - 1) require(available >= 0) fun edge(index: Int) = (available * index + columns / 2) / columns return IntArray(columns) { (edge(it + 1) - edge(it)).toInt() } }