mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-15 04:54:05 +09:00
scrollbar on wall-of-texts
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user