-
Notifications
You must be signed in to change notification settings - Fork 526
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wrong transition animation when values indirectly updated right before start #5426
Comments
Thanks for filling a bug. The thing is that the binding evaluation is lazy, and the animation starts from the last evaluated value. So in summary, the binding for your property is (pseudo-code): y: !self.expanded ? self.start-y : 'state-animation-to'(0); when you change the value of start-y, the value of You found the work around which is to query that property before the animation start. Slightly related is #4811 in which animation restarts with an outdated value. |
Thanks for your reply!
This is precisely what I would expect. Could you elaborate on why you think it might not be correct? I can't think of any example. If the property is already marked dirty when the transition starts, it was changed before the transition was triggered. In my opinion, the order here implies that the transition should use the updated value. When I access (query) the value, it gets updated. But the animation also (well, conceptually) queries the value to know what to start from. So, the behavior should be the same. Am I missing something? 😉 |
The case i'm thinking about is this:
When we change back from B to A, the property |
I might be missing or misunderstanding something, and I don't know the implementation details.
The
Why do we consider B at all? Shouldn't the B-state animation just stop (be aborted) when we switch back to state A? |
Yes, but the problem is that we didn't evaluate that property before since it is lazy evaluated. We used the last computed property, which is not necessarily the value it should have had when the animation starts. Which is arguably wrong. |
Slint 1.6 + Rust
I noticed that values used for a transition animation are wrong if the property value is indirectly updated right before the transition is triggered.
Example code:
Initially, the red rectangle is placed at the very bottom of the window. However, when clicked, the position is updated, and the expanded state is enabled (with the transition triggered).
My expectation for the code is that after clicking on the rectangle, it is firstly moved to the proper position (
30% * parent.height
) and then expanded. In reality, the rectangle is expanded from the initial bottom position.It seems like the value of
y
will not yet be updated when the transition starts. If they
property is set directly (not via thestart-y
property), the problem is gone. Another workaround is to access they
property before triggering state change (see the commented line).The text was updated successfully, but these errors were encountered: