Fix the buttons being clickable when hidden in ClickGui.kt
This commit is contained in:
parent
530ecb36cb
commit
03ecdd9e2c
|
@ -11,7 +11,9 @@ object ClickGui: SnowyScreen() {
|
||||||
|
|
||||||
val clickBoxes get() = components.filterIsInstance<ClickBox>()
|
val clickBoxes get() = components.filterIsInstance<ClickBox>()
|
||||||
inline fun boxContext(args: ClickBox.() -> Unit) = clickBoxes.forEach(args)
|
inline fun boxContext(args: ClickBox.() -> Unit) = clickBoxes.forEach(args)
|
||||||
private inline fun buttonsContext(args: ColoredElement.() -> Unit) = boxContext { buttons.forEach(args) }
|
private inline fun buttonsContext(args: ColoredElement.() -> Unit) = boxContext { buttons.forEach {
|
||||||
|
if (it.y > y + height) it.args()
|
||||||
|
} }
|
||||||
override fun mouseClicked(d: Double, e: Double, i: Int): Boolean { buttonsContext { this.mouseClicked(d, e, i) }; return false }
|
override fun mouseClicked(d: Double, e: Double, i: Int): Boolean { buttonsContext { this.mouseClicked(d, e, i) }; return false }
|
||||||
override fun mouseReleased(d: Double, e: Double, i: Int): Boolean { buttonsContext { this.mouseReleased(d, e, i) }; return false }
|
override fun mouseReleased(d: Double, e: Double, i: Int): Boolean { buttonsContext { this.mouseReleased(d, e, i) }; return false }
|
||||||
override fun mouseScrolled(d: Double, e: Double, f: Double): Boolean { boxContext { scroll(d, e, f) }; return false }
|
override fun mouseScrolled(d: Double, e: Double, f: Double): Boolean { boxContext { scroll(d, e, f) }; return false }
|
||||||
|
|
Loading…
Reference in New Issue