Skip to content

Commit b6cccfa

Browse files
NopoTheGamerlineargraph
authored andcommitted
fix slider resetting while typing if an accidental letter was typed
1 parent 9eb0f44 commit b6cccfa

File tree

1 file changed

+3
-2
lines changed
  • common/src/main/java/io/github/notenoughupdates/moulconfig/gui/component

1 file changed

+3
-2
lines changed

common/src/main/java/io/github/notenoughupdates/moulconfig/gui/component/SliderComponent.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ open class SliderComponent(
9898
var editingBuffer: String = ""
9999

100100
override fun get(): String {
101-
if (isFocused) return editingBuffer
101+
if (isInFocus) return editingBuffer
102102
var num: Float
103103
try {
104104
num = value.get()
@@ -111,6 +111,7 @@ open class SliderComponent(
111111

112112
override fun set(newValue: String) {
113113
editingBuffer = newValue
114+
if (isInFocus) return
114115
var num: Float
115116
try {
116117
num = editingBuffer.toFloat()
@@ -122,7 +123,7 @@ open class SliderComponent(
122123
},
123124
20,
124125
GetSetter.constant(true),
125-
"#000000",
126+
"",
126127
IMinecraft.instance.defaultFontRenderer
127128
)
128129
}

0 commit comments

Comments
 (0)