slint icon indicating copy to clipboard operation
slint copied to clipboard

`opacity` messes up with the x and y property

Open ogoffart opened this issue 2 years ago • 1 comments

As seen in this example: We would like the text to say "I'm at 100,50", and the change of parent.x should animate and and the rectangle should go left, not right.

Hello := Rectangle {
  x: 100px;
  background: blue;
  Text { text: "I'm at \{root.x/1px},\{root.y/1px}"; }
}

export Demo := Window {
  width:  300px; height: 300px;
  background: gray;
  Hello {
    opacity: 0.5;
    animate x { duration: 2s; }
    y: 50px;
    TouchArea { clicked => { parent.x = 50px; } }
  }
}

ogoffart avatar Mar 18 '22 13:03 ogoffart

That's because adjust_geometry_for_injected_parent used by the opacity pass moves the x and y binding to the created Opacity element, but all the bindings to existing property are kept around.

ogoffart avatar Mar 18 '22 13:03 ogoffart

depends on #1932

ogoffart avatar Mar 10 '23 13:03 ogoffart