programmer style scrolling
This commit is contained in:
parent
2dd4d60be1
commit
9cc36c3e40
@ -12,6 +12,7 @@ import ru.dbotthepony.mc.otm.client.render.element
|
|||||||
import ru.dbotthepony.mc.otm.client.screen.panels.*
|
import ru.dbotthepony.mc.otm.client.screen.panels.*
|
||||||
import ru.dbotthepony.mc.otm.client.setMousePos
|
import ru.dbotthepony.mc.otm.client.setMousePos
|
||||||
import ru.dbotthepony.mc.otm.client.shouldOpenVanillaInventory
|
import ru.dbotthepony.mc.otm.client.shouldOpenVanillaInventory
|
||||||
|
import ru.dbotthepony.mc.otm.core.maxScrollDivision
|
||||||
import ru.dbotthepony.mc.otm.menu.ExoSuitInventoryMenu
|
import ru.dbotthepony.mc.otm.menu.ExoSuitInventoryMenu
|
||||||
import ru.dbotthepony.mc.otm.network.ExoSuitMenuOpen
|
import ru.dbotthepony.mc.otm.network.ExoSuitMenuOpen
|
||||||
import ru.dbotthepony.mc.otm.network.MatteryPlayerNetworkChannel
|
import ru.dbotthepony.mc.otm.network.MatteryPlayerNetworkChannel
|
||||||
@ -49,7 +50,7 @@ class ExoSuitInventoryScreen(menu: ExoSuitInventoryMenu) : MatteryScreen<ExoSuit
|
|||||||
|
|
||||||
toolbeltLine.setDockMargin(top = 3f)
|
toolbeltLine.setDockMargin(top = 3f)
|
||||||
|
|
||||||
scrollPanel = DiscreteScrollBarPanel(this, null, maxScroll = { ((menu.playerCombinedInventorySlots.size - inventoryRows * 9) + 8) / 9 },
|
scrollPanel = DiscreteScrollBarPanel(this, null, maxScroll = { maxScrollDivision(menu.playerCombinedInventorySlots.size, 9) },
|
||||||
scrollCallback = {
|
scrollCallback = {
|
||||||
_, old, new ->
|
_, old, new ->
|
||||||
|
|
||||||
|
@ -18,6 +18,7 @@ import org.lwjgl.opengl.GL11
|
|||||||
import org.lwjgl.opengl.GL13
|
import org.lwjgl.opengl.GL13
|
||||||
import ru.dbotthepony.mc.otm.client.moveMousePosScaled
|
import ru.dbotthepony.mc.otm.client.moveMousePosScaled
|
||||||
import ru.dbotthepony.mc.otm.client.screen.panels.*
|
import ru.dbotthepony.mc.otm.client.screen.panels.*
|
||||||
|
import ru.dbotthepony.mc.otm.core.maxScrollDivision
|
||||||
import ru.dbotthepony.mc.otm.menu.MatteryMenu
|
import ru.dbotthepony.mc.otm.menu.MatteryMenu
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -126,7 +127,7 @@ abstract class MatteryScreen<T : MatteryMenu>(menu: T, inventory: Inventory, tit
|
|||||||
} else {
|
} else {
|
||||||
inventoryFrame = FramePanel<MatteryScreen<*>>(this, null, 0f, 0f, INVENTORY_FRAME_WIDTH_EXTENDED, BASE_INVENTORY_FRAME_HEIGHT + AbstractSlotPanel.SIZE * inventoryRows, inventory.displayName).also(this::addPanel)
|
inventoryFrame = FramePanel<MatteryScreen<*>>(this, null, 0f, 0f, INVENTORY_FRAME_WIDTH_EXTENDED, BASE_INVENTORY_FRAME_HEIGHT + AbstractSlotPanel.SIZE * inventoryRows, inventory.displayName).also(this::addPanel)
|
||||||
|
|
||||||
inventoryScrollbar = DiscreteScrollBarPanel(this, inventoryFrame, { ((menu.playerCombinedInventorySlots.size - inventoryRows * 9) + 8) / 9 }, {
|
inventoryScrollbar = DiscreteScrollBarPanel(this, inventoryFrame, { maxScrollDivision(menu.playerCombinedInventorySlots.size, 9) }, {
|
||||||
_, old, new ->
|
_, old, new ->
|
||||||
|
|
||||||
for (i in old until old + inventoryRows) {
|
for (i in old until old + inventoryRows) {
|
||||||
|
Loading…
Reference in New Issue
Block a user