aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/Ui.kt
diff options
context:
space:
mode:
authorJames Barnett <noreply@jamesbarnett.xyz>2020-12-31 14:23:45 +0000
committerJames Barnett <noreply@jamesbarnett.xyz>2020-12-31 14:23:45 +0000
commit29e52544d389f88a4af836ae1d82b838ed7a10c7 (patch)
tree4c80995e8ed0f5b2bdcc55404d18ee03ed474fd1 /src/main/kotlin/Ui.kt
parent3c3322ef1a7aca3517ff94f723004fb809dec6cd (diff)
downloadkotlin-raycaster-29e52544d389f88a4af836ae1d82b838ed7a10c7.tar.xz
kotlin-raycaster-29e52544d389f88a4af836ae1d82b838ed7a10c7.zip
Fix texture loading. Add log overlay
Diffstat (limited to 'src/main/kotlin/Ui.kt')
-rw-r--r--src/main/kotlin/Ui.kt20
1 files changed, 8 insertions, 12 deletions
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