fix: Crash on some config pages involving checkboxes

This commit is contained in:
Linnea Gräf
2025-02-17 20:51:42 +01:00
parent 9cce9ddf26
commit 44fa3b0f31

View File

@@ -28,8 +28,8 @@ class CheckboxComponent<T>(
val ctx = (context.renderContext as ModernRenderContext).drawContext val ctx = (context.renderContext as ModernRenderContext).drawContext
ctx.drawGuiTexture( ctx.drawGuiTexture(
RenderLayer::getGuiTextured, RenderLayer::getGuiTextured,
if (isEnabled()) Firmament.identifier("firmament:widget/checkbox_checked") if (isEnabled()) Firmament.identifier("widget/checkbox_checked")
else Firmament.identifier("firmament:widget/checkbox_unchecked"), else Firmament.identifier("widget/checkbox_unchecked"),
0, 0, 0, 0,
16, 16 16, 16
) )
@@ -43,6 +43,7 @@ class CheckboxComponent<T>(
isClicking = false isClicking = false
if (context.isHovered) if (context.isHovered)
state.set(value) state.set(value)
blur()
return true return true
} }
if (mouseEvent.mouseState && mouseEvent.mouseButton == 0 && context.isHovered) { if (mouseEvent.mouseState && mouseEvent.mouseButton == 0 && context.isHovered) {