mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-11 02:54:04 +09:00
catbar: enlarged button hitbox
This commit is contained in:
@@ -29,11 +29,13 @@ class UIItemCatBar(
|
|||||||
companion object {
|
companion object {
|
||||||
const val CAT_ALL = "__all__"
|
const val CAT_ALL = "__all__"
|
||||||
val FILTER_CAT_ALL = arrayOf(CAT_ALL)
|
val FILTER_CAT_ALL = arrayOf(CAT_ALL)
|
||||||
|
|
||||||
|
const val CATBAR_UNDERLINE_OFFSET = 5
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private val inventoryUI = parentUI
|
private val inventoryUI = parentUI
|
||||||
override val height = catIcons.tileH + 5
|
override val height = catIcons.tileH + CATBAR_UNDERLINE_OFFSET
|
||||||
|
|
||||||
|
|
||||||
private val mainButtons: Array<UIItemImageButton>
|
private val mainButtons: Array<UIItemImageButton>
|
||||||
@@ -70,7 +72,7 @@ class UIItemCatBar(
|
|||||||
highlightable = true
|
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
|
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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user