Fix animation when started from a different item tree

Fixes #4741

This commit move the property_binding_and_analysis from the inlining
pass to an associated funciton in the context.
Then re-use that from the rust and c++ generator to actually get the
right animation
This commit is contained in:
Olivier Goffart 2024-03-05 11:38:01 +01:00
parent 1b17fe3c1d
commit 5fe68e1746
7 changed files with 403 additions and 276 deletions

View file

@ -429,8 +429,10 @@ fn property_set_value_code(
ctx: &EvaluationContext,
) -> String {
let prop = access_member(property, ctx);
if let Some(animation) = ctx.current_sub_component.and_then(|c| c.animations.get(property)) {
let animation_code = compile_expression(animation, ctx);
if let Some((animation, map)) = &ctx.property_info(property).animation {
let mut animation = (*animation).clone();
map.map_expression(&mut animation);
let animation_code = compile_expression(&animation, ctx);
return format!("{}.set_animated_value({}, {})", prop, value_expr, animation_code);
}
format!("{}.set({})", prop, value_expr)