Complete the scroll function
This commit is contained in:
parent
8e444c9596
commit
2beaf74843
|
@ -43,10 +43,14 @@ class ClickBox(
|
|||
}
|
||||
init { height = 8 }
|
||||
}
|
||||
var barStage: Int = 1; private set
|
||||
fun scroll(supplied: Double) {
|
||||
with(buttonsProgressBar) {
|
||||
if ((height != 8 || (supplied < 0)) && ((height != originalHeight) || (supplied > 0))) {
|
||||
height -= supplied.toInt()
|
||||
if (buttons.count() != 0) (height / buttons.count()).let {
|
||||
if (it > 0) barStage = it
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -87,10 +91,12 @@ class ClickBox(
|
|||
x = this@ClickBox.x + this@ClickBox.width - 3
|
||||
y = this@ClickBox.y + this@ClickBox.height + 3
|
||||
}.display(poseStack)
|
||||
buttons.values.forEachIndexed { num, it ->
|
||||
it.apply {
|
||||
it.x = this@ClickBox.x + 3
|
||||
it.y = this@ClickBox.y + 5 + height + (num * 9)
|
||||
buttons.values.forEachIndexed { num, button ->
|
||||
val fullHeight = (y + height.toDouble())..(y + height + 80.0)
|
||||
button.also {
|
||||
it.x = x + 3
|
||||
it.y = y + 3 + height + (((num + 1) - barStage) * 9)
|
||||
it.hidden = if ((num + 1) <= 8) ((it.y) !in fullHeight) else ((it.y + it.height) !in fullHeight)
|
||||
}.display(poseStack)
|
||||
}
|
||||
} else null
|
||||
|
|
Loading…
Reference in New Issue