File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed
common/src/main/java/io/github/notenoughupdates/moulconfig/gui/component Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -24,8 +24,9 @@ open class TextFieldComponent(
2424 private var selection = - 1
2525 private var scrollOffset = 0
2626 private var visibleText: String? = null
27+ private var shouldExpandToFit = false
2728 override fun getWidth (): Int {
28- if (isFocused) return max(preferredWidth, font.getStringWidth(text.get()) + 10 )
29+ if (isFocused && shouldExpandToFit ) return max(preferredWidth, font.getStringWidth(text.get()) + 10 )
2930 return preferredWidth
3031 }
3132
@@ -316,6 +317,10 @@ open class TextFieldComponent(
316317 }
317318 }
318319
320+ fun setShouldExpandToFit (new : Boolean ) {
321+ shouldExpandToFit = new
322+ }
323+
319324 companion object {
320325 private const val TEXT_PADDING_X = 4
321326 private const val BACKGROUND_COLOR = - 0x1000000
You can’t perform that action at this time.
0 commit comments