From c270b6e7ddeebba20f5592a779f120ce3ff90caf Mon Sep 17 00:00:00 2001 From: minjaesong Date: Thu, 18 Jan 2024 00:05:05 +0900 Subject: [PATCH] catbar: enlarged button hitbox --- src/net/torvald/terrarum/ui/UIItemCatBar.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/net/torvald/terrarum/ui/UIItemCatBar.kt b/src/net/torvald/terrarum/ui/UIItemCatBar.kt index 073d7d8c5..4424d40e0 100644 --- a/src/net/torvald/terrarum/ui/UIItemCatBar.kt +++ b/src/net/torvald/terrarum/ui/UIItemCatBar.kt @@ -29,11 +29,13 @@ class UIItemCatBar( companion object { const val CAT_ALL = "__all__" val FILTER_CAT_ALL = arrayOf(CAT_ALL) + + const val CATBAR_UNDERLINE_OFFSET = 5 } private val inventoryUI = parentUI - override val height = catIcons.tileH + 5 + override val height = catIcons.tileH + CATBAR_UNDERLINE_OFFSET private val mainButtons: Array @@ -70,7 +72,7 @@ class UIItemCatBar( highlightable = true ) { override val mouseUp: Boolean // true if mouse is on its occupying section on the bar, not just on the icon's bounding box - get() = getButtonIndexUnderMouseOnTray() == index && itemRelativeMouseY in 0 until height + get() = getButtonIndexUnderMouseOnTray() == index && itemRelativeMouseY in -CATBAR_UNDERLINE_OFFSET until (catIcons.tileH + CATBAR_UNDERLINE_OFFSET) } }