From 29e52544d389f88a4af836ae1d82b838ed7a10c7 Mon Sep 17 00:00:00 2001 From: James Barnett Date: Thu, 31 Dec 2020 14:23:45 +0000 Subject: Fix texture loading. Add log overlay --- src/main/kotlin/Ui.kt | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) (limited to 'src/main/kotlin/Ui.kt') diff --git a/src/main/kotlin/Ui.kt b/src/main/kotlin/Ui.kt index dd8b0fc..fb7bd25 100644 --- a/src/main/kotlin/Ui.kt +++ b/src/main/kotlin/Ui.kt @@ -1,8 +1,6 @@ import kotlinx.browser.document import kotlinx.dom.removeClass -import org.w3c.dom.HTMLElement -import org.w3c.dom.HTMLInputElement -import org.w3c.dom.HTMLSelectElement +import org.w3c.dom.* class Ui(private val context: RaycastContext, private val afterChange: () -> Unit) { @@ -11,7 +9,7 @@ class Ui(private val context: RaycastContext, private val afterChange: () -> Uni init { registerFovInputHandler() registerRaycastPrecisionInputHandler() - registerMinimapToggleHandler() + registerOverlayToggleHandler() registerFisheyeToggleHandler() } @@ -44,11 +42,13 @@ class Ui(private val context: RaycastContext, private val afterChange: () -> Uni } } - private fun registerMinimapToggleHandler() { - val toggle = document.getElementById("minimap-toggle") as HTMLInputElement + private fun registerOverlayToggleHandler() { + val toggle = document.getElementById("overlay-toggle") as HTMLInputElement val minimap = document.getElementById("minimap") as HTMLElement + val log = document.getElementById("log") as HTMLElement toggle.onchange = { minimap.hidden = !toggle.checked + log.hidden = !toggle.checked afterChange() } } @@ -61,11 +61,7 @@ class Ui(private val context: RaycastContext, private val afterChange: () -> Uni } } - fun getSelectedTextureSet(): String { - return textureSelect.value - } + fun getSelectedTextureSet() = textureSelect.value - fun removeLoadingIndicator() { - document.getElementById("output-wrapper")?.removeClass("loading") - } + fun removeLoadingIndicator() = document.getElementById("output-wrapper")?.removeClass("loading") } \ No newline at end of file -- cgit v1.2.3