From 1b4037be02cf663d5a6cc0d8439fc4b69fdf4a6c Mon Sep 17 00:00:00 2001 From: Username404-59 Date: Mon, 7 Jun 2021 00:18:22 +0200 Subject: [PATCH] Improve the ClickGui.boxContext() method --- common/src/main/kotlin/fr/username404/snowygui/ClickGui.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/src/main/kotlin/fr/username404/snowygui/ClickGui.kt b/common/src/main/kotlin/fr/username404/snowygui/ClickGui.kt index beab8d9..1dda75e 100644 --- a/common/src/main/kotlin/fr/username404/snowygui/ClickGui.kt +++ b/common/src/main/kotlin/fr/username404/snowygui/ClickGui.kt @@ -10,7 +10,7 @@ object ClickGui: SnowyScreen() { override val components = mutableSetOf() val clickBoxes get() = components.filterIsInstance() - inline fun boxContext(args: ClickBox.() -> Unit) = components.filterIsInstance().forEach(args) + inline fun boxContext(args: ClickBox.() -> Unit) = clickBoxes.forEach(args) private inline fun buttonsContext(args: ColoredElement.() -> Unit) = boxContext { buttons.forEach(args) } 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 }