scrollbar on wall-of-texts

This commit is contained in:
minjaesong
2023-09-17 01:43:19 +09:00
parent 259806e636
commit e87c061635
5 changed files with 161 additions and 43 deletions

View File

@@ -106,5 +106,16 @@ class UIItemHorzSlider(
if (disposeTexture) backgroundTexture?.texture?.tryDispose()
}
fun scrolledForce(amountX: Float, amountY: Float): Boolean {
val scroll = if (amountY == 0f) amountX else if (amountX == 0f) amountY else (amountX + amountY) / 2f
val move = Math.round(scroll)
val newValue = (value + move).coerceIn(min, max)
handlePos = interpolateLinear(newValue / max, 0.0, handleTravelDist.toDouble())
value = newValue
selectionChangeListener(value)
return true
}
}