@@ -3,16 +3,14 @@ package org.polyfrost.oneconfig.internal.ui.hud.screens.sections
33import androidx.compose.foundation.layout.Arrangement
44import androidx.compose.foundation.layout.Column
55import androidx.compose.foundation.layout.Row
6- import androidx.compose.foundation.rememberScrollState
7- import androidx.compose.foundation.verticalScroll
6+ import androidx.compose.foundation.lazy.LazyColumn
87import androidx.compose.runtime.Composable
98import androidx.compose.runtime.getValue
109import androidx.compose.runtime.mutableStateOf
1110import androidx.compose.runtime.remember
1211import androidx.compose.runtime.setValue
1312import androidx.compose.runtime.snapshots.Snapshot
1413import androidx.compose.ui.Alignment
15- import androidx.compose.ui.Modifier
1614import androidx.compose.ui.graphics.Color
1715import androidx.compose.ui.graphics.toArgb
1816import androidx.compose.ui.unit.dp
@@ -37,82 +35,89 @@ fun Settings(hud: Hud? = null) {
3735 var showShadow by remember(hud) { mutableStateOf(hud.showShadow) }
3836 var shadowColor by remember(hud) { mutableStateOf(Color (hud.shadowColor)) }
3937
40- Column (
41- modifier = Modifier .verticalScroll(rememberScrollState()),
38+ LazyColumn (
4239 verticalArrangement = Arrangement .spacedBy(22 .dp),
4340 ) {
44- Section (" GUI Scale" ) {
45- Column (verticalArrangement = Arrangement .spacedBy(12 .dp)) {
46- Row (
47- verticalAlignment = Alignment .CenterVertically ,
48- horizontalArrangement = Arrangement .spacedBy(12 .dp),
49- ) {
50- SwitchControl (useGuiScale) {
51- Snapshot .withMutableSnapshot { useGuiScale = it; hud.useGuiScale = it }
41+ item {
42+ Section (" GUI Scale" ) {
43+ Column (verticalArrangement = Arrangement .spacedBy(12 .dp)) {
44+ Row (
45+ verticalAlignment = Alignment .CenterVertically ,
46+ horizontalArrangement = Arrangement .spacedBy(12 .dp),
47+ ) {
48+ SwitchControl (useGuiScale) {
49+ Snapshot .withMutableSnapshot { useGuiScale = it; hud.useGuiScale = it }
50+ }
51+ Text (" Use Minecraft GUI Scale" , color = LocalTheme .current.textColor, fontSize = 14 .sp)
52+ }
53+ if (! useGuiScale) {
54+ NumberSpinner (
55+ " Custom Scale" , " x" ,
56+ customScale, { Snapshot .withMutableSnapshot { customScale = it; hud.customScale = it } },
57+ 0.25f , 4f , 0.25f , width = 128 .dp
58+ )
5259 }
53- Text (" Use Minecraft GUI Scale" , color = LocalTheme .current.textColor, fontSize = 14 .sp)
54- }
55- if (! useGuiScale) {
56- NumberSpinner (
57- " Custom Scale" , " x" ,
58- customScale, { Snapshot .withMutableSnapshot { customScale = it; hud.customScale = it } },
59- 0.25f , 4f , 0.25f , width = 128 .dp
60- )
6160 }
6261 }
6362 }
6463
65- Section (" Background" ) {
66- Column (verticalArrangement = Arrangement .spacedBy(12 .dp)) {
67- Row (
68- verticalAlignment = Alignment .CenterVertically ,
69- horizontalArrangement = Arrangement .spacedBy(12 .dp),
70- ) {
71- SwitchControl (showBackground) {
72- Snapshot .withMutableSnapshot { showBackground = it; hud.showBackground = it }
73- }
74- Text (" Show Background" , color = LocalTheme .current.textColor, fontSize = 14 .sp)
75- }
76- if (showBackground) {
64+ item {
65+ Section (" Background" ) {
66+ Column (verticalArrangement = Arrangement .spacedBy(12 .dp)) {
7767 Row (
78- horizontalArrangement = Arrangement .spacedBy(12 .dp),
7968 verticalAlignment = Alignment .CenterVertically ,
69+ horizontalArrangement = Arrangement .spacedBy(12 .dp),
8070 ) {
81- ColorButton (" Background Color" , bgColor) {
82- Snapshot .withMutableSnapshot { bgColor = it; hud.bgColor = it.toArgb() }
71+ SwitchControl (showBackground) {
72+ Snapshot .withMutableSnapshot { showBackground = it; hud.showBackground = it }
73+ }
74+ Text (" Show Background" , color = LocalTheme .current.textColor, fontSize = 14 .sp)
75+ }
76+ if (showBackground) {
77+ Row (
78+ horizontalArrangement = Arrangement .spacedBy(12 .dp),
79+ verticalAlignment = Alignment .CenterVertically ,
80+ ) {
81+ ColorButton (" Background Color" , bgColor) {
82+ Snapshot .withMutableSnapshot { bgColor = it; hud.bgColor = it.toArgb() }
83+ }
84+ NumberSpinner (
85+ " Radius" , " px" ,
86+ bgRadius, { Snapshot .withMutableSnapshot { bgRadius = it; hud.bgRadius = it } },
87+ 0f , 32f , 1f , width = 100 .dp
88+ )
8389 }
84- NumberSpinner (
85- " Radius" , " px" ,
86- bgRadius, { Snapshot .withMutableSnapshot { bgRadius = it; hud.bgRadius = it } },
87- 0f , 32f , 1f , width = 100 .dp
88- )
8990 }
9091 }
9192 }
9293 }
9394
94- Section (" Appearance" ) {
95- Column (verticalArrangement = Arrangement .spacedBy(12 .dp)) {
96- ColorButton (" Text Color" , textColor) {
97- Snapshot .withMutableSnapshot { textColor = it; hud.textColor = it.toArgb() }
98- }
99- Row (
100- verticalAlignment = Alignment .CenterVertically ,
101- horizontalArrangement = Arrangement .spacedBy(12 .dp),
102- ) {
103- SwitchControl (showShadow) {
104- Snapshot .withMutableSnapshot { showShadow = it; hud.showShadow = it }
95+ item {
96+ Section (" Appearance" ) {
97+ Column (verticalArrangement = Arrangement .spacedBy(12 .dp)) {
98+ ColorButton (" Text Color" , textColor) {
99+ Snapshot .withMutableSnapshot { textColor = it; hud.textColor = it.toArgb() }
105100 }
106- Text (" Text Shadow" , color = LocalTheme .current.textColor, fontSize = 14 .sp)
107- }
108- if (showShadow) {
109- ColorButton (" Shadow Color" , shadowColor) {
110- Snapshot .withMutableSnapshot { shadowColor = it; hud.shadowColor = it.toArgb() }
101+ Row (
102+ verticalAlignment = Alignment .CenterVertically ,
103+ horizontalArrangement = Arrangement .spacedBy(12 .dp),
104+ ) {
105+ SwitchControl (showShadow) {
106+ Snapshot .withMutableSnapshot { showShadow = it; hud.showShadow = it }
107+ }
108+ Text (" Text Shadow" , color = LocalTheme .current.textColor, fontSize = 14 .sp)
109+ }
110+ if (showShadow) {
111+ ColorButton (" Shadow Color" , shadowColor) {
112+ Snapshot .withMutableSnapshot { shadowColor = it; hud.shadowColor = it.toArgb() }
113+ }
111114 }
112115 }
113116 }
114117 }
115118
116- HudConfigScreen (hud.tree)
119+ item {
120+ HudConfigScreen (hud.tree)
121+ }
117122 }
118123}
0 commit comments