You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Sep 28, 2024. It is now read-only.
I use (sometimes complex) bindings with no problem, but stucked with this one.
I have this code (simplified):
val deltaXProperty = SimpleDoubleProperty(100.0)
val deltaYProperty = SimpleDoubleProperty(100.0)
class TranslateInfo(x: Double = 0.0, y: Double = 0.0) {
val xProperty = SimpleDoubleProperty(x)
var x by xProperty
val yProperty = SimpleDoubleProperty(y)
var y by yProperty
val translateXProperty = ReadOnlyDoubleWrapper(0.0).apply {
bind(xProperty.add(deltaXProperty))
}
val translateYProperty = ReadOnlyDoubleWrapper(0.0).apply {
bind(yProperty.doubleBinding(deltaYProperty) { y + deltaYProperty.value } )
}
override fun toString(): String {
return "FloorTranslateInfo[x= $x, y=$y, tx=${translateXProperty.value}, ty=${translateYProperty.value}}]"
}
}
fun main() {
val t = TranslateInfo(10.0,20.0)
println("Initial: $t")
t.x = 30.0
println("Change x: $t")
t.y = 40.0
println("Change y: $t")
}
The first type of binding I use in translateX works fine and the value is updated. However, using the doubleBinding function doesn't binds the values and the bound value isn't updated.
The output:
It should be some simple mistake I doesn't see, but can't make it work. (I could use the first syntax, but z (which I left out) has a more complex expression with four or five dependencies.
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I use (sometimes complex) bindings with no problem, but stucked with this one.
I have this code (simplified):
The first type of binding I use in translateX works fine and the value is updated. However, using the
doubleBinding
function doesn't binds the values and the bound value isn't updated.The output:
It should be some simple mistake I doesn't see, but can't make it work. (I could use the first syntax, but z (which I left out) has a more complex expression with four or five dependencies.
The text was updated successfully, but these errors were encountered: