aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/utils/guide/GuideScrollPage.kt
blob: 97cf68442ccf2e7b15adcd153a62c9c04b63a2da (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package at.hannibal2.skyhanni.utils.guide

import at.hannibal2.skyhanni.utils.CollectionUtils.tableStretchXPadding
import at.hannibal2.skyhanni.utils.renderables.Renderable
import at.hannibal2.skyhanni.utils.renderables.ScrollValue

abstract class GuideScrollPage(
    val sizeX: Int,
    val sizeY: Int,
    paddingX: Int = 0,
    paddingY: Int = 0,
    val marginY: Int = 5,
    val velocity: Double = 3.0,
    val hasHeader: Boolean = true,
) : GuideRenderablePage(paddingX, paddingY) {

    private val scroll = ScrollValue()

    fun update(content: List<List<Renderable>>) {
        renderable = Renderable.scrollTable(
            content = content,
            height = sizeY - paddingY * 2,
            scrollValue = scroll,
            velocity = velocity,
            xPadding = content.tableStretchXPadding(sizeX - paddingX * 2),
            yPadding = marginY,
            hasHeader = hasHeader,
            button = 0
        )
    }
}