Merge f40cd771ef139c6df822025afa5bfb910ad7023e into d51ef24c205b6b05330b3c4d7ce79c402db44447

This commit is contained in:
Loof 2025-09-18 18:06:09 +02:00 committed by GitHub
commit 191e04f5cd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -55,6 +55,7 @@ private class RestorableTextButtonStyle(
//todo ButtonStyle *does* have a `disabled` Drawable, and Button ignores touches in disabled state anyway - all this is a wrong approach
/** Disable a [Button] by setting its [touchable][Button.touchable] and [style][Button.style] properties. */
fun Button.disable() {
touchable = Touchable.disabled
/** We want disabled buttons to "swallow" the click so that things behind aren't activated, so we don't change touchable
The action won't be activated due to [ActorAttachments.activate] checking the isDisabled property */
isDisabled = true
@ -65,6 +66,7 @@ fun Button.disable() {
}
/** Enable a [Button] by setting its [touchable][Button.touchable] and [style][Button.style] properties. */
fun Button.enable() {
touchable = Touchable.enabled
val oldStyle = style
if (oldStyle is RestorableTextButtonStyle) {
style = oldStyle.restoreStyle