Small File Chooser and Separator fixes (#9496)

* Fix FileChooser click-behind

* Fix separators not allowing a Table to shrink back when other cells change width
This commit is contained in:
SomeTroglodyte 2023-06-01 21:53:20 +02:00 committed by GitHub
parent a7107fa04d
commit 00712e49a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 3 deletions

View File

@ -123,6 +123,7 @@ open class FileChooser(
init {
innerTable.top().left()
innerTable.touchable = Touchable.enabled
fileList.selection.setProgrammaticChangeEvents(false)
fileNameInput.setTextFieldListener { textField, _ -> result = textField.text }

View File

@ -428,9 +428,9 @@ fun Group.addBorderAllowOpacity(size:Float, color: Color): Group {
/** get background Image for a new separator */
private fun getSeparatorImage(color: Color) = ImageGetter.getDot(
private fun getSeparatorImage(color: Color) = Image(ImageGetter.getWhiteDotDrawable().tint(
if (color.a != 0f) color else BaseScreen.skin.getColor("color") //0x334d80
)
))
/**
* Create a horizontal separator as an empty Container with a colored background.
@ -441,7 +441,7 @@ fun Table.addSeparator(color: Color = Color.WHITE, colSpan: Int = 0, height: Flo
val separator = getSeparatorImage(color)
val cell = add(separator)
.colspan(if (colSpan == 0) columns else colSpan)
.minHeight(height).fillX()
.height(height).fillX()
row()
return cell
}

View File

@ -172,6 +172,7 @@ object ImageGetter {
}
fun getWhiteDot() = getImage(whiteDotLocation).apply { setSize(1f) }
fun getWhiteDotDrawable() = textureRegionDrawables[whiteDotLocation]!!
fun getDot(dotColor: Color) = getWhiteDot().apply { color = dotColor }
fun getExternalImage(fileName: String): Image {