Skip to content

Conversation

@issacyee
Copy link
Contributor

This PR adds support for the ObservableProperty type in the Debug property editor and excludes meaningless nested ObservableProperty types.

Previously, if you wanted to edit an ObservableProperty type property in the property editor, you had to create a backing property for it and annotate it with @ViewProperty, like this:

@ViewProperty
var score: Int
    get() = _score.value
    set(value) = _score(value)
private val _score: ObservableProperty<Int> = ObservableProperty(0)

This PR simplifies the process of editing ObservableProperty type properties in the property editor. Now, you only need to annotate it with @ViewProperty:

@ViewProperty
private val score: ObservableProperty<Int> = ObservableProperty(0)

Test Code and Screenshots

// ...

class MainTextBounds2 : Scene() {
    @ViewProperty
    val nestedObsInt: ObservableProperty<ObservableProperty<Int>> = ObservableProperty(ObservableProperty(1))
    @ViewProperty
    val obsInt: ObservableProperty<Int> = ObservableProperty(1)
    @ViewProperty
    val obsPair: ObservableProperty<Pair<Int, Int>> = ObservableProperty(1 to 1)
    // ...

    override suspend fun SContainer.sceneMain() {
        uiVerticalStack {
            uiHorizontalStack {
                uiText("obsInt: ")
                uiText(obsInt.value.toString()) {
                    obsInt.observe { text = it.toString() }
                }
            }
            uiHorizontalStack {
                uiText("obsPair: ")
                uiText(obsPair.value.toString()) {
                    obsPair.observe { text = it.toString() }
                }
            }
            // ...
        }
    }
}
image

@FSaurenbach
Copy link
Member

augment review

@augmentcode
Copy link

augmentcode bot commented Dec 16, 2025

Sorry, Augment does not have access to the org this pull request's branch is from.

@FSaurenbach
Copy link
Member

@jobe-m Have you checked the pr? If yes we could include this for 6.0.1

@jobe-m jobe-m enabled auto-merge (squash) January 10, 2026 18:27
@jobe-m jobe-m merged commit 7485aae into korlibs:main Jan 10, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants